1 28 29 30 package org.objectweb.ccm.runtime; 31 32 35 public class CIDLCOPI 36 extends org.objectweb.corba.command.lib.CommandOnASTBase 37 { 38 private org.objectweb.util.cmdline.lib.DefaultOptionArgument _outdir; 40 41 public 43 CIDLCOPI() 44 { 45 super(new org.objectweb.util.cmdline.lib.DefaultCommandLine( 46 "ir3_copi", 47 "declaration", 48 "Generate the container interceptors for a component/module from the OpenCCM IR3", 49 false)); 50 51 _outdir = new org.objectweb.util.cmdline.lib.DefaultOptionArgument( 53 new String [] { "-d", "--outputdir" }, "outputdir", 54 new String [] { "Generate container interceptors into directory <outputdir>" }, 55 null); 56 57 _outdir.setMandatory(true); 59 60 getCommandLine().addOption(_outdir); 61 } 62 63 67 final public int 68 run(java.lang.String [] args) 69 { 70 if(!initAST()) { 72 return -1; 73 } 74 75 String declname = args[0]; 77 org.objectweb.corba.ast.api.Scope scope = null; 78 try { 79 scope = (org.objectweb.corba.ast.api.Scope)getAST().lookup(declname); 80 } catch(ClassCastException e) { 81 getConsole().error(declname+"must be a scope"); 82 return -1; 83 } 84 85 if(scope==null) { 86 getConsole().error("Declaration "+declname +" not found"); 87 return -1; 88 } 89 90 getConsole().message("Generating container interceptor for " + declname + "..."); 92 CIDLCOPIGenerator gen = new CIDLCOPIGenerator(getAST()); 93 94 try { 95 gen.generate(_outdir.getArgument(), scope); 96 } catch(org.objectweb.corba.generator.common.lib.GenerationException ex) { 97 report_exception(ex); 98 return -1; 99 } 100 101 getConsole().message("Interceptors generated in "+_outdir.getArgument()+"."); 102 103 return 0; 104 } 105 106 110 static public void 111 main(String [] args) 112 { 113 CIDLCOPI cmd = new CIDLCOPI(); 114 cmd.runMain(args); 115 } 116 } 117 | Popular Tags |