FileDocCategorySizeDatePackage
HelpException.javaAPI DocGlassfish v2 API4118Fri May 04 22:25:20 BST 2007com.sun.enterprise.cli.framework

HelpException

public class HelpException extends Exception
Whenever the HelpException is thrown, it will use the helpclass defined in the xml to display the usage text or manpage.
author
Jane Young
version
$Revision: 1.4 $

Fields Summary
private String
command
private boolean
isShell
Constructors Summary
public HelpException()
Creates new HelpException without detail message.


               
      
    
    
public HelpException(String commandName)
Creates new HelpException with the command name to display the help

        command = commandName;
    
public HelpException(String[] args)

        if (args.length<2) {
            command = null;
        }
        else {
                //help, help --shell, help command --shell
            int next = 1;
            if(!args[next].startsWith("--"))
                command = args[next++];
            if(args.length>next && args[next].equals("--shell"))
                isShell = true;
        }
    
Methods Summary
public java.lang.StringgetCommandName()
Returns the command to display the help.

        return command;
    
public java.lang.StringgetHelpClassName()
Returns the help class to invoke.

        //read CLI descriptor
        final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance();
	return cliDescriptorsReader.getHelpClass();
    
public java.lang.StringgetUsageText()
Returns the usage text of the command.

        try 
        {
                //read CLI descriptor
            final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance();
                //get the validCommand object from CLI descriptor
            final ValidCommand validCommand = cliDescriptorsReader.getCommand(command);
            return validCommand.getUsageText();
        }
        catch (Exception e) 
        {
            return null;
        }
    
public booleanisShell()

        return isShell;