1 26 27 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer; 28 29 30 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 35 43 public class ComponentinstantiationDeployer 44 extends ComponentinstantiationDeployerContext 45 { 46 52 private CCMObject component; 53 65 private void 66 setupComponentProperties(org.omg.Components.CCMObject new_component) 67 throws FatalDeploymentException 68 { 69 try{ 70 getComponentpropertiesDeployer() 71 .setupComponentProperties(new_component); 72 } 73 catch(ComponentPropertiesSetupFailureException e){ 74 getErrorManager().submitException(e); 75 } 76 77 } 78 84 private void 85 registerComponent(org.omg.Components.CCMObject new_component) 86 throws FatalDeploymentException 87 { 88 traverse(this,getRegisterwithcomponentDeployers()); 89 } 90 91 99 public void visit(RegistercomponentDeployer deployer, DeployerInactiveState status) 100 throws FatalDeploymentException 101 { 102 deployer.makeComponentRegistration(component); 103 } 104 105 106 112 118 119 128 public void 129 deploy(org.omg.Components.CCMHome homeDeployed) 130 throws FatalDeploymentException, 131 ComponentInstantiationFailureException 132 { 133 try{ 134 component = 136 org.omg.Components.KeylessCCMHomeHelper 137 .narrow(homeDeployed) 138 .create_component(); 139 } 140 catch(Exception e){ 141 getLifeCycleManager().stepAborded(); 142 throw new ComponentInstantiationFailureException(this,e); 143 } 144 145 if(getComponentpropertiesDeployer()!=null) 147 setupComponentProperties(component); 148 try{ 149 registerComponent(component); 151 storeComponentReference(component); 152 } 153 catch(Exception e){ e.printStackTrace();} 154 155 getLifeCycleManager().stepEndedSuccessFully(); 156 } 157 158 163 public CCMObject 164 getComponent() 165 { 166 return component; 167 } 168 169 174 public void 175 tearDown() 176 throws FatalDeploymentException 177 { 178 if(getLifeCycleManager().getStatus() 179 instanceof DeployerFailureException) 180 { 181 getLifeCycleManager().stepEndedSuccessFully(); 182 return ; 183 } 184 185 traverse(this,getRegisterwithcomponentDeployers()); 186 try{ 187 unstoreComponentReference(); 188 component.remove(); 189 } 190 catch(Exception e){ 191 } 193 getLifeCycleManager().stepEndedSuccessFully(); 194 } 195 196 201 public void 202 visit(RegistercomponentDeployer deployer, DeployerActiveState status) 203 throws FatalDeploymentException 204 { 205 deployer.undoComponentRegistration(); 206 } 207 208 209 210 211 } 212 | Popular Tags |