|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.izforge.izpack.util.os.unix.ShellScript
public class ShellScript
A Generator, Wrapper and Executor for Unix ShellScripts
| Field Summary | |
|---|---|
private static java.lang.String |
Author
Author = "marc.eppelmann_at_gmx.de" |
private static java.lang.String |
CommentPre
internal comment prefix; makes a line as comment:-) :: 'CommentPre = "# "' |
private java.lang.StringBuffer |
content
Internal ContentBuffer of this ShellScript |
private static java.lang.String |
currentDateMsg
"Generated at: " + new Date().toString() |
private static java.lang.String |
explanation
the explanation header for this generated script |
private static java.lang.String |
Generator
Generator = "Generator: " + ShellScript.class.getName() |
private static java.lang.String |
H
H = CommentPre |
private static java.lang.String |
header
the header of this ShellScript |
private java.lang.String |
itsLocation
internal field: where to write via write( itsLocation ) this shellscript. |
private static java.lang.String |
lf
the linefeed: lf = "\n" |
private static java.lang.String |
lh
lh = lf + H = "\n#" |
private static java.lang.String |
Revision
internal Revision = "$Revision$" |
private static java.lang.String |
SCM_ID
internal SourceCode Management ( currently 'svn') ID :: 'SCM_ID = "$Id$"' |
| Constructor Summary | |
|---|---|
ShellScript()
Creates and initializes the ShellScript for running on the bourne shell: "sh". |
|
ShellScript(java.lang.String aShell)
Creates and initializes the ShellScript for running on the given shell. |
|
| Method Summary | |
|---|---|
void |
append(char aChar)
Appends a Char to this ShellScript. |
void |
append(java.lang.Object anObject)
Appends an Object or String to this ShellScript. |
void |
appendln()
Appends an Object or String to this ShellScript with unix linefeed ("\n"). |
void |
appendln(char aChar)
Appends a Char Object or String to this ShellScript with unix linefeed ("\n"). |
void |
appendln(java.lang.Object anObject)
Appends an Object or String to this ShellScript with unix linefeed ("\n"). |
java.lang.String |
exec()
Execute this ShellScript. |
java.lang.String |
exec(java.lang.String itsParams)
Executes thsi ShellScript with the given Params. |
static java.lang.String |
execAndDelete(java.lang.StringBuffer lines,
java.lang.String aLocation)
Executes and removes the script. |
static java.lang.String |
execAndDelete(java.lang.String aShell,
java.lang.StringBuffer lines,
java.lang.String aLocation,
java.lang.String itsParams)
Executes and removes the script. |
static java.lang.String |
execute(java.lang.StringBuffer lines,
java.lang.String aLocation)
Executes ths given lines in the created default shell (sh) stored on location. |
static java.lang.String |
execute(java.lang.String aShell,
java.lang.StringBuffer lines,
java.lang.String aLocation,
java.lang.String itsParams)
Execs ths given lines in the creted shell stored on location. |
java.lang.StringBuffer |
getContent()
gets the Content of this Script. |
java.lang.String |
getContentAsString()
Gets the Content of this Script as String |
static void |
main(java.lang.String[] args)
Test Main Method Run test with: java -cp .jar com.izforge.izpack.util.os.unix.ShellScript |
java.lang.String |
toString()
Dumps the ShellScript Content, and Location. |
void |
write(java.lang.String aDestination)
write this to the given Destination FileName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String Author
private static final java.lang.String Generator
private static final java.lang.String SCM_ID
private static final java.lang.String Revision
private static final java.lang.String CommentPre
private static final java.lang.String H
private static final java.lang.String lf
private static final java.lang.String lh
private static final java.lang.String explanation
private static java.lang.String currentDateMsg
private static final java.lang.String header
private java.lang.StringBuffer content
private java.lang.String itsLocation
| Constructor Detail |
|---|
public ShellScript(java.lang.String aShell)
aShell - "sh", "bash", "ksh", "csh" and so an...public ShellScript()
| Method Detail |
|---|
public void append(java.lang.Object anObject)
anObject - the Object to appendpublic void append(char aChar)
aChar - a char to appendpublic void appendln(java.lang.Object anObject)
anObject - the Object to appendpublic void appendln(char aChar)
aChar - a char to appendpublic void appendln()
public java.lang.StringBuffer getContent()
public java.lang.String getContentAsString()
public java.lang.String toString()
toString in class java.lang.Objectpublic void write(java.lang.String aDestination)
aDestination - a destination filenamepublic java.lang.String exec(java.lang.String itsParams)
itsParams -
public java.lang.String exec()
public static java.lang.String execute(java.lang.String aShell,
java.lang.StringBuffer lines,
java.lang.String aLocation,
java.lang.String itsParams)
aShell - A Shell which will be eexecute the script.lines - The content of the script.aLocation - The location where to store.itsParams - Th eoptional params of the script.
public static java.lang.String execute(java.lang.StringBuffer lines,
java.lang.String aLocation)
lines - the lines of the script to exec.saLocation - where to store
public static java.lang.String execAndDelete(java.lang.String aShell,
java.lang.StringBuffer lines,
java.lang.String aLocation,
java.lang.String itsParams)
aShell - The Shell which should exec the script. Can be also be python or perl, if the
shellcontent is given in this language.lines - of the script.aLocation - where to store.itsParams - which should be pass to the script.
public static java.lang.String execAndDelete(java.lang.StringBuffer lines,
java.lang.String aLocation)
lines - of the script.aLocation - where to store.
public static void main(java.lang.String[] args)
args - Arguments from Commandline
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||