1 28 29 30 package org.objectweb.ccm.runtime; 31 32 35 public class CIDLIDL 36 extends org.objectweb.corba.command.lib.CommandOnASTBase 37 { 38 private org.objectweb.util.cmdline.lib.DefaultOptionArgument _outdir; 40 41 public 43 CIDLIDL() 44 { 45 super(new org.objectweb.util.cmdline.lib.DefaultCommandLine( 46 "cidl_idl", 47 "declaration", 48 "Generate the IDL mapping for a component/module from the OpenCCM IR3", 49 true)); 50 51 _outdir = new org.objectweb.util.cmdline.lib.DefaultOptionArgument( 53 new String [] { "-d", "--outputdir" }, "outputdir", 54 new String [] { "Generate IDL file 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.Declaration decl = getAST().lookup(declname); 78 79 if(decl==null) { 80 getConsole().error("Declaration "+declname +" not found"); 81 return -1; 82 } 83 84 getConsole().message("Generating implementations for " + declname + "..."); 86 CIDLIDLGenerator gen = new CIDLIDLGenerator(getAST()); 87 88 try { 89 gen.initialize(getConsole()); 90 gen.generate(_outdir.getArgument(), decl, getConsole()); 91 } catch(org.objectweb.corba.generator.common.lib.GenerationException ex) { 92 report_exception(ex); 93 return -1; 94 } 95 96 return 0; 97 } 98 99 103 static public void 104 main(String [] args) 105 { 106 CIDLIDL cmd = new CIDLIDL(); 107 cmd.runMain(args); 108 } 109 } 110 | Popular Tags |