You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2009/05/20 15:50:58 UTC

svn commit: r776703 - in /portals/jetspeed-2/portal/trunk/components: jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/ jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/ jetspeed-security/src/main/java/org/apache/jetspeed/se...

Author: ate
Date: Wed May 20 13:50:58 2009
New Revision: 776703

URL: http://svn.apache.org/viewvc?rev=776703&view=rev
Log:
JS2-1019: Several import/export mapping bugs in the JetspeedSerializer implementations
See: https://issues.apache.org/jira/browse/JS2-1019
- a major cleanup of obsolete code
- lots of bug fixes
- generalizing security principal import/export loading/writing
- dropping old-format export
- optimizing export xml format of Preferences and SecurityAttributes big time, while still retaining old-style import format
- fully tested on import/export, to the effect I uncovered several bugs with the *old* code by carefully comparing import/export and re-import/export results
- still plenty of areas to improve and enhance, but that'll be dealt with after the release

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java Wed May 20 13:50:58 2009
@@ -28,6 +28,7 @@
 import org.apache.jetspeed.profiler.rules.PrincipalRule;
 import org.apache.jetspeed.profiler.rules.ProfilingRule;
 import org.apache.jetspeed.profiler.rules.RuleCriterion;
+import org.apache.jetspeed.security.JetspeedPrincipalType;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.serializer.objects.JSPrincipalRule;
@@ -37,7 +38,6 @@
 import org.apache.jetspeed.serializer.objects.JSRuleCriterions;
 import org.apache.jetspeed.serializer.objects.JSSnapshot;
 import org.apache.jetspeed.serializer.objects.JSPrincipal;
-import org.apache.jetspeed.serializer.objects.JSUser;
 
 /**
  * JetspeedProfilerSerializer - Profiler component serializer
@@ -172,65 +172,40 @@
         log.debug("recreateUserPrincipalRules - started");
 
         // get Rules for each user
-        for (JSPrincipal _user : snapshot.getUsers())
+        for (JSPrincipal _user : snapshot.getPrincipals())
         {
-            try
+            if (JetspeedPrincipalType.USER.equals(_user.getType()))
             {
-                User user = userManager.getUser(_user.getName());
-                
-                for (JSPrincipalRule pr : _user.getRules())
+                try
                 {
-                    ProfilingRule pRule = pm.getRule(pr.getRule());
-    
-                    try
+                    User user = userManager.getUser(_user.getName());
+                    
+                    for (JSPrincipalRule pr : _user.getRules())
                     {
-                        PrincipalRule p1 = pm.createPrincipalRule();
-                        p1.setLocatorName(pr.getLocator());
-                        p1.setProfilingRule(pRule);
-                        p1.setPrincipalName(user.getName());
-                        pm.storePrincipalRule(p1);
-                    }
-                    catch (Exception eRole)
-                    {
-                        eRole.printStackTrace();
+                        ProfilingRule pRule = pm.getRule(pr.getRule());
+        
+                        try
+                        {
+                            PrincipalRule p1 = pm.createPrincipalRule();
+                            p1.setLocatorName(pr.getLocator());
+                            p1.setProfilingRule(pRule);
+                            p1.setPrincipalName(user.getName());
+                            pm.storePrincipalRule(p1);
+                        }
+                        catch (Exception eRole)
+                        {
+                            eRole.printStackTrace();
+                        }
                     }
                 }
-            }
-            catch (Exception eUser)
-            {
-                eUser.printStackTrace();
-            }
-        }
-        for (JSUser _user : snapshot.getOldUsers())
-        {
-            try
-            {
-                User user = userManager.getUser(_user.getName());
-                
-                for (JSPrincipalRule pr : _user.getRules())
+                catch (Exception eUser)
                 {
-                    ProfilingRule pRule = pm.getRule(pr.getRule());
-    
-                    try
-                    {
-                        PrincipalRule p1 = pm.createPrincipalRule();
-                        p1.setLocatorName(pr.getLocator());
-                        p1.setProfilingRule(pRule);
-                        p1.setPrincipalName(user.getName());
-                        pm.storePrincipalRule(p1);
-                    }
-                    catch (Exception eRole)
-                    {
-                        eRole.printStackTrace();
-                    }
+                    eUser.printStackTrace();
                 }
             }
-            catch (Exception eUser)
-            {
-                eUser.printStackTrace();
-            }
-            
+               
         }
+        
         log.debug("recreateUserPrincipalRules - done");
     }
 
@@ -386,16 +361,19 @@
     {
         // get Rules for each user
         
-        for (JSPrincipal _user : snapshot.getUsers())
+        for (JSPrincipal _user : snapshot.getPrincipals())
         {
-            Principal principal = _user.getPrincipal();
-            
-            if (principal != null)
+            if (JetspeedPrincipalType.USER.equals(_user.getType()))
             {
-                for (PrincipalRule p1 : (Collection<PrincipalRule>) pm.getRulesForPrincipal(principal))
+                Principal principal = _user.getPrincipal();
+                
+                if (principal != null)
                 {
-                    JSPrincipalRule pr = new JSPrincipalRule(p1.getLocatorName(), p1.getProfilingRule().getId());
-                    _user.getRules().add(pr);
+                    for (PrincipalRule p1 : (Collection<PrincipalRule>) pm.getRulesForPrincipal(principal))
+                    {
+                        JSPrincipalRule pr = new JSPrincipalRule(p1.getLocatorName(), p1.getProfilingRule().getId());
+                        _user.getRules().add(pr);
+                    }
                 }
             }
         }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java Wed May 20 13:50:58 2009
@@ -181,9 +181,8 @@
                 Map<String, PortletPreference> portletPreference = new HashMap<String, PortletPreference>();
                 JSEntityPreference preference = (JSEntityPreference) it.next();
                 String userName = preference.getPrincapalName();
-                for (int counter = 0; counter < preference.getPreferences().getValues().size(); counter++)
+                for (JSNVPElement element : preference.getPreferences().getValues())
                 {
-                    JSNVPElement element = preference.getPreferences().getValues().get(counter);
                     if (element.getValues() == null)
                     {
                         JetspeedPreferenceImpl pref = new JetspeedPreferenceImpl(element.getKey(), new String[] { element.getValue() });
@@ -329,11 +328,11 @@
             JSEntityPreference userPreference = new JSEntityPreference();
             userPreference.setPrincapalName(userName);
             Iterator<String> preferences = userPreferences.keySet().iterator();
-            JSNVPElements v = new JSNVPElements();
+            JSNVPElements v = new JSNVPElements("preference");
             while (preferences.hasNext())
             {
                 String pKey = preferences.next();
-                PortletPreference portletPreference = (PortletPreference) userPreferences.get(pKey);
+                PortletPreference portletPreference = userPreferences.get(pKey);
                 JSNVPElement element = new JSNVPElement();
                 element.setKey(pKey);
                 element.setValues(portletPreference.getValues());

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java Wed May 20 13:50:58 2009
@@ -21,6 +21,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -39,10 +40,10 @@
 import org.apache.jetspeed.security.JetspeedPrincipalManagerProvider;
 import org.apache.jetspeed.security.JetspeedPrincipalType;
 import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.PermissionFactory;
 import org.apache.jetspeed.security.PermissionManager;
 import org.apache.jetspeed.security.Role;
 import org.apache.jetspeed.security.RoleManager;
-import org.apache.jetspeed.security.SecurityAttribute;
 import org.apache.jetspeed.security.SecurityAttributes;
 import org.apache.jetspeed.security.SecurityDomain;
 import org.apache.jetspeed.security.SecurityException;
@@ -77,38 +78,21 @@
  */
 public class JetspeedSecuritySerializer extends AbstractJetspeedComponentSerializer
 {
-    private static String ENCODING_STRING = "JETSPEED 2.2 - 2008";
+    private static String ENCODING_STRING = "JETSPEED 2.2 - 2009";
     private static String JETSPEED = "JETSPEED";
 
     private static class ImportRefs
     {
         private HashMap<String, HashMap<String, Principal>> principalMapByType = new HashMap<String, HashMap<String, Principal>>();
-        private HashMap<String, Principal> roleMap = new HashMap<String, Principal>();
-        private HashMap<String, Principal> groupMap = new HashMap<String, Principal>();
-        private HashMap<String, Principal> userMap = new HashMap<String, Principal>();
-        private HashMap<String, JSPermission> permissionMap = new HashMap<String, JSPermission>();
-        
-        public ImportRefs()
-        {
-            principalMapByType.put(JetspeedPrincipalType.USER, userMap);
-            principalMapByType.put(JetspeedPrincipalType.GROUP, groupMap);
-            principalMapByType.put(JetspeedPrincipalType.ROLE, roleMap);
-        }
         
         public HashMap<String, Principal> getPrincipalMap(String principalTypeName)
         {
-            HashMap<String, Principal> principalMap = null;
-            
-            if (principalMapByType.containsKey(principalTypeName))
-            {
-                principalMap = principalMapByType.get(principalTypeName);
-            }
-            else
+            HashMap<String, Principal> principalMap = principalMapByType.get(principalTypeName);
+            if (principalMap == null)
             {
                 principalMap = new HashMap<String, Principal>();
                 principalMapByType.put(principalTypeName, principalMap);
             }
-            
             return principalMap;
         }
     }
@@ -116,25 +100,15 @@
     private static class ExportRefs
     {
         private HashMap<String, HashMap<String, JSPrincipal>> principalMapByType = new HashMap<String, HashMap<String, JSPrincipal>>();
-        private HashMap<String, JSPrincipal> roleMap = new HashMap<String, JSPrincipal>();
-        private HashMap<String, JSPrincipal> groupMap = new HashMap<String, JSPrincipal>();
-        private HashMap<String, JSPrincipal> userMap = new HashMap<String, JSPrincipal>();
-        private HashMap<String, JSPermission> permissionMap = new HashMap<String, JSPermission>();
         
         public HashMap<String, JSPrincipal> getPrincipalMap(String principalTypeName)
         {
-            HashMap<String, JSPrincipal> jsPrincipalMap = null;
-            
-            if (principalMapByType.containsKey(principalTypeName))
-            {
-                jsPrincipalMap = principalMapByType.get(principalTypeName);
-            }
-            else
+            HashMap<String, JSPrincipal> jsPrincipalMap = principalMapByType.get(principalTypeName);
+            if (jsPrincipalMap == null)
             {
                 jsPrincipalMap = new HashMap<String, JSPrincipal>();
                 principalMapByType.put(principalTypeName, jsPrincipalMap);
             }
-            
             return jsPrincipalMap;
         }
     }
@@ -224,21 +198,24 @@
                 {
                     pm.removePermission(permission);
                 }                
+                
                 String anonymousUser = userManager.getAnonymousUser();
-                for (String userName : userManager.getUserNames(""))
+                boolean userType;
+                
+                for (JetspeedPrincipalType type : principalManagerProvider.getPrincipalTypeMap().values())
                 {
-                    if (!anonymousUser.equals(userName))
+                    String typeName = type.getName();
+                    userType = JetspeedPrincipalType.USER.equals(typeName);
+                    
+                    JetspeedPrincipalManager principalManager = principalManagerProvider.getManager(type);
+                    
+                    for (JetspeedPrincipal principal : principalManager.getPrincipals(""))
                     {
-                        userManager.removeUser((String)userName);
+                        if (!(userType && anonymousUser.equals(principal.getName())))
+                        {
+                            principalManager.removePrincipal(principal);
+                        }
                     }
-                }                
-                for (Group group : groupManager.getGroups(""))
-                {
-                    groupManager.removeGroup(group.getName());
-                }
-                for (Role role : roleManager.getRoles(""))
-                {
-                    roleManager.removeRole(role.getName());
                 }
             }
             catch (Exception e)
@@ -361,7 +338,9 @@
     private void recreateJetspeedPrincipals(ImportRefs refs, JSSnapshot snapshot, Map settings, Logger log)
             throws SerializerException
     {
-        log.debug("recreateRolesGroupsUsers");
+        log.debug("recreateJetspeedPrincipals");
+        
+        log.debug("processing old groups");
         
         for (JSGroup jsGroup : snapshot.getOldGroups())
         {
@@ -372,24 +351,7 @@
                 if (!(groupManager.groupExists(name)))
                     groupManager.addGroup(name);
                 Group group = groupManager.getGroup(name);
-                refs.groupMap.put(name, (Principal) group);
-            }
-            catch (Exception e)
-            {
-                throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "Group",
-                        e.getMessage() }), e);
-            }
-        }
-        
-        for (JSPrincipal jsGroup : snapshot.getGroups())
-        {
-            String name = jsGroup.getName();
-            try
-            {
-                if (!(groupManager.groupExists(name)))
-                    groupManager.addGroup(name);
-                Group group = groupManager.getGroup(name);
-                refs.groupMap.put(name, (Principal) group);
+                refs.getPrincipalMap(JetspeedPrincipalType.GROUP).put(name, group);
             }
             catch (Exception e)
             {
@@ -398,9 +360,9 @@
             }
         }
         
-        log.debug("recreateGroups - done");
+        log.debug("recreateOldGroups - done");
         
-        log.debug("processing roles");
+        log.debug("processing old roles");
 
         for (JSRole jsRole : snapshot.getOldRoles())
         {
@@ -410,7 +372,7 @@
                 if (!(roleManager.roleExists(name)))
                     roleManager.addRole(name);
                 Role role = roleManager.getRole(name);
-                refs.roleMap.put(name, (Principal) role);
+                refs.getPrincipalMap(JetspeedPrincipalType.ROLE).put(name, role);
             }
             catch (Exception e)
             {
@@ -419,72 +381,13 @@
             }
         }
         
-        for (JSPrincipal jsRole : snapshot.getRoles())
-        {
-            String name = jsRole.getName();
-            try
-            {
-                if (!(roleManager.roleExists(name)))
-                    roleManager.addRole(name);
-                Role role = roleManager.getRole(name);
-                refs.roleMap.put(name, (Principal) role);
-            }
-            catch (Exception e)
-            {
-                throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "Role",
-                        e.getMessage() }));
-            }
-        }
-        
-        log.debug("recreateRoles - done");
+        log.debug("recreateOldRoles - done");
         
-        log.debug("processing general principals");
-        
-        JetspeedPrincipalManager principalManager = null;
-        
-        for (JSPrincipal jsPrincipal : snapshot.getPrincipals())
-        {
-            String typeName = jsPrincipal.getType();
-            String name = jsPrincipal.getName();
-            
-            try
-            {
-                JetspeedPrincipalType type = this.principalManagerProvider.getPrincipalType(typeName);
-                principalManager = this.principalManagerProvider.getManager(type);
-                JetspeedPrincipal principal = null;
-                
-                if (!(principalManager.principalExists(name)))
-                {
-                    principal = principalManager.newPrincipal(name, jsPrincipal.isMapped());
-                    JSSecurityAttributes jsSecAttrs = jsPrincipal.getSecurityAttributes();
-                    if (jsSecAttrs != null)
-                    {
-                        for (JSNVPElement elem : jsSecAttrs.getValues())
-                        {
-                            principal.getSecurityAttributes().getAttribute(elem.getKey(), true).setStringValue(elem.getValue());
-                        }
-                    }
-                    principalManager.addPrincipal(principal, null);
-                }
-                
-                principal = principalManager.getPrincipal(name);
-                refs.getPrincipalMap(typeName).put(name, principal);
-            }
-            catch (Exception e)
-            {
-                e.printStackTrace();
-                throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { typeName,
-                        e.getMessage() }), e);
-            }
-        }
-        
-        log.debug("recreate general principals - done");
-        
-        log.debug("processing users");
-
         /** determine whether passwords can be reconstructed or not */
         int passwordEncoding = compareCurrentSecurityProvider(snapshot);
-        
+                
+        log.debug("processing old users");
+
         for (JSUser jsuser : snapshot.getOldUsers())
         {
             try
@@ -560,21 +463,21 @@
                         Iterator<String> _itTemp = listUserGroups.iterator();
                         while (_itTemp.hasNext())
                         {
-                            groupManager.addUserToGroup(jsuser.getName(), (String) _itTemp.next());
+                            groupManager.addUserToGroup(jsuser.getName(), _itTemp.next());
                         }
                     }
                     JSUserRoles jsUserRoles = jsuser.getRoleString();
                     List<String> listUserRoles = null;
                     if (jsUserRoles != null)
+                    {
                         listUserRoles = getTokens(jsUserRoles.toString());
-                    else
-                        listUserRoles = null;
+                    }
                     if ((listUserRoles != null) && (listUserRoles.size() > 0))
                     {
                         Iterator<String> _itTemp = listUserRoles.iterator();
                         while (_itTemp.hasNext())
                         {
-                            roleManager.addRoleToUser(jsuser.getName(), (String) _itTemp.next());
+                            roleManager.addRoleToUser(jsuser.getName(), _itTemp.next());
                         }
                     }
                     JSUserAttributes attributes = jsuser.getUserInfo();
@@ -597,7 +500,7 @@
                             userSecAttrs.getAttribute(element.getKey(), true).setStringValue(element.getValue());
                         }
                     }
-                    refs.userMap.put(jsuser.getName(), (Principal) user);
+                    refs.getPrincipalMap(JetspeedPrincipalType.USER).put(jsuser.getName(), user);
                     userManager.updateUser(user);
                 }
             }
@@ -607,106 +510,144 @@
                 throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "User",
                         e.getMessage() }));
             }
-        }        
+        }
+        log.debug("recreateOldUsers - done");
         
-        for (JSPrincipal jsuser : snapshot.getUsers())
+        log.debug("processing jetspeed principals");
+        
+        JetspeedPrincipalManager principalManager = null;
+        
+        for (JSPrincipal jsPrincipal : snapshot.getPrincipals())
         {
-            try
+            String typeName = jsPrincipal.getType();
+            if (JetspeedPrincipalType.USER.equals(typeName))
             {
-                User user = null;
-                if (userManager.userExists(jsuser.getName()))
-                {
-                    user = userManager.getUser(jsuser.getName());
-                }
-                if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING)) || (user == null))
+                recreateUserPrincipal(refs, snapshot, settings, log, jsPrincipal, passwordEncoding);
+            }
+            else
+            {
+                String name = jsPrincipal.getName();
+                
+                try
                 {
-                    if (user == null) // create new one
+                    JetspeedPrincipalType type = this.principalManagerProvider.getPrincipalType(typeName);
+                    principalManager = this.principalManagerProvider.getManager(type);
+                    JetspeedPrincipal principal = null;
+                    
+                    if (!(principalManager.principalExists(name)))
                     {
-                        String pwdString = jsuser.getPwDataValue("password");
-                        char [] pwdChars = (pwdString != null ? pwdString.toCharArray() : null);
-                        String password = recreatePassword(pwdChars);
-                        log.debug("add User " + jsuser.getName() + " with password " + (password));
-                        
-                        user = userManager.addUser(jsuser.getName());
-                        if (password != null && password.length() > 0)
-                        {
-                            PasswordCredential pwc = userManager.getPasswordCredential(user);
-                            pwc.setPassword(null, password);
-                            pwc.setEncoded((passwordEncoding == JetspeedSerializer.PASSTHRU_REQUIRED));
-                            userManager.storePasswordCredential(pwc);
+                        principal = principalManager.newPrincipal(name, jsPrincipal.isMapped());
+                        JSSecurityAttributes jsSecAttrs = jsPrincipal.getSecurityAttributes();
+                        if (jsSecAttrs != null)
+                        {
+                            for (JSNVPElement elem : jsSecAttrs.getValues())
+                            {
+                                principal.getSecurityAttributes().getAttribute(elem.getKey(), true).setStringValue(elem.getValue());
+                            }
                         }
-                        log.debug("add User done ");
+                        principalManager.addPrincipal(principal, null);
                     }
-                    try
+                    
+                    principal = principalManager.getPrincipal(name);
+                    refs.getPrincipalMap(typeName).put(name, principal);
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                    throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { typeName,
+                            e.getMessage() }), e);
+                }
+            }
+        }
+        
+        log.debug("recreate jetspeed principals - done");
+    }
+    
+    private void recreateUserPrincipal(ImportRefs refs, JSSnapshot snapshot, Map settings, Logger log, JSPrincipal jsuser, int passwordEncoding)
+    throws SerializerException
+    {
+        try
+        {
+            User user = null;
+            if (userManager.userExists(jsuser.getName()))
+            {
+                user = userManager.getUser(jsuser.getName());
+            }
+            if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING)) || (user == null))
+            {
+                if (user == null) // create new one
+                {
+                    String pwdString = jsuser.getPwDataValue("password");
+                    char [] pwdChars = (pwdString != null ? pwdString.toCharArray() : null);
+                    String password = recreatePassword(pwdChars);
+                    log.debug("add User " + jsuser.getName() + " with password " + (password));
+                    
+                    user = userManager.addUser(jsuser.getName(), jsuser.isMapped());
+                    if (password != null && password.length() > 0)
                     {
                         PasswordCredential pwc = userManager.getPasswordCredential(user);
-                        pwc.setEnabled(jsuser.getPwDataValueAsBoolean("enabled"));
-                        pwc.setUpdateRequired(jsuser.getPwDataValueAsBoolean("requiresUpdate"));
-                        java.sql.Date d = jsuser.getPwDataValueAsDate("expirationDate");
-                        if (d != null)
-                            pwc.setExpirationDate(d);
+                        pwc.setPassword(null, password);
+                        pwc.setEncoded((passwordEncoding == JetspeedSerializer.PASSTHRU_REQUIRED));
                         userManager.storePasswordCredential(pwc);
                     }
-                    catch (Exception e)
-                    {
-                        // most likely caused by protected users (like "guest")
-                        log.error("setting userinfo for " + jsuser.getName() + " failed because of "
-                                + e.getLocalizedMessage());
-                    }
-                    
-                    // credentials
-                    Subject subject = userManager.getSubject(user);
-                    List<Credential> listTemp = jsuser.getPrivateCredentials();
-                    if ((listTemp != null) && (listTemp.size() > 0))
-                    {
-                        Iterator<Credential> _itTemp = listTemp.iterator();
-                        while (_itTemp.hasNext())
-                        {
-                            subject.getPrivateCredentials().add(_itTemp.next());
-                        }
-                    }
-                    listTemp = jsuser.getPublicCredentials();
-                    if ((listTemp != null) && (listTemp.size() > 0))
+                    log.debug("add User done ");
+                }
+                try
+                {
+                    PasswordCredential pwc = userManager.getPasswordCredential(user);
+                    pwc.setEnabled(jsuser.getPwDataValueAsBoolean("enabled"));
+                    pwc.setUpdateRequired(jsuser.getPwDataValueAsBoolean("requiresUpdate"));
+                    java.sql.Date d = jsuser.getPwDataValueAsDate("expirationDate");
+                    if (d != null)
+                        pwc.setExpirationDate(d);
+                    userManager.storePasswordCredential(pwc);
+                }
+                catch (Exception e)
+                {
+                    // most likely caused by protected users (like "guest")
+                    log.error("setting userinfo for " + jsuser.getName() + " failed because of "
+                            + e.getLocalizedMessage());
+                }
+                
+                // credentials
+                Subject subject = userManager.getSubject(user);
+                List<Credential> listTemp = jsuser.getPrivateCredentials();
+                if ((listTemp != null) && (listTemp.size() > 0))
+                {
+                    Iterator<Credential> _itTemp = listTemp.iterator();
+                    while (_itTemp.hasNext())
                     {
-                        Iterator<Credential> _itTemp = listTemp.iterator();
-                        while (_itTemp.hasNext())
-                        {
-                            subject.getPublicCredentials().add(_itTemp.next());
-                        }
+                        subject.getPrivateCredentials().add(_itTemp.next());
                     }
-                    
-                    JSSecurityAttributes attributes = jsuser.getInfoAttributes();
-                    if (attributes != null)
+                }
+                listTemp = jsuser.getPublicCredentials();
+                if ((listTemp != null) && (listTemp.size() > 0))
+                {
+                    Iterator<Credential> _itTemp = listTemp.iterator();
+                    while (_itTemp.hasNext())
                     {
-                        SecurityAttributes userSecAttrs = user.getSecurityAttributes();
-                        
-                        for (JSNVPElement element : attributes.getValues())
-                        {
-                            userSecAttrs.getAttribute(element.getKey(), true).setStringValue(element.getValue());
-                        }
+                        subject.getPublicCredentials().add(_itTemp.next());
                     }
-                    JSSecurityAttributes jsNVP = jsuser.getSecurityAttributes();
-                    if ((jsNVP != null) && (jsNVP.getValues() != null))
+                }
+                
+                JSSecurityAttributes jsSecAttrs = jsuser.getSecurityAttributes();
+                if (jsSecAttrs != null)
+                {
+                    for (JSNVPElement elem : jsSecAttrs.getValues())
                     {
-                        SecurityAttributes userSecAttrs = user.getSecurityAttributes();
-                        
-                        for (JSNVPElement element : jsNVP.getValues())
-                        {
-                            userSecAttrs.getAttribute(element.getKey(), true).setStringValue(element.getValue());
-                        }
+                        user.getSecurityAttributes().getAttribute(elem.getKey(), true).setStringValue(elem.getValue());
                     }
-                    refs.userMap.put(jsuser.getName(), (Principal) user);
-                    userManager.updateUser(user);
                 }
+                refs.getPrincipalMap(JetspeedPrincipalType.USER).put(jsuser.getName(), user);
+                userManager.updateUser(user);
             }
-            catch (Exception e)
-            {
-                e.printStackTrace();
-                throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "User",
-                        e.getMessage() }));
-            }
         }
-        log.debug("recreateUsers - done");
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "User",
+                    e.getMessage() }));
+        }
     }
 
     private void recreateJetspeedPrincipalAssociations(ImportRefs refs, JSSnapshot snapshot, Map settings, Logger log)
@@ -764,7 +705,7 @@
             JetspeedPermission perm = null;
             if (jsPermission.getType().equals(JSPermission.TYPE_PORTAL))
             {
-                perm = pm.newPermission(pm.PORTLET_PERMISSION, jsPermission.getResource(), jsPermission.getActions());
+                perm = pm.newPermission(PermissionFactory.PORTLET_PERMISSION, jsPermission.getResource(), jsPermission.getActions());
             }
             else
             {
@@ -775,6 +716,7 @@
                 try
                 {
                     pm.addPermission(perm);
+                    // TODO handle permission principals generically
                     List<String> listTemp = null;
                     JSUserGroups jsUserGroups = jsPermission.getGroupString();
                     if (jsUserGroups != null)
@@ -784,7 +726,7 @@
                         Iterator<String> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
-                            JetspeedPrincipal p = (JetspeedPrincipal) refs.groupMap.get((String) _itTemp.next());
+                            JetspeedPrincipal p = (JetspeedPrincipal) refs.getPrincipalMap(JetspeedPrincipalType.GROUP).get(_itTemp.next());
                             if (p != null)
                                 pm.grantPermission(perm, p);
                         }
@@ -799,7 +741,7 @@
                         Iterator<String> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
-                            JetspeedPrincipal p = (JetspeedPrincipal) refs.roleMap.get((String) _itTemp.next());
+                            JetspeedPrincipal p = (JetspeedPrincipal) refs.getPrincipalMap(JetspeedPrincipalType.ROLE).get(_itTemp.next());
                             if (p != null)
                                 pm.grantPermission(perm, p);
                         }
@@ -814,7 +756,7 @@
                         Iterator<String> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
-                            JetspeedPrincipal p = (JetspeedPrincipal) refs.userMap.get((String) _itTemp.next());
+                            JetspeedPrincipal p = (JetspeedPrincipal) refs.getPrincipalMap(JetspeedPrincipalType.USER).get(_itTemp.next());
                             if (p != null)
                                 pm.grantPermission(perm, p);
                         }
@@ -890,93 +832,25 @@
         /** set the security provider info in the snapshot file */
         snapshot.setEncryption(getEncryptionString());
         
-        for (Role role : roleManager.getRoles(""))
-        {
-            try
-            {
-                JSPrincipal _tempRole = (JSPrincipal) getObjectBehindPrinicpal(refs.roleMap, role);
-                if (_tempRole == null)
-                {
-                    _tempRole = createJSPrincipal(role);
-                    refs.roleMap.put(_tempRole.getName(), _tempRole);
-                    snapshot.getRoles().add(_tempRole);
-                }
-
-            }
-            catch (Exception e)
-            {
-                throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] {
-                        "Role", e.getMessage() }));
-            }
-        }
-        
-        for (Group group : groupManager.getGroups(""))
-        {
-
-            try
-            {
-                JSPrincipal _tempGroup = (JSPrincipal) getObjectBehindPrinicpal(refs.groupMap, group);
-                if (_tempGroup == null)
-                {
-                    _tempGroup = createJSPrincipal(group);
-                    refs.groupMap.put(_tempGroup.getName(), _tempGroup);
-                    snapshot.getGroups().add(_tempGroup);
-                }
-
-            }
-            catch (Exception e)
-            {
-                throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] {
-                        "Group", e.getMessage() }));
-            }
-        }
-
-        for (User user : userManager.getUsers(""))
-        {
-            try
-            {
-                JSPrincipal _tempUser = createJSPrincipal(user);
-                PasswordCredential pwc = userManager.getPasswordCredential(user);
-                char [] password = (pwc.getPassword() != null ? pwc.getPassword().toCharArray() : null);
-                _tempUser.setCredential(user.getName(), password, pwc.getExpirationDate(), pwc.isEnabled(), pwc.isExpired(), pwc.isUpdateRequired());
-                refs.userMap.put(_tempUser.getName(), _tempUser);
-                snapshot.getUsers().add(_tempUser);
-            }
-            catch (Exception e)
-            {
-                throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] {
-                        "User", e.getMessage() }), e);
-            }
-        }
-        
         for (Map.Entry<String, JetspeedPrincipalType> entry : this.principalManagerProvider.getPrincipalTypeMap().entrySet())
         {
             String typeName = entry.getKey();
             
-            if (!JetspeedPrincipalType.USER.equals(typeName) && !JetspeedPrincipalType.GROUP.equals(typeName) && !JetspeedPrincipalType.ROLE.equals(typeName))
+            JetspeedPrincipalType type = this.principalManagerProvider.getPrincipalType(typeName);
+            JetspeedPrincipalManager principalManager = this.principalManagerProvider.getManager(type);
+            
+            for (JetspeedPrincipal principal : principalManager.getPrincipals(""))
             {
-                JetspeedPrincipalType type = this.principalManagerProvider.getPrincipalType(typeName);
-                JetspeedPrincipalManager principalManager = this.principalManagerProvider.getManager(type);
-                
-                for (JetspeedPrincipal principal : principalManager.getPrincipals(""))
+                try
                 {
-                    try
-                    {
-                        Map refsMap = refs.getPrincipalMap(typeName);
-                        JSPrincipal _tempPrincipal = (JSPrincipal) getObjectBehindPrinicpal(refsMap, principal);
-                        if (_tempPrincipal == null)
-                        {
-                            _tempPrincipal = createJSPrincipal(principal);
-                            refsMap.put(_tempPrincipal.getName(), _tempPrincipal);
-                            snapshot.getPrincipals().add(_tempPrincipal);
-                        }
-    
-                    }
-                    catch (Exception e)
-                    {
-                        throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] {
-                                typeName, e.getMessage() }));
-                    }
+                    JSPrincipal _tempPrincipal = createJSPrincipal(principal);
+                    refs.getPrincipalMap(typeName).put(_tempPrincipal.getName(), _tempPrincipal);
+                    snapshot.getPrincipals().add(_tempPrincipal);
+                }
+                catch (Exception e)
+                {
+                    throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] {
+                            typeName, e.getMessage() }));
                 }
             }
         }
@@ -1042,34 +916,23 @@
                 for (JetspeedPrincipal principal : pm.getPrincipals(perm))
                 {
                     String principalTypeName = principal.getType().getName();
-                    
-                    if (JetspeedPrincipalType.ROLE.equals(principalTypeName))
+                    JSPrincipal jsPrincipal = refs.getPrincipalMap(principalTypeName).get(principal.getName());
+                    if (jsPrincipal != null)
                     {
-                        JSPrincipal _tempRole = (JSPrincipal) this.getObjectBehindPath(refs.roleMap, principal.getName());
-                        
-                        if (_tempRole != null)
+                        // TODO: handle permission principals generically
+                        if (JetspeedPrincipalType.ROLE.equals(principalTypeName))
                         {
-                            _js.addRole(_tempRole);
+                            _js.addRole(jsPrincipal);
                         }
-                    }
-                    else if (JetspeedPrincipalType.GROUP.equals(principalTypeName))
-                    {
-                        JSPrincipal _tempGroup = (JSPrincipal) this.getObjectBehindPath(refs.groupMap, principal.getName());
-                        
-                        if (_tempGroup != null)
+                        else if (JetspeedPrincipalType.GROUP.equals(principalTypeName))
                         {
-                            _js.addGroup(_tempGroup);
+                            _js.addGroup(jsPrincipal);
                         }
-                    }
-                    else if (JetspeedPrincipalType.USER.equals(principalTypeName))
-                    {
-                        JSPrincipal _tempUser = (JSPrincipal) this.getObjectBehindPath(refs.userMap, principal.getName());
-                        
-                        if (_tempUser != null)
+                        else if (JetspeedPrincipalType.USER.equals(principalTypeName))
                         {
-                            _js.addUser(_tempUser);
-                        }
-                    }                    
+                            _js.addUser(jsPrincipal);
+                        }                    
+                    }
                 }
                 
                 snapshot.getPermissions().add(_js);
@@ -1083,39 +946,6 @@
     }
 
     /**
-     * simple lookup for principal object from a map
-     * 
-     * @param map
-     * @param _fullPath
-     * @return
-     */
-
-    private Object getObjectBehindPrinicpal(Map map, Principal principal)
-    {
-        return getObjectBehindPath(map, principal.getName());
-    }
-
-    /**
-     * simple lookup for object from a map
-     * 
-     * @param map
-     * @param _fullPath
-     * @return
-     */
-    protected final Object getObjectBehindPath(Map map, String _fullPath)
-    {
-        return map.get(_fullPath);
-    }
-
-    /**
-     * remove a given sequence from the beginning of a string
-     */
-    protected final String removeFromString(String base, String excess)
-    {
-        return base.replaceFirst(excess, "").trim();
-    }
-    
-    /**
      * Add the credentials to the JSUser object.
      * <p>
      * If the credential provided is a PasswordCredential, userid and password
@@ -1157,6 +987,7 @@
         _jsPrincipal.setEnabled(principal.isEnabled());
         _jsPrincipal.setReadonly(principal.isReadOnly());
         _jsPrincipal.setRemovable(principal.isRemovable());
+        _jsPrincipal.setExtendable(principal.isExtendable());
         
         if (JetspeedPrincipalType.USER.equals(principal.getType()))
         {
@@ -1185,120 +1016,4 @@
         
         return _jsPrincipal;
     }
-
-    /**
-     * create a serializable wrapper for role
-     * 
-     * @param role
-     * @return
-     */
-    private JSRole createJSRole(Role role)
-    {
-        JSRole _role = new JSRole();
-        _role.setName(role.getName());
-        return _role;
-    }
-
-    /**
-     * create a wrapper JSGroup object
-     */
-    private JSGroup createJSGroup(Group group)
-    {
-        JSGroup _group = new JSGroup();
-        _group.setName(group.getName());
-        return _group;
-    }
-
-    /**
-     * Add the credentials to the JSUser object.
-     * <p>
-     * If the credential provided is a PasswordCredential, userid and password
-     * are extracted and set explcitely
-     * 
-     * @param isPublic
-     *            public or private credential
-     * @param newUser
-     *            the JS user object reference
-     * @param credential
-     *            the credential object
-     */
-
-    private void addJSUserCredentials(boolean isPublic, JSUser newUser, Credential credential)
-    {
-        if (credential == null)
-            return;
-        if (credential instanceof PasswordCredential)
-        {
-            PasswordCredential pw = (PasswordCredential) credential;
-            char [] pwdChars = (pw.getPassword() != null ? pw.getPassword().toCharArray() : null);
-            newUser.setUserCredential(pw.getUserName(), pwdChars, pw.getExpirationDate(), pw.isEnabled(), 
-                                      pw.isExpired(), pw.isUpdateRequired());
-            return;
-        }
-        else if (isPublic)
-            newUser.addPublicCredential(credential);
-        else
-            newUser.addPrivateCredential(credential);
-    }
-
-    /**
-     * create a new JSUser object
-     * 
-     * @param user
-     * @return a new JSUser object
-     * @throws SecurityException 
-     */
-    private JSUser createJSUser(ExportRefs refs, User user) throws SecurityException
-    {
-        JSUser _newUser = new JSUser();
-        Subject subject = userManager.getSubject(user);
-        for (Principal principal : subject.getPrincipals())
-        {
-            if (principal instanceof Role)
-            {
-                JSPrincipal _tempRole = (JSPrincipal) this.getObjectBehindPath(refs.roleMap, principal.getName());
-                if (_tempRole != null)
-                {
-                    _newUser.addRole(_tempRole);
-                }
-
-            }
-            else if (principal instanceof Group)
-            {
-                JSPrincipal _tempGroup = (JSPrincipal) this.getObjectBehindPath(refs.groupMap, principal.getName());
-                if (_tempGroup != null)
-                {
-                    _newUser.addGroup(_tempGroup);
-                }
-            }
-            else if (principal instanceof User)
-            {
-                _newUser.setPrincipal(principal);
-            }
-        }
-        
-        Credential credential = userManager.getPasswordCredential(user);
-        
-        if (credential != null)
-        {
-            addJSUserCredentials(true, _newUser, credential);
-        }
-        
-        for (Object o : subject.getPublicCredentials())
-        {
-            credential = (Credential)o;
-            addJSUserCredentials(true, _newUser, credential);
-        }
-        
-        for (Object o : subject.getPrivateCredentials())
-        {
-            credential = (Credential)o;
-            addJSUserCredentials(false, _newUser, credential);
-        }
-        
-        _newUser.setSecurityAttributes(user.getSecurityAttributes().getAttributeMap(SecurityAttribute.JETSPEED_CATEGORY));
-        _newUser.setUserInfo(user.getSecurityAttributes().getInfoAttributeMap());
-        
-        return _newUser;
-    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElement.java Wed May 20 13:50:58 2009
@@ -17,22 +17,30 @@
 
 package org.apache.jetspeed.serializer.objects;
 
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 import javolution.xml.XMLFormat;
+import javolution.xml.sax.Attributes;
 import javolution.xml.stream.XMLStreamException;
 
 import org.apache.commons.lang.StringEscapeUtils;
 
 public class JSNVPElement
 {
-
+    private static final String READONLY = "readonly";
+    private static final String NULLVALUE = "nullValue";
+    private static final String NAME = "name";
+    private static final String VALUE = "value";
+    
     private String key;
 
     private String value;
     
     private String [] values;
 
-    private boolean nullValue;
-    private boolean isReadOnly;
+    private Map<String, String> attributes = new LinkedHashMap<String, String>();
 
     public JSNVPElement()
     {
@@ -43,7 +51,7 @@
         this.key = key;
         this.value = value;
     }
-
+    
     private static final XMLFormat XML = new XMLFormat(JSNVPElement.class)
     {
 
@@ -57,23 +65,40 @@
                 throws XMLStreamException
         {
             JSNVPElement e = (JSNVPElement) o;
-            // xml.add((String) g.get(_key), _key, String.class);
-            xml.setAttribute("readonly",String.valueOf(e.isReadOnly()));
-            xml.add(e.key, "name", String.class);
-            if (e.nullValue)
+            xml.setAttribute(READONLY, e.isReadOnly() ? "true" : "false");
+            for (Map.Entry<String,String> entry : e.attributes.entrySet())
             {
-                xml.setAttribute("nullValue", true);
-            } else
+                if (entry.getKey().equals(READONLY) || entry.getKey().equals(NULLVALUE))
+                {
+                    ; // skip
+                }
+                else
+                {
+                    xml.setAttribute(entry.getKey(), entry.getValue());
+                }
+            }
+            xml.setAttribute(NAME, e.key);
+            if (e.isNullValue())
             {
-                if(null!=e.getValues())
+                xml.setAttribute(NULLVALUE, "true");
+            }
+            else if (e.getValue() != null)
+            {
+                xml.setAttribute(VALUE, e.value);
+            }            
+            else if (e.values != null)
+            {
+                if (e.values.length == 1)
+                {
+                    xml.setAttribute(VALUE, e.values[0]);
+                }
+                else
                 {
-                    for(int count=0;count<e.getValues().length;count++)
+                    for(int count=0;count<e.values.length;count++)
                     {
-                        xml.add(e.getValues()[count], "value", String.class);
+                        xml.add(e.values[count], VALUE, String.class);
                     }
-                }else{
-                    xml.add(e.value, "value", String.class);       
-                }             
+                }
             }
         }
 
@@ -82,20 +107,51 @@
             try
             {
                 JSNVPElement g = (JSNVPElement) o;
-                g.isReadOnly  = Boolean.parseBoolean(xml.getAttribute("readonly", "false"));
-                g.key = StringEscapeUtils.unescapeHtml((String) xml.get("name",
-                        String.class));
-                g.value = StringEscapeUtils.unescapeHtml((String) xml.get(
-                        "value", String.class));                
-                // DST: not sure what Ate was doing here, but it breaks things
-                // we also need to add upport for multiple values and 'readonly', but its not clear what this null value does for us
-                //                g.nullValue = xml.getAttribute("nullValue", false);                
-                //if (!g.nullValue)
-                //{
-                // g.value =
-                // StringEscapeUtils.unescapeHtml((String)xml.get("value",
-                // String.class));
-                // }
+                Attributes attribs = xml.getAttributes();
+
+                for (int i = 0, len = attribs.getLength(); i < len; i++)
+                {
+                    try
+                    {
+                        String _key = StringEscapeUtils.unescapeHtml(attribs.getLocalName(i).toString());
+                        String _value = StringEscapeUtils.unescapeHtml(attribs.getValue(i).toString());
+                        g.setAttribute(_key,_value);
+                    } catch (Exception e)
+                    {
+                        /**
+                         * while annoying invalid entries in the file should be
+                         * just disregarded
+                         */
+                        e.printStackTrace();
+                    }
+                }
+                
+                g.key = g.getAttributes().get("name");
+                if (g.key == null)
+                {
+                    g.key = StringEscapeUtils.unescapeHtml((String) xml.get("name",String.class));
+                }                
+                
+                if (g.key != null && !g.isNullValue())
+                {
+                    g.value = g.getAttributes().get("value");
+                    if (g.value == null)
+                    {
+                        ArrayList<String> strings = new ArrayList<String>();
+                        while (xml.hasNext())
+                        {
+                            strings.add(StringEscapeUtils.unescapeHtml((String) xml.get("value", String.class)));
+                        }
+                        if (strings.size() > 1)
+                        {
+                            g.values = strings.toArray(new String[strings.size()]);
+                        }
+                        else
+                        {
+                            g.value = strings.get(0);
+                        }
+                    }
+                }
             } catch (Exception e)
             {
                 e.printStackTrace();
@@ -126,26 +182,91 @@
     public void setValue(String value)
     {
         this.value = value;
-        nullValue = value == null;
+        this.values = null;
+        setNullValue(value == null);
     }
     
     public void setValues(String [] values)
     {
+        this.value = null;
         this.values = values;
-        nullValue = values == null;
+        setNullValue(values == null);
     }
     /**
      * @return the isReadOnly
      */
     public boolean isReadOnly()
     {
-        return isReadOnly;
+        return attributes.get(READONLY) != null;
     }
     /**
      * @param isReadOnly the isReadOnly to set
      */
     public void setReadOnly(boolean isReadOnly)
     {
-        this.isReadOnly = isReadOnly;
+        if (isReadOnly)
+        {
+            attributes.put(READONLY, "true");
+        }
+        else
+        {
+            attributes.remove(READONLY);
+        }
+    }
+    
+    /**
+     * @return the isNullValue
+     */
+    public boolean isNullValue()
+    {
+        return attributes.get(NULLVALUE) != null;
+    }
+    /**
+     * @param isNullValue the isNullValue to set
+     */
+    public void setNullValue(boolean isNullValue)
+    {
+        if (isNullValue)
+        {
+            attributes.put(NULLVALUE, "true");
+        }
+        else
+        {
+            attributes.remove(NULLVALUE);
+        }
+    }
+
+    public Map<String, String> getAttributes()
+    {
+        return attributes;
+    }
+
+    public String getAttribute(String key)
+    {
+        return attributes.get(key);
+    }
+    
+    public void setAttribute(String key, String value)
+    {
+        if (key != null && value != null && key.trim().length() > 0 && value.trim().length() > 0)
+        {
+            if (READONLY.equals(key))
+            {
+                setReadOnly(Boolean.parseBoolean(value));
+            }
+            else if (NULLVALUE.equals(key))
+            {
+                setNullValue(Boolean.parseBoolean(value));
+            }
+            else
+            {
+                attributes.put(key,value);
+            }
+        }
+    }
+    
+    public void removeAttribute(String key)
+    {
+        attributes.remove(key);
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java Wed May 20 13:50:58 2009
@@ -24,34 +24,50 @@
  * @author <a href="mailto:hajo@bluesunrsie.com">Hajo Birthelmer</a>
  * @version $Id: $
  */
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Comparator;
+import java.util.Set;
+import java.util.TreeSet;
 
 import javolution.xml.XMLFormat;
 import javolution.xml.stream.XMLStreamException;
 
 public class JSNVPElements
 {
-    private List<JSNVPElement> values = new ArrayList<JSNVPElement>();
+    private static final Comparator elementComparator = new Comparator<JSNVPElement>()
+    {
+
+        public int compare(JSNVPElement o1, JSNVPElement o2)
+        {
+            return o1.getKey().compareTo(o2.getKey());
+        }
+    };
+    private Set<JSNVPElement> values;
     
-    private String itemElementName = "preference";
+    private String itemElementName;
 
     public int size()
     {
     	return values.size();
     	
     }
+    
     public JSNVPElements()
     {
+        this("preference");
     }
     
     public JSNVPElements(String itemElementName)
     {
-        this();
+        this(itemElementName, elementComparator);
+    }
+ 
+    public JSNVPElements(String itemElementName, Comparator<JSNVPElement> comparator)
+    {
+        values = new TreeSet<JSNVPElement>(comparator);
         this.itemElementName = itemElementName;
     }
  
-    public List<JSNVPElement> getValues()
+    public Set<JSNVPElement> getValues()
 	{
 		return values;
 	}
@@ -101,7 +117,10 @@
                     // Allow any sub element as long as it has name-value pair. 
 					//JSNVPElement elem = (JSNVPElement)xml.get(g.getItemElementName(), JSNVPElement.class);
                     JSNVPElement elem = (JSNVPElement)xml.getNext();
-					g.add(elem);
+                    if (elem.getKey() != null)
+                    {
+                        g.add(elem);
+                    }
 				}
             } 
             catch (Exception e)
@@ -113,8 +132,5 @@
                 e.printStackTrace();
             }
         }
-    };
-
-
-    
+    };    
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java Wed May 20 13:50:58 2009
@@ -33,8 +33,6 @@
 import javolution.xml.stream.XMLStreamException;
 
 import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.jetspeed.security.SecurityAttribute;
-import org.apache.jetspeed.security.SecurityAttributes;
 
 public class JSNameValuePairs
 {
@@ -61,25 +59,6 @@
     	myMap.put(key,value);
     }
 
-	/**
-     * @param arg0
-     */
-    public JSNameValuePairs(SecurityAttributes attributes)
-    {
-        try
-        {
-            for (String key : attributes.getAttributeNames())
-            {
-                SecurityAttribute attr = attributes.getAttribute(key);
-                myMap.put(key, attr.getStringValue());
-            }
-        } 
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
-    }
-
     /***************************************************************************
      * SERIALIZER
      */

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java Wed May 20 13:50:58 2009
@@ -28,7 +28,6 @@
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.jetspeed.security.Credential;
 import org.apache.jetspeed.security.SecurityAttribute;
-import org.apache.jetspeed.security.SecurityAttributeType;
 
 /**
  * Jetspeed Serialized (JS) JetspeedPrincipal
@@ -44,8 +43,8 @@
     private boolean enabled;
     private boolean readonly;
     private boolean removable;
-    private JSSecurityAttributes secAttrs;
-    private JSSecurityAttributes infoAttrs;
+    private boolean extendable;
+    private JSSecurityAttributes secAttrs = new JSSecurityAttributes();
     private JSPWAttributes pwData;
     private List<Credential> publicCredentials;
     private List<Credential> privateCredentials;
@@ -68,19 +67,19 @@
                 JSPrincipal p = (JSPrincipal) o;
                 xml.setAttribute("type", p.getType());
                 xml.setAttribute("name", p.getName());
-                xml.setAttribute("mapped", false);
-                xml.setAttribute("enabled", false);
-                xml.setAttribute("readonly", false);
-                xml.setAttribute("removable", false);
+                xml.setAttribute("mapped", p.isMapped());
+                xml.setAttribute("enabled", p.isEnabled());
+                xml.setAttribute("readonly", p.isReadonly());
+                xml.setAttribute("removable", p.isRemovable());
+                xml.setAttribute("extendable", p.isExtendable());
                 
                 if (p.pwData != null)
                     xml.add(p.pwData);
                 
                 if (p.secAttrs != null && p.secAttrs.size() > 0)
+                {
                     xml.add(p.secAttrs);
-                
-                if (p.infoAttrs != null && p.infoAttrs.size() > 0)
-                    xml.add(p.infoAttrs);
+                }
                 
                 if (p.rules != null && p.rules.size() > 0)
                     xml.add(p.rules);
@@ -99,9 +98,10 @@
                 p.setType(xml.getAttribute("type", ""));
                 p.setName(StringEscapeUtils.unescapeHtml(xml.getAttribute("name", "")));
                 p.mapped = xml.getAttribute("mapped", false);
-                p.enabled = xml.getAttribute("enabled", false);
+                p.enabled = xml.getAttribute("enabled", true);
                 p.readonly = xml.getAttribute("readonly", false);
-                p.removable = xml.getAttribute("removable", false);
+                p.removable = xml.getAttribute("removable", true);
+                p.extendable = xml.getAttribute("extendable", true);
                 
                 Object o1 = null;
                 while (xml.hasNext())
@@ -110,16 +110,7 @@
                     
                     if (o1 instanceof JSSecurityAttributes)
                     {
-                        JSSecurityAttributes sas = (JSSecurityAttributes) o1;
-                        
-                        if (SecurityAttributeType.JETSPEED_CATEGORY.equals(sas.getCategory()))
-                        {
-                            p.secAttrs = sas;
-                        }
-                        else if (SecurityAttributeType.INFO_CATEGORY.equals(sas.getCategory()))
-                        {
-                            p.infoAttrs = sas;
-                        }
+                        p.secAttrs = (JSSecurityAttributes)o1;
                     }
                     else if (o1 instanceof JSPWAttributes)
                     {
@@ -210,50 +201,36 @@
         this.removable = removable;
     }
     
-    public JSSecurityAttributes getSecurityAttributes()
-    {
-        return this.secAttrs;
-    }
-    
-    public void setSecurityAttributes(JSSecurityAttributes secAttrs)
+    public void setExtendable(boolean extendable)
     {
-        this.secAttrs = secAttrs;
+        this.extendable = extendable;
     }
     
-    public void setSecurityAttributes(Map<String, SecurityAttribute> sa)
-    {
-        this.secAttrs = new JSSecurityAttributes(SecurityAttributeType.JETSPEED_CATEGORY);
-        
-        for (Map.Entry<String, SecurityAttribute> e : sa.entrySet())
-        {
-            SecurityAttribute attrib = e.getValue();
-            JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getStringValue());
-            this.secAttrs.add(element);
-        }
-    }
-
-    public JSSecurityAttributes getInfoAttributes()
+    public boolean isExtendable()
     {
-        return this.infoAttrs;
+        return extendable;
     }
     
-    public void setInfoAttributes(JSSecurityAttributes infoAttrs)
+    public JSSecurityAttributes getSecurityAttributes()
     {
-        this.infoAttrs = infoAttrs;
+        return this.secAttrs;
     }
     
-    public void setInfoAttributes(Map<String, SecurityAttribute> sa)
+    public void setSecurityAttributes(Map<String, SecurityAttribute> sa)
     {
-        this.infoAttrs = new JSSecurityAttributes(SecurityAttributeType.INFO_CATEGORY); 
-        
         for (Map.Entry<String, SecurityAttribute> e : sa.entrySet())
         {
             SecurityAttribute attrib = e.getValue();
             JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getStringValue());
-            this.infoAttrs.add(element);
+            element.setReadOnly(attrib.isReadOnly());
+            element.setAttribute("datatype",attrib.getDataType().name());
+            element.setAttribute("registered",Boolean.toString(attrib.isRegistered()));
+            element.setAttribute("required",Boolean.toString(attrib.isRequired()));
+            element.setAttribute("category",attrib.getCategory());
+            secAttrs.add(element);
         }
     }
-    
+
     public void setCredential(String name, char [] password, Date expirationDate, boolean isEnabled, boolean isExpired, boolean requireUpdate)
     {
         setName(name);

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java Wed May 20 13:50:58 2009
@@ -18,8 +18,6 @@
 
 import java.util.ArrayList;
 
-import org.apache.jetspeed.security.JetspeedPrincipalType;
-
 import javolution.xml.XMLFormat;
 import javolution.xml.stream.XMLStreamException;
 
@@ -34,28 +32,10 @@
 {
     private static final long serialVersionUID = -5698435742048612881L;
     
-    private String type = JetspeedPrincipalType.USER;
-
     public JSPrincipals()
     {
     }
     
-    public JSPrincipals(String type)
-    {
-        this();
-        this.type = type;
-    }
-    
-    public String getType()
-    {
-        return this.type;
-    }
-    
-    public void setType(String type)
-    {
-        this.type = type;
-    }
-    
     /***************************************************************************
      * SERIALIZER
      */
@@ -68,7 +48,6 @@
             try
             {
                 JSPrincipals g = (JSPrincipals) o;
-                xml.setAttribute("type", g.getType());
                 
                 for (JSPrincipal p : g)
                 {
@@ -87,7 +66,6 @@
             try
             {
                 JSPrincipals g = (JSPrincipals) o;
-                g.setType(xml.getAttribute("type", JetspeedPrincipalType.USER));
                 
                 while (xml.hasNext())
                 {

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java Wed May 20 13:50:58 2009
@@ -17,7 +17,7 @@
 
 package org.apache.jetspeed.serializer.objects;
 
-import org.apache.jetspeed.security.SecurityAttributeType;
+import java.util.Comparator;
 
 import javolution.xml.XMLFormat;
 import javolution.xml.stream.XMLStreamException;
@@ -25,27 +25,28 @@
 
 public class JSSecurityAttributes extends JSNVPElements
 {
-    private String category = SecurityAttributeType.JETSPEED_CATEGORY;
-    
-    public JSSecurityAttributes()
-    {
-        super("SecurityAttribute");
-    }
-    
-    public JSSecurityAttributes(String category)
+    private static final Comparator securityAttrComparator = new Comparator<JSNVPElement>()
     {
-        this();
-        this.category = category;
-    }
-    
-    public String getCategory()
-    {
-        return this.category;
-    }
+        public int compare(JSNVPElement o1, JSNVPElement o2)
+        {
+            int result = 0;
+            String o1Category = o1.getAttribute("category");
+            String o2Category = o2.getAttribute("category");
+            if (o1Category != null && o2Category != null)
+            {
+                result = o1Category.compareTo(o2Category);
+            }
+            if (result == 0)
+            {
+                result = o1.getKey().compareTo(o2.getKey());
+            }
+            return result;
+        }
+    };
     
-    public void setCategory(String category)
+    public JSSecurityAttributes()
     {
-        this.category = category;
+        super("SecurityAttribute", securityAttrComparator);
     }
     
     /***************************************************************************
@@ -63,7 +64,6 @@
             try
             {
                 JSSecurityAttributes g = (JSSecurityAttributes) o;
-                xml.setAttribute("category", g.getCategory());
                 
                 for (JSNVPElement element : g.getValues())
                 {
@@ -81,7 +81,6 @@
             try
             {
                 JSSecurityAttributes g = (JSSecurityAttributes) o;
-                g.setCategory(xml.getAttribute("category", SecurityAttributeType.JETSPEED_CATEGORY));
                 
                 while (xml.hasNext())
                 {

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java Wed May 20 13:50:58 2009
@@ -18,7 +18,6 @@
 package org.apache.jetspeed.serializer.objects;
 
 import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.jetspeed.security.JetspeedPrincipalType;
 import org.apache.jetspeed.serializer.JetspeedSerializedData;
 
 import javolution.xml.XMLFormat;
@@ -50,16 +49,10 @@
 
     private JSCapabilities capabilities;
     
-    private JSPrincipals roles;
-    
     private JSRoles oldRoles;
 
-    private JSPrincipals groups;
-    
     private JSGroups oldGroups;
 
-    private JSPrincipals users;
-    
     private JSUsers oldUsers;
     
     private JSPrincipals principals;
@@ -90,17 +83,12 @@
 
     public JSSnapshot()
     {
-        System.out.println(this.getClass().getName() + " created");
-
         mimeTypes = new JSMimeTypes();
         mediaTypes = new JSMediaTypes();
         clients = new JSClients();
         capabilities = new JSCapabilities();
-        roles = new JSPrincipals(JetspeedPrincipalType.ROLE);
         oldRoles = new JSRoles();
-        groups = new JSPrincipals(JetspeedPrincipalType.GROUP);
         oldGroups = new JSGroups();
-        users = new JSPrincipals(JetspeedPrincipalType.USER);
         oldUsers = new JSUsers();
         principals = new JSPrincipals();
         principalAssociations = new JSPrincipalAssociations();
@@ -218,23 +206,6 @@
     }
     
     /**
-     * @return Returns the groups.
-     */
-    public JSPrincipals getGroups()
-    {
-        return groups;
-    }
-
-    /**
-     * @param groups
-     *            The groups to set.
-     */
-    public void setGroups(JSPrincipals groups)
-    {
-        this.groups = groups;
-    }
-
-    /**
      * @return Returns the groups from old format.
      */
     public JSGroups getOldGroups()
@@ -252,23 +223,6 @@
     }
     
     /**
-     * @return Returns the roles.
-     */
-    public JSPrincipals getRoles()
-    {
-        return roles;
-    }
-
-    /**
-     * @param roles
-     *            The roles to set.
-     */
-    public void setRoles(JSPrincipals roles)
-    {
-        this.roles = roles;
-    }
-
-    /**
      * @return Returns the roles from old format.
      */
     public JSRoles getOldRoles()
@@ -286,14 +240,6 @@
     }
     
     /**
-     * @return Returns the users.
-     */
-    public JSPrincipals getUsers()
-    {
-        return users;
-    }
-
-    /**
      * @return Returns the users from old format.
      */
     public JSUsers getOldUsers()
@@ -412,18 +358,6 @@
         this.mimeTypes = mimeTypes;
     }
 
- 
- 
-
-    /**
-     * @param users
-     *            The users to set.
-     */
-    public void setUsers(JSPrincipals users)
-    {
-        this.users = users;
-    }
-
     /**
      * @return Returns the permissions.
      */
@@ -553,26 +487,14 @@
                 {
                     xml.add(g.getOldRoles());
                 }
-                if ( !g.getRoles().isEmpty() )
-                {
-                    xml.add(g.getRoles());
-                }
                 if ( !g.getOldGroups().isEmpty() )
                 {
                     xml.add(g.getOldGroups());
                 }
-                if ( !g.getGroups().isEmpty() )
-                {
-                    xml.add(g.getGroups());
-                }
                 if ( !g.getOldUsers().isEmpty() )
                 {
                     xml.add(g.getOldUsers());
                 }
-                if ( !g.getUsers().isEmpty() )
-                {
-                    xml.add(g.getUsers());
-                }
                 if ( !g.getPrincipals().isEmpty() )
                 {
                     xml.add(g.getPrincipals());
@@ -655,25 +577,7 @@
                         g.oldUsers = (JSUsers) o1;
                     else if (o1 instanceof JSPrincipals)
                     {
-                        JSPrincipals jsps = (JSPrincipals) o1;
-                        String principalType = jsps.getType();
-                        
-                        if (JetspeedPrincipalType.ROLE.equals(principalType))
-                        {
-                            g.roles = jsps;
-                        }
-                        else if (JetspeedPrincipalType.GROUP.equals(principalType))
-                        {
-                            g.groups = jsps;
-                        }
-                        else if (JetspeedPrincipalType.USER.equals(principalType))
-                        {
-                            g.users = jsps;
-                        }
-                        else if (principalType != null && !"".equals(principalType))
-                        {
-                            g.principals = jsps;
-                        }
+                        g.principals = (JSPrincipals) o1;
                     }
                     else if (o1 instanceof JSPrincipalAssociations)
                         g.principalAssociations = (JSPrincipalAssociations) o1;

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java?rev=776703&r1=776702&r2=776703&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java Wed May 20 13:50:58 2009
@@ -22,6 +22,6 @@
 {
     public JSUserAttributes()
     {
-        super();
+        super("preference");
     }
 }



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