1 26 27 28 29 package org.objectweb.openccm.OpenCCM_DCI.cif; 30 31 import org.objectweb.openccm.OpenCCM_DCI.*; 32 import org.objectweb.openccm.corba.*; 33 34 43 public class ServerActivatorImpl 44 extends org.objectweb.openccm 45 .OpenCCM_DCI.NodeManagerSessionComposition 46 .ServerActivatorSeg 47 { 48 54 55 private int last_cs_num; 56 57 58 private java.util.Hashtable c_servers; 59 60 61 private java.util.Hashtable process; 62 63 64 private org.objectweb.openccm.OpenCCM_DCI.NodeManagerCCM node; 65 66 72 private org.objectweb.openccm.OpenCCM_DCI.NodeManagerCCM 73 getNode() 74 { 75 if(node==null) 76 this.node=(org.objectweb.openccm 77 .OpenCCM_DCI.NodeManagerCCM)get_context(); 78 return node; 79 } 80 88 public ServerActivatorImpl(){ 89 last_cs_num=0; 91 c_servers= new java.util.Hashtable (); 92 process=new java.util.Hashtable (); 93 94 } 95 101 117 public 118 org.omg.Components.Deployment.ComponentServer 119 create_component_server(org.omg.Components.ConfigValue[] config) 120 throws org.omg.Components.CreateFailure, 121 org.omg.Components.Deployment.InvalidConfiguration 122 { 123 org.omg.Components.Deployment.ComponentServer server=null; 124 try{ 125 126 String server_name="ComponentServer"+last_cs_num++; 128 129 org.objectweb.openccm.Components.ConfigValueImpl[] config1= 130 new org.objectweb.openccm.Components.ConfigValueImpl[1]; 131 132 org.omg.CORBA.Any any= 133 org.objectweb.openccm.corba.TheORB.getORB().create_any(); 134 135 any.insert_string(server_name); 137 config1[0]= new org.objectweb.openccm.Components.ConfigValueImpl("ServerName",any); 138 ComponentServerManagerHome cshome= 140 getNode().get_connection_component_server_manager_home(); 141 org.objectweb.openccm.OpenCCM_DCI.ComponentServerManager csm= 143 cshome.create(); 144 csm.config(config1); 146 147 csm.connect_component_server_manager_registration 149 (getNode().provide_component_server_manager_registration()); 150 csm.connect_parent_server_activator 152 (getNode().provide_server_activator()); 153 csm.connect_container_manager_home 155 (getNode().get_connection_container_manager_home()); 156 csm.connect_component_installation 158 (getNode().provide_component_installation()); 159 csm.configuration_complete(); 161 return csm.provide_component_server(); 163 } 164 catch(Exception e) 165 { 166 e.printStackTrace(); 167 throw new org.omg.Components.CreateFailure(); 168 } 169 } 170 171 181 public void 182 remove_component_server( 183 org.omg.Components 184 .Deployment.ComponentServer server) 185 throws org.omg.Components.RemoveFailure 186 { 187 188 210 211 org.objectweb.openccm.OpenCCM_DCI. 212 NodeManagerPackage.component_server_managersConnection 213 connect[]=getNode().get_connections_component_server_managers(); 214 215 for(int i=0;i<connect.length;i++) 216 if(connect[i].objref. 217 provide_component_server(). 218 _is_equivalent(server)) 219 { 220 connect[i].objref.remove(); 221 return ; 222 } 223 throw new org.omg.Components.RemoveFailure(); 224 } 225 226 227 234 public org.omg.Components.Deployment.ComponentServer[] 235 get_component_servers() 236 { 237 238 241 242 org.objectweb.openccm.OpenCCM_DCI. 243 NodeManagerPackage.component_server_managersConnection 244 connect[]=getNode().get_connections_component_server_managers(); 245 246 org.omg.Components.Deployment.ComponentServer[] cs= 247 new org.omg.Components.Deployment.ComponentServer[connect.length]; 248 249 for(int i=0;i<connect.length;i++) 250 cs[i]=connect[i].objref.provide_component_server(); 251 252 return cs; 253 } 255 256 259 public void 260 remove() 261 throws org.omg.Components.RemoveFailure 262 { 263 org.objectweb.openccm.OpenCCM_DCI. 264 NodeManagerPackage.component_server_managersConnection 265 connect[]=getNode().get_connections_component_server_managers(); 266 267 for(int i=0;i<connect.length;i++) 268 { 269 connect[i].objref.remove(); 270 } 271 } 272 } 273 | Popular Tags |