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 AssemblyFactorySegImpl 42 extends org.objectweb.openccm.OpenCCM_DCI. 43 AssemblyFactoryManagerSessionComposition.AssemblyFactorySeg 44 { 45 org.objectweb.openccm.OpenCCM_DCI.AssemblyFactoryManagerCCM AFM; 51 52 53 59 public AssemblyFactorySegImpl(){ 65 super(); 66 } 67 68 public void 74 setup() 75 { 76 AFM=(org.objectweb.openccm.OpenCCM_DCI.AssemblyFactoryManagerCCM) 77 get_context(); 78 } 79 80 86 91 public org.omg.Components.Cookie 92 create_assembly(String assembly_loc) 93 throws org.omg.Components.Deployment.InvalidLocation, 94 org.omg.Components.CreateFailure 95 { 96 try{ 97 org.objectweb.openccm.OpenCCM_DCI.AssemblyManager am= 99 AFM.get_connection_assembly_manager_home() 100 .create_assembly_manager(assembly_loc); 101 102 am.connect_home_finder(AFM.get_connection_home_finder()); 104 am.connect_home_registration(AFM.get_connection_home_registration()); 106 am.connect_naming_service(AFM.get_connection_naming_service()); 108 am.connect_dci_information(AFM.get_connection_dci_information()); 111 am.connect_assembly_manager_registration(AFM.provide_assembly_manager_registration()); 113 am.configuration_complete(); 117 org.objectweb.openccm.OpenCCM_DCI. 119 AssemblyFactoryManagerPackage.assembly_managersConnection 120 connect[]=AFM.get_connections_assembly_managers(); 121 for(int i=0;i<connect.length;i++){ 123 if(connect[i].objref._is_equivalent(am)) 124 return connect[i].ck; 125 } 126 127 } 128 catch(Exception e){ 129 e.printStackTrace(); 130 System.err.println(e.getMessage()); 131 System.err.println("Cannot create the assembly"); 132 } 133 throw new org.omg.Components.CreateFailure(); 134 } 135 136 137 144 public org.omg.Components.Deployment.Assembly 145 lookup(org.omg.Components.Cookie c) 146 throws org.omg.Components.Deployment.InvalidAssembly 147 { 148 org.objectweb.openccm.OpenCCM_DCI. 150 AssemblyFactoryManagerPackage.assembly_managersConnection 151 connect[]=AFM.get_connections_assembly_managers(); 152 for(int i=0;i<connect.length;i++) 154 { 155 if(connect[i].ck.equals(c)) 156 return connect[i].objref.provide_assembly(); 157 } 158 throw new org.omg.Components.Deployment.InvalidAssembly(); 160 } 161 162 168 public void 169 destroy(org.omg.Components.Cookie c) 170 throws org.omg.Components.Deployment.InvalidAssembly, 171 org.omg.Components.RemoveFailure 172 { 173 org.objectweb.openccm.OpenCCM_DCI. 175 AssemblyFactoryManagerPackage.assembly_managersConnection 176 connect[]=AFM.get_connections_assembly_managers(); 177 for(int i=0;i<connect.length;i++){ 180 if(connect[i].ck.equals(c)) 181 connect[i].objref.remove(); 182 } 183 } 184 185 186 192 193 198 public org.omg.Components.Cookie 199 create_assembly_XML(java.lang.String xml) 200 throws org.omg.Components.CreateFailure 201 { 202 203 try{ 204 org.objectweb.openccm.OpenCCM_DCI.AssemblyManager am= 206 AFM.get_connection_assembly_manager_home() 207 .create_assembly_manager_xml(xml); 208 am.connect_home_finder(AFM.get_connection_home_finder()); 210 am.connect_home_registration(AFM.get_connection_home_registration()); 212 am.connect_naming_service(AFM.get_connection_naming_service()); 214 am.connect_dci_information(AFM.get_connection_dci_information()); 217 am.connect_assembly_manager_registration(AFM.provide_assembly_manager_registration()); 219 am.configuration_complete(); 223 org.objectweb.openccm.OpenCCM_DCI. 225 AssemblyFactoryManagerPackage.assembly_managersConnection 226 connect[]=AFM.get_connections_assembly_managers(); 227 for(int i=0;i<connect.length;i++){ 229 if(connect[i].objref._is_equivalent(am)) 230 return connect[i].ck; 231 } 232 233 } 234 catch(Exception e){ 235 e.printStackTrace(); 236 System.err.println(e.getMessage()); 237 System.err.println("Cannot create the assembly"); 238 } 239 240 throw new org.omg.Components.CreateFailure(); 241 } 242 243 249 public org.objectweb.openccm.OpenCCM_DCI.AssemblyManager 250 lookup_assembly_manager(org.omg.Components.Cookie c) 251 throws org.omg.Components.Deployment.InvalidAssembly 252 { 253 org.objectweb.openccm.OpenCCM_DCI. 255 AssemblyFactoryManagerPackage.assembly_managersConnection 256 connect[]=AFM.get_connections_assembly_managers(); 257 for(int i=0;i<connect.length;i++){ 259 if(connect[i].ck.equals(c)) 260 return (org.objectweb.openccm.OpenCCM_DCI.AssemblyManager) 261 connect[i].objref; 262 } 263 throw new org.omg.Components.Deployment.InvalidAssembly(); 265 } 266 267 271 public void 272 destroy_assembly_factory() 273 throws org.omg.Components.RemoveFailure 274 { 275 org.objectweb.openccm.OpenCCM_DCI. 277 AssemblyFactoryManagerPackage.assembly_managersConnection 278 connect[]=AFM.get_connections_assembly_managers(); 279 for(int i=0;i<connect.length;i++){ 282 connect[i].objref.remove(); 283 } 284 } 285 } 286 | Popular Tags |