geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r434512 [2/2] - in /geronimo/server/branches/sachin: ./ modules/axis-builder/src/java/org/apache/geronimo/axis/builder/ modules/client-builder/src/java/org/apache/geronimo/client/builder/ modules/connector-builder/src/java/org/apache/geroni...
Date Thu, 24 Aug 2006 20:31:00 GMT
Modified: geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java
Thu Aug 24 13:30:58 2006
@@ -19,6 +19,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.DeployableModule;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.ReferenceCollection;
@@ -40,7 +41,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.jar.JarFile;
 
 /**
  * @version $Rev:386276 $ $Date$
@@ -82,7 +82,7 @@
         this.defaultNamespace = defaultNamespace;
     }
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
+    public Module createModule(File plan, DeployableModule deployableModule, Naming naming,
ModuleIDBuilder idBuilder) throws DeploymentException {
         String namespace;
         if (plan == null) {
             namespace = defaultNamespace;
@@ -91,7 +91,7 @@
         }
         ModuleBuilder builder = getBuilderFromNamespace(namespace);
         if (builder != null) {
-            return builder.createModule(plan, moduleFile, naming, idBuilder);
+            return builder.createModule(plan, deployableModule, naming, idBuilder);
         } else {
             return null;
         }
@@ -134,20 +134,20 @@
         return builder;
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
+    public Module createModule(Object plan, DeployableModule deployableModule, String targetPath,
URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming
naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         String namespace = getNamespaceFromPlan(plan);
         ModuleBuilder builder = getBuilderFromNamespace(namespace);
         if (builder != null) {
-            return builder.createModule(plan, moduleFile, targetPath, specDDUrl, environment,
moduleContextInfo, earName, naming, idBuilder);
+            return builder.createModule(plan, deployableModule, targetPath, specDDUrl, environment,
moduleContextInfo, earName, naming, idBuilder);
         } else {
             return null;
         }
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection
configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories)
throws DeploymentException {
+    public void installModule(DeployableModule ear, EARContext earContext, Module module,
Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories)
throws DeploymentException {
         String namespace = module.getNamespace();
         ModuleBuilder builder = getBuilderFromNamespace(namespace);
-        builder.installModule(earFile, earContext, module, configurationStores, targetConfigurationStore,
repositories);
+        builder.installModule(ear, earContext, module, configurationStores, targetConfigurationStore,
repositories);
     }
 
     public void initContext(EARContext earContext, Module module, ClassLoader cl) throws
DeploymentException {

Modified: geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java
Thu Aug 24 13:30:58 2006
@@ -14,21 +14,22 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.DeployableModule;
 
 /**
  * @version $Rev$ $Date$
  */
 public class UnavailableModuleBuilder implements ModuleBuilder {
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
+    public Module createModule(File plan, DeployableModule deployableModule, Naming naming,
ModuleIDBuilder idBuilder) throws DeploymentException {
             return null;
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
+    public Module createModule(Object plan, DeployableModule deployableModule, String targetPath,
URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming
naming, ModuleIDBuilder idBuilder) throws DeploymentException {
             return null;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection
configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws
DeploymentException {
+    public void installModule(DeployableModule earFile, EARContext earContext, Module module,
Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository)
throws DeploymentException {
         throw new DeploymentException("Module type unavailable");
     }
 

Modified: geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableWebServiceBuilder.java
Thu Aug 24 13:30:58 2006
@@ -26,21 +26,22 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.deployment.DeployableModule;
 
 /**
  * @version $Rev$ $Date$
  */
 public class UnavailableWebServiceBuilder implements WebServiceBuilder {
 
-    public Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB,
Map correctedPortLocations) throws DeploymentException {
+    public Map parseWebServiceDescriptor(URL wsDDUrl, DeployableModule moduleFile, boolean
isEJB, Map correctedPortLocations) throws DeploymentException {
         return new HashMap();
     }
 
-    public void configurePOJO(GBeanData targetGBean, JarFile moduleFile, Object portInfo,
String seiClassName, ClassLoader classLoader) throws DeploymentException {
+    public void configurePOJO(GBeanData targetGBean, DeployableModule moduleFile, Object
portInfo, String seiClassName, ClassLoader classLoader) throws DeploymentException {
         throw new DeploymentException("Web services are not available in this configuration");
     }
 
-    public void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfoObject,
ClassLoader classLoader) throws DeploymentException {
+    public void configureEJB(GBeanData targetGBean, DeployableModule moduleFile, Object portInfoObject,
ClassLoader classLoader) throws DeploymentException {
         throw new DeploymentException("Web services are not available in this configuration");
     }
 

Modified: geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebModule.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebModule.java
(original)
+++ geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebModule.java
Thu Aug 24 13:30:58 2006
@@ -23,6 +23,7 @@
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.DeployableModule;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -35,8 +36,8 @@
     private final String contextRoot;
     private final Map portMap;
 
-    public WebModule(boolean standAlone, AbstractName moduleName, Environment environment,
JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD,
String contextRoot, Map portMap, String namespace) {
-        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD,
originalSpecDD, namespace);
+    public WebModule(boolean standAlone, AbstractName moduleName, Environment environment,
DeployableModule deployableModule, String targetPath, XmlObject specDD, XmlObject vendorDD,
String originalSpecDD, String contextRoot, Map portMap, String namespace) {
+        super(standAlone, moduleName, environment, deployableModule, targetPath, specDD,
vendorDD, originalSpecDD, namespace);
         this.contextRoot = contextRoot;
         this.portMap = portMap;
     }

Modified: geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/WebServiceBuilder.java
Thu Aug 24 13:30:58 2006
@@ -18,6 +18,8 @@
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.deployment.DeployableModule;
+
 import java.util.jar.JarFile;
 import java.util.Map;
 import java.net.URL;
@@ -27,7 +29,7 @@
  */
 public interface WebServiceBuilder {
 
-    Map parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB, Map correctedPortLocations)
throws DeploymentException;
+    Map parseWebServiceDescriptor(URL wsDDUrl, DeployableModule deployableModule, boolean
isEJB, Map correctedPortLocations) throws DeploymentException;
 
     //obviously these need the deployment descriptors, but I'm not sure in what form yet.
     /**
@@ -35,21 +37,21 @@
      * The GBeanData will be for a ServletHolder like gbean that is adapted to holding a
ws stack that talks to a
      * POJO web service.  The web deployer is responsible for filling in the standard servlet
info such as init params.
      * @param targetGBean
-     * @param moduleFile
+     * @param deployableModule
      * @param portInfo
      * @param seiClassName
      * @throws DeploymentException
      */
-    void configurePOJO(GBeanData targetGBean, JarFile moduleFile, Object portInfo, String
seiClassName, ClassLoader classLoader) throws DeploymentException;
+    void configurePOJO(GBeanData targetGBean, DeployableModule deployableModule, Object portInfo,
String seiClassName, ClassLoader classLoader) throws DeploymentException;
 
     /**
      * configure the supplied EJBContainer gbeandata to implement the ejb web service described
in the deployment descriptor
      * N.B. this method is a complete guess and should be replaced by something useable right
away!
      * @param targetGBean
-     * @param moduleFile
+     * @param deployableModule
      * @param classLoader
      * @throws DeploymentException
      */
-    void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfo, ClassLoader
classLoader) throws DeploymentException;
+    void configureEJB(GBeanData targetGBean, DeployableModule deployableModule, Object portInfo,
ClassLoader classLoader) throws DeploymentException;
 
 }

Modified: geronimo/server/branches/sachin/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Thu Aug 24 13:30:58 2006
@@ -47,6 +47,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.DeployableModule;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
@@ -173,8 +174,8 @@
         return kernel.getGBeanData(templateName);
     }
 
-    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL
specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
-        assert moduleFile != null: "moduleFile is null";
+    protected Module createModule(Object plan, DeployableModule deployableModule, String
targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming
naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        assert deployableModule != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
 
@@ -183,7 +184,7 @@
         WebAppType webApp;
         try {
             if (specDDUrl == null) {
-                specDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/web.xml");
+                specDDUrl = deployableModule.resolve("WEB-INF/web.xml");
             }
 
             // read in the entire specDD as a string, we need this for getDeploymentDescriptor
@@ -208,12 +209,12 @@
         check(webApp);
 
         // parse vendor dd
-        JettyWebAppType jettyWebApp = getJettyWebApp(plan, moduleFile, standAlone, targetPath,
webApp);
+        JettyWebAppType jettyWebApp = getJettyWebApp(plan, deployableModule, standAlone,
targetPath, webApp);
         if (contextRoot == null || contextRoot.trim().equals("")) {
             if (jettyWebApp.isSetContextRoot()) {
                 contextRoot = jettyWebApp.getContextRoot();
             } else {
-                contextRoot = determineDefaultContextRoot(webApp, standAlone, moduleFile,
targetPath);
+                contextRoot = determineDefaultContextRoot(webApp, standAlone, deployableModule,
targetPath);
             }
         }
 
@@ -222,7 +223,7 @@
         EnvironmentType environmentType = jettyWebApp.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
         // Note: logic elsewhere depends on the default artifact ID being the file name less
extension (ConfigIDExtractor)
-        String warName = new File(moduleFile.getName()).getName();
+        String warName = deployableModule.getRoot().getName();
         if (warName.lastIndexOf('.') > -1) {
             warName = warName.substring(0, warName.lastIndexOf('.'));
         }
@@ -233,9 +234,9 @@
         //look for a webservices dd
         Map portMap = Collections.EMPTY_MAP;
         try {
-            URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/webservices.xml");
-            portMap = getWebServiceBuilder().parseWebServiceDescriptor(wsDDUrl, moduleFile,
false, servletNameToPathMap);
-        } catch (MalformedURLException e) {
+            URL wsDDUrl = deployableModule.resolve("WEB-INF/webservices.xml");
+            portMap = getWebServiceBuilder().parseWebServiceDescriptor(wsDDUrl, deployableModule,
false, servletNameToPathMap);
+        } catch (IOException e) {
             //no descriptor
         }
         AbstractName moduleName;
@@ -246,10 +247,10 @@
             moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
-        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, jettyWebApp, specDD, contextRoot, portMap, JETTY_NAMESPACE);
+        return new WebModule(standAlone, moduleName, environment, deployableModule, targetPath,
webApp, jettyWebApp, specDD, contextRoot, portMap, JETTY_NAMESPACE);
     }
 
-    JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, boolean standAlone, String
targetPath, WebAppType webApp) throws DeploymentException {
+    JettyWebAppType getJettyWebApp(Object plan, DeployableModule deployableModule, boolean
standAlone, String targetPath, WebAppType webApp) throws DeploymentException {
         XmlObject rawPlan = null;
         try {
             // load the geronimo-web.xml from either the supplied plan or from the earFile
@@ -260,11 +261,11 @@
                     if (plan != null) {
                         rawPlan = XmlBeansUtil.parse(((File) plan).toURL(), getClass().getClassLoader());
                     } else {
-                        URL path = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/geronimo-web.xml");
+                        URL path = deployableModule.resolve("WEB-INF/geronimo-web.xml");
                         try {
                             rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                         } catch (FileNotFoundException e) {
-                            path = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/geronimo-jetty.xml");
+                            path = deployableModule.resolve("WEB-INF/geronimo-jetty.xml");
                             try {
                                 rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                             } catch (FileNotFoundException e1) {
@@ -284,7 +285,7 @@
                 jettyWebApp = (JettyWebAppType) webPlan.changeType(JettyWebAppType.type);
                 XmlBeansUtil.validateDD(jettyWebApp);
             } else {
-                String defaultContextRoot = determineDefaultContextRoot(webApp, standAlone,
moduleFile, targetPath);
+                String defaultContextRoot = determineDefaultContextRoot(webApp, standAlone,
deployableModule, targetPath);
                 jettyWebApp = createDefaultPlan(defaultContextRoot);
             }
             return jettyWebApp;
@@ -743,7 +744,7 @@
      * Adds the provided servlets, taking into account the load-on-startup ordering.
      *
      * @param webModuleName   an <code>ObjectName</code> value
-     * @param moduleFile      a <code>JarFile</code> value
+     * @param deployableModule a <code>DeployableModule</code> value
      * @param servletTypes    a <code>ServletType[]</code> value, contains the
<code>servlet</code> entries from <code>web.xml</code>.
      * @param servletMappings a <code>Map</code> value
      * @param securityRoles   a <code>Set</code> value
@@ -754,7 +755,7 @@
      * @throws DeploymentException if an error occurs
      */
     private void addServlets(AbstractName webModuleName,
-            JarFile moduleFile,
+            DeployableModule deployableModule,
             ServletType[] servletTypes,
             Map servletMappings,
             Set securityRoles,
@@ -783,7 +784,7 @@
         AbstractName previousServlet = null;
         for (Iterator servlets = loadOrder.iterator(); servlets.hasNext();) {
             ServletType servletType = (ServletType) servlets.next();
-            previousServlet = addServlet(webModuleName, moduleFile, previousServlet, servletType,
servletMappings, securityRoles, rolePermissions, portMap, webClassLoader, earContext);
+            previousServlet = addServlet(webModuleName, deployableModule, previousServlet,
servletType, servletMappings, securityRoles, rolePermissions, portMap, webClassLoader, earContext);
         }
 
         // JACC v1.0 secion B.19
@@ -792,7 +793,7 @@
 
     /**
      * @param webModuleName
-     * @param moduleFile
+     * @param deployableModule
      * @param previousServlet
      * @param servletType
      * @param servletMappings
@@ -805,7 +806,7 @@
      * @throws DeploymentException
      */
     private AbstractName addServlet(AbstractName webModuleName,
-            JarFile moduleFile,
+            DeployableModule deployableModule,
             AbstractName previousServlet,
             ServletType servletType,
             Map servletMappings,
@@ -842,7 +843,7 @@
                 if (portInfo == null) {
                     throw new DeploymentException("No web service deployment info for servlet
name " + servletName); // TODO identify web app in message
                 }
-                getWebServiceBuilder().configurePOJO(servletData, moduleFile, portInfo, servletClassName,
webClassLoader);
+                getWebServiceBuilder().configurePOJO(servletData, deployableModule, portInfo,
servletClassName, webClassLoader);
             }
         } else if (servletType.isSetJspFile()) {
             servletData = new GBeanData(servletAbstractName, JettyServletHolder.GBEAN_INFO);

Modified: geronimo/server/branches/sachin/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
(original)
+++ geronimo/server/branches/sachin/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
Thu Aug 24 13:30:58 2006
@@ -505,6 +505,10 @@
         }
     }
 
+    public void addToClassPath(URL url) throws IOException {
+        configurationClassLoader.addURL(url);
+    }
+
     /**
      * Gets the type of the configuration (WAR, RAR et cetera)
      * @return Type of the configuration.

Modified: geronimo/server/branches/sachin/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
Thu Aug 24 13:30:58 2006
@@ -30,11 +30,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.ConfigurationBuilder;
-import org.apache.geronimo.deployment.DeploymentContext;
-import org.apache.geronimo.deployment.ModuleIDBuilder;
-import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
-import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
+import org.apache.geronimo.deployment.*;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
@@ -96,7 +92,7 @@
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
     }
 
-    public Object getDeploymentPlan(File planFile, JarFile jarFile, ModuleIDBuilder idBuilder)
throws DeploymentException {
+    public Object getDeploymentPlan(File planFile, DeployableModule jarFile, ModuleIDBuilder
idBuilder) throws DeploymentException {
         if (planFile == null && jarFile == null) {
             return null;
         }
@@ -106,7 +102,7 @@
             if (planFile != null) {
                 xmlObject = XmlBeansUtil.parse(planFile.toURL(), getClass().getClassLoader());
             } else {
-                URL path = DeploymentUtil.createJarURL(jarFile, "META-INF/geronimo-service.xml");
+                URL path = jarFile.resolve("META-INF/geronimo-service.xml");;
                 try {
                     xmlObject = XmlBeansUtil.parse(path, getClass().getClassLoader());
                 } catch (FileNotFoundException e) {
@@ -160,24 +156,24 @@
         }
     }
 
-    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder)
throws IOException, DeploymentException {
+    public Artifact getConfigurationID(Object plan, DeployableModule module, ModuleIDBuilder
idBuilder) throws IOException, DeploymentException {
         ModuleType configType = (ModuleType) plan;
         EnvironmentType environmentType = configType.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
-        idBuilder.resolve(environment, module == null ? "" : new File(module.getName()).getName(),
"car");
+        idBuilder.resolve(environment, module == null ? "" : module.getRoot().getName(),
"car");
         if(!environment.getConfigId().isResolved()) {
             throw new IllegalStateException("Service Module ID is not fully populated ("+environment.getConfigId()+")");
         }
         return environment.getConfigId();
     }
 
-    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId,
Object plan, JarFile jar, Collection configurationStores, ArtifactResolver artifactResolver,
ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId,
Object plan, DeployableModule jar, Collection configurationStores, ArtifactResolver artifactResolver,
ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
         ModuleType configType = (ModuleType) plan;
 
         return buildConfiguration(inPlaceDeployment, configId, configType, jar, configurationStores,
artifactResolver, targetConfigurationStore);
     }
 
-    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId,
ModuleType moduleType, JarFile jar, Collection configurationStores, ArtifactResolver artifactResolver,
ConfigurationStore targetConfigurationStore) throws DeploymentException, IOException {
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId,
ModuleType moduleType, DeployableModule jar, Collection configurationStores, ArtifactResolver
artifactResolver, ConfigurationStore targetConfigurationStore) throws DeploymentException,
IOException {
         ArtifactType type = moduleType.getEnvironment().isSetModuleId() ? moduleType.getEnvironment().getModuleId()
: moduleType.getEnvironment().addNewModuleId();
         type.setArtifactId(configId.getArtifactId());
         type.setGroupId(configId.getGroupId());
@@ -203,7 +199,7 @@
 
             AbstractName moduleName = naming.createRootName(configId, configId.toString(),
SERVICE_MODULE);
             context = new DeploymentContext(outfile,
-                    inPlaceDeployment && null != jar ? DeploymentUtil.toFile(jar)
: null,
+                    inPlaceDeployment && jar.getRoot().isDirectory() ? jar.getRoot()
: null,
                     environment,
                     moduleName,
                     ConfigurationModuleType.SERVICE,
@@ -211,8 +207,12 @@
                     configurationManager,
                     repositories);
             if(jar != null) {
-                File file = new File(jar.getName());
-                context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
+                if(jar instanceof DefaultDeployableModule) {
+                    JarFile jarFile = ((DefaultDeployableModule) jar).getJarFile();
+                    context.addIncludeAsPackedJar(URI.create(jar.getRoot().getName()), jarFile);
+                } else {
+                    //TODO GERONIMO-1526
+                }
             }
 
             serviceBuilders.build(moduleType, context, context);

Modified: geronimo/server/branches/sachin/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
(original)
+++ geronimo/server/branches/sachin/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
Thu Aug 24 13:30:58 2006
@@ -29,10 +29,7 @@
 import javax.management.ObjectName;
 
 import junit.framework.TestCase;
-import org.apache.geronimo.deployment.DeploymentContext;
-import org.apache.geronimo.deployment.FooBarBean;
-import org.apache.geronimo.deployment.ModuleIDBuilder;
-import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.*;
 import org.apache.geronimo.deployment.xbeans.ModuleDocument;
 import org.apache.geronimo.deployment.xbeans.ModuleType;
 import org.apache.geronimo.gbean.AbstractName;
@@ -63,9 +60,10 @@
         URL url = getClass().getResource("/empty.jar");
         File file = new File(url.getPath());
         JarFile jar = new JarFile(file);
+        DeployableModule module = DeployableModuleFactory.createDeployableModule(jar);
         assertTrue(file.exists());
         ServiceConfigBuilder builder = new ServiceConfigBuilder(parentEnvironment, null,
new Jsr77Naming());
-        assertNull(builder.getDeploymentPlan(null, jar, new ModuleIDBuilder()));
+        assertNull(builder.getDeploymentPlan(null, module, new ModuleIDBuilder()));
         jar.close();
     }
 

Modified: geronimo/server/branches/sachin/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Thu Aug 24 13:30:58 2006
@@ -39,6 +39,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.DeployableModule;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
@@ -116,8 +117,8 @@
         return (WebServiceBuilder) webServiceBuilder.getElement();
     }
 
-    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL
specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
-        assert moduleFile != null: "moduleFile is null";
+    protected Module createModule(Object plan, DeployableModule deployableModule, String
targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming
naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        assert deployableModule != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
 
@@ -126,7 +127,7 @@
         WebAppType webApp;
         try {
             if (specDDUrl == null) {
-                specDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/web.xml");
+                specDDUrl = deployableModule.resolve("WEB-INF/web.xml");
             }
 
             // read in the entire specDD as a string, we need this for getDeploymentDescriptor
@@ -151,13 +152,13 @@
         check(webApp);
 
         // parse vendor dd
-        TomcatWebAppType tomcatWebApp = getTomcatWebApp(plan, moduleFile, standAlone, targetPath,
webApp);
+        TomcatWebAppType tomcatWebApp = getTomcatWebApp(plan, deployableModule, standAlone,
targetPath, webApp);
 
         if (contextRoot == null || contextRoot.trim().equals("")) {
             if (tomcatWebApp.isSetContextRoot()) {
                 contextRoot = tomcatWebApp.getContextRoot();
             } else {
-                contextRoot = determineDefaultContextRoot(webApp, standAlone, moduleFile,
targetPath);
+                contextRoot = determineDefaultContextRoot(webApp, standAlone, deployableModule,
targetPath);
             }
         }
 
@@ -166,7 +167,7 @@
         EnvironmentType environmentType = tomcatWebApp.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
         // Note: logic elsewhere depends on the default artifact ID being the file name less
extension (ConfigIDExtractor)
-        String warName = new File(moduleFile.getName()).getName();
+        String warName = deployableModule.getRoot().getName();
         if(warName.lastIndexOf('.') > -1) {
             warName = warName.substring(0, warName.lastIndexOf('.'));
         }
@@ -177,9 +178,9 @@
         //look for a webservices dd
         Map portMap = Collections.EMPTY_MAP;
         try {
-            URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/webservices.xml");
-            portMap = getWebServiceBuilder().parseWebServiceDescriptor(wsDDUrl, moduleFile,
false, servletNameToPathMap);
-        } catch (MalformedURLException e) {
+            URL wsDDUrl = deployableModule.resolve("WEB-INF/webservices.xml");
+            portMap = getWebServiceBuilder().parseWebServiceDescriptor(wsDDUrl, deployableModule,
false, servletNameToPathMap);
+        } catch (IOException e) {
             //no descriptor
         }
         AbstractName moduleName;
@@ -190,11 +191,11 @@
             moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
-        return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath,
webApp, tomcatWebApp, specDD, contextRoot, portMap, TOMCAT_NAMESPACE);
+        return new WebModule(standAlone, moduleName, environment, deployableModule, targetPath,
webApp, tomcatWebApp, specDD, contextRoot, portMap, TOMCAT_NAMESPACE);
     }
 
 
-    TomcatWebAppType getTomcatWebApp(Object plan, JarFile moduleFile, boolean standAlone,
String targetPath, WebAppType webApp) throws DeploymentException {
+    TomcatWebAppType getTomcatWebApp(Object plan, DeployableModule deployableModule, boolean
standAlone, String targetPath, WebAppType webApp) throws DeploymentException {
         XmlObject rawPlan = null;
         try {
             // load the geronimo-web.xml from either the supplied plan or from the earFile
@@ -205,11 +206,11 @@
                     if (plan != null) {
                         rawPlan = XmlBeansUtil.parse(((File) plan).toURL(), getClass().getClassLoader());
                     } else {
-                        URL path = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/geronimo-web.xml");
+                        URL path = deployableModule.resolve("WEB-INF/geronimo-web.xml");
                         try {
                             rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                         } catch (FileNotFoundException e) {
-                            path = DeploymentUtil.createJarURL(moduleFile, "WEB-INF/geronimo-tomcat.xml");
+                            path = deployableModule.resolve("WEB-INF/geronimo-tomcat.xml");
                             try {
                                 rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                             } catch (FileNotFoundException e1) {
@@ -229,7 +230,7 @@
                 tomcatWebApp = (TomcatWebAppType) webPlan.changeType(TomcatWebAppType.type);
                 XmlBeansUtil.validateDD(tomcatWebApp);
             } else {
-                String defaultContextRoot = determineDefaultContextRoot(webApp, standAlone,
moduleFile, targetPath);
+                String defaultContextRoot = determineDefaultContextRoot(webApp, standAlone,
deployableModule, targetPath);
                 tomcatWebApp = createDefaultPlan(defaultContextRoot);
             }
             return tomcatWebApp;
@@ -431,13 +432,13 @@
         return TOMCAT_NAMESPACE;
     }
 
-    public WebServiceContainer configurePOJO(JarFile moduleFile, Object portInfoObject, String
seiClassName, ClassLoader classLoader) throws DeploymentException, IOException {
+    public WebServiceContainer configurePOJO(DeployableModule deployableModule, Object portInfoObject,
String seiClassName, ClassLoader classLoader) throws DeploymentException, IOException {
         //the reason to configure a gbeandata rather than just fetch the WebServiceContainer
is that fetching the WSContainer ties us to that
         //ws implementation.  By configuring a servlet gbean, you can provide a different
servlet for each combination of
         //web container and ws implementation while assuming almost nothing about their relationship.
 
         GBeanData fakeData = new GBeanData();
-        getWebServiceBuilder().configurePOJO(fakeData, moduleFile, portInfoObject, seiClassName,
classLoader);
+        getWebServiceBuilder().configurePOJO(fakeData, deployableModule, portInfoObject,
seiClassName, classLoader);
         return (WebServiceContainer) fakeData.getAttribute("webServiceContainer");
     }
 

Modified: geronimo/server/branches/sachin/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=434512&r1=434458&r2=434512&view=diff
==============================================================================
--- geronimo/server/branches/sachin/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
(original)
+++ geronimo/server/branches/sachin/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
Thu Aug 24 13:30:58 2006
@@ -47,6 +47,8 @@
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
+import org.apache.geronimo.deployment.DeployableModule;
+import org.apache.geronimo.deployment.DefaultDeployableModule;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.deployment.xbeans.ServiceDocument;
 import org.apache.geronimo.gbean.AbstractName;
@@ -130,15 +132,15 @@
         return dependencies;
     }
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
-        return createModule(plan, moduleFile, ".", null, true, null, null, naming, idBuilder);
+    public Module createModule(File plan, DeployableModule deployableModule, Naming naming,
ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, deployableModule, ".", null, true, null, null, naming,
idBuilder);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo,
earName, naming, idBuilder);
+    public Module createModule(Object plan, DeployableModule deployableModule, String targetPath,
URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming
naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, deployableModule, targetPath, specDDUrl, false, (String)
moduleContextInfo, earName, naming, idBuilder);
     }
 
-    protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath,
URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming,
ModuleIDBuilder idBuilder) throws DeploymentException;
+    protected abstract Module createModule(Object plan, DeployableModule deployableModule,
String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName,
Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
 
     /**
      * Some servlets will have multiple url patterns.  However, webservice servlets
@@ -160,7 +162,7 @@
         return map;
     }
 
-    protected String determineDefaultContextRoot(WebAppType webApp, boolean isStandAlone,
JarFile moduleFile, String targetPath) {
+    protected String determineDefaultContextRoot(WebAppType webApp, boolean isStandAlone,
DeployableModule deployableModule, String targetPath) {
 
         if (webApp != null && webApp.getId() != null) {
             return webApp.getId();
@@ -168,7 +170,7 @@
 
         if (isStandAlone) {
             // default configId is based on the moduleFile name
-            return trimPath(new File(moduleFile.getName()).getName());
+            return trimPath(deployableModule.getRoot().getName());
         }
 
         // default configId is based on the module uri from the application.xml
@@ -191,7 +193,7 @@
         return path;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection
configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories)
throws DeploymentException {
+    public void installModule(DeployableModule ear, EARContext earContext, Module module,
Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories)
throws DeploymentException {
         EARContext moduleContext;
         if (module.isStandAlone()) {
             moduleContext = earContext;
@@ -225,29 +227,38 @@
 
         try {
             // add the warfile's content to the configuration
-            JarFile warFile = module.getModuleFile();
-            Enumeration entries = warFile.entries();
-            while (entries.hasMoreElements()) {
-                ZipEntry entry = (ZipEntry) entries.nextElement();
-                URI targetPath = new URI(null, entry.getName(), null);
-                if (entry.getName().equals("WEB-INF/web.xml")) {
-                    moduleContext.addFile(targetPath, module.getOriginalSpecDD());
-                } else if (entry.getName().startsWith("WEB-INF/lib") && entry.getName().endsWith(".jar"))
{
-                    moduleContext.addInclude(targetPath, warFile, entry);
-                } else {
-                    moduleContext.addFile(targetPath, warFile, entry);
+            DeployableModule war = module.getModuleFile();
+            if (war instanceof DefaultDeployableModule) {
+                JarFile jar = ((DefaultDeployableModule) war).getJarFile();
+
+                Enumeration entries = jar.entries();
+                while (entries.hasMoreElements()) {
+                    ZipEntry entry = (ZipEntry) entries.nextElement();
+                    URI targetPath = new URI(null, entry.getName(), null);
+                    if (entry.getName().equals("WEB-INF/web.xml")) {
+                        moduleContext.addFile(targetPath, module.getOriginalSpecDD());
+                    } else if (entry.getName().startsWith("WEB-INF/lib") && entry.getName().endsWith(".jar"))
{
+                        moduleContext.addInclude(targetPath, jar, entry);
+                    } else {
+                        moduleContext.addFile(targetPath, jar, entry);
+                    }
                 }
-            }
-
-            //always add WEB-INF/classes to the classpath regardless of whether
-            //any classes exist
-            moduleContext.getConfiguration().addToClassPath("WEB-INF/classes/");
-
-            // add the manifest classpath entries declared in the war to the class loader
-            // we have to explicitly add these since we are unpacking the web module
-            // and the url class loader will not pick up a manifest from an unpacked dir
-            moduleContext.addManifestClassPath(warFile, RELATIVE_MODULE_BASE_URI);
 
+                //always add WEB-INF/classes to the classpath regardless of whether
+                //any classes exist
+                moduleContext.getConfiguration().addToClassPath("WEB-INF/classes/");
+
+                // add the manifest classpath entries declared in the war to the class loader
+                // we have to explicitly add these since we are unpacking the web module
+                // and the url class loader will not pick up a manifest from an unpacked
dir
+                moduleContext.addManifestClassPath(jar, RELATIVE_MODULE_BASE_URI);
+            } else {
+                //TODO GERONIMO-1526
+                File[] classes = war.getClassesFolders();
+                for(int i = 0; i < classes.length; i++) {
+                    moduleContext.getConfiguration().addToClassPath(classes[i].toURL());
+                }
+            }
         } catch (IOException e) {
             throw new DeploymentException("Problem deploying war", e);
         } catch (URISyntaxException e) {



Mime
View raw message