1 9 package org.jboss.portal.server.deployment.jboss; 10 11 import org.jboss.deployment.DeploymentException; 12 import org.jboss.deployment.DeploymentInfo; 13 import org.jboss.deployment.SubDeployerSupport; 14 15 19 public class GenericDeployer 20 extends SubDeployerSupport 21 implements GenericDeployerMBean 22 { 23 24 25 private String [] acceptedSuffixes; 26 27 28 private ServerDeployerMBean serverDeployer; 29 30 public ServerDeployerMBean getServerDeployer() 31 { 32 return serverDeployer; 33 } 34 35 public void setServerDeployer(ServerDeployerMBean serverDeployer) 36 { 37 this.serverDeployer = serverDeployer; 38 } 39 40 public String [] getAcceptedSuffixes() 41 { 42 return acceptedSuffixes; 43 } 44 45 public void setAcceptedSuffixes(String [] acceptedSuffixes) 46 { 47 this.acceptedSuffixes = acceptedSuffixes; 48 } 49 50 public boolean accepts(DeploymentInfo di) 51 { 52 String urlStr = di.url.toString(); 53 for (int i = 0;i < acceptedSuffixes.length;i++) 54 { 55 String suffix = acceptedSuffixes[i]; 56 if (urlStr.endsWith(suffix)) 57 { 58 return true; 59 } 60 } 61 return false; 62 } 63 64 public void init(DeploymentInfo di) throws DeploymentException 65 { 66 67 DeploymentFactory factory = serverDeployer.findFactory(di.url); 68 if (factory == null) 69 { 70 } 72 else 73 { 74 Deployment deployment = factory.newInstance(serverDeployer.getServetManager(), di.url, null, null); 75 di.metaData = deployment; 76 } 77 } 78 79 public void create(DeploymentInfo di) throws DeploymentException 80 { 81 ((Deployment)di.metaData).create(); 82 } 83 84 public void start(DeploymentInfo di) throws DeploymentException 85 { 86 ((Deployment)di.metaData).start(); 87 } 88 89 public void stop(DeploymentInfo di) throws DeploymentException 90 { 91 ((Deployment)di.metaData).stop(); 92 } 93 94 public void destroy(DeploymentInfo di) throws DeploymentException 95 { 96 ((Deployment)di.metaData).destroy(); 97 } 98 } 99 | Popular Tags |