com.ibm.as400.util
Class CommandHelpRetriever

java.lang.Object
  extended bycom.ibm.as400.util.CommandHelpRetriever

public class CommandHelpRetriever
extends Object

Utility class for generating IBM-formatted CL command help documentation. This class requires that valid XML and XSL processors (e.g. Xerces and Xalan) be in the CLASSPATH. CommandHelpRetriever can be run as a command line program, as follows:

java com.ibm.as400.util.CommandHelpRetriever -library -command [ -system -userid -password -showChoicePgmValues -output -debug ]
Options:

-help
Displays the help text. The -help option may be abbreviated to -h or -?.

Parameters:

-library iSeries library.
Specifies the iSeries library. This parameter may be abbreviated -l or -lib.
-command iSeries command.
Specifies the iSeries command. This parameter may be abbreviated -c or -cmd.
-system iSeries system name
Specifies the iSeries system. If an iSeries system name is not provided, a signon dialog will be displayed. This optional parameter may be abbreviated -s or -sys.
-userid iSeries userId.
Specifies the iSeries userId. If an iSeries userid is not provided, a signon dialog will be displayed. This optional parameter may be abbreviated -u or -uid.
-password iSeries password.
Specifies the iSeries password. If an iSeries password is not provided, a signon dialog will be displayed. This optional parameter may be abbreviated -p or -pwd.
-showChoicePgmValues [true | false]
Specifies whether or not parameter choices returned from choice programs are shown in the Choices cells of the parameter summary table. The default is false. This optional parameter may be abbreviated -scpv.
-output output location.
Specifies the output location for the generated help. The default is the current directory. The output cannot be a file when the command (-c) parameter contains a wildcard (*). This optional parameter may be abbreviated -o.
-debug [true | false]
Specifies whether to output the source command help and xml files to the output location specified by the -output parameter. The default is false. This optional parameter may be abbreviated -d.

See Also:
Command, CommandList

Constructor Summary
CommandHelpRetriever()
          Constructs an instance of the CommandHelpRetriever utility.
 
Method Summary
 String generateHTML(Command command)
          Generates IBM-formatted command help documentation for the specified CL command.
 String generateHTML(Command command, PanelGroup panelGroup)
          Generates IBM-formatted command help documentation for the specified CL command.
 byte[] generateHTMLBytes(Command command, PanelGroup panelGroup)
          Generates IBM-formatted command help documentation for the specified CL command.
 String generateUIM(Command command)
          Generates an IBM-formatted UIM template for the specified CL command.
 boolean getDebug()
          Returns whether or not the source XML and source command HTML help, which are used in generating the resulting command help HTML documentation, are saved to the current output location.
 String getOutputLocation()
          Returns the output location for the source XML and source command HTML help when running programatically.
 boolean getShowChoiceProgramValues()
          Returns whether or not the generated HTML documentation will contain parameter values returned by a "choices program".
static void main(String[] args)
          Performs the actions specified in the invocation arguments.
 void setDebug(boolean debug)
          Sets whether or not the source XML and source command HTML help, which are used in generating the resulting command help HTML documentation, are saved to the current output location.
 void setOutputLocation(String location)
          Sets the output location for the source XML and source command HTML help when running programatically.
 void setShowChoiceProgramValues(boolean show)
          Sets whether or not parameter values returned by a "choices program" will be generated as part of the HTML documentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandHelpRetriever

public CommandHelpRetriever()
Constructs an instance of the CommandHelpRetriever utility.

Method Detail

main

public static void main(String[] args)
Performs the actions specified in the invocation arguments.

Parameters:
args - The command line arguments.

generateHTML

public String generateHTML(Command command)
                    throws AS400Exception,
                           AS400SecurityException,
                           ErrorCompletingRequestException,
                           IOException,
                           InterruptedException,
                           ObjectDoesNotExistException,
                           SAXException,
                           ParserConfigurationException,
                           TransformerConfigurationException,
                           TransformerException
Generates IBM-formatted command help documentation for the specified CL command. Portions of the resulting HTML will contain strings that were translated using the Locale specified on the AS400 object for the given Command.

Note: While the String being returned is a typical UTF-16 Java String, the contents of the String is an HTML file with a META tag that defines the charset as UTF-8. Applications that use the String returned by this method should then be sure to convert the contents to UTF-8 bytes, or replace the charset tag inside the HTML with whichever encoding the application chooses to convert to. See generateHTMLBytes().

Parameters:
command - The command.
Returns:
An HTML string consisting of the help documentation for the command.
Throws:
AS400Exception
AS400SecurityException
ErrorCompletingRequestException
IOException
InterruptedException
ObjectDoesNotExistException
SAXException
ParserConfigurationException
TransformerConfigurationException
TransformerException
See Also:
Locale, AS400, Command

generateHTML

public String generateHTML(Command command,
                           PanelGroup panelGroup)
                    throws AS400Exception,
                           AS400SecurityException,
                           ErrorCompletingRequestException,
                           IOException,
                           InterruptedException,
                           ObjectDoesNotExistException,
                           SAXException,
                           ParserConfigurationException,
                           TransformerConfigurationException,
                           TransformerException
Generates IBM-formatted command help documentation for the specified CL command. Portions of the resulting HTML will contain strings that were translated using the Locale specified on the AS400 object for the given Command.

Note: While the String being returned is a typical UTF-16 Java String, the contents of the String is an HTML file with a META tag that defines the charset as UTF-8. Applications that use the String returned by this method should then be sure to convert the contents to UTF-8 bytes, or replace the charset tag inside the HTML with whichever encoding the application chooses to convert to. See generateHTMLBytes().

Parameters:
command - The command.
panelGroup - The panel group used to generate the help text, instead of the Command's defined panel group.
Returns:
An HTML string consisting of the help documentation for the command.
Throws:
AS400Exception
AS400SecurityException
ErrorCompletingRequestException
IOException
InterruptedException
ObjectDoesNotExistException
SAXException
ParserConfigurationException
TransformerConfigurationException
TransformerException
See Also:
Locale, AS400, Command, PanelGroup

generateHTMLBytes

public byte[] generateHTMLBytes(Command command,
                                PanelGroup panelGroup)
                         throws AS400Exception,
                                AS400SecurityException,
                                ErrorCompletingRequestException,
                                IOException,
                                InterruptedException,
                                ObjectDoesNotExistException,
                                SAXException,
                                ParserConfigurationException,
                                TransformerConfigurationException,
                                TransformerException
Generates IBM-formatted command help documentation for the specified CL command. Portions of the resulting HTML will contain strings that were translated using the Locale specified on the AS400 object for the given Command.

Note: The byte array returned by this method has already been encoded in UTF-8 in order to match the charset tag within the HTML document.

Parameters:
command - The command.
panelGroup - The panel group used to generate the help text. Specify null to use the Command's defined panel group.
Returns:
An HTML document encoded in UTF-8 bytes, consisting of the help documentation for the command.
Throws:
AS400Exception
AS400SecurityException
ErrorCompletingRequestException
IOException
InterruptedException
ObjectDoesNotExistException
SAXException
ParserConfigurationException
TransformerConfigurationException
TransformerException
See Also:
Locale, AS400, Command, PanelGroup

generateUIM

public String generateUIM(Command command)
                   throws AS400Exception,
                          AS400SecurityException,
                          ErrorCompletingRequestException,
                          IOException,
                          InterruptedException,
                          ObjectDoesNotExistException,
                          SAXException,
                          ParserConfigurationException,
                          TransformerConfigurationException,
                          TransformerException
Generates an IBM-formatted UIM template for the specified CL command. Portions of the resulting UIM output will contain strings that were translated using the Locale specified on the AS400 object for the given Command.

Parameters:
command - The command.
Returns:
A UIM string consisting of the UIM template for the command.
Throws:
AS400Exception
AS400SecurityException
ErrorCompletingRequestException
IOException
InterruptedException
ObjectDoesNotExistException
SAXException
ParserConfigurationException
TransformerConfigurationException
TransformerException
See Also:
Locale, AS400, Command

getDebug

public boolean getDebug()
Returns whether or not the source XML and source command HTML help, which are used in generating the resulting command help HTML documentation, are saved to the current output location.

Returns:
true if the source XML and source HTML files will be generated; false otherwise. The default is false.
See Also:
setDebug(boolean)

getOutputLocation

public String getOutputLocation()
Returns the output location for the source XML and source command HTML help when running programatically. The default is the current directory.

Returns:
The output location of the source files.
See Also:
setOutputLocation(java.lang.String)

getShowChoiceProgramValues

public boolean getShowChoiceProgramValues()
Returns whether or not the generated HTML documentation will contain parameter values returned by a "choices program".

Returns:
true if the extra parameters will be shown; false otherwise. The default is false.
See Also:
setShowChoiceProgramValues(boolean)

setDebug

public void setDebug(boolean debug)
Sets whether or not the source XML and source command HTML help, which are used in generating the resulting command help HTML documentation, are saved to the current output location.

Parameters:
debug - true if the source XML and source HTML files will be generated; false otherwise. The default is false.
See Also:
getDebug()

setOutputLocation

public void setOutputLocation(String location)
Sets the output location for the source XML and source command HTML help when running programatically. The default is the current directory.

Parameters:
location - The output location of the source files.
See Also:
getOutputLocation()

setShowChoiceProgramValues

public void setShowChoiceProgramValues(boolean show)
Sets whether or not parameter values returned by a "choices program" will be generated as part of the HTML documentation.

Parameters:
show - true to show the extra parameter values; false otherwise. The default value is false.
See Also:
getShowChoiceProgramValues()