1 26 27 package org.objectweb.openccm.OpenCCM_DCI.cif; 28 29 import org.objectweb.openccm.OpenCCM_DCI.*; 30 31 39 40 public class NodeManagerImpl 41 extends org.objectweb.openccm.OpenCCM_DCI 42 .NodeManagerSessionComposition 43 .NodeManagerSessionImpl 44 { 45 46 private String nodeName; 53 private String npdFilePath; 55 56 private org.omg.CosNaming.NameComponent ncomp[]; 57 58 public NodeManagerImpl(String npdFilePath){ 69 this.npdFilePath=npdFilePath; 71 } 72 73 83 public void 84 ccm_remove() 85 throws org.omg.Components.CCMException 86 { 87 88 try{ 89 ((ServerActivatorImpl) 90 obtain_executor("server_activator")).remove(); 91 } 92 catch(org.omg.Components.RemoveFailure e) 93 { 94 System.err.println("Cannot remove all the componentservers."); 95 } 96 97 try{ 98 if(ncomp!=null){ 99 org.omg.CosNaming.NamingContextExt nce= 100 org.omg.CosNaming 101 .NamingContextExtHelper 102 .narrow(org.objectweb.openccm.corba.TheNameService 103 .getNamingContext().getNamingContext()); 104 105 nce.unbind(ncomp); 106 107 System.err.println("The "+nodeName+"Node is unreferenced"); 108 } 109 } 110 catch(Exception e) 111 { 112 System.err.println("Cannot unbind The "+nodeName+"Node"); 113 } 114 115 try{ 116 ((org.objectweb.openccm.OpenCCM_DCI.NodeManagerCCM)get_context()). 117 get_connection_node_management().deregister_node(nodeName); 118 119 org.objectweb.openccm.Deployment.ShutDownThread tr= 120 new org.objectweb.openccm.Deployment.ShutDownThread(); 121 tr.start(); 122 try{ 123 tr.join(); 124 } 125 catch(InterruptedException e){ 126 e.printStackTrace(); 127 } 128 129 130 } 131 catch(org.ist.coach.DCI.UnknownNode e){ 132 e.printStackTrace(); 133 throw new org.omg.Components.CCMException(); 134 } 135 System.exit(0); 136 } 137 138 144 public void 145 configuration_complete() 146 throws org.omg.Components.InvalidConfiguration 147 { 148 try{ 149 ((NodeInformationSegImpl) 151 obtain_executor("node_information")).setTree(npdFilePath); 152 153 org.omg.Components.SessionContext sc= 154 (org.omg.Components.SessionContext)get_context(); 155 156 org.ist.coach.DCI.NodeManager node= 157 org.objectweb.openccm. 158 OpenCCM_DCI.NodeManagerHelper 159 .narrow(sc.get_CCM_object()); 160 ((org.objectweb.openccm.OpenCCM_DCI.NodeManagerCCM)get_context()). 162 get_connection_node_management() 163 .register_node(nodeName,node); 164 165 org.omg.CosNaming.NamingContextExt nce= 166 org.omg.CosNaming 167 .NamingContextExtHelper 168 .narrow(org.objectweb.openccm.corba.TheNameService 169 .getNamingContext().getNamingContext()); 170 String registrationName= 171 System.getProperty("Node_ns_dir") 172 +nodeName; 173 174 ncomp=org.objectweb.openccm 175 .descriptor.componentassembly.ccm 176 .deployer.registrar.RegisterwithnamingDeployer 177 .rebind(nce,registrationName,node); 178 179 } 180 catch(Exception e){ 181 e.printStackTrace(); 182 } 183 } 184 185 public void node_name(String node_name){ 191 this.nodeName=node_name; 192 } 193 194 public String node_name(){ 195 return nodeName; 196 } 197 198 199 } 200 | Popular Tags |