Java Doc for ShellScript.java in  » Installer » IzPack » com » izforge » izpack » util » os » unix » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Installer » IzPack » com.izforge.izpack.util.os.unix 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.izforge.izpack.util.os.unix.ShellScript

ShellScript
public class ShellScript (Code)
A Generator, Wrapper and Executor for Unix ShellScripts
author:
   marc.eppelmann@reddot.de



Constructor Summary
public  ShellScript(String aShell)
     Creates and initializes the ShellScript for running on the given shell.
public  ShellScript()
     Creates and initializes the ShellScript for running on the bourne shell: "sh".

Method Summary
public  voidappend(Object anObject)
     Appends an Object or String to this ShellScript.
public  voidappend(char aChar)
     Appends a Char to this ShellScript.
public  voidappendln(Object anObject)
     Appends an Object or String to this ShellScript with unix linefeed ("\n").
public  voidappendln(char aChar)
     Appends a Char Object or String to this ShellScript with unix linefeed ("\n").
public  voidappendln()
     Appends an Object or String to this ShellScript with unix linefeed ("\n").
public  Stringexec(String itsParams)
     Executes thsi ShellScript with the given Params.
NOTE: the params cannot be contain whitespaces.
This (su -c <br>"cp from to"</br>) would not work:
because the underlaying java.runtime.exec("command") does not handle balanced or unbalanced (") correctly.
else just whitespace separate tokens.
This means for the sample.
public  Stringexec()
     Execute this ShellScript.
public static  StringexecAndDelete(String aShell, StringBuffer lines, String aLocation, String itsParams)
     Executes and removes the script.
The Lines be also written in python or perl,
In this case, the Shell must be python or perl or so.
Parameters:
  aShell - The Shell which should exec the script.
public static  StringexecAndDelete(StringBuffer lines, String aLocation)
     Executes and removes the script.
Parameters:
  lines - of the script.
Parameters:
  aLocation - where to store.
public static  Stringexecute(String aShell, StringBuffer lines, String aLocation, String itsParams)
     Execs ths given lines in the creted shell stored on location.
Parameters:
  aShell - A Shell which will be eexecute the script.
Parameters:
  lines - The content of the script.
Parameters:
  aLocation - The location where to store.
Parameters:
  itsParams - Th eoptional params of the script.
public static  Stringexecute(StringBuffer lines, String aLocation)
     Executes ths given lines in the created default shell (sh) stored on location.
public  StringBuffergetContent()
     gets the Content of this Script.
public  StringgetContentAsString()
    
public static  voidmain(String[] args)
    
public  StringtoString()
     Dumps the ShellScript Content, and Location.
public  voidwrite(String aDestination)
    


Constructor Detail
ShellScript
public ShellScript(String aShell)(Code)
Creates and initializes the ShellScript for running on the given shell.
Parameters:
  aShell - "sh", "bash", "ksh", "csh" and so an...



ShellScript
public ShellScript()(Code)
Creates and initializes the ShellScript for running on the bourne shell: "sh".




Method Detail
append
public void append(Object anObject)(Code)
Appends an Object or String to this ShellScript.
Parameters:
  anObject - the Object to append



append
public void append(char aChar)(Code)
Appends a Char to this ShellScript.
Parameters:
  aChar - a char to append



appendln
public void appendln(Object anObject)(Code)
Appends an Object or String to this ShellScript with unix linefeed ("\n").
Parameters:
  anObject - the Object to append



appendln
public void appendln(char aChar)(Code)
Appends a Char Object or String to this ShellScript with unix linefeed ("\n").
Parameters:
  aChar - a char to append



appendln
public void appendln()(Code)
Appends an Object or String to this ShellScript with unix linefeed ("\n").



exec
public String exec(String itsParams)(Code)
Executes thsi ShellScript with the given Params.
NOTE: the params cannot be contain whitespaces.
This (su -c <br>"cp from to"</br>) would not work:
because the underlaying java.runtime.exec("command") does not handle balanced or unbalanced (") correctly.
else just whitespace separate tokens.
This means for the sample. runtime.exec() would ever execute such as: su "-c" "\"cp" "fromFile" "toFile\""
But this his hidden in Sun's native code ;-(
This was the reason to write thsi class to have a Workaround :-)
Parameters:
  itsParams - the output from stdout of the execution.



exec
public String exec()(Code)
Execute this ShellScript. the output from stdout of the execution.



execAndDelete
public static String execAndDelete(String aShell, StringBuffer lines, String aLocation, String itsParams)(Code)
Executes and removes the script.
The Lines be also written in python or perl,
In this case, the Shell must be python or perl or so.
Parameters:
  aShell - The Shell which should exec the script. Can be also be python or perl, if theshellcontent is given in this language.
Parameters:
  lines - of the script.
Parameters:
  aLocation - where to store.
Parameters:
  itsParams - which should be pass to the script. the stdout.



execAndDelete
public static String execAndDelete(StringBuffer lines, String aLocation)(Code)
Executes and removes the script.
Parameters:
  lines - of the script.
Parameters:
  aLocation - where to store. the sdtout.



execute
public static String execute(String aShell, StringBuffer lines, String aLocation, String itsParams)(Code)
Execs ths given lines in the creted shell stored on location.
Parameters:
  aShell - A Shell which will be eexecute the script.
Parameters:
  lines - The content of the script.
Parameters:
  aLocation - The location where to store.
Parameters:
  itsParams - Th eoptional params of the script. the exec result



execute
public static String execute(StringBuffer lines, String aLocation)(Code)
Executes ths given lines in the created default shell (sh) stored on location.
Parameters:
  lines - the lines of the script to exec.s
Parameters:
  aLocation - where to store the stdout of the script.



getContent
public StringBuffer getContent()(Code)
gets the Content of this Script. the Content



getContentAsString
public String getContentAsString()(Code)
Gets the Content of this Script as String the script as String



main
public static void main(String[] args)(Code)
Test Main Method Run test with: java -cp .jar com.izforge.izpack.util.os.unix.ShellScript
Parameters:
  args - Arguments from Commandline



toString
public String toString()(Code)
Dumps the ShellScript Content, and Location. Use getContentAsString() to get this ShellScripts Content The ShellScript as Object dump.



write
public void write(String aDestination)(Code)
write this to the given Destination FileName
Parameters:
  aDestination - a destination filename



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.