Class Scriptlet
java.lang.Object
org.codehaus.mojo.rpm.Scriptlet
- Direct Known Subclasses:
BaseTrigger
Defines a scriptlet including the optinal
getSubpackage() and getProgram(). The (optional) contents
can be provided by either getScript() or getScriptFile().- Since:
- 2.0-beta-4
- Author:
- Brett Okken, Cerner Corp.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildScriptletLine(String directive) Builds the scriptlet line including any optional args.The encoding to use to readgetScriptFile().The program to use to execute the script.The contents of the script as aString.The location of the script: a file path (absolute, or relative to the project base directory) or, with the prefixclasspath:, a resource on the plugin class path, for example a script shipped in a jar that is added to the plugin'sdependencies.The optional subpackage.booleanisFilter()voidsetFileEncoding(String fileEncoding) voidsetFilter(boolean filter) voidsetProgram(String program) voidvoidsetScriptFile(String scriptFile) voidsetSourceEncoding(String sourceEncoding) This is the maven property: project.build.sourceEncodingvoidsetSubpackage(String subpackage) toString()protected final voidwrite(PrintWriter writer, String directive, AbstractRPMMojo mojo) Writes the scriptlet.protected final voidwriteContent(PrintWriter writer, AbstractRPMMojo mojo) Writes the content (eithergetScript()orgetScriptFile()) to writer.
-
Constructor Details
-
Scriptlet
public Scriptlet()
-
-
Method Details
-
getSubpackage
The optional subpackage. This is passed as a -n argument to the scriptlet directive.- Returns:
- Returns the
subpackage.
-
setSubpackage
- Parameters:
subpackage- Thesubpackageto set.
-
getProgram
The program to use to execute the script. This is passed as a -p argument to the scriptlet directive.- Returns:
- Returns the
program.
-
setProgram
- Parameters:
program- Theprogramto set.
-
getScript
The contents of the script as aString. This value will override anything atgetScriptFile().- Returns:
- Returns the
script.
-
setScript
- Parameters:
script- Thescriptto set.
-
getScriptFile
The location of the script: a file path (absolute, or relative to the project base directory) or, with the prefixclasspath:, a resource on the plugin class path, for example a script shipped in a jar that is added to the plugin'sdependencies. This is ignored ifgetScript()is populated.- Returns:
- Returns the
scriptFile. - Since:
- 2.5.0 the
classpath:prefix, and the return typeStringinstead ofFile
-
setScriptFile
- Parameters:
scriptFile- ThescriptFileto set.
-
getFileEncoding
The encoding to use to readgetScriptFile(). Ifnull, the default character encoding for th platform will be used.- Returns:
- Returns the
fileEncoding.
-
setFileEncoding
- Parameters:
fileEncoding- ThefileEncodingto set.
-
setSourceEncoding
This is the maven property: project.build.sourceEncoding- Parameters:
sourceEncoding- ThesourceEncodingto set.
-
isFilter
public boolean isFilter()- Returns:
- Returns the
filter.
-
setFilter
public void setFilter(boolean filter) - Parameters:
filter- Thefilterto set.
-
write
protected final void write(PrintWriter writer, String directive, AbstractRPMMojo mojo) throws IOException Writes the scriptlet.- Parameters:
writer-PrintWriterto write content to.directive- The directive for the scriptlet.mojo- theAbstractRPMMojowhich contains any resources needed when writing the scriptlet.- Throws:
IOException- if an I/IO error occurs
-
buildScriptletLine
-
writeContent
Writes the content (eithergetScript()orgetScriptFile()) to writer.- Parameters:
writer-PrintWriterto write content to.mojo- theAbstractRPMMojowhich contains any resources needed when writing the scriptlet.- Throws:
IOException- if an I/IO error occurs
-
toString
-