1 26 27 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer; 28 29 import java.util.Iterator ; 30 import java.util.LinkedList ; 31 import org.objectweb.openccm.descriptor.componentassembly.Componentfile; 32 import org.objectweb.openccm.descriptor.componentassembly.beans.ComponentfileBean; 33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*; 34 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.util.FileinarchiveDeployer; 35 import org.objectweb.openccm.descriptor.softpkg.beans.ImplementationBean; 36 import org.objectweb.openccm.descriptor.softpkg.beans.ImplementationBeanImpl; 37 import org.objectweb.openccm.descriptor.softpkg.beans.SoftpkgBean; 38 import org.objectweb.openccm.descriptor.softpkg.ccm.ImplementationDeployer; 39 import org.objectweb.openccm.descriptor.softpkg.ccm.SoftpkgDeployer; 40 41 49 public abstract class ComponentfileDeployerContext 50 extends ChildDeployerContext 51 { 52 private FileinarchiveDeployer fia; 58 private ComponentfileBean comp; 59 private SoftpkgBean softpkg; 60 private SoftpkgDeployer softpkgDeployer; 61 private LinkedList implementationBeans; 62 private LinkedList implementationDeployers; 63 64 public ComponentfileDeployerContext() { 70 implementationBeans = new LinkedList (); 71 implementationDeployers = new LinkedList (); 72 } 73 public void 84 connectImplementation(ImplementationBean impl) 85 { 86 implementationBeans.addLast(impl); 87 } 88 89 public ImplementationBean[] 90 getImplementations() 91 { 92 return (ImplementationBean[]) implementationBeans.toArray( 93 new ImplementationBeanImpl[implementationDeployers.size()]); 94 } 95 96 public void 97 connectImplementationDeployer(ImplementationDeployer impl) 98 { 99 implementationDeployers.addLast(impl); 100 } 101 102 public ImplementationDeployer[] 103 getImplementationDeployers() 104 { 105 return (ImplementationDeployer[]) implementationDeployers.toArray( 106 new ImplementationDeployer[implementationDeployers.size()]); 107 } 108 109 public ImplementationDeployer 110 getImplementationDeployer(String id) 111 { 112 for (Iterator it = implementationDeployers.iterator(); it.hasNext();) { 113 ImplementationDeployer impl = (ImplementationDeployer) it.next(); 114 if (impl.getImplementation().getId().equals(id)) 115 return impl; 116 } 117 return null; 118 } 119 120 public void 121 connectFileinarchiveDeployer(FileinarchiveDeployer fia) 122 { 123 this.fia = fia; 124 } 125 126 public FileinarchiveDeployer 127 getFileinarchiveDeployer() 128 { 129 return fia; 130 } 131 132 public void 133 connectComponentfile(ComponentfileBean comp) 134 { 135 this.comp = comp; 136 connectDeployerDescription(comp); 137 } 138 139 public Componentfile 140 getComponentfile() 141 { 142 return comp; 143 } 144 145 148 public SoftpkgBean 149 getSoftpkg() 150 { 151 return softpkg; 152 } 153 154 157 public void 158 connectSoftpkg(SoftpkgBean bean) 159 { 160 softpkg = bean; 161 } 162 163 166 public SoftpkgDeployer 167 getSoftpkgDeployer() 168 { 169 return softpkgDeployer; 170 } 171 172 175 public void 176 connectSoftpkgDeployer(SoftpkgDeployer deployer) 177 { 178 softpkgDeployer = deployer; 179 } 180 181 public abstract void 182 initializeSoftpkgTree() 183 throws InitializationError; 184 185 192 public void 193 initialize() 194 throws InitializationError 195 { 196 if (getComponentfile() == null) 197 getErrorManager().submitException( 198 new InitializationError( 199 this, 200 "Connection on Componentfile is required" 201 + "check the handler code it must specify this connection")); 202 203 if (getFileinarchiveDeployer() == null) 204 getErrorManager().submitException( 205 new InitializationError( 206 this, 207 "A fileinarchive must be specified in componentfile element," 208 + "check you componentfiles element description.\n" 209 + getStringifiedDeployerDescription())); 210 initializeSoftpkgTree(); 211 getLifeCycleManager().stepEndedSuccessFully(); 212 } 213 214 215 } 216 | Popular Tags |