org.vishia.mainCmd
Interface MainCmd_ifc

All Superinterfaces:
Report
All Known Implementing Classes:
CmdHeader2Reflection, CorrectHref.Main, Java2C, Main.CmdLine, MainCmd, MainCmdSwt, MainCmdWin, Menu, SampleCmdLine.CmdLine, SampleGuiSwtButtonInput.MainCmd, SampleZbnfJava, SocketTester, Textfile2Html, Xslt.CmdLine, Xsltpre.CmdLine, Zbnf2Xml.CmdLine, ZbnfGui, Zmake.CmdLine

public interface MainCmd_ifc
extends Report

The interface MainCmd_Ifc is an interface for all java programms to do something in respect to command line things. Specifically the writing of messages is supported. The implemented class effectuate the writing at example to the System.out or to a window in GUI-applications.
The interface Report is extended here, so all report things are also accessable via this interface.


date       who      change
2007-12-29 JcHartmut displace some methods to org.vishia.mainCmd.Report.
2007-03-07 JcHartmut Method getReportFileName
2006-01-07 JcHartmut some corrections
2004-06-00 JcHartmut initial revision



Field Summary
 
Fields inherited from interface org.vishia.mainCmd.Report
anytime, debug, error, eventOrder, exitSuccessfull, exitUserAbort, exitWithArgumentError, exitWithErrors, exitWithFileProblems, exitWithNotes, exitWithWarnings, fineDebug, fineEventOrder, fineInfo, info, interested, mNeverOutputToDisplay, mReportLevel, warning
 
Method Summary
 int executeCmdLine(java.lang.ProcessBuilder processBuilder, java.lang.String[] cmd, java.lang.String input, int nReportLevel, java.lang.StringBuffer output, java.lang.StringBuffer error)
          Executes a command line call maybe as pipe, waiting for finishing..
 int executeCmdLine(java.lang.ProcessBuilder processBuilder, java.lang.String cmd, java.lang.String input, int nReportLevel, java.lang.StringBuffer output, java.lang.StringBuffer error)
          Executes a command line call maybe as pipe, waiting for finishing..
 int executeCmdLine(java.lang.String[] cmd, int nReportLevel, java.lang.StringBuffer output, java.lang.String input)
          Execute a command, invoke a cmdline call.
 int executeCmdLine(java.lang.String cmdLine, int nReportLevel, java.lang.StringBuffer output, java.lang.String input)
          Execute a command, invoke a cmdline call.
 java.lang.String getReportFileName()
          Returns the name of the report file to write out as info.
 int startCmdLine(java.lang.ProcessBuilder processBuilder, java.lang.String cmd)
          Starts a command invocation for a independent window.
 int startCmdLine(java.lang.ProcessBuilder processBuilder, java.lang.String[] cmd)
          Starts a command invocation for a independent window.
 int switchToWindowOrStartCmdline(java.lang.ProcessBuilder processBuilder, java.lang.String sCmd, java.lang.String sWindowTitle)
          Searches the window for the already running process or starts the process with command invocation for a independent window.
 
Methods inherited from interface org.vishia.mainCmd.Report
flushReport, getExitErrorLevel, getLogMessageOutputConsole, getLogMessageOutputFile, getReportLevel, getReportLevelFromIdent, openReportfile, report, report, reportln, reportln, setExitErrorLevel, setReportLevelToIdent, writeError, writeError, writeInfo, writeInfoln, writeWarning
 

Method Detail

getReportFileName

java.lang.String getReportFileName()
Returns the name of the report file to write out as info.

Returns:
name of Reportfile.

executeCmdLine

int executeCmdLine(java.lang.String[] cmd,
                   int nReportLevel,
                   java.lang.StringBuffer output,
                   java.lang.String input)
Execute a command, invoke a cmdline call. The call must not be needed any input ::TODO:: see input. The output is written with a separate thread either to writeInfoln() or to report.

Parameters:
cmd - String with the separeted parts of the command. cmd[0] is the command to invoke.
nReportLevel - Determines the kind of writing the output. Possible values are 1..6 using Report.error to Report.fineInfo and -1..-3 using -Report.error to -report.info (with a negativ sign!). On negativ values the report is written to display with the write..()-methods of this interface, with the positive value, the report is written to Report.report..()-Methods.
The error output is always written to the reportfile with Report.error or with writeError().
Example: -3 detemines, that the normal output is written with writeInfoln() and the error output is written with writeError(), 3 detemines that the normal output is written with reportln(3,...) and the error output is written with Report(1, ...).
output - If not null, than the stdout is written in this Buffer. If null, the stdout is written to report.
input - If not null, this input is send to the cmdline process. If null, no input is send.
Returns:
exitErrorLevel from the command line process.

executeCmdLine

int executeCmdLine(java.lang.String cmdLine,
                   int nReportLevel,
                   java.lang.StringBuffer output,
                   java.lang.String input)
Execute a command, invoke a cmdline call. The call must not be needed any input. The output is written with a separate thread either to writeInfoln() or to report.

Parameters:
cmdLine - String represents the command with all arguments. The arguments must be separated by exactly one space. The rest of paramter and return see executeCmdLine(String[], ...).

executeCmdLine

int executeCmdLine(java.lang.ProcessBuilder processBuilder,
                   java.lang.String cmd,
                   java.lang.String input,
                   int nReportLevel,
                   java.lang.StringBuffer output,
                   java.lang.StringBuffer error)
Executes a command line call maybe as pipe, waiting for finishing.. The output is written with a separate thread, using the internal (private) class ShowCmdOutput.

Parameters:
processBuilder - The ProcessBuilder. There may be assigned environment variables and a current directory.
cmd - The cmd and arguments. If it is null, the command assigened to the processBuilder is used.
input - Any pipe-input. It may be null.
nReportLevel - The report level which is used for output. If it is 0, then the output isn't written TODO
output - The output pipe.
error - The error pipe. If it is null, then errors are written in the output pipe.
Returns:

executeCmdLine

int executeCmdLine(java.lang.ProcessBuilder processBuilder,
                   java.lang.String[] cmd,
                   java.lang.String input,
                   int nReportLevel,
                   java.lang.StringBuffer output,
                   java.lang.StringBuffer error)
Executes a command line call maybe as pipe, waiting for finishing.. The output is written with a separate thread, using the internal (private) class ShowCmdOutput.

Parameters:
processBuilder - The ProcessBuilder. There may be assigned environment variables and a current directory.
cmd - The cmd and arguments. If it is null, the command assigend to the processBuilder is used.
input - Any pipe-input. It may be null.
nReportLevel - The report level which is used for output. If it is 0, then the output isn't written TODO
output - The output pipe.
error - The error pipe. If it is null, then errors are written in the output pipe.
Returns:

startCmdLine

int startCmdLine(java.lang.ProcessBuilder processBuilder,
                 java.lang.String cmd)
Starts a command invocation for a independent window. This command does not have any input or output. The command will be started, the finishing isn't await. This command line invocation is proper for commands, which create a new window in the operation system. The new window has its own live cycle then, independent of the invocation.

Parameters:
cmd - The command. Some arguments are possible, they should be separated by space.
processBuilder - The processBuilder.
Returns:

startCmdLine

int startCmdLine(java.lang.ProcessBuilder processBuilder,
                 java.lang.String[] cmd)
Starts a command invocation for a independent window. This command does not have any input or output. The command will be started, the finishing isn't await. This command line invocation is proper for commands, which create a new window in the operation system. The new window has its own live cycle then, independent of the invocation.

Parameters:
cmd - The command and some arguments.
processBuilder - The processBuilder.
Returns:

switchToWindowOrStartCmdline

int switchToWindowOrStartCmdline(java.lang.ProcessBuilder processBuilder,
                                 java.lang.String sCmd,
                                 java.lang.String sWindowTitle)
Searches the window for the already running process or starts the process with command invocation for a independent window. This command does not have any input or output. The command will be started, the finishing isn't await. This command line invocation is proper for commands, which create a new window in the operation system. The new window has its own live cycle then, independent of the invocation.

Parameters:
cmd - The command and some arguments.
processBuilder - The processBuilder.
sWindowTitle - The title or the start of the window if the process is running already. Note: The title is depending from the application. Sometimes the title starts with the associated file, forex calling windows-notepad.
Returns:
0 on success, 255 if any start error.