1 23 24 package com.sun.enterprise.cli.framework; 25 26 32 public class HelpException extends java.lang.Exception 33 { 34 private String command = null; 35 private boolean isShell = false; 36 37 40 public HelpException() 41 { 42 } 43 44 47 public HelpException(String commandName) 48 { 49 command = commandName; 50 } 51 52 public HelpException(String [] args) 53 { 54 if (args.length<2) { 55 command = null; 56 } 57 else { 58 int next = 1; 60 if(!args[next].startsWith("--")) 61 command = args[next++]; 62 if(args.length>next && args[next].equals("--shell")) 63 isShell = true; 64 } 65 } 66 67 70 public String getHelpClassName() 71 { 72 final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance(); 74 return cliDescriptorsReader.getHelpClass(); 75 } 76 77 80 public String getCommandName() 81 { 82 return command; 83 } 84 85 88 public String getUsageText() 89 { 90 try 91 { 92 final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance(); 94 final ValidCommand validCommand = cliDescriptorsReader.getCommand(command); 96 return validCommand.getUsageText(); 97 } 98 catch (Exception e) 99 { 100 return null; 101 } 102 } 103 104 public boolean isShell(){ 105 return isShell; 106 } 107 } 108 109 110 | Popular Tags |