1 28 29 package org.objectweb.openccm.OpenCCM_DCI.cif; 30 31 import org.objectweb.openccm.OpenCCM_DCI.*; 32 import org.objectweb.openccm.Deployment.ContainerLocalImpl; 33 import org.objectweb.openccm.Deployment.listener.ContainerListenerDefault; 34 import org.objectweb.openccm.corba.*; 35 36 37 45 46 public class ContainerSegImpl 47 extends org.objectweb.openccm.OpenCCM_DCI. 48 ContainerManagerSessionComposition.ContainerSeg 49 implements org.objectweb.openccm.Deployment.ContainerHomeInformation 50 { 51 52 private org.objectweb.openccm.Deployment.ContainerImpl container ; 59 private org.omg.Components.ConfigValue[] configuration; 61 private org.omg.Components.Cookie cookie; 63 private org.objectweb.openccm.OpenCCM_DCI.ContainerManagerCCM cont; 65 71 private org.objectweb.openccm.OpenCCM_DCI.ContainerManagerCCM 72 getCont() 73 { 74 if(cont==null) 75 cont=(org.objectweb.openccm.OpenCCM_DCI.ContainerManagerCCM) 76 get_context(); 77 return cont; 78 } 79 public ContainerSegImpl(){ 85 super(); 86 } 87 88 98 public void 99 configuration(org.omg.Components.ConfigValue[] configuration) 100 { 101 try{ 102 103 105 container= new org.objectweb.openccm.Deployment 106 .ContainerImpl(configuration, 107 null, 108 get_context() 109 .get_connection_component_installation()); 110 container._delegate().set_container_home_info(this); 111 114 115 125 126 127 org.omg.CORBA.Object ref = null; 128 try 129 { 130 byte[] oid = org.objectweb.openccm.corba.TheRootPOA.getRootPOA().activate_object(container); 131 ref = org.objectweb.openccm.corba.TheRootPOA.getRootPOA().id_to_reference(oid); 132 } 133 catch(Exception ex) 134 { 135 ex.printStackTrace(); 136 } 137 138 139 140 141 142 this.configuration=configuration; 144 146 147 org.omg.Components.Deployment.Container cont_ref = 148 org.omg.Components.Deployment.ContainerHelper.narrow(ref); 149 container.the_container_ref(cont_ref); 150 151 153 } 154 catch(Exception e){ 155 e.printStackTrace(); 156 } 157 } 158 163 public void 164 cookie(org.omg.Components.Cookie cookie) 165 { 166 this.cookie=cookie; 167 } 168 169 172 public void 173 unregister_home(org.omg.Components.CCMHome ref) 174 throws org.omg.Components.RemoveFailure 175 { 176 try{ 177 org.objectweb.openccm.OpenCCM_DCI. 179 ContainerManagerPackage.homes_createdConnection 180 connect[]=getCont().get_connections_homes_created(); 181 for(int i=0;i<connect.length;i++) 183 if(connect[i].objref._is_equivalent(ref)) 184 { 185 getCont().disconnect_homes_created(connect[i].ck); 186 return ; 187 } 188 } 189 catch(org.omg.Components.ExceededConnectionLimit ecl){ 190 ecl.printStackTrace(); 191 } 192 throw new org.omg.Components.RemoveFailure(); 193 } 194 200 204 public 205 org.omg.Components.Deployment.ComponentServer 206 get_component_server(){ 207 return getCont().get_connection_component_server(); 208 } 209 210 216 public org.omg.Components.CCMHome 217 install_home(java.lang.String uuid, 218 java.lang.String entrypt, 219 org.omg.Components.ConfigValue[] config) 220 throws org.omg.Components.Deployment.UnknownImplId, 221 org.omg.Components.Deployment.ImplEntryPointNotFound, 222 org.omg.Components.Deployment.InstallationFailure, 223 org.omg.Components.Deployment.InvalidConfiguration 224 { 225 org.omg.Components.CCMHome home= 227 container.install_home(uuid,entrypt,config); 228 229 try{ 230 getCont().connect_homes_created(home); 232 } 233 catch(Exception e) 234 { 235 System.err.println(e.getMessage()); 236 throw new org.omg.Components.Deployment.InstallationFailure(); 237 } 238 return home; 240 } 241 242 247 public 248 void 249 remove_home(org.omg.Components.CCMHome homeref) 250 throws org.omg.Components.RemoveFailure 251 { 252 try{ 253 org.objectweb.openccm.OpenCCM_DCI. 255 ContainerManagerPackage.homes_createdConnection 256 connect[]=getCont().get_connections_homes_created(); 257 for(int i=0;i<connect.length;i++) 259 if(connect[i].objref._is_equivalent(homeref)) 260 { 261 homeref.remove_home(); 265 return ; 266 } 267 } 268 catch(Exception ecl){ 269 ecl.printStackTrace(); 270 } 271 throw new org.omg.Components.RemoveFailure(); 272 273 } 274 275 279 public org.omg.Components.CCMHome[] 280 get_homes() 281 { 282 org.objectweb.openccm.OpenCCM_DCI. 284 ContainerManagerPackage.homes_createdConnection 285 connect[]=getCont().get_connections_homes_created(); 286 org.omg.Components.CCMHome[] homes= 288 new org.omg.Components.CCMHome[connect.length]; 289 for(int i=0;i<connect.length;i++) 291 homes[i]=connect[i].objref; 292 return homes; 294 } 295 296 299 public void 300 remove() 301 throws org.omg.Components.RemoveFailure 302 { 303 try 304 { 305 get_context().get_connection_container_manager_registration() 307 .unregister_container_manager(cookie); 308 org.objectweb.openccm.OpenCCM_DCI. 310 ContainerManagerPackage.homes_createdConnection 311 connect[]=getCont().get_connections_homes_created(); 312 for(int i=0;i<connect.length;i++){ 314 connect[i].objref.remove_home(); 316 } 317 318 container.remove(); 320 321 } 324 catch(Exception e ) 325 { 326 System.err.println("Cannot disconnect Container/ComponentServer/Node"); 327 e.printStackTrace(System.err); 328 throw new org.omg.Components.RemoveFailure(); 329 } 330 } 331 332 338 public org.omg.Components.ConfigValue[] 339 configuration() 340 { 341 return this.configuration; 342 } 343 344 345 } 346 | Popular Tags |