1 17 18 package org.apache.geronimo.deployment.tools.loader; 19 20 import java.net.URL ; 21 import java.net.URLClassLoader ; 22 import javax.enterprise.deploy.model.DeployableObject ; 23 import javax.enterprise.deploy.model.exceptions.DDBeanCreateException; 24 25 30 public class DeployableFactory { 31 public static DeployableObject createDeployable(URL moduleURL) throws DDBeanCreateException { 32 ClassLoader cl = new URLClassLoader (new URL [] {moduleURL}, ClassLoader.getSystemClassLoader()); 33 if (cl.getResource("META-INF/application.xml") != null) { 34 throw new UnsupportedOperationException (); 37 } else if (cl.getResource("META-INF/application-client.xml") != null) { 38 return new ClientDeployable(moduleURL); 40 } else if (cl.getResource("WEB-INF/web.xml") != null) { 41 return new WebDeployable(moduleURL); 43 } else if (cl.getResource("META-INF/ejb-jar.xml") != null) { 44 throw new UnsupportedOperationException (); 46 } else if (cl.getResource("META-INF/ra.xml") != null) { 47 return new ConnectorDeployable(moduleURL); 49 } else { 50 throw new DDBeanCreateException("Unrecognized archive: " + moduleURL); 51 } 52 } 53 } 54 | Popular Tags |