1 6 package org.jfox.deployment.application; 7 8 import org.jfox.deployment.ejb.EJBDeployer; 9 import org.jfox.deployment.ejb.NestedEJBModule; 10 import org.jfox.deployment.web.WebDeployer; 11 import org.jfox.deployment.web.WebModule; 12 import org.jfox.ioc.common.AbstractComponent; 13 import org.jfox.ioc.deploy.DeployException; 14 import org.jfox.ioc.deployment.Deployable; 15 import org.jfox.ioc.deployment.Deployer; 16 17 20 21 public class EARDeployer extends AbstractComponent implements Deployer { 22 26 private EJBDeployer ejbDeployer = null; 27 private WebDeployer webDeployer = null; 28 29 public EARDeployer(EJBDeployer ejbDeployer, WebDeployer webDeployer) { 30 this.ejbDeployer = ejbDeployer; 31 this.webDeployer = webDeployer; 32 } 33 34 39 40 public void deploy(Deployable comp) throws DeployException { 41 if(comp instanceof EARModule) { 42 try { 43 EARModule earModule = (EARModule) comp; 44 45 NestedEJBModule[] ejbModules = earModule.getNestedEJBModules(); 46 for(int i = 0; i < ejbModules.length; i++) { 47 ejbModules[i].deploy(ejbDeployer); 48 } 49 50 WebModule[] webModules = earModule.getNestedWebModules(); 51 for(int i = 0; i < webModules.length; i++) { 52 webModules[i].deploy(webDeployer); 53 } 54 55 } 56 catch(Exception e) { 57 throw new DeployException("deploy Module " + comp + " error", e); 58 } 59 } 60 else { 61 throw new DeployException("can not deploy " + comp); 62 } 63 } 64 65 public void undeploy(Deployable comp) throws DeployException { 67 68 } 69 70 protected void doInit() throws Exception { 71 } 72 73 protected void doDestroy() throws Exception { 74 } 75 76 public EJBDeployer getEjbDeployer() { 77 return ejbDeployer; 78 } 79 80 public WebDeployer getWebDeployer() { 81 return webDeployer; 82 } 83 84 public static void main(String [] args) { 85 86 } 87 } 88 89 | Popular Tags |