com.ibm.as400.util

Class CommandHelpRetriever

  • java.lang.Object
    • com.ibm.as400.util.CommandHelpRetriever


  • public class CommandHelpRetriever
    extends java.lang.Object
    Generates 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 <library> -command <command> [ -system <systemName> -userid <userid> -password <password> -showChoicePgmValues -output <outputDirectory> -debug ]
      
    Options:
    -help
    Displays the help text. The -help option may be abbreviated to -h or -?.

    Parameters:

    -library IBM i library.
    Specifies the IBM i library. This parameter may be abbreviated -l or -lib.
    -command IBM i command.
    Specifies the IBM i command. This parameter may be abbreviated -c or -cmd.
    -system IBM i system name
    Specifies the IBM i system. If an IBM i system name is not provided, a signon dialog will be displayed. This optional parameter may be abbreviated -s or -sys.
    -userid IBM i userID.
    Specifies the IBM i userId. If an IBM i userID is not provided, a signon dialog will be displayed. This optional parameter may be abbreviated -u or -uid.
    -password IBM i password.
    Specifies the IBM i password. If an IBM i 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

      Constructors 
      Constructor and Description
      CommandHelpRetriever()
      Constructs an instance of the CommandHelpRetriever utility.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String generateHTML(Command command)
      Generates IBM-formatted command help documentation for the specified CL command.
      java.lang.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.
      java.lang.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.
      java.lang.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(java.lang.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(java.lang.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(java.lang.String[] args)
        Performs the actions specified in the invocation arguments.
        Parameters:
        args - The command line arguments.
      • generateHTML

        public java.lang.String generateHTML(Command command)
                                      throws AS400Exception,
                                             AS400SecurityException,
                                             ErrorCompletingRequestException,
                                             java.io.IOException,
                                             java.lang.InterruptedException,
                                             ObjectDoesNotExistException,
                                             org.xml.sax.SAXException,
                                             javax.xml.parsers.ParserConfigurationException,
                                             javax.xml.transform.TransformerConfigurationException,
                                             javax.xml.transform.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
        java.io.IOException
        java.lang.InterruptedException
        ObjectDoesNotExistException
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        javax.xml.transform.TransformerConfigurationException
        javax.xml.transform.TransformerException
        See Also:
        Locale, AS400, Command
      • generateHTML

        public java.lang.String generateHTML(Command command,
                                    PanelGroup panelGroup)
                                      throws AS400Exception,
                                             AS400SecurityException,
                                             ErrorCompletingRequestException,
                                             java.io.IOException,
                                             java.lang.InterruptedException,
                                             ObjectDoesNotExistException,
                                             org.xml.sax.SAXException,
                                             javax.xml.parsers.ParserConfigurationException,
                                             javax.xml.transform.TransformerConfigurationException,
                                             javax.xml.transform.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
        java.io.IOException
        java.lang.InterruptedException
        ObjectDoesNotExistException
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        javax.xml.transform.TransformerConfigurationException
        javax.xml.transform.TransformerException
        See Also:
        Locale, AS400, Command, PanelGroup
      • generateHTMLBytes

        public byte[] generateHTMLBytes(Command command,
                               PanelGroup panelGroup)
                                 throws AS400Exception,
                                        AS400SecurityException,
                                        ErrorCompletingRequestException,
                                        java.io.IOException,
                                        java.lang.InterruptedException,
                                        ObjectDoesNotExistException,
                                        org.xml.sax.SAXException,
                                        javax.xml.parsers.ParserConfigurationException,
                                        javax.xml.transform.TransformerConfigurationException,
                                        javax.xml.transform.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
        java.io.IOException
        java.lang.InterruptedException
        ObjectDoesNotExistException
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        javax.xml.transform.TransformerConfigurationException
        javax.xml.transform.TransformerException
        See Also:
        Locale, AS400, Command, PanelGroup
      • 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 java.lang.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(java.lang.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()