1 26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer; 27 28 import org.objectweb.openccm.descriptor.componentassembly.beans.DestinationBeanImpl; 30 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*; 31 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.util.FindbyDeployer; 32 33 43 public class DestinationDeployerHandler 44 extends HandlerBase 45 { 46 52 private DestinationDeployerBase _deploy; 53 54 60 66 72 80 public Object 81 getInstance(DestinationBeanImpl cons) 82 throws InitializationError 83 { 84 if (_deploy == null) 85 { 86 if (getRootDeployerContext() 87 .getDestinationDeployerFactory()== null) 88 throw new InitializationError(_deploy, null, 89 "Cannot found a valid Destination Deployer, no DestinationDelpoyerFactory connected"); 90 91 94 95 try 96 { 97 98 if( (cons.getNode()==null) 100 && ( (cons.getInstallation()==null) 101 || (cons.getActivation()==null) 102 ) 103 ) 104 { 105 throw new InitializationError(_deploy, 106 null, 107 "The <node> child or the nodes <installation> and <activation>" + 108 " must be present in the <destination>\n" + 109 "Check the <destination> Description:\n" + 110 getStringifiedDescription(cons)); 111 } 112 113 String deployType = null; 114 if(cons.getNode() != null) 115 { 116 deployType = NodeDeployer.getNodeManagerType(); 117 } 118 else 119 { 120 deployType = cons.getActivation().getType().trim(); 121 } 122 123 _deploy = getRootDeployerContext() 124 .getDestinationDeployerFactory() 125 .getDestinationDeployer(deployType); 126 } 127 catch (UnknownDestinationDeployer e) 128 { 129 throw new InitializationError(_deploy, e, e.getMessage()); 130 } 131 132 _deploy.connectDestination(cons); 133 134 applyCommonConfig(_deploy); 135 136 if(cons.getNode() != null) 137 { 138 _deploy.connectNodeDeployer((NodeDeployer)getDeployer(cons.getNode())); 139 } 140 141 if (cons.getActivation() != null && cons.getActivation().getFindby() != null) 142 { 143 _deploy.connectFindbyDeployer( 144 (FindbyDeployer)getDeployer(cons.getActivation().getFindby()) 145 ); 146 } 147 148 _deploy.initialize(); 149 150 } 151 return (_deploy); 152 } 153 154 } 155 | Popular Tags |