1 26 27 package org.objectweb.openccm.OpenCCM_DCI.cif; 28 29 import org.objectweb.openccm.OpenCCM_DCI.*; 30 import org.objectweb.openccm.corba.*; 31 32 41 public class ComponentServerSegImpl 42 extends org.objectweb.openccm.OpenCCM_DCI. 43 ComponentServerManagerSessionComposition.ComponentServerSeg 44 { 45 private org.omg.Components.ConfigValue[] configuration; 52 private org.omg.Components.Cookie cookie; 54 private org.objectweb.openccm.OpenCCM_DCI.ComponentServerManagerCCM CS; 56 private boolean removed; 58 59 public ComponentServerSegImpl(){ 65 super(); 66 68 } 69 70 76 private org.objectweb.openccm.OpenCCM_DCI.ComponentServerManagerCCM 77 getCS() 78 { 79 if(CS==null) 80 CS=(org.objectweb.openccm 81 .OpenCCM_DCI.ComponentServerManagerCCM)get_context(); 82 return CS; 83 } 84 public void 90 configuration(org.omg.Components.ConfigValue[] configuration) 91 { 92 this.configuration=configuration; 93 } 94 95 public void 96 cookie(org.omg.Components.Cookie cookie) 97 { 98 this.cookie=cookie; 99 } 100 101 107 111 public org.omg.Components.ConfigValue[] 112 configuration(){ 113 return this.configuration; 114 } 115 116 120 public org.omg.Components.Deployment.ServerActivator 121 get_server_activator(){ 122 return getCS().get_connection_parent_server_activator(); 123 } 124 125 130 public 131 org.omg.Components.Deployment.Container 132 create_container(org.omg.Components.ConfigValue[] config) 133 throws org.omg.Components.CreateFailure, 134 org.omg.Components.Deployment.InvalidConfiguration 135 { 136 137 ContainerManagerHome conthome= 139 getCS().get_connection_container_manager_home(); 140 org.objectweb.openccm.OpenCCM_DCI.ContainerManager contm= 142 conthome.create(); 143 contm.config(config); 145 146 try{ 147 contm.connect_container_manager_registration(getCS().provide_container_manager_registration()); 149 contm.connect_component_server(getCS().provide_component_server()); 151 contm.connect_component_installation(get_context().get_connection_component_installation()); 153 } 154 catch(org.omg.Components.AlreadyConnected e) 155 { 156 System.err.println(e.getMessage()); 157 throw new org.omg.Components.CreateFailure(); 158 } 159 try{ 160 contm.configuration_complete(); 162 } 163 catch(org.omg.Components.InvalidConfiguration e2) 164 { 165 System.err.println(e2.getMessage()); 166 throw new org.omg.Components.Deployment.InvalidConfiguration(); 167 } 168 return contm.provide_container(); 170 } 171 172 175 public void 176 remove_container(org.omg.Components.Deployment.Container cref) 177 throws org.omg.Components.RemoveFailure 178 { 179 org.objectweb.openccm.OpenCCM_DCI. 181 ComponentServerManagerPackage.container_managersConnection 182 connect[]=getCS().get_connections_container_managers(); 183 for(int i=0;i<connect.length;i++) 186 if(connect[i].objref. 187 provide_container(). 188 _is_equivalent(cref)) 189 { 190 connect[i].objref.remove(); 191 return ; 192 } 193 throw new org.omg.Components.RemoveFailure(); 195 } 196 197 200 public org.omg.Components.Deployment.Container[] 201 get_containers() 202 { 203 org.objectweb.openccm.OpenCCM_DCI. 205 ComponentServerManagerPackage.container_managersConnection 206 connect[]=getCS().get_connections_container_managers(); 207 org.omg.Components.Deployment.Container[] cont= 209 new org.omg.Components.Deployment.Container[connect.length]; 210 for(int i=0;i<connect.length;i++) 212 cont[i]=connect[i].objref.provide_container(); 213 return cont; 215 216 } 217 218 222 public void 223 remove() 224 throws org.omg.Components.RemoveFailure 225 { 226 if(!removed) 227 { 228 removed=true; 229 230 try 231 { 232 get_context().get_connection_component_server_manager_registration() 234 .unregister_component_server_manager(cookie); 235 org.objectweb.openccm.OpenCCM_DCI. 237 ComponentServerManagerPackage.container_managersConnection 238 connect[]=getCS().get_connections_container_managers(); 239 240 for(int i=0;i<connect.length;i++) 242 connect[i].objref.remove(); 243 getCS().remove(); 245 } 246 catch(Exception e ) 247 { 248 System.out.println("Cannot disconnect ComponentServer/Node"); 249 e.printStackTrace(); 250 throw new org.omg.Components.RemoveFailure(); 251 } 252 } 253 254 } 255 256 257 258 } 259 | Popular Tags |