1 9 package org.jboss.portal.server.deployment.jboss; 10 11 import org.jboss.deployment.DeploymentInfo; 12 import org.jboss.deployment.DeploymentException; 13 import org.jboss.portal.server.ServerManager; 14 import org.jboss.portal.server.deployment.PortalWebApp; 15 import org.jboss.mx.loading.RepositoryClassLoader; 16 import org.apache.log4j.Logger; 17 18 import javax.management.MBeanServer ; 19 import java.net.URL ; 20 import java.net.MalformedURLException ; 21 import java.io.File ; 22 23 27 public class Deployment 28 { 29 30 protected final Logger log = Logger.getLogger(getClass()); 31 32 private final ServerManager serverManager; 33 34 public final URL url; 35 36 37 protected final PortalWebApp pwa; 38 39 40 protected final String appName; 41 42 public Deployment(ServerManager serverManager, URL url) 43 { 44 this.serverManager = serverManager; 45 this.url = url; 46 this.pwa = null; 47 this.appName = null; 48 } 49 50 53 public Deployment(ServerManager serverManager, URL url, PortalWebApp pwa, String appName) 54 { 55 this.serverManager = serverManager; 56 this.url = url; 57 this.pwa = pwa; 58 this.appName = appName; 59 } 60 61 public void create() throws DeploymentException { } 62 63 public void start() throws DeploymentException { } 64 65 public void stop() throws DeploymentException { } 66 67 public void destroy() throws DeploymentException { } 68 69 protected ServerManager getServerManager() 70 { 71 return serverManager; 72 } 73 74 77 public static URL findWEBINFURL(URL warURL) throws DeploymentException 78 { 79 try 80 { 81 if ("file".equals(warURL.getProtocol())) 82 { 83 File f = new File (warURL.getFile()); 84 f = new File (f, "WEB-INF"); 85 return f.toURL(); 86 } 87 else 88 { 89 throw new DeploymentException("Deployment URL not found " + warURL); 90 } 91 } 92 catch (MalformedURLException e) 93 { 94 throw new DeploymentException(e); 95 } 96 } 97 98 101 public static RepositoryClassLoader findRepositoryClassLoader(ClassLoader loader) throws DeploymentException 102 { 103 while (loader != null) 104 { 105 if (loader instanceof RepositoryClassLoader) 106 { 107 return (RepositoryClassLoader)loader; 108 } 109 loader = loader.getParent(); 110 } 111 throw new DeploymentException("No repository class loader found"); 112 } 113 } 114 | Popular Tags |