1 26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer; 27 28 import java.util.LinkedList ; 29 import org.objectweb.openccm.descriptor.componentassembly.Componentinstantiation; 30 import org.objectweb.openccm.descriptor.componentassembly.beans.ComponentinstantiationBean; 31 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*; 32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.registrar.*; 33 import org.omg.Components.CCMObject; 34 import org.omg.Components.Cookie; 35 import org.omg.Components.ExceededConnectionLimit; 36 37 45 public class ComponentinstantiationDeployerContext 46 extends ChildDeployerContext 47 { 48 private ComponentinstantiationBean componentInstantiation; 54 private ComponentinstantiationDeployInfo componentInstantiationDeployInfo; 55 private ComponentpropertiesDeployer properties; 56 private LinkedList registercomponentDeployers; 57 private Cookie cookie; 58 private CCMObject comp; 59 public ComponentinstantiationDeployerContext() 65 { 66 registercomponentDeployers=new LinkedList (); 67 } 68 public void 79 connectComponentinstantiation ( ComponentinstantiationBean componentInstantiation) 80 { 81 this.componentInstantiation=componentInstantiation; 82 connectDeployerDescription(componentInstantiation); 83 } 84 85 public Componentinstantiation 86 getComponentinstantiation() 87 { 88 return componentInstantiation; 89 } 90 91 public void 92 connectComponentpropertiesDeployer(ComponentpropertiesDeployer properties) 93 { 94 this.properties=properties; 95 } 96 97 public ComponentpropertiesDeployer 98 getComponentpropertiesDeployer() 99 { 100 return properties; 101 } 102 103 public void 104 connectRegistercomponentDeployer(RegistercomponentDeployer reg) 105 { 106 this.registercomponentDeployers.addLast(reg); 107 } 108 109 public RegistercomponentDeployer[] 110 getRegisterwithcomponentDeployers() 111 { 112 return (RegistercomponentDeployer[]) 113 registercomponentDeployers.toArray 114 (new RegistercomponentDeployer[registercomponentDeployers.size()]); 115 } 116 119 public ComponentinstantiationDeployInfo getComponentInstantiationDeployInfo() { 120 return componentInstantiationDeployInfo; 121 } 122 123 126 public void connectComponentInstantiationDeployInfo(ComponentinstantiationDeployInfo info) { 127 componentInstantiationDeployInfo = info; 128 } 129 130 137 public void initialize() throws InitializationError { 138 if (getComponentinstantiation() == null) 139 getErrorManager().submitException( 140 new InitializationError( 141 this, 142 "Connection on componentinstantiation bean is required" 143 + "check the handler code it must specify this connection")); 144 if (getComponentpropertiesDeployer() == null) 145 getLogger().log( 146 "No componentproperties specified for this componentinstantiation"); 147 148 getLifeCycleManager().stepEndedSuccessFully(); 149 } 150 151 157 public void 158 storeComponentReference(CCMObject comp) 159 { 160 this.comp=comp; 162 getComponentInstantiationDeployInfo().setCorbaReference(comp); 163 getRootDeployerContext().connectComponent(comp); 164 if(getRootDeployerContext().getAssemblyManager()!=null) 165 try { 166 cookie=getRootDeployerContext().getAssemblyManager().connect_components(comp); 167 } catch (ExceededConnectionLimit e) { 168 getLogger().log("Connection of component on AssemblyManager failed."); 169 } 170 } 171 176 public void 177 unstoreComponentReference() 178 { 179 getRootDeployerContext().disconnectComponent(comp); 180 if(getRootDeployerContext().getAssemblyManager()!=null) 181 try 182 { 183 getRootDeployerContext() 184 .getAssemblyManager() 185 .disconnect_components(cookie); 186 } 187 catch (ExceededConnectionLimit e) 188 { 189 e.printStackTrace(); 190 } 191 } 192 193 } 194 | Popular Tags |