portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r1737160 - in /portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE: components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/ components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/po...
Date Wed, 30 Mar 2016 20:19:58 GMT
Author: taylor
Date: Wed Mar 30 20:19:58 2016
New Revision: 1737160

URL: http://svn.apache.org/viewvc?rev=1737160&view=rev
Log:
Including r1735310 and r1735336 (UserSessionPreferences entity empty patch and VersionDeploymentManaagerPath)

Modified:
    portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/VersionedPortletApplicationManager.java
    portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/UserSessionPreferences.java
    portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/jetspeed-portal-resources/src/main/resources/assembly/alternate/versioned-deployment/deployment.xml

Modified: portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/VersionedPortletApplicationManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/VersionedPortletApplicationManager.java?rev=1737160&r1=1737159&r2=1737160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/VersionedPortletApplicationManager.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/VersionedPortletApplicationManager.java
Wed Mar 30 20:19:58 2016
@@ -16,11 +16,6 @@
  */
 package org.apache.jetspeed.tools.pamanager;
 
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.components.portletregistry.RegistryException;
 import org.apache.jetspeed.descriptor.JetspeedDescriptorService;
@@ -35,6 +30,11 @@ import org.apache.jetspeed.util.descript
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -57,7 +57,9 @@ import org.slf4j.LoggerFactory;
 public class VersionedPortletApplicationManager extends PortletApplicationManager
 {
     private static final Logger    log = LoggerFactory.getLogger("deployment");
-        
+
+    private Boolean useNumericVersions = true;
+
     public VersionedPortletApplicationManager(PortletFactory portletFactory, PortletRegistry
registry,
             PermissionManager permissionManager, SearchEngine searchEngine,  RoleManager
roleManager,
             List<String> permissionRoles, /* node manager, */ String appRoot, JetspeedDescriptorService
descriptorService)
@@ -66,7 +68,15 @@ public class VersionedPortletApplication
                 searchEngine, roleManager, permissionRoles, null, appRoot, descriptorService);

                
     }
-    
+
+    public Boolean getUseNumericVersions() {
+        return useNumericVersions;
+    }
+
+    public void setUseNumericVersions(Boolean useNumericVersions) {
+        this.useNumericVersions = useNumericVersions;
+    }
+
     public boolean isStarted()
     {
         return started;
@@ -140,14 +150,14 @@ public class VersionedPortletApplication
                 {
                     System.out.println(" - New Version was NOT provided: registration not
required ... " + contextName);                                    	
                 }
-                else if (newVersion.compareTo(regVersion) > 0)
+                else if (compareVersions(newVersion, regVersion, useNumericVersions) >
0)
                 {
                     System.out.println(" - **** New Version is greater: registration required...
" + contextName);
                     regPA = registerPortletApplication(paWar, regPA, paType, paClassLoader,
silent);                    
                 }
                 else
                 {
-                    System.out.println(" - New Version is NOT greater: registration not required
... " + contextName);                    
+                    System.out.println(" - New Version is NOT greater: registration not required
... " + contextName);
                 }
             }
             if (portletFactory.isPortletApplicationRegistered(regPA))
@@ -182,4 +192,35 @@ public class VersionedPortletApplication
         }
         return version;
     }
+
+    public static int compareVersions(String newVersion, String regVersion, boolean useNumericVersions)
throws NumberFormatException {
+        if (!useNumericVersions) {
+            return newVersion.compareTo(regVersion);
+        }
+        String[] v1 = newVersion.split("\\.");
+        String[] v2 = regVersion.split("\\.");
+
+        int ix = 0;
+        while(ix < v1.length || ix < v2.length){
+            if(ix < v1.length && ix < v2.length){
+                if(Integer.parseInt(v1[ix]) < Integer.parseInt(v2[ix])){
+                    return -1;
+                }else if(Integer.parseInt(v1[ix]) > Integer.parseInt(v2[ix])){
+                    return 1;
+                }
+            } else if(ix < v1.length){
+                if(Integer.parseInt(v1[ix]) != 0){
+                    return 1;
+                }
+            } else if(ix < v2.length){
+                if(Integer.parseInt(v2[ix]) != 0){
+                    return -1;
+                }
+            }
+
+            ix++;
+        }
+        return 0;
+    }
+
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/UserSessionPreferences.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/UserSessionPreferences.java?rev=1737160&r1=1737159&r2=1737160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/UserSessionPreferences.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/UserSessionPreferences.java
Wed Mar 30 20:19:58 2016
@@ -35,17 +35,24 @@ public class UserSessionPreferences {
     private Map<String,Map<String,PortletPreference>> windowPreferences = new
ConcurrentHashMap<>();
 
     public Map<String,PortletPreference> getWindowPreferences(String portletWindowId)
{
-        return windowPreferences.get(portletWindowId);
+        if (portletWindowId != null) {
+            return windowPreferences.get(portletWindowId);
+        }
+        return null;
     }
 
     public Map<String,PortletPreference> createWindowPreferences(String portletWindowId)
{
         Map<String,PortletPreference> preferences = new HashMap<>();
-        windowPreferences.put(portletWindowId, preferences);
+        if (portletWindowId != null) {
+            windowPreferences.put(portletWindowId, preferences);
+        }
         return preferences;
     }
 
     public Map<String,PortletPreference> updateWindowPreferences(String portletWindowId,
Map<String,PortletPreference> preferences) {
-        windowPreferences.put(portletWindowId, preferences);
+        if (portletWindowId != null) {
+            windowPreferences.put(portletWindowId, preferences);
+        }
         return preferences;
     }
 

Modified: portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/jetspeed-portal-resources/src/main/resources/assembly/alternate/versioned-deployment/deployment.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/jetspeed-portal-resources/src/main/resources/assembly/alternate/versioned-deployment/deployment.xml?rev=1737160&r1=1737159&r2=1737160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/jetspeed-portal-resources/src/main/resources/assembly/alternate/versioned-deployment/deployment.xml
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.3.0-POST-RELEASE/jetspeed-portal-resources/src/main/resources/assembly/alternate/versioned-deployment/deployment.xml
Wed Mar 30 20:19:58 2016
@@ -66,6 +66,11 @@
          locking by setting value to "false":
       <property name="lockRegistryAccess"><value>false</value></property>
     -->
+    <!-- optional use numeric version numbers such as 2.9.0.11. Do not allow numbers
+         this feature is enabled by default. To use lexical comparisions, set this property
to false
+      <property name="useNumericVersions" value="false" />
+    -->
+
   </bean>
 
 </beans>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message