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 de...@apache.org on 2006/05/19 16:12:20 UTC

svn commit: r407800 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: description/AxisOperation.java description/AxisService.java description/AxisServiceGroup.java engine/AxisConfiguration.java util/Utils.java

Author: deepal
Date: Fri May 19 07:12:18 2006
New Revision: 407800

URL: http://svn.apache.org/viewvc?rev=407800&view=rev
Log:
If you trying to engage a module which is already engaged then we are not going to throw exception. We just ignore that.  If the module version are mismatched then throw exception. 
So whoever trying to engage a module with different version number of the same module will treat by nice exception. 

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java?rev=407800&r1=407799&r2=407800&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java Fri May 19 07:12:18 2006
@@ -1,7 +1,6 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.ConfigurationContext;
@@ -14,6 +13,7 @@
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.modules.Module;
 import org.apache.axis2.phaseresolver.PhaseResolver;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -28,7 +28,7 @@
     public static final String STYLE_RPC = "rpc";
     public static final String STYLE_MSG = "msg";
     public static final String STYLE_DOC = "doc";
-	private static final Log log = LogFactory.getLog(AxisOperation.class);
+    private static final Log log = LogFactory.getLog(AxisOperation.class);
     private int mep = MEP_CONSTANT_INVALID;
 
     public static final String SOAP_ACTION = "soapaction";
@@ -114,14 +114,14 @@
             return null;
         }
         Iterator module_itr = engagedModules.iterator();
+        boolean isEngagable;
+        QName moduleName = moduleref.getName();
         while (module_itr.hasNext()) {
             AxisModule module = (AxisModule) module_itr.next();
-
-            if (module.getName().equals(moduleref.getName())) {
-                log.debug(Messages.getMessage("modulealredyengaged",
-                        moduleref.getName().getLocalPart()));
-                throw new AxisFault(Messages.getMessage("modulealredyengaged",
-                        moduleref.getName().getLocalPart()));
+            QName modu = module.getName();
+            isEngagable = org.apache.axis2.util.Utils.checkVersion(moduleName, modu);
+            if (!isEngagable) {
+                return new ArrayList();
             }
         }
         PhaseResolver phaseResolver = new PhaseResolver(axisConfig);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=407800&r1=407799&r2=407800&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Fri May 19 07:12:18 2006
@@ -418,15 +418,14 @@
             throw new AxisFault(Messages.getMessage("modulenf"));
         }
         Iterator itr_engageModules = engagedModules.iterator();
-
+        boolean isEngagable;
+        QName moduleName = axisModule.getName();
         while (itr_engageModules.hasNext()) {
             AxisModule module = (AxisModule) itr_engageModules.next();
-
-            if (module.getName().equals(axisModule.getName())) {
-                log.debug(Messages.getMessage("modulealredyengagetoservice",
-                        axisModule.getName().getLocalPart()));
-                throw new AxisFault(Messages.getMessage("modulealredyengagetoservice",
-                        axisModule.getName().getLocalPart()));
+            QName modu = module.getName();
+            isEngagable = org.apache.axis2.util.Utils.checkVersion(moduleName, modu);
+            if (!isEngagable) {
+                return;
             }
         }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java?rev=407800&r1=407799&r2=407800&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java Fri May 19 07:12:18 2006
@@ -22,6 +22,7 @@
 import org.apache.axis2.engine.AxisEvent;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.modules.Module;
+import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -32,7 +33,7 @@
 
 public class AxisServiceGroup extends AxisDescription {
 
-	private static final Log log = LogFactory.getLog(AxisServiceGroup.class);
+    private static final Log log = LogFactory.getLog(AxisServiceGroup.class);
 
     // to store module ref at deploy time parsing
     private ArrayList modulesList = new ArrayList();
@@ -121,17 +122,14 @@
 
     public void engageModule(AxisModule module) throws AxisFault {
         QName moduleName = module.getName();
+        boolean isEngagable ;
         for (Iterator iterator = engagedModules.iterator(); iterator.hasNext();) {
             QName modu = (QName) iterator.next();
-
-            if (modu.getLocalPart().equals(moduleName.getLocalPart())) {
-                log.debug(Messages.getMessage(
-                        "modulealredyengagedtoservicegroup", moduleName.getLocalPart()));
-                throw new AxisFault(Messages.getMessage(
-                        "modulealredyengagedtoservicegroup", moduleName.getLocalPart()));
+            isEngagable = Utils.checkVersion(moduleName, modu);
+            if (!isEngagable) {
+                return;
             }
         }
-
         Iterator srevice = getServices();
         while (srevice.hasNext()) {
             // engaging each service

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java?rev=407800&r1=407799&r2=407800&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java Fri May 19 07:12:18 2006
@@ -315,16 +315,15 @@
     }
 
     private void engageModule(AxisModule module) throws AxisFault {
-        QName moduleQName;
+        QName moduleQName = module.getName();
+        boolean isEngagable;
         if (module != null) {
             for (Iterator iterator = engagedModules.iterator(); iterator.hasNext();) {
                 QName qName = (QName) iterator.next();
-                moduleQName = module.getName();
-                if (moduleQName.equals(qName)) {
-                    log.info(Messages.getMessage("modulealredyengagedglobaly",
-                            qName.getLocalPart()));
-                    throw new AxisFault(Messages.getMessage("modulealredyengagedglobaly",
-                            qName.getLocalPart()));
+
+                isEngagable = Utils.checkVersion(moduleQName, qName);
+                if (!isEngagable) {
+                    return;
                 }
             }
         } else {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java?rev=407800&r1=407799&r2=407800&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java Fri May 19 07:12:18 2006
@@ -21,7 +21,6 @@
 import org.apache.axiom.soap.*;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
@@ -33,6 +32,7 @@
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.receivers.AbstractMessageReceiver;
 import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
+import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import java.io.File;
@@ -271,6 +271,36 @@
         return new QName(moduleName);
     }
 
+    /**
+     * Will check whether a given module can be engage or not
+     * if the version mismamathc then thow en exception
+     * - if he trying to engage the same module then method will returen false
+     * - else it will return true
+     *
+     * @param deployingModuleName
+     * @param deployedModulename
+     * @return
+     * @throws AxisFault
+     */
+    public static boolean checkVersion(QName deployingModuleName,
+                                       QName deployedModulename) throws AxisFault {
+        String module1name = getModuleName(deployingModuleName.getLocalPart());
+        String module2name = getModuleName(deployedModulename.getLocalPart());
+        String module1version = getModuleVersion(deployingModuleName.getLocalPart());
+        String module2version = getModuleVersion(deployedModulename.getLocalPart());
+        if (module1name.equals(module2name)) {
+            if (module1version != null) {
+                if (!module1version.equals(module2version)) {
+                    throw new AxisFault("trying to engage two different module versions " +
+                            module1version + " : " + module2version);
+                } else {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
     public static void calculateDefaultModuleVersion(HashMap modules, AxisConfiguration axisConfig) {
         Iterator allModules = modules.values().iterator();
         HashMap defaultModules = new HashMap();
@@ -282,7 +312,7 @@
             String currentDefaultVerison = (String) defaultModules.get(moduleNameString);
             if (currentDefaultVerison != null) {
                 // if the module version is null then , that will be ignore in this case
-                if (moduleVersionString!=null&&isLatest(moduleVersionString, currentDefaultVerison)) {
+                if (moduleVersionString != null && isLatest(moduleVersionString, currentDefaultVerison)) {
                     defaultModules.put(moduleNameString, moduleVersionString);
                 }
             } else {



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