1 26 27 package org.objectweb.openccm.command.lib; 28 29 import org.objectweb.util.cmdline.api.OptionArgument; 31 import org.objectweb.util.cmdline.api.OptionFlag; 32 import org.objectweb.util.cmdline.lib.DefaultCommandLine; 33 import org.objectweb.util.cmdline.lib.DefaultOptionArgument; 34 import org.objectweb.util.cmdline.lib.DefaultOptionFlag; 35 import org.objectweb.openccm.corba.TheORB; 36 import org.objectweb.openccm.ir3.IFR; 37 import org.omg.CORBA.ComponentIR.Repository; 38 39 46 47 public class IR3Server 48 extends ApplicationServerBase 49 { 50 56 57 private OptionArgument option_IOR_file_; 58 59 60 private OptionFlag option_disable_mapping_; 61 62 63 private IR3Feed compiler_; 64 65 71 72 public 73 IR3Server() 74 { 75 super(new DefaultCommandLine("ir3server", 77 "[omg_idl_files]", 78 "Start the OpenCCM Interface Repository", 79 true)); 80 81 option_IOR_file_ = new DefaultOptionArgument( 83 "--ior-file", 84 "ior_file", 85 new String [] { 86 "Set the file to store the OpenCCM Interface Repository IOR,", 87 "default is ./InterfaceRepository.IOR" 88 }, 89 "./InterfaceRepository.IOR" ); 90 getCommandLine().addOption(option_IOR_file_); 91 92 option_disable_mapping_ = new DefaultOptionFlag( 94 "--no-mappings", 95 "Disable OMG IDL 2.x mappings", 96 false); 97 getCommandLine().addOption(option_disable_mapping_); 98 99 compiler_ = new IR3Feed(getCommandLine()); 101 compiler_.setConsole(getConsole()); 102 compiler_.getPreprocessorApplication().setConsole(getConsole()); 103 } 104 105 111 117 123 129 138 public int 139 before_run(String [] args) 140 { 141 IFR repositoryServer = new IFR(!option_disable_mapping_.getFlag()); 143 Repository repositoryRef = repositoryServer.getRepository().asComponentRepository(); 144 145 TheORB.register_initial_reference("InterfaceRepository", repositoryRef); 147 148 int result = compiler_.run(args); 150 if(result != 0) 151 return result; 152 153 System.out.println("The OpenCCM OMG IDL3 Repository is ready."); 154 155 TheORB.save_IOR(repositoryRef, option_IOR_file_.getArgument()); 157 158 return 0; 159 } 160 161 166 public void 167 after_run() 168 { 169 } 170 171 177 182 public static void 183 main(String [] args) 184 { 185 IR3Server ir3server = new IR3Server(); 186 ir3server.runMain(args); 187 } 188 } | Popular Tags |