1 26 package org.objectweb.openccm.descriptor.softpkg.ccm; 27 28 import java.util.LinkedList ; 29 30 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.DeployerInactiveState; 31 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.FatalDeploymentException; 32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer.CodeDeployerVisitor; 33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer.DependencyDeployerVisitor; 34 import org.omg.Components.ConfigValue; 35 import org.omg.Components.Deployment.ComponentInstallation; 36 37 45 public class ImplementationDeployer 46 extends ImplementationDeployerContext 47 { 48 private ComponentInstallation comp; 54 private LinkedList config; 55 private String entryPoint; 56 67 73 private ConfigValue[] 74 processDependencies() 75 throws FatalDeploymentException 76 { 77 config=new LinkedList (); 78 traverse(this,getDependencyDeployers()); 79 return (ConfigValue[])config.toArray(new ConfigValue[config.size()]); 80 } 81 82 83 93 public ConfigValue[] 94 install(ComponentInstallation comp) 95 throws FatalDeploymentException 96 { 97 this.comp=comp; 98 traverse(this,getCodeDeployers()); 99 return processDependencies(); 100 } 101 108 public void 109 visit(DependencyDeployer deployer,DeployerInactiveState status) 110 throws FatalDeploymentException 111 { 112 try{ 113 deployer.resolveDependency(comp); 114 } 115 catch(DependencyResolutionFailureException e) 116 { 117 getErrorManager().submitException(e); 118 } 119 } 120 127 public void 128 visit(CodeDeployer codeDeployer, DeployerInactiveState status) 129 throws FatalDeploymentException 130 { 131 try{ 132 entryPoint=codeDeployer.intallCode(comp,getImplementation().getId()); 133 } 134 catch(CodeInstallationFailureException e) 135 { 136 getErrorManager().submitException(e); 137 } 138 } 139 147 public void 148 visitDependencyDeployers(DependencyDeployerVisitor depVisitor) 149 throws DependencyResolutionFailureException 150 { 151 DependencyDeployer depDepl[]=getDependencyDeployers(); 152 for(int i=0;i<depDepl.length;i++) 153 depVisitor.visit(depDepl[i]); 154 } 155 163 public void 164 visitCodeDeployers(CodeDeployerVisitor codeVisitor) 165 throws CodeInstallationFailureException 166 { 167 CodeDeployer codeDepl[]=getCodeDeployers(); 168 for(int i=0;i<codeDepl.length;i++) 169 codeVisitor.visit(codeDepl[i]); 170 } 171 175 public String 176 getEntryPoint() 177 { 178 return entryPoint; 179 } 180 181 } 182 | Popular Tags |