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 String
buildScriptletLine(String directive)
Builds the scriptlet line including any optional args.String
getFileEncoding()
The encoding to use to readgetScriptFile()
.String
getProgram()
The program to use to execute the script.String
getScript()
The contents of the script as aString
.File
getScriptFile()
The contents of the script as aFile
.String
getSubpackage()
The optional subpackage.boolean
isFilter()
void
setFileEncoding(String fileEncoding)
void
setFilter(boolean filter)
void
setProgram(String program)
void
setScript(String script)
void
setScriptFile(File scriptFile)
void
setSourceEncoding(String sourceEncoding)
This is the maven property: project.build.sourceEncodingvoid
setSubpackage(String subpackage)
String
toString()
protected void
write(PrintWriter writer, String directive, List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers)
Writes the scriptlet.protected void
writeContent(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
- Thesubpackage
to 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
- ThescriptFile
to 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
- ThefileEncoding
to set.
-
setSourceEncoding
public void setSourceEncoding(String sourceEncoding)
This is the maven property: project.build.sourceEncoding- Parameters:
sourceEncoding
- ThesourceEncoding
to set.
-
isFilter
public boolean isFilter()
- Returns:
- Returns the
filter
.
-
setFilter
public void setFilter(boolean filter)
- Parameters:
filter
- Thefilter
to 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
-PrintWriter
to 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
-PrintWriter
to write content to.filterWrappers
- The filter wrappers to be applied when writing the content.- Throws:
IOException
- if an I/IO error occurs
-
-