You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2007/06/19 16:51:33 UTC

svn commit: r548751 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/rpc/receivers/ kernel/ kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/engine/ kernel/test-resources/deployment/ClasspathModule/ kernel/test-re...

Author: gdaniels
Date: Tue Jun 19 07:51:31 2007
New Revision: 548751

URL: http://svn.apache.org/viewvc?view=rev&rev=548751
Log:
* Add capability to load modules directly from the CLASSPATH, per discussions on-list and at hackathon.  This includes re-adding the @name attribute to module.xml.

* Add test for above, but commented out due to classpath config - will fix this in build script next.

* Re-add deprecated getGlobalModules() to AxisConfiguration.

* RPCMessageReceiver now extends correct receiver.

Added:
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/ClasspathModule/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/ClasspathModule/META-INF/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/ClasspathModule/META-INF/module.xml
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/exploded/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/exploded/META-INF/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/exploded/META-INF/module.xml
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/ModuleLoadingTest.java
Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java
    webservices/axis2/trunk/java/modules/kernel/pom.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java?view=diff&rev=548751&r1=548750&r2=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java Tue Jun 19 07:51:31 2007
@@ -29,7 +29,7 @@
 import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -38,7 +38,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-public class RPCMessageReceiver extends AbstractInOutSyncMessageReceiver {
+public class RPCMessageReceiver extends AbstractInOutMessageReceiver {
     private static Log log = LogFactory.getLog(RPCMessageReceiver.class);
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/pom.xml?view=diff&rev=548751&r1=548750&r2=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/pom.xml Tue Jun 19 07:51:31 2007
@@ -118,7 +118,14 @@
 					<include>**/**</include>
 				</includes>
 			</testResource>
-		</testResources>
+            <testResource>
+                <targetPath>../test-resources/deployment/ClasspathModule</targetPath>
+                <directory>test-resources/deployment/ClasspathModule</directory>
+                <includes>
+                    <include>**/**</include>
+                </includes>
+            </testResource>            
+        </testResources>
 		<plugins>
 			<plugin>
 				<artifactId>maven-surefire-plugin</artifactId>

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java?view=diff&rev=548751&r1=548750&r2=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java Tue Jun 19 07:51:31 2007
@@ -94,7 +94,17 @@
                 }
             }
 
-// process service description
+            // Get our name and version.  If this is NOT present, we'll try to figure it out
+            // from the file name (e.g. "addressing-1.0.mar").  If the attribute is there, we
+            // always respect it.
+            OMAttribute nameAtt = moduleElement.getAttribute(new QName("name"));
+            if (nameAtt != null) {
+                String moduleName = nameAtt.getAttributeValue();
+                if (moduleName != null && !"".equals(moduleName))
+                    module.setName(moduleName);
+            }
+
+            // Process service description
             OMElement descriptionElement =
                     moduleElement.getFirstChildWithName(new QName(TAG_DESCRIPTION));
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?view=diff&rev=548751&r1=548750&r2=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java Tue Jun 19 07:51:31 2007
@@ -29,8 +29,10 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.URLDecoder;
+import java.net.URI;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Enumeration;
 
 public class RepositoryListener implements DeploymentConstants {
     protected static final Log log = LogFactory.getLog(RepositoryListener.class);
@@ -102,11 +104,9 @@
     protected void loadClassPathModules() {
         ModuleDeployer deployer = deploymentEngine.getModuleDeployer();
 
-        /* WORKING (Glen)
         // Find Modules on the class path (i.e. if classpath includes "addressing.mar" then
         // addressing will be available for engaging)
 
-        // TODO: Confirm correct class loader
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
         try {
             Enumeration moduleURLs = loader.getResources("META-INF/module.xml");
@@ -114,17 +114,13 @@
                 URL url = (URL)moduleURLs.nextElement();
                 String fileName = url.toString();
                 fileName = fileName.substring(0, fileName.lastIndexOf("/META-INF/module.xml"));
-                System.out.println(fileName);
                 File f = new File(new URI(fileName));
-                System.out.println(f.getAbsolutePath());
                 addFileToDeploy(f, deployer);
             }
         } catch (Exception e) {
             // Oh well, log the problem
-            log.error(e);
+            log.info(e);
         }
-
-        */
 
         String classPath = getLocation();
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=548751&r1=548750&r2=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Tue Jun 19 07:51:31 2007
@@ -546,12 +546,17 @@
      *
      * TODO: should this check for duplicate names?
      *
-     * @param module name of AxisModule to add to list.
+     * @param moduleName name of AxisModule to add to list.
      */
     public void addGlobalModuleRef(String moduleName) {
         globalModuleList.add(moduleName);
     }
 
+    /**
+     * Engage all the previously added global modules.
+     *
+     * @throws AxisFault if an individual engageModule() fails
+     */
     public void engageGlobalModules() throws AxisFault {
         for (Iterator i = globalModuleList.iterator(); i.hasNext();) {
             engageModule((String)i.next());
@@ -669,6 +674,16 @@
      */
     public HashMap getModules() {
         return allModules;
+    }
+
+    /**
+     * Get a list of the global modules
+     *
+     * @return the global module list.  BE CAREFUL, this list is mutable.
+     * @deprecated please use addGlobalModule()
+     */
+    public List getGlobalModules() {
+        return globalModuleList;
     }
 
     /**

Added: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/ClasspathModule/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/ClasspathModule/META-INF/module.xml?view=auto&rev=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/ClasspathModule/META-INF/module.xml (added)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/ClasspathModule/META-INF/module.xml Tue Jun 19 07:51:31 2007
@@ -0,0 +1,3 @@
+<module name="classpathModule">
+    <parameter name="color">blue</parameter>
+</module>

Added: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/exploded/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/exploded/META-INF/module.xml?view=auto&rev=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/exploded/META-INF/module.xml (added)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/repositories/moduleLoadTest/modules/exploded/META-INF/module.xml Tue Jun 19 07:51:31 2007
@@ -0,0 +1,4 @@
+<!-- name attr is "explodedModule", but directory name is "exploded".  Attr wins. -->
+<module name="explodedModule">
+    <parameter name="color">green</parameter>
+</module>

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/ModuleLoadingTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/ModuleLoadingTest.java?view=auto&rev=548751
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/ModuleLoadingTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/ModuleLoadingTest.java Tue Jun 19 07:51:31 2007
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.AbstractTestCase;
+import org.apache.axis2.description.AxisModule;
+import junit.framework.TestCase;
+
+public class ModuleLoadingTest extends TestCase {
+    public void testModuleLoading() throws Exception {
+//        String repoRoot = AbstractTestCase.basedir + "/test-resources/deployment/repositories/moduleLoadTest";
+//        AxisConfiguration ac =
+//                ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoRoot)
+//                        .getAxisConfiguration();
+//
+//        // Make sure we got the exploded module in the repo/modules dir
+//        AxisModule module = ac.getModule("explodedModule");
+//        assertNotNull(module);
+//        String val = (String)module.getParameter("color").getValue();
+//        assertEquals("green", val);
+//
+//        // Make sure we got the module that's outside the repo, but in the classpath
+//        module = ac.getModule("classpathModule");
+//        assertNotNull("Didn't find classpath module!", module);
+//        val = (String)module.getParameter("color").getValue();
+//        assertEquals("Parameter wasn't set correctly", "blue", val);
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org