You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ve...@apache.org on 2009/07/24 00:20:02 UTC

svn commit: r797245 - in /webservices/axis2/branches/java/1_5/modules: kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/deployment/repository/util/ kernel/src/org/apache/axis2/description/ kernel/src/org/apache/axis2/engine/ kernel/s...

Author: veithen
Date: Thu Jul 23 22:20:01 2009
New Revision: 797245

URL: http://svn.apache.org/viewvc?rev=797245&view=rev
Log:
Merged the fix for AXIS2-4034 (correct module version scheme) from trunk to 1.5 branch.

Note that only the first part (r777751) was merged. The second part (which improves the way the distribution is built) is not suitable for an interim release, and only the values of the xxx.mar.version properties have been fixed.

Added:
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/Version.java
      - copied unchanged from r777751, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/Version.java
    webservices/axis2/branches/java/1_5/modules/kernel/test/org/apache/axis2/description/VersionTest.java
      - copied unchanged from r777751, webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/VersionTest.java
Modified:
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisModule.java
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/util/Utils.java
    webservices/axis2/branches/java/1_5/modules/kernel/test/org/apache/axis2/deployment/ModuleversionTest.java
    webservices/axis2/branches/java/1_5/modules/osgi/src/org/apache/axis2/osgi/deployment/ModuleRegistry.java
    webservices/axis2/branches/java/1_5/modules/parent/pom.xml

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Thu Jul 23 22:20:01 2009
@@ -265,7 +265,7 @@
                                             fileUrl.substring(0, fileUrl.indexOf(".aar")));
                     addServiceGroup(serviceGroup, servicelist, servicesURL, null, axisConfig);
                     log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
-                                                 org.apache.axis2.util.Utils.getModuleName(serviceGroup.getServiceGroupName()),
+                                                 serviceGroup.getServiceGroupName(),
                                                  servicesURL.toString()));
                 }
             }
@@ -307,16 +307,12 @@
                     module.setModuleClassLoader(deploymentClassLoader);
                     module.setParent(axisConfig);
                     String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar"));
-                    if (module.getName() == null) {
-                        module.setName(org.apache.axis2.util.Utils.getModuleName(moduleFile));
-                        module.setVersion(org.apache.axis2.util.Utils.getModuleVersion(moduleFile));
-                    }
+                    module.setArchiveName(moduleFile);
                     populateModule(module, moduleurl);
                     module.setFileName(moduleurl);
                     addNewModule(module, axisConfig);
                     log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
-                                                 org.apache.axis2.util.Utils.getModuleName(module.getName(),
-                                                                                           module.getVersion()),
+                                                 module.getArchiveName(),
                                                  moduleurl.toString()));
                 }
             }

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java Thu Jul 23 22:20:01 2009
@@ -73,8 +73,7 @@
             metaData.setFileName(url);
             DeploymentEngine.addNewModule(metaData, axisConfig);
             log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
-                                         Utils.getModuleName(metaData.getName(),
-                                                             metaData.getVersion()),
+                                         metaData.getArchiveName(),
                                          url.toString()));
         } catch (DeploymentException e) {
             log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Thu Jul 23 22:20:01 2009
@@ -46,7 +46,6 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.namespace.Constants;
-import org.apache.axis2.util.Utils;
 import org.apache.axis2.util.XMLUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -512,9 +511,8 @@
                     if (entry.getName().equalsIgnoreCase(MODULE_XML)) {
                         moduleXMLFound = true;
                         ModuleBuilder builder = new ModuleBuilder(zin, module, axisConfig);
-                        // setting module name
-                        module.setName(Utils.getModuleName(shortFileName));
-                        module.setVersion(Utils.getModuleVersion(shortFileName));
+                        // setting module name and version
+                        module.setArchiveName(shortFileName);
                         builder.populateModule();
                         break;
                     }
@@ -540,9 +538,8 @@
                 try {
                     in = new FileInputStream(file);
                     ModuleBuilder builder = new ModuleBuilder(in, module, axisConfig);
-                    // setting module name
-                    module.setName(Utils.getModuleName(shortFileName));
-                    module.setVersion(Utils.getModuleVersion(shortFileName));
+                    // setting module name and version
+                    module.setArchiveName(shortFileName);
                     builder.populateModule();
                 } catch (FileNotFoundException e) {
                     throw new DeploymentException(

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisDescription.java Thu Jul 23 22:20:01 2009
@@ -58,6 +58,10 @@
 
     private Map<Object, AxisDescription> children;
 
+    /**
+     * Map of modules engaged on this object. The key is the archive name as defined by
+     * {@link AxisModule#getArchiveName()}.
+     */
     protected Map<String, AxisModule> engagedModules;
 
     /** List of ParameterObservers who want to be notified of changes */
@@ -449,12 +453,12 @@
             String tempModuleName = tempAxisModule.getName();
 
             if (moduleName.equals(tempModuleName)) {
-                String existing = tempAxisModule.getVersion();
+                Version existing = tempAxisModule.getVersion();
                 if (!Utils.checkVersion(axisModule.getVersion(), existing)) {
                     throw new AxisFault(Messages.getMessage("mismatchedModuleVersions",
                                                             getClass().getName(),
                                                             moduleName,
-                                                            existing));
+                                                            String.valueOf(existing)));
                 }
             }
 
@@ -469,8 +473,7 @@
         // If we have anything specific to do, let that happen
         onEngage(axisModule, source);
 
-        engagedModules.put(Utils.getModuleName(axisModule.getName(), axisModule.getVersion()),
-                           axisModule);
+        engagedModules.put(axisModule.getArchiveName(), axisModule);
     }
 
     protected void onEngage(AxisModule module, AxisDescription engager)
@@ -497,8 +500,7 @@
     }
 
     public boolean isEngaged(AxisModule axisModule) {
-        String id = Utils.getModuleName(axisModule.getName(), axisModule
-                .getVersion());
+        String id = axisModule.getArchiveName();
         return engagedModules != null && engagedModules.keySet().contains(id);
     }
 
@@ -509,8 +511,7 @@
         // module.getVersion());
         if (isEngaged(module)) {
             onDisengage(module);
-            engagedModules.remove(Utils.getModuleName(module.getName(), module
-                    .getVersion()));
+            engagedModules.remove(module.getArchiveName());
         }
     }
 

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisModule.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisModule.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisModule.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/description/AxisModule.java Thu Jul 23 22:20:01 2009
@@ -25,9 +25,11 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.modules.Module;
+import org.apache.axis2.util.Utils;
 
 import javax.xml.namespace.QName;
 import java.net.URL;
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -63,7 +65,7 @@
 
     //This is to keep the version number of the module, if the module name is a-b-c-1.3.mar ,
     // then the module version would be 1.3
-    private String version;
+    private Version version;
 
     // to store module operations , which are suppose to be added to a service if it is engaged to a service
     private HashMap<QName, AxisOperation> operations = new HashMap<QName, AxisOperation>();
@@ -100,6 +102,94 @@
         this.name = name;
     }
 
+    /**
+     * Get the name of this module.
+     * Note that it is possible to deploy several versions of the same module. Therefore,
+     * the name of a module is not unique in the scope of a given {@link AxisConfiguration}.
+     * 
+     * @return the name of the module
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Set the name of this module.
+     * 
+     * @param name the name of the module
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Get the archive name of this module. The archive name is the combination
+     * of the module name and version (if available). In general it is equal to the
+     * name of the module archive file without the suffix.
+     * 
+     * @return the archive name of the module
+     */
+    public String getArchiveName() {
+        return version == null ? name : (name + "-" + version);
+    }
+
+    /**
+     * Set the archive name of this module. This method will split the archive name
+     * to extract the module name and version (which can be retrieved using
+     * {@link #getName()} and {@link #getVersion()}).
+     * 
+     * @param archiveName the archive name of the module
+     */
+    public void setArchiveName(String archiveName) {
+        int index = 0;
+        // First look for a part that starts with a digit
+        while ((index = archiveName.indexOf('-', index)) != -1) {
+            char c = archiveName.charAt(++index);
+            if ('0' <= c && c <= '9') {
+                break;
+            }
+        }
+        // Also support SNAPSHOT
+        if (index == -1 && archiveName.endsWith("-SNAPSHOT")) {
+            index = archiveName.length()-8;
+        }
+        
+        if (index == -1) {
+            name = archiveName;
+            version = null;
+        } else {
+            try {
+                version = new Version(archiveName.substring(index));
+            } catch (ParseException ex) {
+                version = null;
+            }
+            if (version == null) {
+                name = archiveName;
+            } else {
+                name = archiveName.substring(0, index-1);
+            }
+        }
+    }
+
+    /**
+     * Get the version of this module.
+     * 
+     * @return the version of the module, or <code>null</code> if the module doesn't have a
+     *         version number
+     */
+    public Version getVersion() {
+        return version;
+    }
+
+    /**
+     * Set the version of this module.
+     * 
+     * @param version the version of the module
+     */
+    public void setVersion(Version version) {
+        this.version = version;
+    }
+
     public void addOperation(AxisOperation axisOperation) {
         operations.put(axisOperation.getName(), axisOperation);
     }
@@ -156,14 +246,6 @@
         return moduleClassLoader;
     }
 
-    /**
-     * Get the name of this Module
-     * @return a String name.
-     */
-    public String getName() {
-        return name;
-    }
-
     public HashMap<QName, AxisOperation> getOperations() {
         return operations;
     }
@@ -238,13 +320,6 @@
         this.moduleClassLoader = moduleClassLoader;
     }
 
-    /**
-     * @param name  : Setting name of the module
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
     public void setOutFlow(Flow outFlow) {
         flowInclude.setOutFlow(outFlow);
     }
@@ -299,13 +374,4 @@
     public void setFileName(URL fileName) {
         this.fileName = fileName;
     }
-
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
 }

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Thu Jul 23 22:20:01 2009
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.net.URL;
 import java.security.PrivilegedAction;
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Hashtable;
@@ -54,6 +55,7 @@
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.Version;
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.phaseresolver.PhaseMetadata;
@@ -77,7 +79,8 @@
     private HashMap<String, String> dataLocatorClassNames = new HashMap<String, String>();
 
     /**
-     * This is a Map of String name -> AxisModule for all available Modules.
+     * Map of all available modules. The key is the archive name as defined by
+     * {@link AxisModule#getArchiveName()}.
      */
     private final HashMap<String, AxisModule> allModules = new HashMap<String, AxisModule>();
 
@@ -220,27 +223,18 @@
         module.setParent(this);
 
         // check whether the module version paramter is there , if so set the module version as that
-        Parameter verisonParamter = module.getParameter(org.apache.axis2.Constants.MODULE_VERSION);
-        if (verisonParamter !=null ) {
-            String version = (String) verisonParamter.getValue();
-            module.setVersion(version);
-        }
-
-        if (module.getVersion() == null) {
-            if (module.getName().endsWith(AxisModule.VERSION_SNAPSHOT)) {
-                allModules.put(module.getName(), module);
-                String moduleName =
-                        module.getName().substring(0,
-                                                   module.getName().indexOf(AxisModule.VERSION_SNAPSHOT) - 1);
-                module.setName(moduleName);
-                module.setVersion(AxisModule.VERSION_SNAPSHOT);
-            } else {
-                allModules.put(module.getName(), module);
+        Parameter versionParameter = module.getParameter(org.apache.axis2.Constants.MODULE_VERSION);
+        if (versionParameter !=null ) {
+            String version = (String) versionParameter.getValue();
+            try {
+                module.setVersion(new Version(version));
+            } catch (ParseException ex) {
+                throw new AxisFault("The version number '" + version + "' specified by the "
+                        + org.apache.axis2.Constants.MODULE_VERSION + " parameter is invalid");
             }
-
-        } else { // Calculate the module version from the name
-            allModules.put(Utils.getModuleName(module.getName(), module.getVersion()), module);
         }
+
+        allModules.put(module.getArchiveName(), module);
         notifyObservers(AxisEvent.MODULE_DEPLOY, module);
 
         // Registering the policy namespaces that the module understand
@@ -282,6 +276,16 @@
     }
 
     /**
+     * Remove a module with moduleName & moduleVersion
+     *
+     * @param moduleName the name of the module to remove
+     * @param moduleVersion the version of the module to remove
+     */
+    public void removeModule(String moduleName, Version moduleVersion) {
+        removeModule(moduleName, moduleVersion.toString());
+    }
+
+    /**
      * Adds module configuration, if there is a moduleConfig tag in service.
      *
      * @param moduleConfiguration a ModuleConfiguration to remember

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/util/Utils.java Thu Jul 23 22:20:01 2009
@@ -42,6 +42,7 @@
 import org.apache.axis2.description.OutInAxisOperation;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.PhaseRule;
+import org.apache.axis2.description.Version;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisError;
@@ -57,9 +58,11 @@
 import java.io.File;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.text.ParseException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Enumeration;
+import java.util.Map;
 import java.net.SocketException;
 import java.net.NetworkInterface;
 import java.net.InetAddress;
@@ -286,52 +289,6 @@
         }
     }
 
-    /**
-     * Get the name of the module , where archive name is combination of module name + its version
-     * The format of the name is as follows:
-     * moduleName-00.0000
-     * Example: "addressing-01.0001.mar" would return "addressing"
-     *
-     * @param moduleName the name of the module archive
-     * @return the module name parsed out of the file name
-     */
-    public static String getModuleName(String moduleName) {
-        if (moduleName.endsWith("-SNAPSHOT")) {
-            return moduleName.substring(0, moduleName.indexOf("-SNAPSHOT"));
-        }
-        char delimiter = '-';
-        int version_index = moduleName.lastIndexOf(delimiter);
-        if (version_index > 0) {
-            String versionString = getModuleVersion(moduleName);
-            if (versionString == null) {
-                return moduleName;
-            } else {
-                return moduleName.substring(0, version_index);
-            }
-        } else {
-            return moduleName;
-        }
-    }
-
-    public static String getModuleVersion(String moduleName) {
-        if (moduleName.endsWith("-SNAPSHOT")) {
-            return "SNAPSHOT";
-        }
-        char version_seperator = '-';
-        int version_index = moduleName.lastIndexOf(version_seperator);
-        if (version_index > 0) {
-            String versionString = moduleName.substring(version_index + 1, moduleName.length());
-            try {
-                Float.parseFloat(versionString);
-                return versionString;
-            } catch (NumberFormatException e) {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-
     public static String getModuleName(String moduleName, String moduleVersion) {
         if (moduleVersion != null && moduleVersion.length() != 0) {
             moduleName = moduleName + "-" + moduleVersion;
@@ -344,8 +301,8 @@
      * - else it will return true
      *
      */
-    public static boolean checkVersion(String module1version,
-                                       String module2version) throws AxisFault {
+    public static boolean checkVersion(Version module1version,
+                                       Version module2version) throws AxisFault {
         if ((module1version !=null && !module1version.equals(module2version)) ||
                 module2version !=null && !module2version.equals(module1version)) {
             throw new AxisFault("trying to engage two different module versions " +
@@ -357,61 +314,22 @@
     public static void calculateDefaultModuleVersion(HashMap modules,
                                                      AxisConfiguration axisConfig) {
         Iterator allModules = modules.values().iterator();
-        HashMap defaultModules = new HashMap();
+        Map<String,Version> defaultModules = new HashMap<String,Version>();
         while (allModules.hasNext()) {
             AxisModule axisModule = (AxisModule) allModules.next();
-            String moduleName = axisModule.getName();
-            String moduleNameString;
-            String moduleVersionString;
-            if (AxisModule.VERSION_SNAPSHOT.equals(axisModule.getVersion())) {
-                moduleNameString = axisModule.getName();
-                moduleVersionString = axisModule.getVersion();
-            } else {
-                if (axisModule.getVersion() == null) {
-                    moduleNameString = getModuleName(moduleName);
-                    moduleVersionString = getModuleVersion(moduleName);
-                    if (moduleVersionString != null) {
-                        try {
-                            Float.valueOf(moduleVersionString);
-                            axisModule.setVersion(moduleVersionString);
-                            axisModule.setName(moduleName);
-                        } catch (NumberFormatException e) {
-                            moduleVersionString = null;
-                        }
-                    }
-                } else {
-                    moduleNameString = axisModule.getName();
-                    moduleVersionString = axisModule.getVersion();
-                }
-            }
-            String currentDefaultVerison = (String) defaultModules.get(moduleNameString);
-            if (currentDefaultVerison != null) {
-                // if the module version is null then , that will be ignore in this case
-                if (!AxisModule.VERSION_SNAPSHOT.equals(currentDefaultVerison)) {
-                    if (moduleVersionString != null &&
-                        isLatest(moduleVersionString, currentDefaultVerison)) {
-                        defaultModules.put(moduleNameString, moduleVersionString);
-                    }
-                }
-            } else {
-                defaultModules.put(moduleNameString, moduleVersionString);
+            String name = axisModule.getName();
+            Version currentDefaultVersion = defaultModules.get(name);
+            Version version = axisModule.getVersion();
+            if (currentDefaultVersion == null ||
+                    (version != null && version.compareTo(currentDefaultVersion) > 0)) {
+                defaultModules.put(name, version);
             }
-
         }
         Iterator def_mod_itr = defaultModules.keySet().iterator();
         while (def_mod_itr.hasNext()) {
             String moduleName = (String) def_mod_itr.next();
-            axisConfig.addDefaultModuleVersion(moduleName, (String) defaultModules.get(moduleName));
-        }
-    }
-
-    public static boolean isLatest(String moduleVersion, String currentDefaultVersion) {
-        if (AxisModule.VERSION_SNAPSHOT.equals(moduleVersion)) {
-            return true;
-        } else {
-            float m_version = Float.parseFloat(moduleVersion);
-            float m_c_vresion = Float.parseFloat(currentDefaultVersion);
-            return m_version > m_c_vresion;
+            Version version = defaultModules.get(moduleName);
+            axisConfig.addDefaultModuleVersion(moduleName, version == null ? null : version.toString());
         }
     }
 

Modified: webservices/axis2/branches/java/1_5/modules/kernel/test/org/apache/axis2/deployment/ModuleversionTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/test/org/apache/axis2/deployment/ModuleversionTest.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/test/org/apache/axis2/deployment/ModuleversionTest.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/test/org/apache/axis2/deployment/ModuleversionTest.java Thu Jul 23 22:20:01 2009
@@ -45,23 +45,23 @@
     public void testCalculateDefaultModuleVersions() throws AxisFault {
         AxisConfiguration axisConfiguration = new AxisConfiguration();
         AxisModule module1 = new AxisModule();
-        module1.setName("Module1");
+        module1.setArchiveName("Module1");
         axisConfiguration.addModule(module1);
 
         AxisModule module2 = new AxisModule();
-        module2.setName("Module2-0.94");
+        module2.setArchiveName("Module2-0.94");
         axisConfiguration.addModule(module2);
 
         AxisModule module3 = new AxisModule();
-        module3.setName("Module2-0.95");
+        module3.setArchiveName("Module2-0.95");
         axisConfiguration.addModule(module3);
 
         AxisModule module4 = new AxisModule();
-        module4.setName("Module2-0.93");
+        module4.setArchiveName("Module2-0.93");
         axisConfiguration.addModule(module4);
 
         AxisModule module5 = new AxisModule();
-        module5.setName("testModule-1.93");
+        module5.setArchiveName("testModule-1.93");
         axisConfiguration.addModule(module5);
 
         Utils.calculateDefaultModuleVersion(axisConfiguration.getModules(), axisConfiguration);
@@ -77,7 +77,7 @@
         boolean found2 = false;
         boolean found3 = false;
         while (engageModules.hasNext()) {
-            String name = ((AxisModule)engageModules.next()).getName();
+            String name = ((AxisModule)engageModules.next()).getArchiveName();
             if (name.equals("Module2-0.95")) {
                 found1 = true;
             }
@@ -103,15 +103,15 @@
      public void testModuleWithSNAPSHOT() throws AxisFault {
         AxisConfiguration axisConfiguration = new AxisConfiguration();
         AxisModule module1 = new AxisModule();
-        module1.setName("Module1");
+        module1.setArchiveName("Module1");
         axisConfiguration.addModule(module1);
 
         AxisModule module2 = new AxisModule();
-        module2.setName("Module1-SNAPSHOT");
+        module2.setArchiveName("Module1-SNAPSHOT");
         axisConfiguration.addModule(module2);
 
         AxisModule module3 = new AxisModule();
-        module3.setName("Module1-0.95");
+        module3.setArchiveName("Module1-0.95");
         axisConfiguration.addModule(module3);
         Utils.calculateDefaultModuleVersion(axisConfiguration.getModules(), axisConfiguration);
         assertEquals(module2, axisConfiguration.getDefaultModule("Module1"));
@@ -121,15 +121,15 @@
      public void testModuleWithSNAPSHOT2() throws AxisFault {
         AxisConfiguration axisConfiguration = new AxisConfiguration();
         AxisModule module1 = new AxisModule();
-        module1.setName("Module1-a");
+        module1.setArchiveName("Module1-a");
         axisConfiguration.addModule(module1);
 
         AxisModule module2 = new AxisModule();
-        module2.setName("Module1-a-SNAPSHOT");
+        module2.setArchiveName("Module1-a-SNAPSHOT");
         axisConfiguration.addModule(module2);
 
         AxisModule module3 = new AxisModule();
-        module3.setName("Module1-a-0.95");
+        module3.setArchiveName("Module1-a-0.95");
         axisConfiguration.addModule(module3);
         Utils.calculateDefaultModuleVersion(axisConfiguration.getModules(), axisConfiguration);
         Utils.calculateDefaultModuleVersion(axisConfiguration.getModules(), axisConfiguration);

Modified: webservices/axis2/branches/java/1_5/modules/osgi/src/org/apache/axis2/osgi/deployment/ModuleRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/osgi/src/org/apache/axis2/osgi/deployment/ModuleRegistry.java?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/osgi/src/org/apache/axis2/osgi/deployment/ModuleRegistry.java (original)
+++ webservices/axis2/branches/java/1_5/modules/osgi/src/org/apache/axis2/osgi/deployment/ModuleRegistry.java Thu Jul 23 22:20:01 2009
@@ -24,6 +24,7 @@
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.Version;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.modules.Module;
 import static org.apache.axis2.osgi.deployment.OSGiAxis2Constants.OSGi_BUNDLE_ID;
@@ -169,7 +170,6 @@
                     }
                     String bundleVersion = (String) headers.get("Bundle-Version");
                     if (bundleVersion != null && bundleVersion.length() != 0) {
-                        String moduleVersion = "SNAPSHOT";
                         /*
                             Bundle version is defined as
                             version ::=
@@ -178,21 +178,14 @@
                                 minor ::= number
                                 micro ::= number
                                 qualifier ::= ( alphanum | ’_’ | '-' )+
-
-                            Hence, in order to sync up with Axis2 module versioning, which is a floating
-                            point number, following logic is used to create the version
-                            version := major(.minormircor)
                          */
                         String[] versionSplit = bundleVersion.split("\\.");
-                        if (versionSplit.length == 3) {
-                            moduleVersion =
-                                    versionSplit[0] + "." + versionSplit[1] + versionSplit[2];
-                        } else if (versionSplit.length == 2) {
-                            moduleVersion = versionSplit[0] + "." + versionSplit[1];
-                        } else if (versionSplit.length == 1) {
-                            moduleVersion = versionSplit[0];
+                        int[] components = new int[Math.min(versionSplit.length, 3)];
+                        for (int i=0; i<components.length; i++) {
+                            components[i] = Integer.parseInt(versionSplit[i]);
                         }
-                        axismodule.setVersion(moduleVersion);
+                        axismodule.setVersion(new Version(components, versionSplit.length > 3 ?
+                                versionSplit[3] : null));
                     }
                     builder.populateModule();
                     axismodule.setParent(axisConfig);

Modified: webservices/axis2/branches/java/1_5/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/parent/pom.xml?rev=797245&r1=797244&r2=797245&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/parent/pom.xml (original)
+++ webservices/axis2/branches/java/1_5/modules/parent/pom.xml Thu Jul 23 22:20:01 2009
@@ -83,12 +83,12 @@
         <version>1.5.1</version>
 
         <!-- Version #'s for the mars that we generate -->
-        <addressing.mar.version>1.51</addressing.mar.version>
-        <soapmonitor.mar.version>1.51</soapmonitor.mar.version>
-        <mex.mar.version>1.51</mex.mar.version>
-        <ping.mar.version>1.51</ping.mar.version>
-        <scripting.mar.version>1.51</scripting.mar.version>
-        <mtompolicy.mar.version>1.51</mtompolicy.mar.version>
+        <addressing.mar.version>1.5.1</addressing.mar.version>
+        <soapmonitor.mar.version>1.5.1</soapmonitor.mar.version>
+        <mex.mar.version>1.5.1</mex.mar.version>
+        <ping.mar.version>1.5.1</ping.mar.version>
+        <scripting.mar.version>1.5.1</scripting.mar.version>
+        <mtompolicy.mar.version>1.5.1</mtompolicy.mar.version>
 
         <ant.version>1.7.0</ant.version>
         <antlr.version>2.7.7</antlr.version>