1 26 27 package org.objectweb.openccm.Deployment; 28 29 import org.omg.CosNaming.NameComponent ; 30 31 32 public class NodeManagerServer extends org.objectweb.openccm.corba.ApplicationServer 33 { 34 35 41 private String nodeIORFilePath; 42 43 private String nodeName; 44 45 private NameComponent [] ncomp; 46 47 private String npdFilePath; 48 49 private org.objectweb.openccm.OpenCCM_DCI.DCIManager DCI ; 50 private void 56 computeArgs(String args[]) 57 { 58 for(int i=0;i<args.length;i++){ 59 if(args[i].startsWith("NODENAME=")) 60 this.nodeName=args[i].substring(9); 61 else if(args[i].startsWith("NPDFILE=-I")) 62 this.npdFilePath=args[i].substring(10); 63 } 64 nodeIORFilePath=System.getProperty("WorkDir")+"/"+nodeName+".IOR"; 65 } 66 67 68 74 77 public 78 NodeManagerServer() 79 { 80 org.objectweb.ccm.descriptor.EntityResolver.setCCMResolver(); 82 } 83 84 90 95 public static void 96 main(String args[]) 97 { 98 NodeManagerServer server = new NodeManagerServer(); 99 101 int status = server.start(args); 102 System.exit(status); 103 } 104 105 111 118 public int 119 before_run(String [] args) 120 { 121 122 try{ 123 org.objectweb.openccm.Components.Runtime.init(org.objectweb.openccm.corba.TheORB.getORB()); 125 126 computeArgs(args); 127 128 DCI= 130 org.objectweb.openccm. 131 OpenCCM_DCI.DCIManagerHelper. 132 narrow(org.objectweb.openccm.corba 133 .TheORB.resolve_initial_reference("DCIManager")); 134 135 org.objectweb.openccm.OpenCCM_DCI.NodeManagerHome nodeHome= 137 org.objectweb.openccm.OpenCCM_DCI.NodeManagerHomeHelper. 138 narrow((new DeploymentComponentFactory()). 139 install_home("org.objectweb.openccm.OpenCCM_DCI.cif.NodeManagerHomeImpl.create_home")); 140 141 org.objectweb.openccm.OpenCCM_DCI.NodeManager 143 node=nodeHome.create_node(npdFilePath); 144 145 if(nodeName!=null) 148 node.node_name(nodeName); 149 150 org.objectweb.openccm.OpenCCM_DCI.ComponentServerManagerHome CSMH= 152 org.objectweb.openccm.OpenCCM_DCI. 153 ComponentServerManagerHomeHelper. 154 narrow((new DeploymentComponentFactory()). 155 install_home("org.objectweb.openccm.OpenCCM_DCI.cif.ComponentServerManagerHomeImpl.create_home")); 156 node.connect_component_server_manager_home(CSMH); 158 159 org.objectweb.openccm.OpenCCM_DCI.ContainerManagerHome CMH= 161 org.objectweb.openccm.OpenCCM_DCI. 162 ContainerManagerHomeHelper. 163 narrow((new DeploymentComponentFactory()). 164 install_home("org.objectweb.openccm.OpenCCM_DCI.cif.ContainerManagerHomeImpl.create_home")); 165 166 node.connect_node_management(DCI.provide_node_management()); 168 169 node.connect_container_manager_home(CMH); 171 node.configuration_complete(); 173 174 189 191 org.objectweb.openccm.corba.TheORB.save_IOR(node,nodeIORFilePath); 193 194 return 0; 195 } 196 catch(Exception e){ 197 e.printStackTrace(); 198 System.out.println(e.getMessage()); 199 200 } 201 return 0; 202 203 } 204 205 208 public void 209 after_run() 210 { 211 228 229 } 230 231 } 232 | Popular Tags |