portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r683497 [5/7] - in /portals/jetspeed-2/portal/branches/JS2-869: components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/ components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/serializer/ components/jetspeed-...
Date Thu, 07 Aug 2008 03:52:09 GMT
Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java Wed Aug  6 20:52:05 2008
@@ -19,21 +19,21 @@
 import java.lang.reflect.Constructor;
 import java.security.Permission;
 import java.security.Principal;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.prefs.Preferences;
 
 import javax.security.auth.Subject;
 
 import org.apache.commons.logging.Log;
 import org.apache.jetspeed.security.BasePrincipal;
+import org.apache.jetspeed.security.Credential;
 import org.apache.jetspeed.security.FolderPermission;
 import org.apache.jetspeed.security.FragmentPermission;
 import org.apache.jetspeed.security.Group;
 import org.apache.jetspeed.security.GroupManager;
+import org.apache.jetspeed.security.GroupPrincipal;
 import org.apache.jetspeed.security.PagePermission;
 import org.apache.jetspeed.security.PasswordCredential;
 import org.apache.jetspeed.security.PermissionManager;
@@ -41,24 +41,31 @@
 import org.apache.jetspeed.security.PortletPermission;
 import org.apache.jetspeed.security.Role;
 import org.apache.jetspeed.security.RoleManager;
+import org.apache.jetspeed.security.RolePrincipal;
+import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.UserPrincipal;
+import org.apache.jetspeed.security.attributes.SecurityAttribute;
+import org.apache.jetspeed.security.attributes.SecurityAttributes;
+import org.apache.jetspeed.security.om.InternalGroupPrincipal;
 import org.apache.jetspeed.security.om.InternalPermission;
 import org.apache.jetspeed.security.om.InternalPrincipal;
+import org.apache.jetspeed.security.om.InternalRolePrincipal;
+import org.apache.jetspeed.security.om.InternalUserPrincipal;
 import org.apache.jetspeed.security.spi.PasswordCredentialProvider;
 import org.apache.jetspeed.serializer.objects.JSGroup;
-import org.apache.jetspeed.serializer.objects.JSGroups;
+import org.apache.jetspeed.serializer.objects.JSNVPElement;
 import org.apache.jetspeed.serializer.objects.JSNVPElements;
 import org.apache.jetspeed.serializer.objects.JSPermission;
+import org.apache.jetspeed.serializer.objects.JSPermissions;
 import org.apache.jetspeed.serializer.objects.JSRole;
-import org.apache.jetspeed.serializer.objects.JSRoles;
 import org.apache.jetspeed.serializer.objects.JSSnapshot;
 import org.apache.jetspeed.serializer.objects.JSUser;
 import org.apache.jetspeed.serializer.objects.JSUserAttributes;
 import org.apache.jetspeed.serializer.objects.JSUserGroups;
 import org.apache.jetspeed.serializer.objects.JSUserRoles;
 import org.apache.jetspeed.serializer.objects.JSUserUsers;
-import org.apache.jetspeed.serializer.objects.JSUsers;
 
 /**
  * JetspeedSecuritySerializer - Security component serializer
@@ -69,28 +76,27 @@
 public class JetspeedSecuritySerializer extends AbstractJetspeedComponentSerializer
 {
     private static String ENCODING_STRING = "JETSPEED 2.1 - 2006";
-
     private static String JETSPEED = "JETSPEED";
 
-    private static class Refs
+    private static class ImportRefs
     {
-        private HashMap roleMap = new HashMap();
-
-        private HashMap groupMap = new HashMap();
-
-        private HashMap userMap = new HashMap();
-
-        private HashMap permissionMap = new HashMap();
+        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>();
+    }
+    private static class ExportRefs
+    {
+        private HashMap<String, JSRole> roleMap = new HashMap<String, JSRole>();
+        private HashMap<String, JSGroup> groupMap = new HashMap<String, JSGroup>();
+        private HashMap<String, JSUser> userMap = new HashMap<String, JSUser>();
+        private HashMap<String, JSPermission> permissionMap = new HashMap<String, JSPermission>();
     }
 
     protected GroupManager groupManager;
-
     protected RoleManager roleManager;
-
     protected UserManager userManager;
-
     protected PasswordCredentialProvider pcp;
-
     protected PermissionManager pm;
 
     public JetspeedSecuritySerializer(GroupManager groupManager, RoleManager roleManager, UserManager userManager,
@@ -103,39 +109,34 @@
         this.pm = pm;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jetspeed.serializer.JetspeedComponentSerializer#processExport(org.apache.jetspeed.serializer.objects.JSSnapshot,
-     *      java.util.Map, org.apache.commons.logging.Log)
-     */
     protected void processExport(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
     {
         if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_USERS))
         {
-            log.info("collecting users/roles/groups");
-            Refs refs = new Refs();
-            exportRolesGroupsUsers(refs, snapshot, settings, log);
-            if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
+            try
+            {
+                log.info("collecting users/roles/groups");
+                ExportRefs refs = new ExportRefs();
+                exportRolesGroupsUsers(refs, snapshot, settings, log);
+                if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
+                {
+                    log.info("collecting permissions");
+                    exportPermissions(refs, snapshot, settings, log);
+                }
+            }
+            catch (SecurityException se)
             {
-                log.info("collecting permissions");
-                exportPermissions(refs, snapshot, settings, log);
+                throw new SerializerException(se);
             }
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jetspeed.serializer.JetspeedComponentSerializer#processImport(org.apache.jetspeed.serializer.objects.JSSnapshot,
-     *      java.util.Map, org.apache.commons.logging.Log)
-     */
     protected void processImport(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
     {
         if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_USERS))
         {
             log.info("creating users/roles/groups and permissions");
-            Refs refs = new Refs();
+            ImportRefs refs = new ImportRefs();
             recreateRolesGroupsUsers(refs, snapshot, settings, log);
             if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
             {
@@ -152,39 +153,30 @@
             log.info("deleting users/roles/groups and permissions");
             try
             {
-                Iterator _it = pm.getPermissions().iterator();
-                while ( _it.hasNext() )
+                for (InternalPermission ip : pm.getInternalPermissions())
                 {
-                    InternalPermission ip = (InternalPermission)_it.next();
                     Class permissionClass = Class.forName(ip.getClassname());
                     Class[] parameterTypes = { String.class, String.class };
                     Constructor permissionConstructor = permissionClass.getConstructor(parameterTypes);
                     Object[] initArgs = { ip.getName(), ip.getActions() };
                     Permission permission = (Permission) permissionConstructor.newInstance(initArgs);            
                     pm.removePermission(permission);
-                }
-                
+                }                
                 String anonymousUser = userManager.getAnonymousUser();
-                _it = userManager.getUserNames("");
-                while (_it.hasNext())
+                for (String userName : userManager.getUserNames(""))
                 {
-                    String userName = (String)_it.next();
-                    if ( !anonymousUser.equals(userName) )
+                    if (!anonymousUser.equals(userName))
                     {
                         userManager.removeUser((String)userName);
                     }
-                }
-                
-                _it = groupManager.getGroups("");
-                while (_it.hasNext())
+                }                
+                for (Group group : groupManager.getGroups(""))
                 {
-                    groupManager.removeGroup(((Group)_it.next()).getPrincipal().getName());
+                    groupManager.removeGroup(group.getPrincipal().getName());
                 }
-                
-                _it = roleManager.getRoles("");
-                while (_it.hasNext())
+                for (Role role : roleManager.getRoles(""))
                 {
-                    roleManager.removeRole(((Role)_it.next()).getPrincipal().getName());
+                    roleManager.removeRole(role.getPrincipal().getName());
                 }
             }
             catch (Exception e)
@@ -199,21 +191,13 @@
      * 
      * @throws SerializerException
      */
-    private void recreateRolesGroupsUsers(Refs refs, JSSnapshot snapshot, Map settings, Log log)
+    private void recreateRolesGroupsUsers(ImportRefs refs, JSSnapshot snapshot, Map settings, Log log)
             throws SerializerException
     {
         log.debug("recreateRolesGroupsUsers");
-
-        JSGroups groups = null;
-        JSRoles roles = null;
-
-        groups = snapshot.getGroups();
-
-        Iterator _it = groups.iterator();
-        while (_it.hasNext())
+        for (JSGroup jsGroup : snapshot.getGroups())
         {
-            String name = ((JSGroup) _it.next()).getName();
-
+            String name = jsGroup.getName();
             try
             {
                 if (!(groupManager.groupExists(name)))
@@ -230,13 +214,9 @@
         log.debug("recreateGroups - done");
         log.debug("processing roles");
 
-        roles = snapshot.getRoles();
-
-        _it = roles.iterator();
-        while (_it.hasNext())
+        for (JSRole jsRole : snapshot.getRoles())
         {
-            String name = ((JSRole) _it.next()).getName();
-
+            String name = jsRole.getName();
             try
             {
                 if (!(roleManager.roleExists(name)))
@@ -255,15 +235,8 @@
 
         /** determine whether passwords can be reconstructed or not */
         int passwordEncoding = compareCurrentSecurityProvider(snapshot);
-        JSUsers users = null;
-        users = snapshot.getUsers();
-
-        _it = users.iterator();
-        while (_it.hasNext())
+        for (JSUser jsuser : snapshot.getUsers())
         {
-
-            JSUser jsuser = (JSUser) _it.next();
-
             try
             {
                 User user = null;
@@ -296,14 +269,12 @@
                         log.debug("setting userinfo for " + jsuser.getName() + " failed because of "
                                 + e.getLocalizedMessage());
                     }
-
                     // credentials
                     Subject subject = user.getSubject();
-
-                    ArrayList listTemp = jsuser.getPrivateCredentials();
+                    List<Credential> listTemp = jsuser.getPrivateCredentials();
                     if ((listTemp != null) && (listTemp.size() > 0))
                     {
-                        Iterator _itTemp = listTemp.iterator();
+                        Iterator<Credential> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
                             subject.getPrivateCredentials().add(_itTemp.next());
@@ -312,82 +283,66 @@
                     listTemp = jsuser.getPublicCredentials();
                     if ((listTemp != null) && (listTemp.size() > 0))
                     {
-                        Iterator _itTemp = listTemp.iterator();
+                        Iterator<Credential> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
                             subject.getPublicCredentials().add(_itTemp.next());
                         }
                     }
                     JSUserGroups jsUserGroups = jsuser.getGroupString();
+                    List<String> listUserGroups = null;
                     if (jsUserGroups != null)
-                        listTemp = getTokens(jsUserGroups.toString());
-                    else
-                        listTemp = null;
-                    if ((listTemp != null) && (listTemp.size() > 0))
+                        listUserGroups = getTokens(jsUserGroups.toString());
+                    if ((listUserGroups != null) && (listUserGroups.size() > 0))
                     {
-                        Iterator _itTemp = listTemp.iterator();
+                        Iterator<String> _itTemp = listUserGroups.iterator();
                         while (_itTemp.hasNext())
                         {
                             groupManager.addUserToGroup(jsuser.getName(), (String) _itTemp.next());
                         }
                     }
                     JSUserRoles jsUserRoles = jsuser.getRoleString();
+                    List<String> listUserRoles = null;
                     if (jsUserRoles != null)
-                        listTemp = getTokens(jsUserRoles.toString());
+                        listUserRoles = getTokens(jsUserRoles.toString());
                     else
-                        listTemp = null;
-                    if ((listTemp != null) && (listTemp.size() > 0))
+                        listUserRoles = null;
+                    if ((listUserRoles != null) && (listUserRoles.size() > 0))
                     {
-                        Iterator _itTemp = listTemp.iterator();
+                        Iterator<String> _itTemp = listUserRoles.iterator();
                         while (_itTemp.hasNext())
                         {
                             roleManager.addRoleToUser(jsuser.getName(), (String) _itTemp.next());
                         }
                     }
-
-                    // TODO: the JSNVPElements class doesn't support/use Preferences anymore
-                    //       because of its dual usage for PortletPreferences as well
-                    //       goto break these two usages apart and provide separate implementations
-                    // NOTE: JSVNPElements is't very well implemented anyway (doesn't seem to be able to handle multi-value elements...)                    
-/*                    
-                    
                     JSUserAttributes attributes = jsuser.getUserInfo();
-
                     if (attributes != null)
                     {
-                        Preferences userAttributes = user.getUserAttributes();
-                        HashMap map = attributes.getMyMap();
-                        if (map != null)
+                        Map <String, SecurityAttribute> userInfo = user.getAttributes().getAttributes(SecurityAttributes.USER_INFORMATION);
+                        List<JSNVPElement> values = attributes.getValues();
+                        if (values != null)
                         {
-                            Iterator _itTemp = map.keySet().iterator();
-                            while (_itTemp.hasNext())
+                            for (JSNVPElement element : values)
                             {
-                                String userAttrName = (String) _itTemp.next();
-                                // if ( userAttributes.get(userAttrName,
-                                // "").equals("")
-                                String userAttrValue = (String) map.get(userAttrName);
-                                userAttributes.put(userAttrName, userAttrValue);
+                                userInfo.put(element.getKey(), user.getAttributes().createUserInformation(element.getKey(), element.getValue()));
                             }
                         }
-
-                    }
-                    
-                    JSNVPElements jsNVP = jsuser.getPreferences();
-
-                    if ((jsNVP != null) && (jsNVP.getMyMap() != null))
-                    {
-                        Preferences preferences = user.getPreferences();
-                        Iterator _itTemp = jsNVP.getMyMap().keySet().iterator();
-                        while (_itTemp.hasNext())
+                    }                    
+                    JSNVPElements jsNVP = jsuser.getSecurityAttributes();
+                    if ((jsNVP != null) && (jsNVP.getValues() != null))
+                    {
+                        Map <String, SecurityAttribute> otherAttrib = user.getAttributes().getAttributes(SecurityAttributes.SECURITY_ATTRIBUTE);
+                        List<JSNVPElement> values = jsNVP.getValues();
+                        if (values != null)
                         {
-                            String prefKey = (String) _itTemp.next();
-                            String prefValue = (String) (jsNVP.getMyMap().get(prefKey));
-                            preferences.put(prefKey, prefValue);
-                        }
+                            for (JSNVPElement element : values)
+                            {
+                                otherAttrib.put(element.getKey(), user.getAttributes().createUserInformation(element.getKey(), element.getValue()));
+                            }
+                        }                        
                     }
-*/
-                    refs.userMap.put(jsuser.getName(), getUserPrincipal(user));
-
+                    refs.userMap.put(jsuser.getName(), user.getUserPrincipal());
+                    userManager.updateUser(user);
                 }
             }
             catch (Exception e)
@@ -405,39 +360,34 @@
      * 
      * @throws SerializerException
      */
-    private void recreatePermissions(Refs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    private void recreatePermissions(ImportRefs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException
     {
         log.debug("recreatePermissions - started");
-
-        Iterator list = null;
+        JSPermissions permissionList = null ;
         try
         {
-            list = snapshot.getPermissions().iterator();
+            permissionList = snapshot.getPermissions();
         }
         catch (Exception e)
         {
             throw new SerializerException(SerializerException.GET_EXISTING_OBJECTS.create(new String[] { "Permissions",
                     e.getMessage() }));
         }
-
-        while (list.hasNext())
+        for (JSPermission jsPermission : permissionList)
         {
-            JSPermission _js = (JSPermission) list.next();
-            PortalResourcePermission perm = getPermissionForType(_js);
+            PortalResourcePermission perm = getPermissionForType(jsPermission);
             if ((perm != null) && (perm instanceof PortalResourcePermission) && !pm.permissionExists(perm))
             {
                 try
                 {
                     pm.addPermission(perm);
-                    ArrayList listTemp = null;
-                    JSUserGroups jsUserGroups = _js.getGroupString();
+                    List<String> listTemp = null;
+                    JSUserGroups jsUserGroups = jsPermission.getGroupString();
                     if (jsUserGroups != null)
                         listTemp = getTokens(jsUserGroups.toString());
-                    else
-                        listTemp = null;
                     if ((listTemp != null) && (listTemp.size() > 0))
                     {
-                        Iterator _itTemp = listTemp.iterator();
+                        Iterator<String> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
                             Principal p = (Principal) refs.groupMap.get((String) _itTemp.next());
@@ -445,14 +395,14 @@
                                 pm.grantPermission(p, perm);
                         }
                     }
-                    JSUserRoles jsUserRoles = _js.getRoleString();
+                    JSUserRoles jsUserRoles = jsPermission.getRoleString();
                     if (jsUserRoles != null)
                         listTemp = getTokens(jsUserRoles.toString());
                     else
                         listTemp = null;
                     if ((listTemp != null) && (listTemp.size() > 0))
                     {
-                        Iterator _itTemp = listTemp.iterator();
+                        Iterator<String> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
                             Principal p = (Principal) refs.roleMap.get((String) _itTemp.next());
@@ -460,14 +410,14 @@
                                 pm.grantPermission(p, perm);
                         }
                     }
-                    JSUserUsers jsUserUsers = _js.getUserString();
+                    JSUserUsers jsUserUsers = jsPermission.getUserString();
                     if (jsUserUsers != null)
                         listTemp = getTokens(jsUserUsers.toString());
                     else
                         listTemp = null;
                     if ((listTemp != null) && (listTemp.size() > 0))
                     {
-                        Iterator _itTemp = listTemp.iterator();
+                        Iterator<String> _itTemp = listTemp.iterator();
                         while (_itTemp.hasNext())
                         {
                             Principal p = (Principal) refs.userMap.get((String) _itTemp.next());
@@ -561,51 +511,24 @@
         return new String(savedPassword);
     }
 
-    private Principal getUserPrincipal(User user)
-    {
-        Subject subject = user.getSubject();
-        // get the user principal
-        Set principals = subject.getPrincipals();
-        Iterator list = principals.iterator();
-        while (list.hasNext())
-        {
-            BasePrincipal principal = (BasePrincipal) list.next();
-            String path = principal.getFullPath();
-            if (path.startsWith("/user/"))
-                return principal;
-        }
-        return null;
-    }
-
+ 
     /**
      * Collect all the roles, groups and users from the current environment.
      * Include the current SecurityProvider to understand, whether the password
      * collected can be used upon import
      * 
      * @throws SerializerException
+     * @throws SecurityException 
      */
-    private void exportRolesGroupsUsers(Refs refs, JSSnapshot snapshot, Map settings, Log log)
-            throws SerializerException
+    private void exportRolesGroupsUsers(ExportRefs refs, JSSnapshot snapshot, Map settings, Log log)
+            throws SerializerException, SecurityException
     {
         /** set the security provider info in the snapshot file */
         snapshot.setEncryption(getEncryptionString());
-        /** get the roles */
-
-        Iterator list = null;
-        try
-        {
-            list = roleManager.getRoles("");
-        }
-        catch (Exception e)
-        {
-            throw new SerializerException(SerializerException.GET_EXISTING_OBJECTS.create(new String[] { "Role",
-                    e.getMessage() }));
-        }
-        while (list.hasNext())
+        for (Role role : roleManager.getRoles(""))
         {
             try
             {
-                Role role = (Role) list.next();
                 JSRole _tempRole = (JSRole) getObjectBehindPrinicpal(refs.roleMap,
                         (BasePrincipal) (role.getPrincipal()));
                 if (_tempRole == null)
@@ -622,23 +545,11 @@
                         "Role", e.getMessage() }));
             }
         }
-
-        /** get the groups */
-        try
-        {
-            list = groupManager.getGroups("");
-        }
-        catch (Exception e)
-        {
-            throw new SerializerException(SerializerException.GET_EXISTING_OBJECTS.create(new String[] { "Group",
-                    e.getMessage() }));
-        }
-        while (list.hasNext())
+        for (Group group : groupManager.getGroups(""))
         {
 
             try
             {
-                Group group = (Group) list.next();
                 JSGroup _tempGroup = (JSGroup) getObjectBehindPrinicpal(refs.groupMap, (BasePrincipal) (group
                         .getPrincipal()));
                 if (_tempGroup == null)
@@ -656,23 +567,11 @@
             }
         }
 
-        /** users */
-        try
-        {
-            list = userManager.getUsers("");
-        }
-        catch (Exception e)
+        for (User user : userManager.getUsers(""))
         {
-            throw new SerializerException(SerializerException.GET_EXISTING_OBJECTS.create(new String[] { "User",
-                    e.getMessage() }));
-        }
-        while (list.hasNext())
-        {
-
             try
             {
-                User _user = (User) list.next();
-                JSUser _tempUser = createJSUser(refs, _user);
+                JSUser _tempUser = createJSUser(refs, user);
                 refs.userMap.put(_tempUser.getName(), _tempUser);
                 snapshot.getUsers().add(_tempUser);
             }
@@ -692,81 +591,50 @@
      * 
      * @throws SerializerException
      */
-    private void exportPermissions(Refs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    private void exportPermissions(ExportRefs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException, SecurityException
     {
-        Object o = null;
-
-        Iterator list = null;
-        try
-        {
-            list = pm.getPermissions().iterator();
-        }
-        catch (Exception e)
-        {
-            throw new SerializerException(SerializerException.GET_EXISTING_OBJECTS.create(new String[] { "Permissions",
-                    e.getMessage() }));
-        }
-
-        while (list.hasNext())
+        for (InternalPermission p : pm.getInternalPermissions())
         {
             try
             {
                 JSPermission _js = new JSPermission();
-
-                InternalPermission p = (InternalPermission) list.next();
                 _js.setResource(p.getName());
                 _js.setActions(p.getActions());
                 _js.setId(p.getPermissionId());
                 _js.setType(_js.getTypeForClass(p.getClassname()));
 
-                Iterator list2 = p.getPrincipals().iterator();
+                Iterator<InternalPrincipal> list2 = p.getPrincipals().iterator();
                 while (list2.hasNext())
                 {
-                    o = list2.next();
+                    InternalPrincipal o = list2.next();
                     InternalPrincipal principal = (InternalPrincipal) o;
-                    String path = principal.getFullPath();
-                    if (path.startsWith("/role/"))
+                    if (principal.getType().equals(InternalRolePrincipal.ROLE_TYPE))
                     {
-                        JSRole _tempRole = (JSRole) this.getObjectBehindPath(refs.roleMap, removeFromString(path,
-                                "/role/"));
+                        JSRole _tempRole = (JSRole) this.getObjectBehindPath(refs.roleMap, principal.getName());
                         if (_tempRole != null)
                         {
                             _js.addRole(_tempRole);
                         }
-
                     }
-                    else
+                    else if (principal.getType().equals(InternalGroupPrincipal.GROUP_TYPE))
                     {
-                        if (path.startsWith("/group/"))
+                        JSGroup _tempGroup = (JSGroup) this.getObjectBehindPath(refs.groupMap, principal.getName());
+                        if (_tempGroup != null)
                         {
-                            JSGroup _tempGroup = (JSGroup) this.getObjectBehindPath(refs.groupMap, removeFromString(
-                                    path, "/group/"));
-                            if (_tempGroup != null)
-                            {
-                                _js.addGroup(_tempGroup);
-                            }
-
+                            _js.addGroup(_tempGroup);
                         }
-                        else
+                    }
+                    else if (principal.getType().equals(InternalUserPrincipal.USER_TYPE))
+                    {
+                        JSUser _tempUser = (JSUser) this.getObjectBehindPath(refs.userMap, principal.getName());
+                        if (_tempUser != null)
                         {
-                            if (path.startsWith("/user/"))
-                            {
-                                JSUser _tempUser = (JSUser) this.getObjectBehindPath(refs.userMap, removeFromString(
-                                        path, "/user/"));
-                                if (_tempUser != null)
-                                {
-                                    _js.addUser(_tempUser);
-                                }
-
-                            }
-
+                            _js.addUser(_tempUser);
                         }
-
                     }
                 }
                 refs.permissionMap.put(_js.getType(), _js);
                 snapshot.getPermissions().add(_js);
-
             }
             catch (Exception e)
             {
@@ -774,8 +642,6 @@
                         "Permissions", e.getMessage() }));
             }
         }
-        return;
-
     }
 
     /**
@@ -786,9 +652,9 @@
      * @return
      */
 
-    private Object getObjectBehindPrinicpal(Map map, BasePrincipal _principal)
+    private Object getObjectBehindPrinicpal(Map map, BasePrincipal principal)
     {
-        return getObjectBehindPath(map, _principal.getFullPath());
+        return getObjectBehindPath(map, principal.getName());
     }
 
     /**
@@ -848,7 +714,7 @@
      *            the credential object
      */
 
-    private void addJSUserCredentials(boolean isPublic, JSUser newUser, Object credential)
+    private void addJSUserCredentials(boolean isPublic, JSUser newUser, Credential credential)
     {
         if (credential == null)
             return;
@@ -871,19 +737,13 @@
      * @param user
      * @return a new JSUser object
      */
-    private JSUser createJSUser(Refs refs, User user)
+    private JSUser createJSUser(ExportRefs refs, User user)
     {
         JSUser _newUser = new JSUser();
-
         Subject subject = user.getSubject();
-        // get the user principal
-        Set principals = subject.getPrincipals();
-        Iterator list = principals.iterator();
-        while (list.hasNext())
-        {
-            BasePrincipal principal = (BasePrincipal) list.next();
-            String path = principal.getFullPath();
-            if (path.startsWith("/role/"))
+        for (Principal principal : subject.getPrincipals())
+        {
+            if (principal instanceof RolePrincipal)
             {
                 JSRole _tempRole = (JSRole) this.getObjectBehindPath(refs.roleMap, principal.getName());
                 if (_tempRole != null)
@@ -892,46 +752,31 @@
                 }
 
             }
-            else
+            else if (principal instanceof GroupPrincipal)
             {
-                if (path.startsWith("/group/"))
+                JSGroup _tempGroup = (JSGroup) this.getObjectBehindPath(refs.groupMap, principal.getName());
+                if (_tempGroup != null)
                 {
-                    JSGroup _tempGroup = (JSGroup) this.getObjectBehindPath(refs.groupMap, principal.getName());
-                    if (_tempGroup != null)
-                    {
-                        _newUser.addGroup(_tempGroup);
-                    }
-
+                    _newUser.addGroup(_tempGroup);
                 }
-                else if (path.startsWith("/user/"))
-                    _newUser.setPrincipal(principal);
-
             }
-
+            else if (principal instanceof UserPrincipal)
+            {
+                _newUser.setPrincipal(principal);
+            }
         }
-        // System.out.println("User Public Credentials");
-        Set credentials = subject.getPublicCredentials();
-        list = credentials.iterator();
-        while (list.hasNext())
+        for (Object o : subject.getPublicCredentials())
         {
-            Object credential = list.next();
+            Credential credential = (Credential)o;
             addJSUserCredentials(true, _newUser, credential);
         }
-        // System.out.println("User Private Credentials");
-        credentials = subject.getPrivateCredentials();
-        list = credentials.iterator();
-        while (list.hasNext())
+        for (Object o : subject.getPrivateCredentials())
         {
-            Object credential = list.next();
+            Credential credential = (Credential)o;
             addJSUserCredentials(false, _newUser, credential);
         }
-
-        Preferences preferences = user.getPreferences();
-        _newUser.setPreferences(preferences);
-        preferences = user.getUserAttributes();
-        _newUser.setUserInfo(preferences);
-        // TODO: HJB, fix preferences...userinfo doesn't return values in
-        // prefs_property_value (in fact preferences.keys() is []
+        _newUser.setSecurityAttributes(user.getAttributes().getAttributes(SecurityAttributes.SECURITY_ATTRIBUTE));
+        _newUser.setUserInfo(user.getAttributes().getAttributes(SecurityAttributes.USER_INFORMATION));
         return _newUser;
     }
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAggregationHierarchy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAggregationHierarchy.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAggregationHierarchy.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAggregationHierarchy.java Wed Aug  6 20:52:05 2008
@@ -45,8 +45,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        ums = new UserManagerImpl(securityProvider, new AggregationHierarchyResolver(),
-                new AggregationHierarchyResolver());
+        ums = new UserManagerImpl(securityProvider, sap, new AggregationHierarchyResolver(rsh, gsh));               
     }
 
     /**

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAuthenticationProviderProxy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAuthenticationProviderProxy.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAuthenticationProviderProxy.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAuthenticationProviderProxy.java Wed Aug  6 20:52:05 2008
@@ -76,9 +76,9 @@
 
         // Need to override the AbstractSecurityTestcase behavior.
         securityProvider = new SecurityProviderImpl(atnProviderProxy, rsh, gsh, smh);
-        ums = new UserManagerImpl(securityProvider);
-        gms = new GroupManagerImpl(securityProvider);
-        rms = new RoleManagerImpl(securityProvider);
+        ums = new UserManagerImpl(securityProvider, sap);
+        gms = new GroupManagerImpl(securityProvider, sap);
+        rms = new RoleManagerImpl(securityProvider, sap);
 
         // Login module.
         new LoginModuleProxyImpl(ums);
@@ -133,7 +133,7 @@
             assertFalse(ums.authenticate("anonuser3", "pword"));
 
             // Get all users. 5 rdbms users + 3 ldap users.
-            Iterator users = ums.getUsers("");
+            Iterator users = ums.getUsers("").iterator();
             int count = 0;
             while (users.hasNext())
             {
@@ -266,7 +266,7 @@
         //before we adding users make sure we know how mnay we have
         try
         {
-	        Iterator it = ums.getUsers("");
+	        Iterator it = ums.getUsers("").iterator();
 	        userCount = 0;
 	        while (it.hasNext())
 	        {
@@ -327,7 +327,7 @@
     {
         try
         {
-            Iterator userIter = ums.getUsers("");
+            Iterator userIter = ums.getUsers("").iterator();
             User user;
             String userName;
             while (userIter.hasNext())

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGeneralizationHierarchy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGeneralizationHierarchy.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGeneralizationHierarchy.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGeneralizationHierarchy.java Wed Aug  6 20:52:05 2008
@@ -43,7 +43,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        ums = new UserManagerImpl(securityProvider, new GeneralizationHierarchyResolver(), new GeneralizationHierarchyResolver());
+        ums = new UserManagerImpl(securityProvider, sap, new GeneralizationHierarchyResolver(rsh, gsh));
     }
    
     /**

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java Wed Aug  6 20:52:05 2008
@@ -19,7 +19,6 @@
 import java.security.Principal;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.prefs.Preferences;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -269,11 +268,6 @@
         assertNotNull("group principal is null", groupPrincipal);
         assertEquals("expected group principal full path == testgetgroup", "testgetgroup", groupPrincipal.getName());
 
-        // Test the Group Preferences.
-        Preferences preferences = group.getPreferences();
-        assertEquals("expected group node == /group/testgetgroup", SecurityHelper
-                .getPreferencesFullPath(groupPrincipal), preferences.absolutePath());
-
         // Cleanup test.
         try
         {
@@ -475,7 +469,7 @@
     {
     	int groupCount = 0;
     	int groupAdded = 0;
-        Iterator it = gms.getGroups("");
+        Iterator it = gms.getGroups("").iterator();
         while (it.hasNext())
         {
             Group group = (Group) it.next();
@@ -489,7 +483,7 @@
         gms.addGroup("g3");
         groupAdded = 3;
         int count = 0;
-        it = gms.getGroups("");
+        it = gms.getGroups("").iterator();
         while (it.hasNext())
         {
             Group group = (Group) it.next();

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java Wed Aug  6 20:52:05 2008
@@ -271,11 +271,6 @@
         assertNotNull("role principal is null", rolePrincipal);
         assertEquals("expected role principal full path name == testgetrole", "testgetrole", rolePrincipal.getName());
 
-        // Test the Role Preferences.
-        Preferences preferences = role.getPreferences();
-        assertEquals("expected role node == /role/testgetrole", SecurityHelper.getPreferencesFullPath(rolePrincipal),
-                preferences.absolutePath());
-
         // Cleanup test.
         try
         {
@@ -607,7 +602,7 @@
     {
     	int roleCount = 0;
     	int rolesAdded = 0;
-        Iterator it = rms.getRoles("");
+        Iterator it = rms.getRoles("").iterator();
         while (it.hasNext())
         {
             it.next();
@@ -622,7 +617,7 @@
 
         int count = 0;
         
-        it = rms.getRoles("");
+        it = rms.getRoles("").iterator();
         while (it.hasNext())
         {
             it.next();

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestUserManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestUserManager.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestUserManager.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestUserManager.java Wed Aug  6 20:52:05 2008
@@ -139,13 +139,7 @@
         // Asset user principal.
         Principal userPrincipal = SecurityHelper.getPrincipal(subject, UserPrincipal.class);
         assertNotNull("user principal is null", userPrincipal);
-        assertEquals("expected user principal full path == /user/test", "/user/test", SecurityHelper
-                .getPreferencesFullPath(userPrincipal));
         assertEquals("expected user principal name == test", "test", userPrincipal.getName());
-
-        // Test the User Preferences.
-        Preferences preferences = user.getPreferences();
-        assertEquals("expected user node == /user/test", "/user/test", preferences.absolutePath());
         
         // Test if roles are inheritable to a user via groups
         try
@@ -359,7 +353,7 @@
         ums.addUser("two", "two-pw");
         ums.addUser("three", "three-pw");
         int count = 0;
-        Iterator it = ums.getUsers("");
+        Iterator it = ums.getUsers("").iterator();
         while (it.hasNext())
         {
             User user = (User) it.next();

Added: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/attributes/TestSecurityAttributes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/attributes/TestSecurityAttributes.java?rev=683497&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/attributes/TestSecurityAttributes.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/attributes/TestSecurityAttributes.java Wed Aug  6 20:52:05 2008
@@ -0,0 +1,122 @@
+package org.apache.jetspeed.security.attributes;
+
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.jetspeed.security.UserPrincipal;
+import org.apache.jetspeed.security.impl.UserPrincipalImpl;
+import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
+
+
+public class TestSecurityAttributes extends AbstractSecurityTestcase
+{
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new TestSuite(TestSecurityAttributes.class);
+    }
+    
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+    
+    public void testAdding() throws Exception
+    {
+// ADD THIS BACK IN once the User stuff is sorted out (removing path)         
+//        System.out.println("test adding stuff");
+//        if (!ums.userExists("david"))
+//        {        
+//            ums.addUser("david", "secret");
+//        }
+//        User david = ums.getUser("david");        
+        SecurityAttributesProvider sap = (SecurityAttributesProvider)scm.getComponent("SecurityAttributesProvider");
+        assertNotNull(sap);
+
+        UserPrincipal user = new UserPrincipalImpl(1, "david");
+        
+        // create 3 attributes
+        SecurityAttributes sa = sap.createSecurityAttributes(user);
+        Map<String,SecurityAttribute> attributes = sa.getAttributes();
+        attributes.put("one", sa.createAttribute("one", "1000.one.1"));
+        attributes.put("two", sa.createAttribute("two", "2000.two.2"));        
+        attributes.put("three", sa.createAttribute("three", "3000.three.3"));        
+        sap.saveAttributes(sa);
+        
+        // retrieve them and assert
+        sa = sap.retrieveAttributes(user);
+        int count = 0;
+        for (String key : sa.getAttributes().keySet())
+        {
+            SecurityAttribute a = sa.getAttributes().get(key);
+            assertTrue(a.getType().equals(SecurityAttributes.SECURITY_ATTRIBUTE));
+            if (key.equals("one"))
+            {
+                assertTrue(a.getValue().equals("1000.one.1"));
+                count++;
+            }
+            else if (key.equals("two"))
+            {
+                assertTrue(a.getValue().equals("2000.two.2"));
+                count++;
+            }
+            else if (key.equals("three"))
+            {
+                assertTrue(a.getValue().equals("3000.three.3"));
+                count++;
+            }            
+        }
+        assertTrue(count == 3);
+         
+        // tests  2 adds and 1 remove, 1 update
+        attributes = sa.getAttributes();
+        attributes.put("four", sa.createAttribute("four", "4000.four.4"));
+        attributes.put("five", sa.createAttribute("five", "5000.five.5"));
+        attributes.put("three", sa.createAttribute("three", "MOD-3"));        
+        attributes.remove("two");
+        sap.saveAttributes(sa);
+
+        // assert
+        count = 0;
+        sa = sap.retrieveAttributes(user);
+        for (String key : sa.getAttributes().keySet())
+        {
+            SecurityAttribute a = sa.getAttributes().get(key);
+            assertTrue(a.getType().equals("attribute"));
+            if (key.equals("one"))
+            {
+                assertTrue(a.getValue().equals("1000.one.1"));
+                count++;
+            }
+            else if (key.equals("two"))
+            {
+                assertTrue(false); // fail out, should not be here
+            }
+            else if (key.equals("three"))
+            {
+                assertTrue(a.getValue().equals("MOD-3"));
+                count++;
+            }
+            else if (key.equals("four"))
+            {
+                assertTrue(a.getValue().equals("4000.four.4"));
+                count++;
+            }            
+            else if (key.equals("five"))
+            {
+                assertTrue(a.getValue().equals("5000.five.5"));
+                count++;
+            }            
+        }
+        assertTrue(count == 4);
+        
+        // delete and assert deleted
+        sap.deleteAttributes(user);        
+        sa = sap.retrieveAttributes(user);
+        assertTrue(sa.getAttributes().size() == 0);
+        
+        
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestCredentialPasswordEncoder.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestCredentialPasswordEncoder.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestCredentialPasswordEncoder.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestCredentialPasswordEncoder.java Wed Aug  6 20:52:05 2008
@@ -81,7 +81,7 @@
                     "password", 0, DefaultPasswordCredentialImpl.class.getName());
         credentials.add(credential);
         internalUser.setCredentials(credentials);
-        securityAccess.setInternalUserPrincipal(internalUser,false);
+        securityAccess.storeInternalUserPrincipal(internalUser,false);
     }
 
     protected void destroyUser() throws Exception

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestPasswordExpirationAndMaxAuthenticationFailuresInterceptor.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestPasswordExpirationAndMaxAuthenticationFailuresInterceptor.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestPasswordExpirationAndMaxAuthenticationFailuresInterceptor.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestPasswordExpirationAndMaxAuthenticationFailuresInterceptor.java Wed Aug  6 20:52:05 2008
@@ -92,7 +92,7 @@
     
     protected void updateCredential() throws Exception
     {
-        securityAccess.setInternalUserPrincipal(internalUser,false);
+        securityAccess.storeInternalUserPrincipal(internalUser,false);
     }
 
     protected void destroyUser() throws Exception

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/LdapDataHelper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/LdapDataHelper.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/LdapDataHelper.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/LdapDataHelper.java Wed Aug  6 20:52:05 2008
@@ -58,13 +58,13 @@
     public static void seedGroupData(String gpUid) throws Exception
     {
         GroupPrincipal gp = new GroupPrincipalImpl(gpUid);
-        grHandler.setGroupPrincipal(gp);
+        grHandler.storeGroupPrincipal(gp);
     }
     
     public static void seedRoleData(String roleUid) throws Exception
     {
         RolePrincipal rp = new RolePrincipalImpl(roleUid);
-        roleHandler.setRolePrincipal(rp);
+        roleHandler.storeRolePrincipal(rp);
     }
     
     public static void removeUserData(String uid) throws Exception

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapGroupSecurityHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapGroupSecurityHandler.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapGroupSecurityHandler.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapGroupSecurityHandler.java Wed Aug  6 20:52:05 2008
@@ -51,12 +51,12 @@
      */
     public void testGetGroupPrincipal() throws Exception
     {
-        String fullPath = (new GroupPrincipalImpl(gpUid1)).getFullPath();
+        String fullPath = (new GroupPrincipalImpl(gpUid1)).getName();
         //GroupPrincipal groupPrincipal = grHandler.getGroupPrincipal(fullPath);
         GroupPrincipal groupPrincipal = grHandler.getGroupPrincipal(gpUid1);
         assertNotNull("Group was not found.", groupPrincipal);
         assertEquals(gpUid1,groupPrincipal.getName());
-        assertEquals(fullPath,groupPrincipal.getFullPath());
+        assertEquals(fullPath,groupPrincipal.getName());
     }
 
     /**
@@ -64,7 +64,7 @@
      */
     public void testAddDuplicateGroupPrincipal() throws Exception
     {
-        grHandler.setGroupPrincipal(new GroupPrincipalImpl(gpUid1));
+        grHandler.storeGroupPrincipal(new GroupPrincipalImpl(gpUid1));
         List groups = grHandler.getGroupPrincipals("");
         assertEquals(1,groups.size());
     }
@@ -85,7 +85,7 @@
     {
         GroupPrincipal gp = new GroupPrincipalImpl(gpUid1);
         grHandler.removeGroupPrincipal(gp);
-        GroupPrincipal groupPrincipal = grHandler.getGroupPrincipal(gp.getFullPath());
+        GroupPrincipal groupPrincipal = grHandler.getGroupPrincipal(gp.getName());
         assertNull("Group was found and should have been removed.", groupPrincipal);
         List groups = grHandler.getGroupPrincipals("");
         assertEquals(0,groups.size());        
@@ -114,14 +114,14 @@
             assertTrue("getUserPrincipals should have returned more than one user.", grHandler.getGroupPrincipals("*")
                     .size() > 1);
 
-            String fullPath = (new GroupPrincipalImpl(gpUid1)).getFullPath();
+            String fullPath = (new GroupPrincipalImpl(gpUid1)).getName();
             List groups = grHandler.getGroupPrincipals(fullPath);
             assertTrue("getGroupPrincipals should have returned one group.", groups.size() == 1);
             assertTrue("List should have consisted of GroupPrincipal objects.", groups.get(0) instanceof GroupPrincipal);
 
             String localUid = Integer.toString(rand.nextInt()).toString();
             assertTrue("getGroupPrincipals should not have found any groups with the specified filter.", grHandler
-                    .getGroupPrincipals(new GroupPrincipalImpl(localUid).getFullPath()).isEmpty());
+                    .getGroupPrincipals(new GroupPrincipalImpl(localUid).getName()).isEmpty());
         }
         finally
         {

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapRoleSecurityHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapRoleSecurityHandler.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapRoleSecurityHandler.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapRoleSecurityHandler.java Wed Aug  6 20:52:05 2008
@@ -51,11 +51,11 @@
      */
     public void testGetRolePrincipal() throws Exception
     {
-        String fullPath = (new RolePrincipalImpl(roleUid1)).getFullPath();
+        String fullPath = (new RolePrincipalImpl(roleUid1)).getName();
         RolePrincipal rolePrincipal = roleHandler.getRolePrincipal(roleUid1);
         assertNotNull("Role was not found.", rolePrincipal);
         assertEquals(roleUid1,rolePrincipal.getName());
-        assertEquals(fullPath,rolePrincipal.getFullPath());
+        assertEquals(fullPath,rolePrincipal.getName());
     }
 
     /**
@@ -63,7 +63,7 @@
      */
     public void testAddDuplicateRolePrincipal() throws Exception
     {
-    	roleHandler.setRolePrincipal(new RolePrincipalImpl(roleUid1));
+    	roleHandler.storeRolePrincipal(new RolePrincipalImpl(roleUid1));
         List roles = roleHandler.getRolePrincipals("");
         assertEquals(1,roles.size());
     }
@@ -84,7 +84,7 @@
     {
         RolePrincipal gp = new RolePrincipalImpl(roleUid1);
         roleHandler.removeRolePrincipal(gp);
-        RolePrincipal rolePrincipal = roleHandler.getRolePrincipal(gp.getFullPath());
+        RolePrincipal rolePrincipal = roleHandler.getRolePrincipal(gp.getName());
         assertNull("Role was found and should have been removed.", rolePrincipal);
         List roles = roleHandler.getRolePrincipals("");
         assertEquals(0,roles.size());        
@@ -113,14 +113,14 @@
             assertTrue("getUserPrincipals should have returned more than one user.", roleHandler.getRolePrincipals("*")
                     .size() > 1);
 
-            String fullPath = (new RolePrincipalImpl(roleUid1)).getFullPath();
+            String fullPath = (new RolePrincipalImpl(roleUid1)).getName();
             List roles = roleHandler.getRolePrincipals(fullPath);
             assertTrue("getRolePrincipals should have returned one role.", roles.size() == 1);
             assertTrue("List should have consisted of RolePrincipal objects.", roles.get(0) instanceof RolePrincipal);
 
             String localUid = Integer.toString(rand.nextInt()).toString();
             assertTrue("getRolePrincipals should not have found any roles with the specified filter.", roleHandler
-                    .getRolePrincipals(new RolePrincipalImpl(localUid).getFullPath()).isEmpty());
+                    .getRolePrincipals(new RolePrincipalImpl(localUid).getName()).isEmpty());
         }
         finally
         {

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java Wed Aug  6 20:52:05 2008
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.serializer;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -80,13 +81,13 @@
      *            Strinbg containing one or more elements seperated by ','
      * @return list of elements of null
      */
-    protected static final ArrayList getTokens(String _line)
+    protected static final List<String> getTokens(String _line)
     {
         if ((_line == null) || (_line.length() == 0))
             return null;
 
         StringTokenizer st = new StringTokenizer(_line, ",");
-        ArrayList list = new ArrayList();
+        List<String> list = new ArrayList<String>();
 
         while (st.hasMoreTokens())
             list.add(st.nextToken());

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSApplications.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSApplications.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSApplications.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSApplications.java Wed Aug  6 20:52:05 2008
@@ -24,6 +24,7 @@
  * @author hajo
  *
  */
-public class JSApplications extends ArrayList
+public class JSApplications extends ArrayList<JSApplication>
 {
+    private static final long serialVersionUID = 6703801953798849348L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSCapabilities.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSCapabilities.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSCapabilities.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSCapabilities.java Wed Aug  6 20:52:05 2008
@@ -27,6 +27,7 @@
  * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
  * @version $Id: $
  */
-public class JSCapabilities extends ArrayList
+public class JSCapabilities extends ArrayList<JSCapability>
 {
+    private static final long serialVersionUID = 4342279175193989562L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSClients.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSClients.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSClients.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSClients.java Wed Aug  6 20:52:05 2008
@@ -28,6 +28,7 @@
 * @version $Id: $
 */
 
-public class JSClients extends ArrayList
+public class JSClients extends ArrayList<JSClient>
 {
+    private static final long serialVersionUID = -4112833259762462264L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSGroups.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSGroups.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSGroups.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSGroups.java Wed Aug  6 20:52:05 2008
@@ -28,6 +28,7 @@
 * @version $Id: $
 */
 
-public class JSGroups extends ArrayList
+public class JSGroups extends ArrayList<JSGroup>
 {
+    private static final long serialVersionUID = -6568194951545408326L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMediaTypes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMediaTypes.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMediaTypes.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMediaTypes.java Wed Aug  6 20:52:05 2008
@@ -27,6 +27,7 @@
 * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
 * @version $Id: $
 */
-public class JSMediaTypes extends ArrayList
+public class JSMediaTypes extends ArrayList<JSMediaType>
 {
+    private static final long serialVersionUID = 1980446521894054025L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMimeTypes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMimeTypes.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMimeTypes.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMimeTypes.java Wed Aug  6 20:52:05 2008
@@ -27,6 +27,7 @@
 * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
 * @version $Id: $
 */
-public class JSMimeTypes extends ArrayList
+public class JSMimeTypes extends ArrayList<JSMimeType>
 {
+    private static final long serialVersionUID = -3255090433022941285L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java Wed Aug  6 20:52:05 2008
@@ -26,18 +26,20 @@
  */
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.prefs.Preferences;
+import java.util.Map;
 
 import javolution.xml.XMLFormat;
 import javolution.xml.sax.Attributes;
 import javolution.xml.stream.XMLStreamException;
 
 import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.jetspeed.security.attributes.SecurityAttribute;
+import org.apache.jetspeed.security.attributes.SecurityAttributes;
 
 public class JSNameValuePairs
 {
 
-    private HashMap myMap = new HashMap();
+    private Map<String, String> myMap = new HashMap<String, String>();
 
     public int size()
     {
@@ -49,7 +51,7 @@
     }
     
  
-    public HashMap getMyMap()
+    public Map<String, String> getMyMap()
 	{
 		return myMap;
 	}
@@ -62,19 +64,17 @@
 	/**
      * @param arg0
      */
-    public JSNameValuePairs(Preferences preferences)
+    public JSNameValuePairs(SecurityAttributes attributes)
     {
         try
         {
-            String[] strings = preferences.keys();
-            if ((strings != null) && (strings.length > 0))
+            for (String key : attributes.getAttributes().keySet())
             {
-                int i = strings.length;
-                for (int j = 0; j < i; j++)
-                    myMap.put(strings[j], preferences.get(strings[j], "?????"));
+                SecurityAttribute attr = attributes.getAttributes().get(key);
+                myMap.put(key, attr.getValue());
             }
-
-        } catch (Exception e)
+        } 
+        catch (Exception e)
         {
             e.printStackTrace();
         }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermissions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermissions.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermissions.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermissions.java Wed Aug  6 20:52:05 2008
@@ -27,6 +27,7 @@
 * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
 * @version $Id: $
 */
-public class JSPermissions extends ArrayList
+public class JSPermissions extends ArrayList<JSPermission>
 {
+    private static final long serialVersionUID = -5989542652543681219L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSProfilingRules.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSProfilingRules.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSProfilingRules.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSProfilingRules.java Wed Aug  6 20:52:05 2008
@@ -27,6 +27,7 @@
 * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
 * @version $Id: $
 */
-public class JSProfilingRules extends ArrayList
+public class JSProfilingRules extends ArrayList<JSProfilingRule>
 {
+    private static final long serialVersionUID = -3452575197134401194L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSRoles.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSRoles.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSRoles.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSRoles.java Wed Aug  6 20:52:05 2008
@@ -27,6 +27,7 @@
 * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
 * @version $Id: $
 */
-public class JSRoles extends ArrayList
+public class JSRoles extends ArrayList<JSRole>
 {
+    private static final long serialVersionUID = 6682626744785492346L;
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java Wed Aug  6 20:52:05 2008
@@ -18,14 +18,18 @@
 
 import java.security.Principal;
 import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 import java.sql.Date;
 import java.util.Iterator;
-import java.util.prefs.Preferences;
 
 import javolution.xml.XMLFormat;
 import javolution.xml.stream.XMLStreamException;
 
 import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.jetspeed.security.Credential;
+import org.apache.jetspeed.security.attributes.SecurityAttribute;
+import org.apache.jetspeed.security.attributes.SecurityAttributes;
 
 /**
  * Jetspeed Serialized (JS) User
@@ -41,17 +45,17 @@
 
     private JSPWAttributes pwData = null;
 
-    private ArrayList roles = null;
+    private List<JSRole> roles = null;
 
-    private ArrayList groups = null;
+    private List<JSGroup> groups = null;
 
     private JSUserAttributes userInfo = null;
 
-    private JSNVPElements preferences = null;
+    private JSNVPElements attributes = null;
 
-    private ArrayList publicCredentials = null;
+    private List<Credential> publicCredentials = null;
 
-    private ArrayList privateCredentials = null;
+    private List<Credential> privateCredentials = null;
 
     private JSUserRoles roleString;
 
@@ -68,36 +72,40 @@
     {
     }
 
-    public void addPublicCredential(Object o)
+    public void addPublicCredential(Credential o)
     {
-        if (publicCredentials == null) publicCredentials = new ArrayList();
+        if (publicCredentials == null) 
+            publicCredentials = new ArrayList<Credential>();
         publicCredentials.add(o);
     }
 
-    public void addPrivateCredential(Object o)
+    public void addPrivateCredential(Credential o)
     {
-        if (privateCredentials == null) privateCredentials = new ArrayList();
+        if (privateCredentials == null) 
+            privateCredentials = new ArrayList<Credential>();
         privateCredentials.add(o);
     }
 
     public void addGroup(JSGroup group)
     {
-        if (groups == null) groups = new ArrayList();
+        if (groups == null) 
+            groups = new ArrayList<JSGroup>();
         groups.add(group);
     }
 
     public void addRole(JSRole role)
     {
-        if (roles == null) roles = new ArrayList();
+        if (roles == null) 
+            roles = new ArrayList<JSRole>();
         roles.add(role);
     }
 
-    public ArrayList getGroups()
+    public List<JSGroup> getGroups()
     {
         return groups;
     }
 
-    public void setGroups(ArrayList groups)
+    public void setGroups(List<JSGroup> groups)
     {
         this.groups = groups;
     }
@@ -203,12 +211,12 @@
         this.name = name;
     }
 
-    public ArrayList getRoles()
+    public List<JSRole> getRoles()
     {
         return roles;
     }
 
-    public void setRoles(ArrayList roles)
+    public void setRoles(List<JSRole> roles)
     {
         this.roles = roles;
     }
@@ -218,44 +226,43 @@
         return name;
     }
 
-    /*
-     * private void initUser() throws Exception { User user = null; try {
-     * ums.addUser("test", "password01"); user = ums.getUser("test"); } catch
-     * (SecurityException sex) { assertTrue("user exists. should not have thrown
-     * an exception.", false); }
-     * 
-     * Preferences userInfoPrefs = user.getPreferences().node("userinfo");
-     * userInfoPrefs.put("user.name.given", "Test Dude");
-     * userInfoPrefs.put("user.name.family", "Dudley"); }
-     * 
-     */
+    public JSNVPElements getSecurityAttributes()
+    {
+        return attributes;
+    }
 
-    /**
-     * @return Returns the preferences.
-     */
-    public JSNVPElements getPreferences()
+    public void setSecurityAttributes(Map<String, SecurityAttribute> sa)
     {
-        return preferences;
+        this.attributes = new JSNVPElements();
+        for (Map.Entry<String, SecurityAttribute> e : sa.entrySet())
+        {
+            SecurityAttribute attrib = e.getValue();
+            JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getValue());
+            this.attributes.add(element);
+        }
+    }
+    
+    public JSUserAttributes getUserInfo()
+    {
+        return userInfo;
     }
 
-    /**
-     * @param preferences
-     *            The preferences to set.
-     */
-    public void setPreferences(Preferences preferences)
+    public void setUserInfo(Map<String, SecurityAttribute> sa)
     {
-        // TODO: the JSNVPElements class doesn't support/use Preferences anymore
-        //       because of its dual usage for PortletPreferences as well
-        //       goto break these two usages apart and provide separate implementations
-        // NOTE: JSVNPElements is't very well implemented anyway (doesn't seem to be able to handle multi-value elements...)
-//        this.preferences = new JSNVPElements(preferences);
-        this.preferences = new JSNVPElements();
+        this.userInfo = new JSUserAttributes(); 
+        for (Map.Entry<String, SecurityAttribute> e : sa.entrySet())
+        {
+            SecurityAttribute attrib = e.getValue();
+            JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getValue());
+            this.userInfo.add(element);
+        }
     }
+    
 
     /**
      * @return Returns the privateCredentials.
      */
-    public ArrayList getPrivateCredentials()
+    public List<Credential> getPrivateCredentials()
     {
         return privateCredentials;
     }
@@ -264,7 +271,7 @@
      * @param privateCredentials
      *            The privateCredentials to set.
      */
-    public void setPrivateCredentials(ArrayList privateCredentials)
+    public void setPrivateCredentials(List<Credential> privateCredentials)
     {
         this.privateCredentials = privateCredentials;
     }
@@ -272,7 +279,7 @@
     /**
      * @return Returns the publicCredentials.
      */
-    public ArrayList getPublicCredentials()
+    public List<Credential> getPublicCredentials()
     {
         return publicCredentials;
     }
@@ -281,28 +288,12 @@
      * @param publicCredentials
      *            The publicCredentials to set.
      */
-    public void setPublicCredentials(ArrayList publicCredentials)
+    public void setPublicCredentials(List<Credential> publicCredentials)
     {
         this.publicCredentials = publicCredentials;
     }
 
-    /**
-     * @param userInfo
-     *            The userInfo to set.
-     */
-    public void setUserInfo(Preferences userInfo)
-    {
-        this.userInfo = new JSUserAttributes(userInfo);
-    }
-
-    /**
-     * @return Returns the userInfo.
-     */
-    public JSUserAttributes getUserInfo()
-    {
-        return userInfo;
-    }
-
+    
     /***************************************************************************
      * SERIALIZER
      */
@@ -341,7 +332,7 @@
 
                 xml.add(g.roleString);
                 xml.add(g.groupString);
-                xml.add(g.preferences);
+                xml.add(g.attributes);
                 xml.add(g.userInfo);
                 xml.add(g.rules);
 
@@ -382,7 +373,7 @@
 	                else if (o1 instanceof JSUserAttributes)
 	                    g.userInfo  = (JSUserAttributes) o1;
 	                else if (o1 instanceof JSNVPElements)
-		                g.preferences  = (JSNVPElements) o1;
+		                g.attributes  = (JSNVPElements) o1;
                     else if (o1 instanceof JSPrincipalRules)
 	                    g.rules  = (JSPrincipalRules) o1;
                 }
@@ -414,7 +405,7 @@
         return s.toString();
     }
 
-    private String putTokens(ArrayList _list)
+    private String putTokens(List _list)
     {
         if ((_list == null) || (_list.size() == 0)) return "";
         boolean _start = true;

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java Wed Aug  6 20:52:05 2008
@@ -17,24 +17,9 @@
 
 package org.apache.jetspeed.serializer.objects;
 
-import java.util.prefs.*;
 
 public class JSUserAttributes extends JSNVPElements
 {
-
-
-	/**
-	 * @param preferences
-	 */
-	public JSUserAttributes(Preferences preferences)
-	{
-        // TODO: the JSNVPElements class doesn't support/use Preferences anymore
-        //       because of its dual usage for PortletPreferences as well
-        //       goto break these two usages apart and provide separate implementations
-        // NOTE: JSVNPElements is't very well implemented anyway (doesn't seem to be able to handle multi-value elements...)
-//		super(preferences);
-	    super();
-	}
     public JSUserAttributes()
     {
         super();

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUsers.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUsers.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUsers.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUsers.java Wed Aug  6 20:52:05 2008
@@ -26,4 +26,5 @@
  */
 public class JSUsers extends ArrayList<JSUser>
 {
+    private static final long serialVersionUID = -5698435742048612881L;
 }



---------------------------------------------------------------------
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