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 [1/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
Author: taylor
Date: Wed Aug  6 20:52:05 2008
New Revision: 683497

URL: http://svn.apache.org/viewvc?rev=683497&view=rev
Log:
 http://issues.apache.org/jira/browse/JS2-869
 Checkpoint #1: everything compiles. next I will work on getting the unit tests running
 Preferences should be completely removed from the security component now. This took almost a weeks worth of refactoring, so I figured I'd better check it in.
 Also did a lot of updating the APIs and everything to Java 1.5 generics
 There are a few things broken here like SSO that will need attention. 

Added:
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/PersistenceBrokerSecurityAttributesProvider.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributeImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributesImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RemotePrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/attributes/
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/attributes/TestSecurityAttributes.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/Credential.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/RemotePrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/attributes/
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttribute.java   (with props)
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributes.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributesProvider.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/om/InternalPrincipalPreference.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/security-attributes.xml
Modified:
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/serializer/JetspeedUserTemplateSerializer.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserInformationAction.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserInfoManagerImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserManagerUserAttributeSourceImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/SecurityHelper.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/AggregationHierarchyResolver.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/AuthenticationProviderProxyImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseHierarchyResolver.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BasePrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GeneralizationHierarchyResolver.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/PermissionManagerImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/PrincipalsSet.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RoleImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/om/impl/InternalPrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/om/impl/InternalRolePrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/om/impl/InternalUserPrincipalImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/DefaultCredentialHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/DefaultGroupSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/DefaultRoleSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/DefaultSecurityMappingHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/LdapCredentialHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/LdapGroupSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/LdapRoleSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/LdapSecurityMappingHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/SecurityAccessImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ldap/LdapPrincipalDaoImpl.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAggregationHierarchy.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestAuthenticationProviderProxy.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGeneralizationHierarchy.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestUserManager.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestCredentialPasswordEncoder.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestPasswordExpirationAndMaxAuthenticationFailuresInterceptor.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/LdapDataHelper.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapGroupSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapRoleSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSApplications.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSCapabilities.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSClients.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSGroups.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMediaTypes.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSMimeTypes.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermissions.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSProfilingRules.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSRoles.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUsers.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/FailedToRenderFragmentException.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/PortletContent.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/aggregator/UnrenderedContentException.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletregistry/FailedToStorePortletDefinitionException.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/engine/JetspeedEngineConstants.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/prefs/PreferencesProvider.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/prefs/om/Node.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/BasePrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/Group.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/GroupManager.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/GroupPrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/HierarchyResolver.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/PasswordCredential.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/PermissionManager.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/Role.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/RoleManager.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/RolePrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityException.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserPrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/om/InternalGroupPrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/om/InternalPermission.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/om/InternalPrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/om/InternalRolePrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/om/InternalUserPrincipal.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/CredentialHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/GroupSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/RoleSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/SecurityAccess.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/SecurityMappingHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserSecurityHandler.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/userinfo/UserAttributeSource.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/userinfo/UserInfoManager.java
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/ddl-schema/registry-schema.xml
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/administration.xml
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/alternate/versioned-deployment/jetspeed-services.xml
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/jetspeed-services.xml
    portals/jetspeed-2/portal/branches/JS2-869/jetspeed-portal-resources/src/main/resources/assembly/security-managers.xml

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java Wed Aug  6 20:52:05 2008
@@ -16,9 +16,9 @@
  */
 package org.apache.jetspeed.serializer;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -255,10 +255,10 @@
                         try
                         {
                             _line = _c.getMimeTypesString().toString();
-                            ArrayList list = getTokens(_line);
+                            List<String> list = getTokens(_line);
                             if ((list != null) && (list.size() > 0))
                             {
-                                Iterator _it1 = list.iterator();
+                                Iterator<String> _it1 = list.iterator();
                                 int added = 0;
                                 while (_it1.hasNext())
                                 {
@@ -276,10 +276,10 @@
                         try
                         {
                             _line = _c.getCapabilitiesString().toString();
-                            ArrayList list = getTokens(_line);
+                            List<String> list = getTokens(_line);
                             if ((list != null) && (list.size() > 0))
                             {
-                                Iterator _it1 = list.iterator();
+                                Iterator<String> _it1 = list.iterator();
                                 if ((list != null) && (list.size() > 0))
                                 {
                                     int added = 0;
@@ -346,10 +346,10 @@
                         try
                         {
                             _line = _c.getMimeTypesString().toString();
-                            ArrayList list = getTokens(_line);
+                            List<String> list = getTokens(_line);
                             if ((list != null) && (list.size() > 0))
                             {
-                                Iterator _it1 = list.iterator();
+                                Iterator<String> _it1 = list.iterator();
                                 int added = 0;
                                 while (_it1.hasNext())
                                 {
@@ -376,10 +376,10 @@
                         try
                         {
                             _line = _c.getCapabilitiesString().toString();
-                            ArrayList list = getTokens(_line);
+                            List<String> list = getTokens(_line);
                             if ((list != null) && (list.size() > 0))
                             {
-                                Iterator _it1 = list.iterator();
+                                Iterator<String> _it1 = list.iterator();
                                 if ((list != null) && (list.size() > 0))
                                 {
                                     int added = 0;

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/serializer/JetspeedUserTemplateSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/serializer/JetspeedUserTemplateSerializer.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/serializer/JetspeedUserTemplateSerializer.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/serializer/JetspeedUserTemplateSerializer.java Wed Aug  6 20:52:05 2008
@@ -18,7 +18,6 @@
 
 import java.security.PrivilegedAction;
 import java.util.Map;
-import java.util.prefs.Preferences;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -35,6 +34,8 @@
 import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.attributes.SecurityAttribute;
+import org.apache.jetspeed.security.attributes.SecurityAttributes;
 import org.apache.jetspeed.serializer.objects.JSSnapshot;
 import org.apache.jetspeed.serializer.objects.JSUser;
 
@@ -149,8 +150,9 @@
                     if (innerSubsite != null)
                     {
                         User innerUser = userManager.getUser(innerUserName);                   
-                        Preferences attributes = innerUser.getUserAttributes();
-                        attributes.put(User.USER_INFO_SUBSITE, innerSubsite);
+                        Map<String, SecurityAttribute> attributes = innerUser.getAttributes().getAttributes(SecurityAttributes.USER_INFORMATION);
+                        attributes.put(User.USER_INFO_SUBSITE, innerUser.getAttributes().createAttribute(User.USER_INFO_SUBSITE, innerSubsite));
+                        userManager.updateUser(innerUser);
                     }
                     Folder source = innerPageManager.getFolder(innerFolderTemplate);
                     innerPageManager.deepMergeFolder(source, templateFolder, innerUserName);

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java Wed Aug  6 20:52:05 2008
@@ -25,7 +25,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.prefs.Preferences;
 
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletRequest;
@@ -42,8 +41,6 @@
 import org.apache.jetspeed.om.folder.InvalidFolderException;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.page.document.NodeException;
-import org.apache.jetspeed.prefs.PreferencesProvider;
-import org.apache.jetspeed.prefs.om.Node;
 import org.apache.jetspeed.profiler.Profiler;
 import org.apache.jetspeed.profiler.rules.ProfilingRule;
 import org.apache.jetspeed.request.RequestContext;
@@ -51,9 +48,13 @@
 import org.apache.jetspeed.security.JSSubject;
 import org.apache.jetspeed.security.RoleManager;
 import org.apache.jetspeed.security.SecurityHelper;
+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.attributes.SecurityAttributesProvider;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 import org.springframework.mail.MailException;
@@ -83,7 +84,6 @@
     protected RoleManager roleManager;
     protected GroupManager groupManager;
     protected PageManager pageManager;
-    private PreferencesProvider preferences;    
     protected Profiler profiler;
     protected JavaMailSender mailSender;
     protected VelocityEngine velocityEngine;
@@ -104,7 +104,6 @@
                                      RoleManager roleManager,
                                      GroupManager groupManager, 
                                      PageManager pageManager,
-                                     PreferencesProvider preferences,
                                      Profiler profiler,
                                      JavaMailSender mailSender,
                                      VelocityEngine velocityEngine)
@@ -113,7 +112,6 @@
         this.roleManager = roleManager;
         this.groupManager = groupManager;
         this.pageManager = pageManager;
-        this.preferences = preferences;
         this.profiler = profiler;
         this.mailSender = mailSender;
         this.velocityEngine = velocityEngine;
@@ -281,8 +279,9 @@
                         {
                              if (innerSubsite != null)
                              {
-                                 Preferences attributes = innerUser.getUserAttributes();
-                                 attributes.put(User.USER_INFO_SUBSITE, innerSubsite);                                    
+                                 Map<String, SecurityAttribute> attributes = innerUser.getAttributes().getAttributes(SecurityAttributes.USER_INFORMATION);
+                                 attributes.put(User.USER_INFO_SUBSITE, innerUser.getAttributes().createAttribute(User.USER_INFO_SUBSITE, innerSubsite));
+                                 userManager.updateUser(innerUser);
                              }                                         
                              // create user's home folder                        
                              // deep copy from the default folder template tree, creating a deep-copy of the template
@@ -297,11 +296,18 @@
                              
                             return null;
                         }
-                         catch (FolderNotFoundException e1) {
+                         catch (SecurityException s1)
+                         {
+                             return s1;
+                         }
+                         catch (FolderNotFoundException e1) 
+                         {
                              return e1;
-                         } catch (InvalidFolderException e1){
+                         } catch (InvalidFolderException e1)
+                         {
                              return e1;
-                         } catch (NodeException e1){
+                         } catch (NodeException e1)
+                         {
                              return e1;
                          }
                     }
@@ -424,32 +430,20 @@
     public User lookupUserFromEmail(String email)
         throws AdministrationEmailException    
     {
-        Collection result = preferences.lookupPreference("userinfo", "user.business-info.online.email", email);
-        if (result.size() == 0)
-        {
-            throw new AdministrationEmailException(USER_NOT_FOUND_FROM_EMAIL + email);
-        }
-        Iterator nodes = result.iterator();
-        Node node = (Node)nodes.next();
-        String nodePath = node.getFullPath();
-        if (nodePath == null)
-        {
-            throw new AdministrationEmailException(USER_NOT_FOUND_FROM_EMAIL + email);
-        }
-        String[] paths = nodePath.split("/");
-        if (paths == null || paths.length != 4)
-        {
-            throw new AdministrationEmailException(USER_NOT_FOUND_FROM_EMAIL + email);
-        }
-        String userName = paths[2];
+        Collection<User> users;
         try
         {
-            return userManager.getUser(userName);
+            users = userManager.lookupUsers("user.business-info.online.email", email);
+        } 
+        catch (SecurityException e)
+        {
+            throw new AdministrationEmailException(e);        
         }
-        catch (Exception e)
+        if (users.isEmpty())
         {
             throw new AdministrationEmailException(USER_NOT_FOUND_FROM_EMAIL + email);
         }
+        return users.iterator().next(); // return the first one and hopefully the only (FIXME: need unique constraints)
     }
 
     /**

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserInformationAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserInformationAction.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserInformationAction.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserInformationAction.java Wed Aug  6 20:52:05 2008
@@ -17,12 +17,10 @@
 package org.apache.jetspeed.layout.impl;
 
 import java.security.Principal;
-import java.util.HashMap;
+import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.List;
-import java.util.ArrayList;
-import java.util.prefs.Preferences;
+import java.util.Map;
 
 import javax.security.auth.Subject;
 
@@ -82,14 +80,8 @@
                 User user = userManager.getUser(principal.getName());
                 if(user != null)
                 {
-                	Preferences prefs = user.getUserAttributes();
-                	String[] prefKeys = prefs.keys();
-                	Map prefsSet = new HashMap();
-                	for(int i = 0; i<prefKeys.length; i++)
-                	{
-                		prefsSet.put(prefKeys[i], prefs.get(prefKeys[i], "No value"));                		
-                	}
-                	resultMap.put(USERINFO, prefsSet);
+                    Map<String, String> userInfo = user.getUserAttributes();
+                	resultMap.put(USERINFO, userInfo);
 
                 	List roles = new ArrayList();
                 	Subject userSubject = user.getSubject();

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/GetUserListAction.java Wed Aug  6 20:52:05 2008
@@ -24,7 +24,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -235,10 +234,8 @@
         		// Check whether we should iterate through all of the users or just logged in ones
     			if(includeOffline)
     			{
-    				Iterator allUusers = userManager.getUsers("");
-    				while(allUusers.hasNext())
+    				for (User user : userManager.getUsers(""))
         			{
-        				User user = (User)allUusers.next();
         				Principal userPrincipal = SecurityHelper.getPrincipal(user.getSubject(), UserPrincipal.class);
         				if(userPrincipal != null)
         				{
@@ -298,22 +295,14 @@
      * @throws SecurityException
      * @throws BackingStoreException
      */
-    private Map getUserInfo(String username) throws SecurityException, BackingStoreException
+    private Map<String, String> getUserInfo(String username) throws SecurityException, BackingStoreException
     {
-    	Map userInfo = new HashMap();
     	User user =  userManager.getUser(username);
 		if(user != null)
 		{
-        	Preferences userPrefs = user.getUserAttributes();
-        	String[] userPrefKeys = userPrefs.keys();
-        
-        	for(int i = 0; i<userPrefKeys.length; i++)
-        	{
-        		userInfo.put(userPrefKeys[i], userPrefs.get(userPrefKeys[i], "No value"));                		
-        	}
+            return user.getUserAttributes();
 		}
-		
-		return userInfo;
+		return new HashMap<String, String>();
     }
     
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/localization/impl/LocalizationValveImpl.java Wed Aug  6 20:52:05 2008
@@ -19,7 +19,7 @@
 import java.security.Principal;
 import java.util.Enumeration;
 import java.util.Locale;
-import java.util.prefs.Preferences;
+import java.util.Map;
 
 import javax.security.auth.Subject;
 
@@ -38,6 +38,8 @@
 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.util.JetspeedLocale;
 
 /**
@@ -116,12 +118,15 @@
                                 && userMgr.userExists(userPrincipal.getName()))
                         {
                             User user = userMgr.getUser(userPrincipal.getName());
-                            // TODO if preferred lang or locale is defined in PLT.D, it's better to use it
-                            Preferences prefs = user.getPreferences();
-                            String localeString = prefs.get(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, null);
-                            if (localeString != null)
+                            Map<String, SecurityAttribute> sa = user.getAttributes().getAttributes(SecurityAttributes.SECURITY_ATTRIBUTE);
+                            SecurityAttribute attrib = sa.get(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE);
+                            if (attrib != null)
                             {
-                                locale = JetspeedLocale.convertStringToLocale(localeString);
+                                String localeString = attrib.getValue();
+                                if (localeString != null)
+                                {
+                                    locale = JetspeedLocale.convertStringToLocale(localeString);
+                                }
                             }
                         }
                     }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserInfoManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserInfoManagerImpl.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserInfoManagerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserInfoManagerImpl.java Wed Aug  6 20:52:05 2008
@@ -22,8 +22,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
 
 import javax.portlet.PortletRequest;
 import javax.security.auth.Subject;
@@ -62,9 +60,6 @@
     /** Map used to cache user info maps for each mapped portlet application. */
     private static Map userInfoMapCache;
 
-    /** The user information property set. */
-    String userInfoPropertySet;
-
     /** The user manager */
     UserManager userMgr;
 
@@ -86,7 +81,6 @@
     {
         this.userMgr = userMgr;
         this.registry = registry;
-        this.userInfoPropertySet = User.USER_INFO_PROPERTY_SET;
         initUserInfoMapCache();
     }
 
@@ -105,7 +99,6 @@
     {
         this.userMgr = userMgr;
         this.registry = registry;
-        this.userInfoPropertySet = userInfoPropertySet;
         initUserInfoMapCache();
     }
 
@@ -124,8 +117,8 @@
             return (Map) userInfoMapCache.get(oid);
         }
         // Not in cache, map user info.
-        Preferences userPrefs = getUserPreferences(context);
-        if (null == userPrefs)
+        Map<String, String> userInfo = getUserInformation(context);
+        if (null == userInfo)
         {
             log.debug(PortletRequest.USER_INFO + " is set to null");
             return null;
@@ -137,50 +130,32 @@
             log.debug(PortletRequest.USER_INFO + " is set to null");
             return null;
         }
-        Preferences userInfoPrefs = userPrefs.node(userInfoPropertySet);
         Collection userAttributes = pa.getUserAttributes();
         Collection userAttributeRefs = pa.getUserAttributeRefs();
-        Map userInfoMap = mapUserInfo(userInfoPrefs, userAttributes, userAttributeRefs);
+        Map userInfoMap = mapUserInfo(userInfo, userAttributes, userAttributeRefs);
 
         return userInfoMap;
     }
 
     /**
      * <p>
-     * Maps the user info properties retrieved from the user preferences to the
+     * Maps the user info properties retrieved from the user information to the
      * user info attribute declared in the portlet.xml descriptor.
      * </p>
      * 
-     * @param userInfoPrefs The user info preferences.
+     * @param userInfo The user info attributes.
      * @param userAttributes The declarative portlet user attributes.
      * @param userAttributeRefs The declarative jetspeed portlet extension user
      *            attributes reference.
      * @return The user info map.
      */
-    private Map mapUserInfo(Preferences userInfoPrefs, Collection userAttributes, Collection userAttributeRefs)
+    private Map<String, String> mapUserInfo(Map<String, String> userInfo, Collection userAttributes, Collection userAttributeRefs)
     {
+        Map<String, String>userInfoMap = new HashMap<String, String>();
         if ((null == userAttributes) || (userAttributes.size() == 0))
         {
             return null;
         }
-
-        Map userInfoMap = new HashMap();
-        String[] propertyKeys = null;
-        try
-        {
-            propertyKeys = userInfoPrefs.keys();
-            if ((null != propertyKeys) && log.isDebugEnabled())
-                log.debug("Found " + propertyKeys.length + " children for " + userInfoPrefs.absolutePath());
-        }
-        catch (BackingStoreException bse)
-        {
-            log.error("BackingStoreException: " + bse.toString());
-        }
-        if (null == propertyKeys)
-        {
-            return null;
-        }
-
         Collection linkedUserAttributes = mapLinkedUserAttributes(userAttributes, userAttributeRefs);
         Iterator iter = linkedUserAttributes.iterator();
         while (iter.hasNext())
@@ -188,45 +163,43 @@
             UserAttributeRef currentAttributeRef = (UserAttributeRef) iter.next();
             if (null != currentAttributeRef)
             {
-                for (int i = 0; i < propertyKeys.length; i++)
+                for (String key : userInfo.keySet())
                 {
                     if (null != currentAttributeRef.getNameLink())
                     {
-                        if ((currentAttributeRef.getNameLink()).equals(propertyKeys[i]))
+                        if ((currentAttributeRef.getNameLink()).equals(key))
                         {
-                            userInfoMap.put(currentAttributeRef.getName(), userInfoPrefs.get(propertyKeys[i], null));
+                            userInfoMap.put(currentAttributeRef.getName(), userInfo.get(key));
                         }
                     }
                     else
                     {
-                        if ((currentAttributeRef.getName()).equals(propertyKeys[i]))
+                        if ((currentAttributeRef.getName()).equals(key))
                         {
-                            userInfoMap.put(currentAttributeRef.getName(), userInfoPrefs.get(propertyKeys[i], null));
+                            userInfoMap.put(currentAttributeRef.getName(), userInfo.get(key));
                         }
                     }
                 }
             }
         }
-
         userInfoMapCache.put(oid, userInfoMap);
-
         return userInfoMap;
     }
 
     /**
      * <p>
-     * Gets the user preferences from the user's request.
+     * Gets the user info from the user's request.
      * </p>
      * <p>
      * If no user is logged in, return null.
      * </p>
      * 
      * @param context The request context.
-     * @return The user preferences.
+     * @return The user info.
      */
-    private Preferences getUserPreferences(RequestContext context)
+    private Map<String, String> getUserInformation(RequestContext context)
     {
-        Preferences userPrefs = null;
+        Map<String, String> userInfo = new HashMap<String, String>();
         Subject subject = context.getSubject();
         if (null != subject)
         {
@@ -239,7 +212,7 @@
                     if (userMgr.userExists(userPrincipal.getName()))
                     {
                         User user = userMgr.getUser(userPrincipal.getName());
-                        userPrefs = user.getPreferences();
+                        userInfo = user.getUserAttributes();
                     }
                 }
                 catch (SecurityException sex)
@@ -248,7 +221,7 @@
                 }
             }
         }
-        return userPrefs;
+        return userInfo;
     }
 
     private void initUserInfoMapCache()

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserManagerUserAttributeSourceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserManagerUserAttributeSourceImpl.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserManagerUserAttributeSourceImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/main/java/org/apache/jetspeed/userinfo/impl/UserManagerUserAttributeSourceImpl.java Wed Aug  6 20:52:05 2008
@@ -16,26 +16,24 @@
  */
 package org.apache.jetspeed.userinfo.impl;
 
-import java.security.Principal;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.prefs.Preferences;
-
-import javax.security.auth.Subject;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.om.common.UserAttributeRef;
-import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.security.SecurityException;
-import org.apache.jetspeed.security.SecurityHelper;
-import org.apache.jetspeed.security.User;
-import org.apache.jetspeed.security.UserManager;
-import org.apache.jetspeed.security.UserPrincipal;
-import org.apache.jetspeed.userinfo.UserAttributeRetrievalException;
-import org.apache.jetspeed.userinfo.UserAttributeSource;
+import java.security.Principal;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.om.common.UserAttributeRef;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.SecurityHelper;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.UserPrincipal;
+import org.apache.jetspeed.userinfo.UserAttributeRetrievalException;
+import org.apache.jetspeed.userinfo.UserAttributeSource;
 
 /**
  * Default implementation of a UserAttribute source Provides users attributes from standard prefs implementation
@@ -67,11 +65,11 @@
      * 
      * @see org.jetspeed.userinfo.UserAttributeSource#getUserAttributeMap(javax.security.auth.Subject, java.util.Set)
      */
-    public Map getUserAttributeMap(Subject subject, Collection userAttributeRefs, RequestContext context)
+    public Map<String, String> getUserAttributeMap(Subject subject, Collection<UserAttributeRef> userAttributeRefs, RequestContext context)
             throws UserAttributeRetrievalException
     {
 
-        Map userAttributeMap = new HashMap();
+        Map<String,String> userAttributeMap = new HashMap<String,String>();
         Principal userPrincipal = SecurityHelper.getPrincipal(subject, UserPrincipal.class);
         if (null != userPrincipal)
         {
@@ -81,11 +79,10 @@
                 if (userManager.userExists(userPrincipal.getName()))
                 {
                     User user = userManager.getUser(userPrincipal.getName());
-                    Preferences userInfoPrefs = user.getPreferences();
-                    for (Iterator iter = userAttributeRefs.iterator(); iter.hasNext();)
+                    Map<String, String> userInfo = user.getUserAttributes();
+                    for (UserAttributeRef currentAttributeRef : userAttributeRefs)
                     {
-                        UserAttributeRef currentAttributeRef = (UserAttributeRef) iter.next();
-                        Object value = userInfoPrefs.get(currentAttributeRef.getName(), null);
+                        String value = userInfo.get(currentAttributeRef.getName());
                         if (value != null)
                         {
                             userAttributeMap.put(currentAttributeRef.getName(), value);

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java Wed Aug  6 20:52:05 2008
@@ -55,7 +55,7 @@
 
     public void testPasswordGen() throws Exception
     {
-        PortalAdministrationImpl pai = new PortalAdministrationImpl(null,null,null,null,null,null,null,null);
+        PortalAdministrationImpl pai = new PortalAdministrationImpl(null,null,null,null,null,null,null);
         String newPassword = pai.generatePassword();
         assertNotNull("new password was NULL!!!",newPassword);
         assertTrue("password is not long enough",(newPassword.length() > 4) );
@@ -63,7 +63,7 @@
     }
     
     public void xtestSendEmail() throws Exception {
-        PortalAdministrationImpl pai = new PortalAdministrationImpl(null,null,null,null,null,null,null,null);
+        PortalAdministrationImpl pai = new PortalAdministrationImpl(null,null,null,null,null,null,null);
         pai.sendEmail("chris@bluesunrise.com","this is a unittest","chris@bluesunrise.com","this is the content of the message");
         
     }
@@ -71,7 +71,7 @@
     // this needs too much init to test easily right now
     public void xtestRegUser() throws Exception
     {
-        PortalAdministrationImpl pai = new PortalAdministrationImpl(null,null,null,null,null,null,null,null);
+        PortalAdministrationImpl pai = new PortalAdministrationImpl(null,null,null,null,null,null,null);
         String user = "user"+(Math.abs(new Date().getTime()));
         String password = "password";
         List emptyList = new ArrayList();

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java Wed Aug  6 20:52:05 2008
@@ -36,6 +36,8 @@
 import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.SecurityHelper;
 import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.attributes.SecurityAttributes;
+import org.apache.jetspeed.security.attributes.SecurityAttributesProvider;
 import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
 import org.apache.jetspeed.util.descriptor.ExtendedPortletMetadata;
 import org.apache.jetspeed.util.descriptor.PortletApplicationDescriptor;
@@ -49,18 +51,10 @@
  */
 public class TestUserInfoManager extends AbstractSecurityTestcase
 {
-
-    /** The test MutablePortletApplication. */
     private MutablePortletApplication portletApp;
-
-    /** The user info manager. */
     private UserInfoManager single;
-
     private PortletRegistry portletRegistry;
-
-    /**
-     * @see junit.framework.TestCase#setUp()
-     */
+    
     public void setUp() throws Exception
     {
         super.setUp();
@@ -69,9 +63,6 @@
         portletRegistry = (PortletRegistry) scm.getComponent("portletRegistry");
     }
 
-    /**
-     * @see junit.framework.TestCase#tearDown()
-     */
     public void tearDown() throws Exception
     {
         cleanUp();
@@ -118,7 +109,7 @@
 
         // Without linked attributes
         // There are no preferences associated to the user profile.
-        Map userInfo = uim.getUserInfoMap(portletApp.getId(), request);
+        Map<String, String> userInfo = uim.getUserInfoMap(portletApp.getId(), request);
         assertNull(PortletRequest.USER_INFO + " is null", userInfo);
 
         // The user has preferences associated to the user profile.
@@ -187,9 +178,10 @@
         {
             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");
+        SecurityAttributes attributes = user.getAttributes();
+        attributes.getAttributes(SecurityAttributes.USER_INFORMATION).put("user.name.given", attributes.createAttribute("user.name.given", "Test Dude"));
+        attributes.getAttributes(SecurityAttributes.USER_INFORMATION).put("user.name.given", attributes.createAttribute("user.name.family", "Dudley"));
+        ums.updateUser(user);
     }
 
     /**

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java Wed Aug  6 20:52:05 2008
@@ -88,10 +88,8 @@
             try
             {
                 String anonymousUser = userManager.getAnonymousUser();
-                Iterator _itUsers = userManager.getUsers("");
-                while (_itUsers.hasNext())
+                for (User _user : userManager.getUsers(""))    
                 {
-                    User _user = (User) _itUsers.next();                    
                     Principal principal = SecurityHelper.getPrincipal(_user.getSubject(), UserPrincipal.class);
                     if (principal != null)
                     {
@@ -193,7 +191,7 @@
             try
             {
                 User user = userManager.getUser(_user.getName());
-                Principal principal = getUserPrincipal(user);
+                Principal principal = user.getUserPrincipal();
                 if (jsRules != null)
                 {
                     Iterator _itRoles = jsRules.iterator();
@@ -316,22 +314,6 @@
 
     }
 
-    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;
-    }
-
     /**
      * read the permissions and then the profiling rules.
      * <p>

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml Wed Aug  6 20:52:05 2008
@@ -1223,7 +1223,7 @@
       
       <field-descriptor
           name="index"
-          column="INDEX"
+          column="IDX"
           jdbc-type="SMALLINT"
           nullable="false"
           primarykey="true"
@@ -1272,7 +1272,7 @@
       </field-descriptor>      
       <field-descriptor
           name="value"
-          column="VALUE"
+          column="PREF_VALUE"
           jdbc-type="VARCHAR"
           nullable="true"
           length="4000"

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java Wed Aug  6 20:52:05 2008
@@ -664,7 +664,7 @@
     {
         if (portletPreferencesProvider == null)
         {
-            portletPreferencesProvider = (PortletPreferencesProvider)Jetspeed.getComponentManager().getComponent("portletPreferencesProvider");
+            portletPreferencesProvider = (PortletPreferencesProvider)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider");
         }
     }
 

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java Wed Aug  6 20:52:05 2008
@@ -956,7 +956,7 @@
     {
         if (portletPreferencesProvider == null)
         {
-            portletPreferencesProvider = (PortletPreferencesProvider)Jetspeed.getComponentManager().getComponent("portletPreferencesProvider");
+            portletPreferencesProvider = (PortletPreferencesProvider)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider");
         }
     }
 }

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml?rev=683497&r1=683496&r2=683497&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml Wed Aug  6 20:52:05 2008
@@ -53,11 +53,19 @@
 	    >
 	    </field-descriptor>
 	    <field-descriptor
-	        name="fullPath"
-	        column="full_path"
+	        name="type"
+	        column="sp_type"
 	        jdbc-type="VARCHAR"
 	        nullable="false"
-	        length="254"
+	        length="20"
+	    >
+	    </field-descriptor>	    
+	    <field-descriptor
+	        name="name"
+	        column="sp_name"
+	        jdbc-type="VARCHAR"
+	        nullable="false"
+	        length="200"
 	    >
 	    </field-descriptor>
 	    <field-descriptor
@@ -80,7 +88,7 @@
           jdbc-type="INTEGER"
           conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
           nullable="false"
-      >
+      > 
       </field-descriptor>      
 	    <collection-descriptor
 	        name="credentials"
@@ -295,13 +303,21 @@
 	    >
 	    </field-descriptor>
 	    <field-descriptor
-	        name="fullPath"
-	        column="full_path"
+	        name="type"
+	        column="sp_type"
 	        jdbc-type="VARCHAR"
 	        nullable="false"
-	        length="254"
+	        length="20"
 	    >
-	    </field-descriptor>
+	    </field-descriptor>	    
+	    <field-descriptor
+	        name="name"
+	        column="sp_name"
+	        jdbc-type="VARCHAR"
+	        nullable="false"
+	        length="200"
+	    >
+	    </field-descriptor>	    	    
 	    <field-descriptor
 	        name="creationDate"
 	        column="creation_date"
@@ -401,15 +417,23 @@
 	        conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
 	        nullable="false"
 	    >
-	    </field-descriptor>
+	    </field-descriptor>	    
 	    <field-descriptor
-	        name="fullPath"
-	        column="full_path"
+	        name="type"
+	        column="sp_type"
 	        jdbc-type="VARCHAR"
 	        nullable="false"
-	        length="254"
+	        length="20"
 	    >
-	    </field-descriptor>
+	    </field-descriptor>	    
+	    <field-descriptor
+	        name="name"
+	        column="sp_name"
+	        jdbc-type="VARCHAR"
+	        nullable="false"
+	        length="200"
+	    >
+	    </field-descriptor>	    
 	    <field-descriptor
 	        name="creationDate"
 	        column="creation_date"
@@ -511,11 +535,19 @@
 	    >
 	    </field-descriptor>
 	    <field-descriptor
-	        name="fullPath"
-	        column="full_path"
+	        name="type"
+	        column="sp_type"
 	        jdbc-type="VARCHAR"
 	        nullable="false"
-	        length="254"
+	        length="20"
+	    >
+	    </field-descriptor>	    
+	    <field-descriptor
+	        name="name"
+	        column="sp_name"
+	        jdbc-type="VARCHAR"
+	        nullable="false"
+	        length="200"
 	    >
 	    </field-descriptor>
 	    <field-descriptor
@@ -628,4 +660,56 @@
 	    </collection-descriptor>
 	</class-descriptor>
 
+
+   <!--
+   - S E C U R I T Y   A T T R I B U T E S
+   -->
+  <class-descriptor
+      class="org.apache.jetspeed.security.attributes.SecurityAttributeImpl"
+      table="security_attributes"
+  >
+      <documentation>Represents a Security Principal Attribute definition.</documentation>
+      <field-descriptor
+          name="attributeId"
+          column="attr_id"
+          jdbc-type="BIGINT"
+          primarykey="true"
+          autoincrement="true"
+      />
+      <field-descriptor
+          name="principalId"
+          column="principal_id"
+          jdbc-type="BIGINT"
+          nullable="false"
+      />
+      <field-descriptor
+          name="name"
+          column="attr_name"
+          jdbc-type="VARCHAR"
+          nullable="false"
+          length="200"
+      />
+      <field-descriptor
+          name="type"
+          column="attr_type"
+          jdbc-type="VARCHAR"
+          nullable="false"
+          length="20"
+      />
+      <field-descriptor
+          name="principalType"
+          column="principal_type"
+          jdbc-type="VARCHAR"
+          nullable="true"
+          length="4"
+      />      
+      <field-descriptor
+          name="value"
+          column="attr_value"
+          jdbc-type="VARCHAR"
+          nullable="true"
+          length="1000"
+      />      
+  </class-descriptor>
+
 </descriptor-repository>

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/SecurityHelper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/SecurityHelper.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/security/SecurityHelper.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/SecurityHelper.java Wed Aug  6 20:52:05 2008
@@ -30,10 +30,14 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.security.impl.PrincipalsSet;
 import org.apache.jetspeed.security.impl.GroupPrincipalImpl;
+import org.apache.jetspeed.security.impl.PrincipalsSet;
 import org.apache.jetspeed.security.impl.RolePrincipalImpl;
 import org.apache.jetspeed.security.impl.UserPrincipalImpl;
+import org.apache.jetspeed.security.om.InternalGroupPrincipal;
+import org.apache.jetspeed.security.om.InternalPrincipal;
+import org.apache.jetspeed.security.om.InternalRolePrincipal;
+import org.apache.jetspeed.security.om.InternalUserPrincipal;
 
 /**
  * <p>
@@ -146,36 +150,6 @@
 
     /**
      * <p>
-     * Utility method used to retrieve the Preferences API absolute/full path from a given
-     * principal.
-     * </p>
-     * 
-     * @param principal The principal.
-     * @return The Preferences absolute/full path.
-     */
-    public static String getPreferencesFullPath(Principal principal)
-    {
-
-        if ((UserPrincipal.class).isInstance(principal))
-        {
-            return UserPrincipalImpl.getFullPathFromPrincipalName(principal.getName());
-        }
-        else if ((RolePrincipal.class).isInstance(principal))
-        {
-            return RolePrincipalImpl.getFullPathFromPrincipalName(principal.getName());
-        }
-        else if ((GroupPrincipal.class).isInstance(principal))
-        {
-            return GroupPrincipalImpl.getFullPathFromPrincipalName(principal.getName());
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    /**
-     * <p>
      * Utility method to create a subject.
      * </p>
      * 
@@ -269,25 +243,16 @@
         }
     }
     
-    public static Principal createPrincipalFromFullPath(String fullPath)
+    
+    public static Principal createPrincipalFromInternal(InternalPrincipal internal)
     {
-        Principal principal = null;
-        if (fullPath.startsWith(BasePrincipal.PREFS_ROLE_ROOT))
-        {
-            String name = RolePrincipalImpl.getPrincipalNameFromFullPath(fullPath);            
-            principal = new RolePrincipalImpl(name);
-        }
-        else if (fullPath.startsWith(BasePrincipal.PREFS_USER_ROOT))
-        {
-            String name = UserPrincipalImpl.getPrincipalNameFromFullPath(fullPath);
-            principal = new UserPrincipalImpl(name);
-        }
-        else if (fullPath.startsWith(BasePrincipal.PREFS_GROUP_ROOT))
-        {
-            String name = GroupPrincipalImpl.getPrincipalNameFromFullPath(fullPath);            
-            principal = new GroupPrincipalImpl(name);
-            
-        }
-        return principal;
+        if (internal instanceof InternalUserPrincipal)
+            return new UserPrincipalImpl(internal.getName());
+        else if (internal instanceof InternalRolePrincipal)
+            return new RolePrincipalImpl(internal.getName());
+        else if (internal instanceof InternalGroupPrincipal)
+            return new GroupPrincipalImpl(internal.getName());
+        else
+            return null;
     }
 }

Added: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/PersistenceBrokerSecurityAttributesProvider.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/PersistenceBrokerSecurityAttributesProvider.java?rev=683497&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/PersistenceBrokerSecurityAttributesProvider.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/PersistenceBrokerSecurityAttributesProvider.java Wed Aug  6 20:52:05 2008
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.attributes;
+
+import java.security.Principal;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.jetspeed.security.BasePrincipal;
+import org.apache.jetspeed.security.GroupPrincipal;
+import org.apache.jetspeed.security.RemotePrincipal;
+import org.apache.jetspeed.security.RolePrincipal;
+import org.apache.jetspeed.security.UserPrincipal;
+import org.apache.jetspeed.security.impl.GroupPrincipalImpl;
+import org.apache.jetspeed.security.impl.RemotePrincipalImpl;
+import org.apache.jetspeed.security.impl.RolePrincipalImpl;
+import org.apache.jetspeed.security.impl.UserPrincipalImpl;
+import org.apache.ojb.broker.query.Criteria;
+import org.apache.ojb.broker.query.QueryByCriteria;
+import org.apache.ojb.broker.query.QueryFactory;
+import org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport;
+import org.apache.jetspeed.security.SecurityException;
+
+/**
+ * <p>
+ * Persistence for Security Attributes including Portlet API User Attributes
+ * </p>
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class PersistenceBrokerSecurityAttributesProvider 
+        extends PersistenceBrokerDaoSupport 
+        implements SecurityAttributesProvider
+{    
+    public PersistenceBrokerSecurityAttributesProvider()
+    {
+    }
+        
+    public SecurityAttributes retrieveAttributes(Principal principal)  throws SecurityException
+    {
+        if (!(principal instanceof UserPrincipal))
+            throw new SecurityException(
+                    SecurityException.UNKNOWN_PRINCIPAL_TYPE.create(principal.getClass().toString())); 
+        BasePrincipal bp = (BasePrincipal)principal;
+        Criteria c = new Criteria();        
+        c.addEqualTo("principalId", bp.getId());
+        QueryByCriteria query = QueryFactory.newQuery(SecurityAttributeImpl.class, c);
+        Map<String, SecurityAttribute> result = new HashMap<String, SecurityAttribute>();
+        Collection<SecurityAttribute> queryResult = getPersistenceBrokerTemplate().getCollectionByQuery(query);
+        for (SecurityAttribute sa : queryResult)
+        {
+            result.put(sa.getName(), sa);
+        }
+        return new SecurityAttributesImpl(principal, result);        
+    }
+    
+    public SecurityAttributes createSecurityAttributes(Principal principal) throws SecurityException
+    {
+        if (!(principal instanceof UserPrincipal))
+            throw new SecurityException(
+                    SecurityException.UNKNOWN_PRINCIPAL_TYPE.create(principal.getClass().toString())); 
+        return new SecurityAttributesImpl(principal, new HashMap<String, SecurityAttribute>());
+    }
+    
+    public void deleteAttributes(Principal principal) throws SecurityException
+    {
+        if (!(principal instanceof BasePrincipal))
+            throw new SecurityException(
+                    SecurityException.UNKNOWN_PRINCIPAL_TYPE.create(principal.getClass().toString())); 
+        BasePrincipal bp = (BasePrincipal)principal;
+        Criteria c = new Criteria();        
+        
+        c.addEqualTo("principalId", bp.getId());
+        QueryByCriteria query = QueryFactory.newQuery(SecurityAttributeImpl.class, c);        
+        getPersistenceBrokerTemplate().deleteByQuery(query);
+    }
+    
+    
+    public void saveAttributes(SecurityAttributes after) throws SecurityException
+    {
+        SecurityAttributes before = this.retrieveAttributes(after.getPrincipal());
+        // first pass, get any deletes
+        for (String key : before.getAttributes().keySet())
+        {
+            SecurityAttribute aa = after.getAttributes().get(key);
+            if (aa == null)
+            {
+                // it was there before, now its gone, so delete it
+                SecurityAttribute ba = before.getAttributes().get(key);                
+                getPersistenceBrokerTemplate().delete(ba);
+            }
+            else
+            {
+                SecurityAttribute ba = before.getAttributes().get(key);
+                if (diff(aa, ba))
+                {
+                    copy(aa, ba);
+                    getPersistenceBrokerTemplate().store(ba);
+                }
+            }            
+        }
+        // second pass, get any adds (updates already processed)
+        for (String key : after.getAttributes().keySet())
+        {
+            SecurityAttribute ba = before.getAttributes().get(key);
+            // if found do nothing, otherwise add it
+            if (ba == null)
+            {
+                SecurityAttribute aa = after.getAttributes().get(key);                
+                getPersistenceBrokerTemplate().store(aa);
+            }
+        }        
+    }
+
+    private void copy(SecurityAttribute source, SecurityAttribute dest)
+    {
+        dest.setValue(source.getValue());
+    }
+    
+    private boolean diff(SecurityAttribute a1, SecurityAttribute a2)
+    {
+        if (a1.getName().equals(a2.getName()) && a1.getType().equals(a2.getType())
+                && a1.getValue().equals(a2.getValue()))
+            return false;
+        return true;
+    }
+
+    public Collection<SecurityAttributes> lookupAttributes(String name, String value) throws SecurityException
+    {
+        Criteria c = new Criteria();        
+        c.addEqualTo("name", name);
+        c.addEqualTo("value", value);
+        QueryByCriteria query = QueryFactory.newQuery(SecurityAttributeImpl.class, c);
+        Map<Long, SecurityAttributes> uniques = new HashMap<Long, SecurityAttributes>();
+        Collection<SecurityAttribute> queryResult = getPersistenceBrokerTemplate().getCollectionByQuery(query);
+        for (SecurityAttribute attrib : queryResult)
+        {
+            SecurityAttributes sa = uniques.get(attrib.getPrincipalId());
+            if (sa == null)
+            {
+                BasePrincipal principal = createPrincipalFromAttribute(attrib);
+                Map<String, SecurityAttribute> result = new HashMap<String, SecurityAttribute>();
+                result.put(attrib.getName(), attrib);
+                sa = new SecurityAttributesImpl(principal, result);
+                uniques.put(attrib.getPrincipalId(), sa);
+            }
+            else
+            {
+                sa.getAttributes().put(attrib.getName(), attrib);
+            }
+        }
+        Collection<SecurityAttributes> resultSet = new LinkedList<SecurityAttributes>();
+        for (Map.Entry<Long, SecurityAttributes> e : uniques.entrySet())
+        {
+            resultSet.add(e.getValue());
+        }
+        return resultSet;
+   }
+
+    public BasePrincipal createPrincipalFromAttribute(SecurityAttribute attr) throws SecurityException
+    {
+        if (attr.getType().equals(UserPrincipal.PRINCIPAL_TYPE))
+            return new UserPrincipalImpl(attr.getPrincipalId(), attr.getName());
+        else if (attr.getType().equals(GroupPrincipal.PRINCIPAL_TYPE))
+            return new GroupPrincipalImpl(attr.getPrincipalId(), attr.getName());
+        else if (attr.getType().equals(RolePrincipal.PRINCIPAL_TYPE))
+            return new RolePrincipalImpl(attr.getPrincipalId(), attr.getName());
+        else if (attr.getType().equals(RemotePrincipal.PRINCIPAL_TYPE))
+            return new RemotePrincipalImpl(attr.getPrincipalId(), attr.getName());        
+        else
+            throw new SecurityException(
+                    SecurityException.UNKNOWN_PRINCIPAL_TYPE.create(attr.getType())); 
+   }
+}
\ No newline at end of file

Added: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributeImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributeImpl.java?rev=683497&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributeImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributeImpl.java Wed Aug  6 20:52:05 2008
@@ -0,0 +1,112 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.attributes;
+
+import java.io.Serializable;
+import java.security.Principal;
+
+import org.apache.jetspeed.security.BasePrincipal;
+import org.apache.jetspeed.security.GroupPrincipal;
+import org.apache.jetspeed.security.RemotePrincipal;
+import org.apache.jetspeed.security.RolePrincipal;
+import org.apache.jetspeed.security.UserPrincipal;
+
+public class SecurityAttributeImpl implements SecurityAttribute, Serializable
+{        
+    private static final long serialVersionUID = 4351915790962874112L;
+    private long attributeId;
+    private long principalId;
+    private String name;
+    private String type;
+    private String principalType;
+    private String value;
+    private boolean nullValue;
+    
+    public SecurityAttributeImpl()
+    {}
+    
+    public SecurityAttributeImpl(Principal p, String name, String type, String value)
+    {
+        if (!(p instanceof BasePrincipal))
+            throw new RuntimeException("Invalid Principal Type: " + p.getClass());
+        BasePrincipal principal = (BasePrincipal)p;
+        this.principalId = principal.getId();
+        this.name = name;
+        this.type = type;
+        this.value = value;
+        if (principal instanceof UserPrincipal)
+        {
+            this.principalType = UserPrincipal.PRINCIPAL_TYPE;            
+        }
+        else if (principal instanceof RolePrincipal)
+        {
+            this.principalType = RolePrincipal.PRINCIPAL_TYPE;            
+        }
+        else if (principal instanceof GroupPrincipal)
+        {
+            this.principalType = GroupPrincipal.PRINCIPAL_TYPE;            
+        }
+        else if (principal instanceof RemotePrincipal)
+        {
+            this.principalType = RemotePrincipal.PRINCIPAL_TYPE;            
+        }
+        else
+            throw new RuntimeException("Invalid Principal Type: " + principal.getClass());
+    }
+    
+    public String getName()
+    {
+        return this.name;
+    }
+
+    public String getType()
+    {
+        return this.type;
+    }
+
+    public String getValue()
+    {
+        return this.value;
+    }
+
+    public boolean getNullValue()
+    {
+        return this.nullValue;
+    }
+    
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+
+    public long getAttributeId()
+    {
+        return attributeId;
+    }
+    
+    public long getPrincipalId()
+    {
+        return principalId;
+    }
+    
+    public String getPrincipalType()
+    {
+        return principalType;
+    }
+
+    
+}

Added: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributesImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributesImpl.java?rev=683497&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributesImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/attributes/SecurityAttributesImpl.java Wed Aug  6 20:52:05 2008
@@ -0,0 +1,73 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.attributes;
+
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.jetspeed.security.BasePrincipal;
+
+
+public class SecurityAttributesImpl implements SecurityAttributes
+{
+    private Map<String, SecurityAttribute> attributes;
+    private Principal principal;
+
+    public SecurityAttributesImpl() 
+    {}
+    
+    public SecurityAttributesImpl(Principal principal, Map<String, SecurityAttribute> attribs)
+    {
+        this.principal = principal;
+        this.attributes = attribs;
+    }
+    
+    public Map<String, SecurityAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
+    public Map<String, SecurityAttribute> getAttributes(String kind)
+    {
+        Map<String, SecurityAttribute> result = new HashMap<String, SecurityAttribute>();
+        for (Map.Entry<String, SecurityAttribute> e : this.attributes.entrySet())
+        {
+            SecurityAttribute attr = e.getValue();
+            if (attr.getType().equals(kind))
+            {
+                result.put(attr.getName(), attr);
+            }
+        }
+        return result;
+    }
+    
+    public Principal getPrincipal()
+    {
+        return principal;
+    }
+
+    public SecurityAttribute createAttribute(String name, String value)
+    {
+        return new SecurityAttributeImpl(principal, name, SecurityAttributes.SECURITY_ATTRIBUTE, value);
+    }
+
+    public SecurityAttribute createUserInformation(String name, String value)
+    {
+        return new SecurityAttributeImpl(principal, name, SecurityAttributes.USER_INFORMATION, value);
+    }
+}



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