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.Hostcollocation; 31 import org.objectweb.openccm.descriptor.componentassembly.beans.HostcollocationBean; 32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.ChildDeployerContext; 33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.InitializationError; 34 35 43 public class HostcollocationDeployerContext 44 extends ChildDeployerContext 45 { 46 private HostcollocationBean hostcollocation; 52 private LinkedList homeplacementDeployers; 53 private DestinationDeployer destinationDeployer; 54 55 public HostcollocationDeployerContext(){ 61 this.homeplacementDeployers=new LinkedList (); 62 } 63 74 public void connectHostcollocation(HostcollocationBean hostcollocation){ 75 this.hostcollocation=hostcollocation; 76 connectDeployerDescription(hostcollocation); 77 } 78 79 public Hostcollocation 80 getHostcollocation() 81 { 82 return hostcollocation; 83 } 84 85 public void 86 connectHomeplacementDeployer(HomeplacementDeployer home) 87 { 88 this.homeplacementDeployers.addLast(home); 89 } 90 91 public HomeplacementDeployer[] 92 getHomeplacementDeployers() 93 { 94 return (HomeplacementDeployer[]) 95 homeplacementDeployers.toArray 96 (new HomeplacementDeployer[homeplacementDeployers.size()]); 97 } 98 101 public DestinationDeployer 102 getDestinationDeployer() 103 { 104 return destinationDeployer; 105 } 106 107 110 public void 111 connectDestinationDeployer(DestinationDeployer deployer) 112 { 113 destinationDeployer = deployer; 114 } 115 122 public void 123 initialize() 124 throws InitializationError 125 { 126 if(getHostcollocation()==null) 127 getErrorManager() 128 .submitException(new InitializationError(this,"Connection on hostcollocation bean is required"+ 129 "check the handler code it must specify this connection")); 130 if(getHostcollocation().getDestination()==null) 131 getErrorManager() 132 .submitException(new InitializationError(this,"The destination element must be precised into"+ 133 "an hostcollocation\n"+getStringifiedDeployerDescription())); 134 if(getHomeplacementDeployers().length==0) 135 getErrorManager() 136 .submitException(new InitializationError(this,"At least one homeplacement child must be specified "+ 137 "check the hostcollocation element"+ 138 "description\n."+getStringifiedDeployerDescription())); 139 getLifeCycleManager().stepEndedSuccessFully(); 140 } 141 142 143 } | Popular Tags |