Package org.codehaus.mojo.rpm
Class Scriptlet
- java.lang.Object
-
- org.codehaus.mojo.rpm.Scriptlet
-
- Direct Known Subclasses:
BaseTrigger
public class Scriptlet extends Object
Defines a scriptlet including the optinalgetSubpackage()andgetProgram(). The (optional) contents can be provided by eithergetScript()orgetScriptFile().- Since:
- 2.0-beta-4
- Author:
- Brett Okken, Cerner Corp.
-
-
Constructor Summary
Constructors Constructor Description Scriptlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringbuildScriptletLine(String directive)Builds the scriptlet line including any optional args.StringgetFileEncoding()The encoding to use to readgetScriptFile().StringgetProgram()The program to use to execute the script.StringgetScript()The contents of the script as aString.FilegetScriptFile()The contents of the script as aFile.StringgetSubpackage()The optional subpackage.booleanisFilter()voidsetFileEncoding(String fileEncoding)voidsetFilter(boolean filter)voidsetProgram(String program)voidsetScript(String script)voidsetScriptFile(File scriptFile)voidsetSourceEncoding(String sourceEncoding)This is the maven property: project.build.sourceEncodingvoidsetSubpackage(String subpackage)StringtoString()protected voidwrite(PrintWriter writer, String directive, List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers)Writes the scriptlet.protected voidwriteContent(PrintWriter writer, List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers)Writes the content (eithergetScript()orgetScriptFile()) to writer.
-
-
-
Method Detail
-
getSubpackage
public String getSubpackage()
The optional subpackage. This is passed as a -n argument to the scriptlet directive.- Returns:
- Returns the
subpackage.
-
setSubpackage
public void setSubpackage(String subpackage)
- Parameters:
subpackage- Thesubpackageto set.
-
getProgram
public String getProgram()
The program to use to execute the script. This is passed as a -p argument to the scriptlet directive.- Returns:
- Returns the
program.
-
getScript
public String getScript()
The contents of the script as aString. This value will override anything atgetScriptFile().- Returns:
- Returns the
script.
-
getScriptFile
public File getScriptFile()
The contents of the script as aFile. This will be ignored ifgetScript()is populated.- Returns:
- Returns the
scriptFile.
-
setScriptFile
public void setScriptFile(File scriptFile)
- Parameters:
scriptFile- ThescriptFileto set.
-
getFileEncoding
public String getFileEncoding()
The encoding to use to readgetScriptFile(). Ifnull, the default character encoding for th platform will be used.- Returns:
- Returns the
fileEncoding.
-
setFileEncoding
public void setFileEncoding(String fileEncoding)
- Parameters:
fileEncoding- ThefileEncodingto set.
-
setSourceEncoding
public void setSourceEncoding(String sourceEncoding)
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, List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers) throws IOException
Writes the scriptlet.- Parameters:
writer-PrintWriterto write content to.directive- The directive for the scriptlet.filterWrappers- The filter wrappers to be applied when writing the content.- Throws:
IOException- if an I/IO error occurs
-
buildScriptletLine
protected String buildScriptletLine(String directive)
Builds the scriptlet line including any optional args.- Parameters:
directive- The directive for the scriptlet.- Returns:
- The scriptlet line - this does not include the script.
-
writeContent
protected final void writeContent(PrintWriter writer, List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers) throws IOException
Writes the content (eithergetScript()orgetScriptFile()) to writer.- Parameters:
writer-PrintWriterto write content to.filterWrappers- The filter wrappers to be applied when writing the content.- Throws:
IOException- if an I/IO error occurs
-
-