1 26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer; 27 28 import java.util.LinkedList ; 29 30 import org.objectweb.openccm.descriptor.componentassembly.Homeplacement; 31 import org.objectweb.openccm.descriptor.componentassembly.beans.HomeplacementBean; 32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.ChildDeployerContext; 33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.InitializationError; 34 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.registrar.*; 35 import org.objectweb.openccm.descriptor.softpkg.ccm.ImplementationDeployer; 36 import org.objectweb.openccm.descriptor.softpkg.ccm.SoftpkgDeployer; 37 38 46 public class HomeplacementDeployerContext 47 extends ChildDeployerContext 48 { 49 private HomeplacementBean homeplacement; 55 private HomeplacementDeployInfo homeplacementInfo; 56 private LinkedList componentInstantiationDeployers; 57 private LinkedList registerwithhomefinderDeployers; 58 private LinkedList registerwithnamingDeployers; 59 private LinkedList registerwithtraderDeployers; 60 private ImplementationDeployer implementationDeployer; 61 private SoftpkgDeployer softpkgDeployer; 62 private DestinationDeployer destinationDeployer; 63 64 public HomeplacementDeployerContext() 70 { 71 componentInstantiationDeployers = new LinkedList (); 72 registerwithhomefinderDeployers = new LinkedList (); 73 registerwithnamingDeployers = new LinkedList (); 74 registerwithtraderDeployers = new LinkedList (); 75 } 76 public void 87 connectRegisterwithhomefinderDeployer(RegisterwithhomefinderDeployer reg) 88 { 89 this.registerwithhomefinderDeployers.addLast(reg); 90 } 91 92 public RegisterwithhomefinderDeployer[] 93 getRegisterwithhomefinderDeployers() 94 { 95 return ( 96 RegisterwithhomefinderDeployer[]) registerwithhomefinderDeployers 97 .toArray( 98 new RegisterwithhomefinderDeployer[registerwithhomefinderDeployers 99 .size()]); 100 } 101 102 public void 103 connectRegisterwithtraderDeployer(RegisterwithtraderDeployer reg) 104 { 105 this.registerwithtraderDeployers.addLast(reg); 106 } 107 108 public RegisterwithtraderDeployer[] 109 getRegisterwithtraderDeployers() 110 { 111 return ( 112 RegisterwithtraderDeployer[]) registerwithtraderDeployers.toArray( 113 new RegisterwithtraderDeployer[registerwithtraderDeployers.size()]); 114 } 115 116 public void 117 connectRegisterwithnamingDeployer(RegisterwithnamingDeployer reg) 118 { 119 this.registerwithnamingDeployers.addLast(reg); 120 } 121 122 public RegisterwithnamingDeployer[] 123 getRegisterwithnamingDeployers() 124 { 125 return ( 126 RegisterwithnamingDeployer[]) registerwithnamingDeployers.toArray( 127 new RegisterwithnamingDeployer[registerwithnamingDeployers.size()]); 128 } 129 130 public void 131 connectHomeplacement(HomeplacementBean homeplacement) 132 { 133 this.homeplacement = homeplacement; 134 connectDeployerDescription(homeplacement); 135 } 136 137 public Homeplacement 138 getHomeplacement() 139 { 140 return homeplacement; 141 } 142 143 public void 144 connectComponentInstantiationDeployer(ComponentinstantiationDeployer componentInstantiationDeployer) 145 { 146 this.componentInstantiationDeployers.addLast( 147 componentInstantiationDeployer); 148 } 149 150 public ComponentinstantiationDeployer[] 151 getComponentInstantiationDeployers() 152 { 153 return ( 154 ComponentinstantiationDeployer[]) componentInstantiationDeployers 155 .toArray( 156 new ComponentinstantiationDeployer[componentInstantiationDeployers 157 .size()]); 158 } 159 162 public ImplementationDeployer 163 getImplementationDeployer() 164 { 165 return implementationDeployer; 166 } 167 168 171 public void 172 connectImplementationDeployer(ImplementationDeployer deployer) 173 { 174 implementationDeployer = deployer; 175 } 176 177 180 public SoftpkgDeployer 181 getSoftpkgDeployer() 182 { 183 return softpkgDeployer; 184 } 185 186 189 public void 190 connectSoftpkgDeployer(SoftpkgDeployer deployer) 191 { 192 softpkgDeployer = deployer; 193 } 194 195 198 public DestinationDeployer 199 getDestinationDeployer() 200 { 201 return destinationDeployer; 202 } 203 204 207 public void 208 connectDestinationDeployer(DestinationDeployer deployer) 209 { 210 destinationDeployer = deployer; 211 } 212 213 216 public HomeplacementDeployInfo 217 getHomeplacementInfo() 218 { 219 return homeplacementInfo; 220 } 221 222 225 public void 226 connectHomeplacementInfo(HomeplacementDeployInfo handler) 227 { 228 homeplacementInfo = handler; 229 } 230 231 238 public void 239 initialize() 240 throws InitializationError 241 { 242 if (getHomeplacement() == null) 243 getErrorManager().submitException( 244 new InitializationError( 245 this, 246 "Connection on homeplacement bean is required" 247 + "check the handler code it must specify this connection")); 248 if (getHomeplacement().getComponentfileref() == null 249 || getHomeplacement().getComponentfileref().getIdref() == null 250 || getHomeplacement().getComponentfileref().getIdref().length() == 0) 251 getErrorManager().submitException( 252 new InitializationError( 253 this, 254 "The homeplacement element must be fullfilled " 255 + "including its idref attribute, check the homeplacement element" 256 + "description\n." 257 + getStringifiedDeployerDescription())); 258 if(getDestinationDeployer()==null) 259 getErrorManager().submitException( 260 new InitializationError( 261 this, 262 "The homeplacement requires a Destination to be installed " 263 + "check the homeplacement element description\n." 264 + getStringifiedDeployerDescription())); 265 266 getLifeCycleManager().stepEndedSuccessFully(); 267 } 268 269 270 } 271 | Popular Tags |