axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r776612 - in /webservices/axis2/trunk/java/modules/kernel: conf/ src/org/apache/axis2/ src/org/apache/axis2/deployment/ src/org/apache/axis2/deployment/repository/util/ src/org/apache/axis2/deployment/util/
Date Wed, 20 May 2009 08:33:44 GMT
Author: amilas
Date: Wed May 20 08:33:44 2009
New Revision: 776612

URL: http://svn.apache.org/viewvc?rev=776612&view=rev
Log:
enable childfirst classloading at module.xml and service.xml levels as well.
with this feature uses can set the global class loading mechanisum at the axis2.xml and
override it as necessary at the module or service level.

Modified:
    webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java

Modified: webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml Wed May 20 08:33:44 2009
@@ -26,6 +26,9 @@
     <parameter name="enableMTOM">false</parameter>
     <parameter name="enableSwA">false</parameter>
 
+
+    <parameter name="EnableChildFirstClassLoading">false</parameter>
+
     <!--Uncomment if you want to enable file caching for attachments -->
     <!--parameter name="cacheAttachments">true</parameter>
     <parameter name="attachmentDIR"></parameter>

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Wed May
20 08:33:44 2009
@@ -444,7 +444,7 @@
          *  so the modules and services first use the classes in their class loader first
          */
 
-        public static final String ENABLE_CHILD_FIRST_CLASS_LOADING="EnableChldFirstClassLoading";
+        public static final String ENABLE_CHILD_FIRST_CLASS_LOADING="EnableChildFirstClassLoading";
 
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
Wed May 20 08:33:44 2009
@@ -283,4 +283,12 @@
         }
         return c;
     }
+
+    public boolean isChildFirstClassLoading() {
+        return isChildFirstClassLoading;
+    }
+
+    public void setChildFirstClassLoading(boolean childFirstClassLoading) {
+        isChildFirstClassLoading = childFirstClassLoading;
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
Wed May 20 08:33:44 2009
@@ -1002,19 +1002,20 @@
      */
     protected void setClassLoaders(String axis2repoURI) throws DeploymentException {
         ClassLoader sysClassLoader =
-                Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI);
+                Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI,
false);
 
         axisConfig.setSystemClassLoader(sysClassLoader);
         if (servicesDir.exists()) {
             axisConfig.setServiceClassLoader(
-                    Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir));
+                    Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir,
axisConfig.isChildFirstClassLoading()));
         } else {
             axisConfig.setServiceClassLoader(axisConfig.getSystemClassLoader());
         }
 
         if (modulesDir.exists()) {
             axisConfig.setModuleClassLoader(Utils.getClassLoader(axisConfig.getSystemClassLoader(),
-                                                                 modulesDir));
+                                                                 modulesDir,
+                                                                 axisConfig.isChildFirstClassLoading()));
         } else {
             axisConfig.setModuleClassLoader(axisConfig.getSystemClassLoader());
         }

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?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- 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
Wed May 20 08:33:44 2009
@@ -23,11 +23,9 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.InOnlyAxisOperation;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.Deployable;
 import org.apache.axis2.engine.MessageReceiver;
@@ -36,6 +34,7 @@
 import org.apache.axis2.modules.Module;
 import org.apache.axis2.phaseresolver.PhaseMetadata;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.JavaUtils;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -99,6 +98,18 @@
             Iterator itr = moduleElement.getChildrenWithName(new QName(TAG_PARAMETER));
 
             processParameters(itr, module, module.getParent());
+
+            Parameter childFirstClassLoading =
+                    module.getParameter(Constants.Configuration.ENABLE_CHILD_FIRST_CLASS_LOADING);
+            if (childFirstClassLoading != null){
+                DeploymentClassLoader deploymentClassLoader = (DeploymentClassLoader) module.getModuleClassLoader();
+                if (JavaUtils.isTrueExplicitly(childFirstClassLoading.getValue())){
+                    deploymentClassLoader.setChildFirstClassLoading(true);
+                } else if (JavaUtils.isFalseExplicitly(childFirstClassLoading.getValue())){
+                    deploymentClassLoader.setChildFirstClassLoading(false);
+                }
+            }
+
             if (moduleClassAtt != null) {
                 String moduleClass = moduleClassAtt.getAttributeValue();
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
Wed May 20 08:33:44 2009
@@ -67,7 +67,8 @@
                 File parentFile = file.getParentFile();
                 ClassLoader classLoader =
                         Utils.getClassLoader(configCtx.getAxisConfiguration().
-                                getSystemClassLoader(), parentFile);
+                                getSystemClassLoader(), parentFile,
+                                configCtx.getAxisConfiguration().isChildFirstClassLoading());
 
                 Thread.currentThread().setContextClassLoader(classLoader);
                 String className = file.getName();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
Wed May 20 08:33:44 2009
@@ -22,20 +22,13 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.dataretrieval.DRConstants;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.ModuleConfiguration;
-import org.apache.axis2.description.ParameterInclude;
-import org.apache.axis2.description.PolicyInclude;
-import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.description.*;
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
 import org.apache.axis2.description.java2wsdl.TypeTable;
 import org.apache.axis2.engine.MessageReceiver;
@@ -43,6 +36,7 @@
 import org.apache.axis2.engine.ServiceLifeCycle;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -131,6 +125,17 @@
 					TAG_PARAMETER));
 			processParameters(itr, service, service.getParent());
 
+            Parameter childFirstClassLoading =
+                    service.getParameter(Constants.Configuration.ENABLE_CHILD_FIRST_CLASS_LOADING);
+            if (childFirstClassLoading != null){
+                DeploymentClassLoader deploymentClassLoader = (DeploymentClassLoader) service.getClassLoader();
+                if (JavaUtils.isTrueExplicitly(childFirstClassLoading.getValue())){
+                    deploymentClassLoader.setChildFirstClassLoading(true);
+                } else if (JavaUtils.isFalseExplicitly(childFirstClassLoading.getValue())){
+                    deploymentClassLoader.setChildFirstClassLoading(false);
+                }
+            }
+
 			// If multiple services in one service group have different values
 			// for the PARENT_FIRST
 			// parameter then the final value become the value specified by the

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
Wed May 20 08:33:44 2009
@@ -119,7 +119,7 @@
             }
         } else {
             if (this.file != null) {
-                classLoader = Utils.getClassLoader(parent, this.file);
+                classLoader = Utils.getClassLoader(parent, this.file, isChildFirstClassLoading);
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=776612&r1=776611&r2=776612&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Wed May 20 08:33:44 2009
@@ -305,9 +305,9 @@
         return f;
     }
 
-    public static ClassLoader getClassLoader(ClassLoader parent, String path)
+    public static ClassLoader getClassLoader(ClassLoader parent, String path, boolean isChildFirstClassLoading)
             throws DeploymentException {
-        return getClassLoader(parent, new File(path));
+        return getClassLoader(parent, new File(path), isChildFirstClassLoading);
     }
 
     /**
@@ -319,7 +319,7 @@
      * @return a new ClassLoader pointing to both the passed dir and jar files under lib/
      * @throws DeploymentException if problems occur
      */
-    public static ClassLoader getClassLoader(final ClassLoader parent, File file)
+    public static ClassLoader getClassLoader(final ClassLoader parent, File file, final boolean
isChildFirstClassLoading)
             throws DeploymentException {
         URLClassLoader classLoader;
 
@@ -348,7 +348,7 @@
                             if (useJarFileClassLoader()) {
                                 return new JarFileClassLoader(urllist, parent);
                             } else {
-                                return new URLClassLoader(urllist, parent);
+                                return new DeploymentClassLoader(urllist, null, parent, isChildFirstClassLoading);
                             }
                         }
                     });



Mime
View raw message