1 28 29 package org.objectweb.ccm.scripts; 30 31 34 public class IR3XMIOptionsManager 35 extends OptionsManager_impl { 36 37 40 private java.lang.String objectName_; 41 42 45 private java.lang.String commandName_; 46 47 53 public 54 IR3XMIOptionsManager(java.lang.String indentation, 55 java.lang.String commandName) { 56 57 super(indentation); 58 59 addOption(new Option( 60 "-h", 0, "-h Display this help.")); 61 addOption(new Option( 62 "-o", 1, "-o <file> Output filename.")); 63 addOption(new Option( 64 "-dtd", 1, "-dtd <file> Location of the XMI DTD.")); 65 66 objectName_ = ""; 67 commandName_ = commandName; 68 } 69 70 73 public void 74 usage() { 75 System.err.println("usage :"); 76 System.err.println(commandName_ + " [options] <ir_object>\n"); 77 System.err.println("options :"); 78 optionsUsage(""); 79 } 80 81 88 public int 89 analyse(java.lang.String [] cmdline) { 90 int length = cmdline.length; 91 92 if (length < 1) { 93 System.err.println("Missing <ir_object>"); 94 usage(); 95 return -1; 96 } 97 if (analyseOptions(cmdline, 1) == -1) { 98 return -1; 99 } 100 if (isSet("-h") || cmdline[length - 1].equals("-h")) { 101 usage(); 102 return -1; 103 } 104 if (cmdline[length - 1].startsWith("-")) { 105 System.err.println("Invalid <ir_object> : " + cmdline[length - 1]); 106 usage(); 107 return -1; 108 } 109 110 objectName_ = cmdline[length - 1]; 111 return 0; 112 } 113 114 119 public java.lang.String 120 getObjectName() { 121 return objectName_; 122 } 123 } 124 | Popular Tags |