portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r736069 [1/3] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: ./ applications/jetspeed-demo/ applications/jetspeed-dependencies/ components/ components/jetspeed-capability/ components/jetspeed-db-tools/ components/jetspeed-page-manager...
Date Tue, 20 Jan 2009 19:10:46 GMT
Author: rwatler
Date: Tue Jan 20 11:10:43 2009
New Revision: 736069

URL: http://svn.apache.org/viewvc?rev=736069&view=rev
Log:
Merge of trunk -r 731458:736033
-------------------------------------
- added plugin management for OpenJPA enhancer plugin in root pom.xml
- added missing sso.xml test configuration for profiler
- suppressed RuntimeException in JetspeedSecurityPersistenceManager on empty database


Added:
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortletEnvironmentService.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortletEnvironmentService.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/ResourceRenderResponseImpl.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/ResourceRenderResponseImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityDomainImpl.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityDomainImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedDomainPrincipalAccessManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedDomainPrincipalAccessManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainAccessManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainAccessManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainStorageManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainStorageManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityDomain.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityDomain.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityDomains.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityDomains.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOUserImpl.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOUserImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/
      - copied from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/SSOSiteManagerSPI.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/SSOSiteManagerSPI.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/SSOUserManagerSPI.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/SSOUserManagerSPI.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/
      - copied from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/JetspeedPersistentSSOSiteManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/JetspeedPersistentSSOSiteManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/SSOUserManagerSPIImpl.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/SSOUserManagerSPIImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/AbstractSecurityTestCase.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/AbstractSecurityTestCase.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestSSOManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestSSOManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/resources/cache-test.xml
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/resources/cache-test.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/sso/SSOPortletUtil.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/sso/SSOPortletUtil.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityDomain.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityDomain.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOClient.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOClient.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOSiteManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOSiteManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOUser.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOUser.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOUserManager.java
      - copied unchanged from r736033, portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOUserManager.java
Removed:
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOCookieImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOPrincipalImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/resources/boot/
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOCookie.java
Modified:
    portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-dependencies/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-db-tools/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/   (props changed)
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialAccessManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BelongsToPrincipalAssociationHandler.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/stubs/StubJetspeedPrincipal.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/stubs/StubJetspeedPrincipalManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/   (props changed)
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/JETSPEED-INF/ojb/sso_repository.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOSiteImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestBasicSSO.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestSSOComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/SSOIFramePortlet.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/SSOWebContentPortlet.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/WebContentPortlet.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/sso/SSOProxyPortlet.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages_en.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages_ja.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages_ko.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages_nl.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages_ua.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages_zh.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/exception/JetspeedExceptionMessages_zh_TW.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalType.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityException.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOException.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOProvider.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOSite.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/jetspeed-services.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-managers.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/security-spi.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/serializer.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/assembly/sso.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/seed/j2-seed.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/seed/min/j2-seed.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml Tue Jan 20 11:10:43 2009
@@ -577,11 +577,11 @@
                     </deployment>
                     <!-- demo pa's -->
                     <deployment>
-                      <artifact>org.apache.portals.jetspeed-2:demo:war</artifact>
+                      <artifact>org.apache.portals.applications:demo:war</artifact>
                       <delete>./demo</delete>
                     </deployment>
                     <deployment>
-                      <artifact>org.apache.portals.jetspeed-2:rss:war</artifact>
+                      <artifact>org.apache.portals.applications:rss:war</artifact>
                       <delete>./rss</delete>
                     </deployment>
                     <deployment>
@@ -659,15 +659,15 @@
               </dependency>
               <!-- demo pa's -->
               <dependency>
-                <groupId>org.apache.portals.jetspeed-2</groupId>
+                <groupId>org.apache.portals.applications</groupId>
                 <artifactId>rss</artifactId>
-                <version>2.1.3</version>
+                <version>2.2-SNAPSHOT</version>
                 <type>war</type>
               </dependency>
               <dependency>
-                <groupId>org.apache.portals.jetspeed-2</groupId>
+                <groupId>org.apache.portals.applications</groupId>
                 <artifactId>demo</artifactId>
-                <version>2.1.3</version>
+                <version>2.2-SNAPSHOT</version>
                 <type>war</type>
               </dependency>
               <dependency>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-dependencies/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-dependencies/pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-dependencies/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/applications/jetspeed-dependencies/pom.xml Tue Jan 20 11:10:43 2009
@@ -95,12 +95,10 @@
       <groupId>org.apache.portals.jetspeed-2</groupId>
       <artifactId>jetspeed-portlet-factory</artifactId>
     </dependency>
-    <!-- Commenting out SSO module for now
     <dependency>
       <groupId>org.apache.portals.jetspeed-2</groupId>
       <artifactId>jetspeed-sso</artifactId>
     </dependency>
-    -->
     <dependency>
       <groupId>org.apache.portals.jetspeed-2</groupId>
       <artifactId>jetspeed-statistics</artifactId>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-capability/pom.xml Tue Jan 20 11:10:43 2009
@@ -107,7 +107,6 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>openjpa-maven-plugin</artifactId>
-        <version>1.0-alpha</version>
         <executions>
           <execution>
             <id>org.apache.jetspeed.capabilities.jpa</id>
@@ -116,7 +115,7 @@
               <goal>enhance</goal>
             </goals>
             <configuration>
-              <classes>${project.build.directory}/classes/org/apache/jetspeed/capabilities/jpa</classes>                   	  
+              <classes>${project.build.directory}/classes/org/apache/jetspeed/capabilities/jpa</classes>
               <toolProperties>                      	 
                 <property>
                   <name>addDefaultConstructor</name>
@@ -130,21 +129,6 @@
             </configuration>
           </execution>
         </executions>
-        <dependencies>
-          <!-- rule objects implement Jetspeed APIs -->
-          <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>jetspeed-api</artifactId>
-            <version>${pom.version}</version>
-          </dependency>
-          <!-- force upgrade of JPA for plugin -->
-          <dependency>
-            <groupId>org.apache.openjpa</groupId>
-            <artifactId>openjpa-persistence-jdbc</artifactId>
-            <version>${openjpa.version}</version>
-            <scope>runtime</scope>
-          </dependency>
-        </dependencies>
       </plugin>
     </plugins>
     <testResources>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-db-tools/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-db-tools/pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-db-tools/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-db-tools/pom.xml Tue Jan 20 11:10:43 2009
@@ -87,6 +87,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.portals.jetspeed-2</groupId>
+      <artifactId>jetspeed-sso</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.portals.jetspeed-2</groupId>
       <artifactId>jetspeed-registry</artifactId>
     </dependency>
     <dependency>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/pom.xml Tue Jan 20 11:10:43 2009
@@ -178,7 +178,6 @@
  	        <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>openjpa-maven-plugin</artifactId>
-                <version>1.0-alpha</version>
                 <executions>
                     <execution>
                         <id>org.apache.jetspeed.om.folder.jpa</id>
@@ -187,7 +186,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/om/folder/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/om/folder/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -207,7 +206,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/om/page/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/om/page/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -227,7 +226,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/page/document/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/page/document/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -247,7 +246,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/page/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/page/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -261,21 +260,6 @@
                         </configuration>                  
                     </execution>
                 </executions>
-                <dependencies>
-                    <!-- om objects implement Jetspeed APIs -->
-                    <dependency>
-                        <groupId>${pom.groupId}</groupId>
-                        <artifactId>jetspeed-api</artifactId>
-                        <version>${pom.version}</version>
-                    </dependency>
-                    <!-- force upgrade of JPA for plugin -->
-                    <dependency>
-                        <groupId>org.apache.openjpa</groupId>
-                        <artifactId>openjpa-persistence-jdbc</artifactId>
-                        <version>${openjpa.version}</version>
-                        <scope>runtime</scope>
-                    </dependency>
-                </dependencies>
             </plugin>
         </plugins>
     </build>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/pom.xml Tue Jan 20 11:10:43 2009
@@ -157,13 +157,11 @@
             <artifactId>jetspeed-search</artifactId>
             <scope>test</scope>
         </dependency>
-        <!-- Commenting out SSO module for now
         <dependency>
             <groupId>${pom.groupId}</groupId>
             <artifactId>jetspeed-sso</artifactId>
             <scope>test</scope>
         </dependency>
-        -->
         <dependency>
             <groupId>${pom.groupId}</groupId>
             <artifactId>jetspeed-profiler</artifactId>

Propchange: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 20 11:10:43 2009
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/pom.xml Tue Jan 20 11:10:43 2009
@@ -89,6 +89,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-sso</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.transaction</groupId>
             <artifactId>jta</artifactId>
             <scope>test</scope>
@@ -144,7 +149,6 @@
  	        <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>openjpa-maven-plugin</artifactId>
-                <version>1.0-alpha</version>
                 <executions>
                     <execution>
                         <id>org.apache.jetspeed.profiler.rules.jpa</id>
@@ -153,7 +157,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/profiler/rules/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/profiler/rules/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -173,7 +177,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/profiler/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/profiler/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -187,21 +191,6 @@
                         </configuration>                  
                     </execution>
                 </executions>
-                <dependencies>
-                    <!-- rule objects implement Jetspeed APIs -->
-                    <dependency>
-                        <groupId>${pom.groupId}</groupId>
-                        <artifactId>jetspeed-api</artifactId>
-                        <version>${pom.version}</version>
-                    </dependency>
-                    <!-- force upgrade of JPA for plugin -->
-                    <dependency>
-                        <groupId>org.apache.openjpa</groupId>
-                        <artifactId>openjpa-persistence-jdbc</artifactId>
-                        <version>${openjpa.version}</version>
-                        <scope>runtime</scope>
-                    </dependency>
-                </dependencies>
             </plugin>
         </plugins>
         <testResources>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestOpenJPAProfiler.java Tue Jan 20 11:10:43 2009
@@ -47,8 +47,10 @@
      */
     protected String[] getConfigurations()
     {
-        return new String[] {"openjpa-profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache-test.xml", "capabilities.xml", "registry.xml", "search.xml", "jetspeed-spring.xml",
-                             "security-managers.xml", "security-spi.xml", "security-spi-atn.xml", "security-atz.xml", "static-bean-references.xml" };
+        return new String[] {"openjpa-profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache-test.xml",
+                             "capabilities.xml", "registry.xml", "search.xml", "jetspeed-spring.xml", "sso.xml",
+                             "security-managers.xml", "security-spi.xml", "security-spi-atn.xml", "security-atz.xml",
+                             "static-bean-references.xml" };
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java Tue Jan 20 11:10:43 2009
@@ -155,8 +155,10 @@
      */
     protected String[] getConfigurations()
     {
-        return new String[] { "profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache-test.xml", "capabilities.xml", "registry.xml", "search.xml", "jetspeed-spring.xml",
-                              "security-managers.xml", "security-spi.xml", "security-spi-atn.xml", "security-atz.xml", "static-bean-references.xml" };
+        return new String[] { "profiler.xml", "transaction.xml", "serializer.xml", "security-providers.xml", "cache-test.xml",
+                              "capabilities.xml", "registry.xml", "search.xml", "jetspeed-spring.xml", "sso.xml",
+                              "security-managers.xml", "security-spi.xml", "security-spi-atn.xml", "security-atz.xml",
+                              "static-bean-references.xml" };
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml Tue Jan 20 11:10:43 2009
@@ -170,7 +170,6 @@
  	        <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>openjpa-maven-plugin</artifactId>
-                <version>1.0-alpha</version>
                 <executions>
                     <execution>
                         <id>org.apache.jetspeed.om.portlet.jpa</id>
@@ -199,7 +198,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/components/portletentity/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/components/portletentity/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -219,7 +218,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/components/portletpreferences/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/components/portletpreferences/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -239,7 +238,7 @@
                             <goal>enhance</goal>
                         </goals>
                         <configuration>
-                            <classes>${project.build.directory}/classes/org/apache/jetspeed/components/portletregistry/jpa</classes>                   	  
+                            <classes>${project.build.directory}/classes/org/apache/jetspeed/components/portletregistry/jpa</classes>
                             <toolProperties>                      	 
                                 <property>
                                     <name>addDefaultConstructor</name>
@@ -253,26 +252,6 @@
                         </configuration>                  
                     </execution>
                 </executions>
-                <dependencies>
-                    <!-- om objects implement Jetspeed/Pluto APIs -->
-                    <dependency>
-                        <groupId>${pom.groupId}</groupId>
-                        <artifactId>jetspeed-api</artifactId>
-                        <version>${pom.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.pluto</groupId>
-                        <artifactId>pluto-container-api</artifactId>
-                        <version>${org.apache.pluto.version}</version>
-                    </dependency>
-                    <!-- force upgrade of JPA for plugin -->
-                    <dependency>
-                        <groupId>org.apache.openjpa</groupId>
-                        <artifactId>openjpa-persistence-jdbc</artifactId>
-                        <version>${openjpa.version}</version>
-                        <scope>runtime</scope>
-                    </dependency>
-                </dependencies>
             </plugin>
         </plugins>
         <testResources>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml Tue Jan 20 11:10:43 2009
@@ -289,6 +289,11 @@
           nullable="false"
       >
       </field-descriptor>
+      <field-descriptor 
+          name="domainId" 
+          nullable="false" 
+          jdbc-type="BIGINT"
+          column="domain_id"/>
       <collection-descriptor
           name="attributes"
           element-class-ref="org.apache.jetspeed.security.impl.SecurityAttributeValue"
@@ -445,4 +450,49 @@
       </reference-descriptor>
   </class-descriptor>
 
+<!-- 
+    SECURITY DOMAIN
+-->
+    <!--
+        - J E T S P E E D   P R I N C I P A L   A S S O C I A T I O N
+    -->
+    <class-descriptor
+        class="org.apache.jetspeed.security.impl.SecurityDomainImpl"
+        table="SECURITY_DOMAIN"        
+        >
+        <documentation>Security Domain</documentation>
+        <field-descriptor
+            name="domainId"            
+            autoincrement="true"            
+            column="domain_id"
+            jdbc-type="BIGINT"
+            primarykey="true"
+        />
+        <field-descriptor
+            name="name"
+            column="domain_name"
+            jdbc-type="VARCHAR"
+            length="30"
+        />
+        <field-descriptor
+            name="ownerDomainId"
+            column="owner_domain_id"
+            jdbc-type="BIGINT"            
+        />
+        <field-descriptor
+            name="remote"
+            column="remote"
+            jdbc-type="INTEGER"
+            conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
+            nullable="false"
+        />
+        <field-descriptor
+            name="enabled"
+            column="enabled"
+            jdbc-type="INTEGER"
+            conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
+            nullable="false"
+        />
+    </class-descriptor>
+    
 </descriptor-repository>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java Tue Jan 20 11:10:43 2009
@@ -234,7 +234,7 @@
             }
             assHandlers.put(key, jpah);
             associationTypes.add(jpah.getAssociationType());
-            if (jpah.getAssociationType().isRequired())
+            if (jpah.getAssociationType().isRequired() && jpah.getAssociationType().getFromPrincipalType().getName().equals(principalType.getName()))
             {
                 reqAssociations.put(key,jpah.getAssociationType());
             }
@@ -347,7 +347,7 @@
      *
      * @param listener principal manager event listener
      */
-    public void setListener(PrincipalManagerEventListener listener)
+    public void addListener(PrincipalManagerEventListener listener)
     {
         // add listener to listeners list
         synchronized (listeners)
@@ -355,7 +355,7 @@
             listeners.add(listener);
         }
     }
-
+       
     /**
      * removeListener - remove principal manager event listener
      *

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java Tue Jan 20 11:10:43 2009
@@ -41,6 +41,7 @@
     
     protected transient JetspeedPrincipalType jpt;
     protected transient SecurityAttributes sa;
+    private Long domainId;
     
     public static void setJetspeedPrincipalManagerProvider(JetspeedPrincipalManagerProvider jpmp)
     {
@@ -166,4 +167,13 @@
     {
         return getType().getName()+": "+getName()+" (id: "+(getId())+", transient: "+isTransient()+", mapped: "+isMapped()+")";
     }
+    
+    public Long getDomainId()
+    {
+        return domainId;
+    }
+
+    public void setDomainId(Long domainId){
+        this.domainId=domainId;
+    }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialAccessManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialAccessManager.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialAccessManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialAccessManager.java Tue Jan 20 11:10:43 2009
@@ -39,4 +39,9 @@
     PasswordCredential getPasswordCredential(String userName);
     void loadPasswordCredentialUser(PasswordCredential credential);
     List<PasswordCredential> getHistoricPasswordCredentials(User user);
+
+
+    PasswordCredential getPasswordCredential(String userName, Long securityDomain);
+    List<PasswordCredential> getHistoricPasswordCredentials(User user, Long securityDomain);
+
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BelongsToPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BelongsToPrincipalAssociationHandler.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BelongsToPrincipalAssociationHandler.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BelongsToPrincipalAssociationHandler.java Tue Jan 20 11:10:43 2009
@@ -30,7 +30,7 @@
 {
     public BelongsToPrincipalAssociationHandler(JetspeedPrincipalManagerSPI from, JetspeedPrincipalManagerSPI to, JetspeedPrincipalAssociationStorageManager jpasm)
     {
-        super(new JetspeedPrincipalAssociationTypeImpl(JetspeedPrincipalAssociationType.IS_CHILD_OF, from.getPrincipalType(), to.getPrincipalType(), true, true, true, false), from, to, jpasm);
+        super(new JetspeedPrincipalAssociationTypeImpl(JetspeedPrincipalAssociationType.BELONGS_TO, from.getPrincipalType(), to.getPrincipalType(), true, true, true, false), from, to, jpasm);
     }
     
     public BelongsToPrincipalAssociationHandler(String associationName, JetspeedPrincipalManagerSPI from, JetspeedPrincipalManagerSPI to, JetspeedPrincipalAssociationStorageManager jpasm)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java Tue Jan 20 11:10:43 2009
@@ -19,6 +19,7 @@
 import java.io.Serializable;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -30,15 +31,21 @@
 import org.apache.jetspeed.security.JetspeedPrincipalAssociationReference;
 import org.apache.jetspeed.security.JetspeedPrincipalType;
 import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityDomain;
 import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.impl.PersistentJetspeedPrincipal;
+import org.apache.jetspeed.security.impl.SecurityDomainImpl;
+import org.apache.jetspeed.security.impl.TransientJetspeedPrincipal;
+import org.apache.jetspeed.security.spi.JetspeedDomainPrincipalAccessManager;
 import org.apache.jetspeed.security.spi.JetspeedPermissionAccessManager;
 import org.apache.jetspeed.security.spi.JetspeedPermissionStorageManager;
 import org.apache.jetspeed.security.spi.JetspeedPrincipalAccessManager;
 import org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationStorageManager;
 import org.apache.jetspeed.security.spi.JetspeedPrincipalStorageManager;
 import org.apache.jetspeed.security.spi.PersistentJetspeedPermission;
+import org.apache.jetspeed.security.spi.SecurityDomainAccessManager;
+import org.apache.jetspeed.security.spi.SecurityDomainStorageManager;
 import org.apache.jetspeed.security.spi.UserPasswordCredentialAccessManager;
 import org.apache.jetspeed.security.spi.UserPasswordCredentialStorageManager;
 import org.apache.ojb.broker.PersistenceBroker;
@@ -51,6 +58,7 @@
 import org.apache.ojb.broker.query.ReportQueryByCriteria;
 import org.apache.ojb.broker.util.collections.ManageableArrayList;
 import org.springframework.dao.DataIntegrityViolationException;
+import org.springframework.orm.ObjectRetrievalFailureException;
 import org.springframework.orm.ojb.PersistenceBrokerCallback;
 
 /**
@@ -59,9 +67,14 @@
 public class JetspeedSecurityPersistenceManager
     extends InitablePersistenceBrokerDaoSupport
     implements Serializable,JetspeedPrincipalAccessManager,
-                JetspeedPrincipalStorageManager, UserPasswordCredentialStorageManager, UserPasswordCredentialAccessManager,
-                JetspeedPrincipalAssociationStorageManager, JetspeedPermissionAccessManager, JetspeedPermissionStorageManager
+                JetspeedPrincipalStorageManager, JetspeedDomainPrincipalAccessManager, UserPasswordCredentialStorageManager, UserPasswordCredentialAccessManager,
+                JetspeedPrincipalAssociationStorageManager, JetspeedPermissionAccessManager, JetspeedPermissionStorageManager, 
+                SecurityDomainStorageManager, SecurityDomainAccessManager
 {
+    private static final long serialVersionUID = -2689340557699526023L;
+	
+    private Long defaultSecurityDomainId;
+    
     private static class ManagedListByQueryCallback implements PersistenceBrokerCallback
     {
         private Query query;
@@ -86,69 +99,109 @@
     {
         if (principal.getId() == null)
         {
-            return principalExists(principal.getName(), principal.getType());
+            if (principal.getDomainId() != null){
+                return principalExists(principal.getName(), principal.getType(), principal.getDomainId());    
+            } else {
+                return principalExists(principal.getName(), principal.getType());
+            }
+            
         }
         Criteria criteria = new Criteria();
         criteria.addEqualTo("id", principal.getId());
         criteria.addEqualTo("type", principal.getType().getName());
+        criteria.addEqualTo("domainId", principal.getDomainId());
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class,criteria);
         return getPersistenceBrokerTemplate().getCount(query) == 1;
     }
 
+	public List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+	    Long defaultDomainId = getDefaultSecurityDomainId();
+	    return getAssociatedFrom(principalFromName, from, to, associationName, defaultDomainId, defaultDomainId);
+	}
     //
     // JetspeedPrincipalAccessManager interface implementation
     //
     @SuppressWarnings("unchecked") 
-    public List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.name", principalFromName);
         criteria.addEqualTo("type", to.getName());
+        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
     }
 
+    public List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+        Long defaultDomainId = getDefaultSecurityDomainId();
+        return getAssociatedTo(principalToName, from, to, associationName, defaultDomainId, defaultDomainId);
+    }
+
     @SuppressWarnings("unchecked") 
-    public List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.name", principalToName);
         criteria.addEqualTo("type", from.getName());
+        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
     }
 
+    public List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+        Long defaultDomainId = getDefaultSecurityDomainId();
+        return getAssociatedFrom(principalFromId, from, to, associationName, defaultDomainId, defaultDomainId);
+    }
+
     @SuppressWarnings("unchecked") 
-    public List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.id", principalFromId);
         criteria.addEqualTo("type", to.getName());
+        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
     }
 
+    public List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+        Long defaultDomainId = getDefaultSecurityDomainId();
+        return getAssociatedTo(principalToId, from, to, associationName, defaultDomainId, defaultDomainId);
+    }
+
     @SuppressWarnings("unchecked") 
-    public List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.id", principalToId);
         criteria.addEqualTo("type", from.getName());
+        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
     }
 
+    public List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+        Long defaultDomainId = getDefaultSecurityDomainId();
+        return getAssociatedNamesFrom(principalFromName, from, to, associationName, defaultDomainId, defaultDomainId);
+    }
+
     @SuppressWarnings("unchecked") 
-    public List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.name", principalFromName);
         criteria.addEqualTo("type", to.getName());
+        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -159,13 +212,20 @@
         return names;
     }
 
+    public List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+        Long defaultDomainId = getDefaultSecurityDomainId();
+        return getAssociatedNamesFrom(principalFromId, from, to, associationName, defaultDomainId, defaultDomainId);
+    }
+
     @SuppressWarnings("unchecked") 
-    public List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.id", principalFromId);
         criteria.addEqualTo("type", to.getName());
+        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -176,13 +236,20 @@
         return names;
     }
 
+    public List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+        Long defaultDomainId = getDefaultSecurityDomainId();
+        return getAssociatedNamesTo(principalToName, from, to, associationName, defaultDomainId, defaultDomainId);
+    }
+
     @SuppressWarnings("unchecked") 
-    public List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.name", principalToName);
         criteria.addEqualTo("type", from.getName());
+        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -193,13 +260,20 @@
         return names;
     }
 
+    public List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
+        Long defaultDomainId = getDefaultSecurityDomainId();
+        return getAssociatedNamesTo(principalToId, from, to, associationName, defaultDomainId, defaultDomainId);
+    }
+
     @SuppressWarnings("unchecked") 
-    public List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName)
+    public List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.id", principalToId);
         criteria.addEqualTo("type", from.getName());
+        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -217,22 +291,34 @@
 
     public JetspeedPrincipal getPrincipal(String principalName, JetspeedPrincipalType type)
     {
+        return getPrincipal(principalName, type, getDefaultSecurityDomainId());
+    }
+    
+    public JetspeedPrincipal getPrincipal(String principalName, JetspeedPrincipalType type, Long securityDomain)
+    {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("name", principalName);
         criteria.addEqualTo("type", type.getName());
+        criteria.addEqualTo("domainId", securityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class,criteria);
         return (JetspeedPrincipal)getPersistenceBrokerTemplate().getObjectByQuery(query);
     }
 
-    @SuppressWarnings("unchecked") 
     public List<String> getPrincipalNames(String nameFilter, JetspeedPrincipalType type)
     {
+        return getPrincipalNames(nameFilter, type, getDefaultSecurityDomainId());
+    }
+
+    @SuppressWarnings("unchecked") 
+    public List<String> getPrincipalNames(String nameFilter, JetspeedPrincipalType type, Long securityDomain)
+    {
         Criteria criteria = new Criteria();
         if (nameFilter != null && nameFilter.length() > 0)
         {
             criteria.addLike("name", nameFilter+"%");
         }
         criteria.addEqualTo("type", type.getName());
+        criteria.addEqualTo("domainId", securityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -243,35 +329,53 @@
         return names;
     }
 
-    @SuppressWarnings("unchecked") 
     public List<JetspeedPrincipal> getPrincipals(String nameFilter, JetspeedPrincipalType type)
     {
+        return getPrincipals(nameFilter, type, getDefaultSecurityDomainId());
+    }
+    
+    @SuppressWarnings("unchecked") 
+    public List<JetspeedPrincipal> getPrincipals(String nameFilter, JetspeedPrincipalType type, Long securityDomain)
+    {
         Criteria criteria = new Criteria();
         if (nameFilter != null && nameFilter.length() > 0)
         {
             criteria.addLike("name", nameFilter+"%");
         }
         criteria.addEqualTo("type", type.getName());
+        criteria.addEqualTo("domainId", securityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class,criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
     }
 
-    @SuppressWarnings("unchecked") 
     public List<JetspeedPrincipal> getPrincipalsByAttribute(String attributeName, String attributeValue, JetspeedPrincipalType type)
     {
+        return getPrincipalsByAttribute(attributeName, attributeValue, type, getDefaultSecurityDomainId());
+    }
+    
+    @SuppressWarnings("unchecked") 
+    public List<JetspeedPrincipal> getPrincipalsByAttribute(String attributeName, String attributeValue, JetspeedPrincipalType type, Long securityDomain)
+    {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("attributes.name", attributeName);
         criteria.addEqualTo("attributes.value", attributeValue);
         criteria.addEqualTo("type", type.getName());
+        criteria.addEqualTo("domainId", securityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class,criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
     }
 
     public boolean principalExists(String principalName, JetspeedPrincipalType type)
     {
+        return principalExists(principalName, type, getDefaultSecurityDomainId());
+    }
+    
+    public boolean principalExists(String principalName, JetspeedPrincipalType type, Long securityDomain)
+    {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("name", principalName);
         criteria.addEqualTo("type", type.getName());
+        criteria.addEqualTo("domainId", securityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class,criteria);
         return getPersistenceBrokerTemplate().getCount(query) == 1;
     }
@@ -282,6 +386,9 @@
     public void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference> associations)
         throws SecurityException
     {
+        if (principal.getDomainId() == null && principal instanceof TransientJetspeedPrincipal){
+            ((TransientJetspeedPrincipal)principal).setDomainId(getDefaultSecurityDomainId());
+        }
         if (principalExists(principal))
         {
             throw new SecurityException(SecurityException.PRINCIPAL_ALREADY_EXISTS.createScoped(principal.getType().getName(), principal.getName()));
@@ -391,6 +498,9 @@
         getPersistenceBrokerTemplate().store(credential);
     }
 
+    public PasswordCredential getPasswordCredential(String userName){
+        return getPasswordCredential(userName,getDefaultSecurityDomainId());
+    }
     //
     // UserPasswordCredentialAccessManager interface implementation
     //
@@ -405,12 +515,13 @@
      * The user reference can be materialized by calling {@link #loadPasswordCredentialUser(PasswordCredential)}.
      * </p>
      */
-    public PasswordCredential getPasswordCredential(String userName)
+    public PasswordCredential getPasswordCredential(String userName, Long securityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("user.name", userName);
         criteria.addEqualTo("user.enabled",true);
         criteria.addEqualTo("type", PasswordCredential.TYPE_CURRENT);
+        criteria.addEqualTo("domainId", securityDomain);
         Query query = QueryFactory.newQuery(PasswordCredentialImpl.class,criteria);
         PasswordCredentialImpl pwc = (PasswordCredentialImpl)getPersistenceBrokerTemplate().getObjectByQuery(query);
         if (pwc != null)
@@ -438,8 +549,12 @@
         }
     }
 
+    public List<PasswordCredential> getHistoricPasswordCredentials(User user){
+        return getHistoricPasswordCredentials(user,getDefaultSecurityDomainId());
+    }
+    
     @SuppressWarnings("unchecked") 
-    public List<PasswordCredential> getHistoricPasswordCredentials(User user)
+    public List<PasswordCredential> getHistoricPasswordCredentials(User user, Long securityDomain)
     {
         Criteria criteria = new Criteria();
         criteria.addEqualTo("principalId", user.getId());
@@ -580,6 +695,7 @@
         {
             criteria.addEqualTo("type", principalType);
         }
+        criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
         QueryByCriteria query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         query.addOrderByAscending("type");
         query.addOrderByAscending("name");
@@ -749,6 +865,7 @@
         {
             criteria.addEqualTo("type", principalType);
         }
+        criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
         QueryByCriteria query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         List<JetspeedPrincipal> currentList = (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
         List<JetspeedPrincipal> targetList = new ArrayList<JetspeedPrincipal>(principals);
@@ -794,6 +911,7 @@
         {
             criteria.addEqualTo("principal.type", principal.getType());
             criteria.addEqualTo("principal.name", principal.getName());
+            criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
         }
         else
         {
@@ -830,6 +948,7 @@
         {
             criteria.addEqualTo("principal.type", principal.getType());
             criteria.addEqualTo("principal.name", principal.getName());
+            criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
         }
         else
         {
@@ -849,4 +968,140 @@
             throw new SecurityException(msg, pbe);
         }
     }
+
+    protected boolean domainExists(SecurityDomain domain){        
+        if (domain.getDomainId() != null){
+            return getDomain(domain.getDomainId()) != null;
+        } else {
+            return getDomainByName(domain.getName()) != null; 
+        }
+    }
+    
+    public void addDomain(SecurityDomain domain) throws SecurityException 
+    {
+        if (domainExists(domain))
+        {
+            throw new SecurityException(SecurityException.SECURITY_DOMAIN_EXISTS.create(domain.getName()));
+        }
+        try
+        {
+            getPersistenceBrokerTemplate().store(domain);
+        }
+        catch (Exception pbe)
+        {
+            KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
+                                                                   "addDomain",
+                                                                   pbe.getMessage());
+            logger.error(msg, pbe);
+            throw new SecurityException(msg, pbe);            
+        }
+    }
+
+    public SecurityDomain getDomain(Long domainId)
+    {
+        try{
+            return (SecurityDomain) getPersistenceBrokerTemplate().getObjectById(SecurityDomainImpl.class, domainId);    
+        } catch (ObjectRetrievalFailureException ore){
+            return null;
+        }
+        
+    }
+
+    protected Long getDefaultSecurityDomainId()
+    {
+        if (defaultSecurityDomainId == null)
+        {
+            SecurityDomain d = getDomainByName(SecurityDomain.DEFAULT_NAME);
+            if (d != null)
+            {
+                // cache real default security domain id
+                defaultSecurityDomainId = d.getDomainId();
+            }
+            else
+            {
+                // return fake id that should not exist
+                return new Long(-1);
+            }
+        }   
+        return defaultSecurityDomainId;
+    }
+    
+    public SecurityDomain getDomainByName(String domainName)
+    {
+    	Criteria criteria = new Criteria();
+        criteria.addEqualTo("name", domainName);
+        Query query = QueryFactory.newQuery(SecurityDomainImpl.class,criteria);
+        return (SecurityDomain) getPersistenceBrokerTemplate().getObjectByQuery(query);    
+    }
+
+    @SuppressWarnings("unchecked") 
+    public Collection<SecurityDomain> getAllDomains()
+    {
+        QueryByCriteria query = QueryFactory.newQuery(SecurityDomainImpl.class, new Criteria());
+        query.addOrderByAscending("name");
+        return (List<SecurityDomain>)getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
+    }
+    
+    public void removeDomain(SecurityDomain domain) throws SecurityException
+    {
+        if (!domainExists(domain))
+        {
+            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.create(domain.getName()));
+        }
+        try
+        {
+            getPersistenceBrokerTemplate().delete(domain);
+        }
+        catch (Exception pbe)
+        {
+            if (pbe instanceof DataIntegrityViolationException)
+            {
+                logger.error(pbe.getMessage(), pbe);
+                throw new SecurityException(SecurityException.SECURITY_DOMAIN_NOT_REMOVABLE.create(domain.getName()));
+            }
+            
+            KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
+                                                                   "removeDomain",
+                                                                   pbe.getMessage());
+            logger.error(msg, pbe);
+            throw new SecurityException(msg, pbe);            
+        }
+        
+    }
+    
+    public void updateDomain(SecurityDomain domain) throws SecurityException
+    {
+         if (!domainExists(domain)){
+             throw new SecurityException(SecurityException.SECURITY_DOMAIN_DOES_NOT_EXIST.create(domain.getName()));
+         }
+         try
+         {
+             getPersistenceBrokerTemplate().store(domain);
+         }
+         catch (Exception pbe)
+         {
+             if (pbe instanceof DataIntegrityViolationException)
+             {
+                 logger.error(pbe.getMessage(), pbe);
+                 throw new SecurityException(SecurityException.SECURITY_DOMAIN_UPDATE_FAILURE.create(domain.getDomainId()));
+             }
+             
+             KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
+                                                                    "updateDomain",
+                                                                    pbe.getMessage());
+             logger.error(msg, pbe);
+             throw new SecurityException(msg, pbe);            
+         }
+    }
+
+    @SuppressWarnings("unchecked") 
+    public Collection<SecurityDomain> getDomainsOwnedBy(Long ownerDomainId)
+    {
+        Criteria criteria = new Criteria();
+        criteria.addEqualTo("ownerDomainId", ownerDomainId);
+        QueryByCriteria query = QueryFactory.newQuery(SecurityDomainImpl.class, criteria);
+        query.addOrderByAscending("name");
+        return (List<SecurityDomain>)getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
+    }
+    
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java Tue Jan 20 11:10:43 2009
@@ -17,6 +17,8 @@
 package org.apache.jetspeed.serializer;
 
 import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -41,9 +43,13 @@
 import org.apache.jetspeed.security.RoleManager;
 import org.apache.jetspeed.security.SecurityAttribute;
 import org.apache.jetspeed.security.SecurityAttributes;
+import org.apache.jetspeed.security.SecurityDomain;
 import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.impl.SecurityDomainImpl;
+import org.apache.jetspeed.security.spi.SecurityDomainAccessManager;
+import org.apache.jetspeed.security.spi.SecurityDomainStorageManager;
 import org.apache.jetspeed.security.spi.impl.SynchronizationStateAccess;
 import org.apache.jetspeed.serializer.objects.JSGroup;
 import org.apache.jetspeed.serializer.objects.JSNVPElement;
@@ -54,6 +60,7 @@
 import org.apache.jetspeed.serializer.objects.JSPrincipalAssociation;
 import org.apache.jetspeed.serializer.objects.JSRole;
 import org.apache.jetspeed.serializer.objects.JSSecurityAttributes;
+import org.apache.jetspeed.serializer.objects.JSSecurityDomain;
 import org.apache.jetspeed.serializer.objects.JSSnapshot;
 import org.apache.jetspeed.serializer.objects.JSUser;
 import org.apache.jetspeed.serializer.objects.JSUserAttributes;
@@ -61,6 +68,8 @@
 import org.apache.jetspeed.serializer.objects.JSUserRoles;
 import org.apache.jetspeed.serializer.objects.JSUserUsers;
 
+import edu.emory.mathcs.backport.java.util.Collections;
+
 /**
  * JetspeedSecuritySerializer - Security component serializer
  *
@@ -131,15 +140,17 @@
         }
     }
 
+    protected SecurityDomainStorageManager domainStorageManager; 
+    protected SecurityDomainAccessManager domainAccessManager;
     protected JetspeedPrincipalManagerProvider principalManagerProvider;
     protected GroupManager groupManager;
     protected RoleManager roleManager;
     protected UserManager userManager;
     protected CredentialPasswordEncoder cpe;
     protected PermissionManager pm;
-
+    
     public JetspeedSecuritySerializer(JetspeedPrincipalManagerProvider principalManagerProvider, GroupManager groupManager, RoleManager roleManager, UserManager userManager,
-            CredentialPasswordEncoder cpe, PermissionManager pm)
+            CredentialPasswordEncoder cpe, PermissionManager pm, SecurityDomainStorageManager sdsm, SecurityDomainAccessManager sdam )
     {
         this.principalManagerProvider = principalManagerProvider;
         this.groupManager = groupManager;
@@ -147,6 +158,8 @@
         this.userManager = userManager;
         this.cpe = cpe;
         this.pm = pm;
+        this.domainAccessManager=sdam;
+        this.domainStorageManager=sdsm;
     }
 
     protected void processExport(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
@@ -182,9 +195,11 @@
             {
                 SynchronizationStateAccess.setSynchronizing(Boolean.TRUE);
                 ImportRefs refs = new ImportRefs();
+                
+                recreateSecurityDomains(refs, snapshot, settings, log);
                 recreateJetspeedPrincipals(refs, snapshot, settings, log);
                 recreateJetspeedPrincipalAssociations(refs, snapshot, settings, log);
-                
+
                 if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
                 {
                     log.info("creating permissions");
@@ -238,6 +253,107 @@
         }
     }
 
+    protected SecurityDomain checkDomainExistsOtherwiseCreate(String domainName) throws SecurityException{
+        SecurityDomain domain = domainAccessManager.getDomainByName(domainName);
+        if (domain == null){
+            SecurityDomainImpl newDomain = new SecurityDomainImpl();
+            newDomain.setName(domainName);
+            newDomain.setEnabled(true);
+            newDomain.setRemote(false);
+            
+            domainStorageManager.addDomain(newDomain);
+            domain = domainAccessManager.getDomainByName(domainName);
+        }
+        return domain;
+    }
+    
+    private void recreateSecurityDomains(ImportRefs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException {
+        log.debug("recreateSecurityDomains");
+    
+     // create system and default domain. Adding them to the seed is not necessary!           
+        Long systemDomainId=null;            
+        Long defaultDomainId=null;
+        try{
+            defaultDomainId=checkDomainExistsOtherwiseCreate(SecurityDomain.DEFAULT_NAME).getDomainId();
+            systemDomainId=checkDomainExistsOtherwiseCreate(SecurityDomain.SYSTEM_NAME).getDomainId();
+        } catch (Exception e){
+            throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "SecurityDomains",
+                    "Could not create default and / or system domains!\n"+e.getMessage() }), e);
+        }
+        
+        if (snapshot.getSecurityDomains() != null && snapshot.getSecurityDomains().size() > 0){
+            
+            // sort the domains according to whether they have an owner domain
+            // domains without owner domains ( = base or parent domains) should be created first
+            ArrayList<JSSecurityDomain> sortedDomains = new ArrayList<JSSecurityDomain>(snapshot.getSecurityDomains());
+            
+            Collections.sort(sortedDomains, new Comparator<JSSecurityDomain>(){
+                public int compare(JSSecurityDomain o1, JSSecurityDomain o2)
+                {
+                    boolean o1HasOwner = o1.getOwnerDomain() != null;
+                    boolean o2HasOwner = o2.getOwnerDomain() != null;
+                    
+                    if (o1HasOwner==o2HasOwner){
+                        return 0;
+                    } else if (o1HasOwner){
+                        return 1;
+                    } else {
+                        return -1;
+                    }
+                }
+            });
+            
+            
+            
+            // create other domains
+            for (JSSecurityDomain jsDomain : sortedDomains){      
+                // do some checks first
+                
+                // if domain is the system domain or the default domain, skip creation (they exist already)
+                if (jsDomain.getName().equals(SecurityDomain.SYSTEM_NAME) || jsDomain.getName().equals(SecurityDomain.DEFAULT_NAME)){
+                    break;
+                }
+                if (jsDomain.getName().length() == 0){
+                    throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "SecurityDomain",
+                            "Name of Security Domain must not be empty!" }));
+                }
+                Long ownerDomainId = null;
+                if (jsDomain.getOwnerDomain() != null){                    
+                    if (jsDomain.getOwnerDomain().equals(SecurityDomain.SYSTEM_NAME)){
+                        ownerDomainId=defaultDomainId;
+                    } else if (jsDomain.getOwnerDomain().equals(SecurityDomain.SYSTEM_NAME)) {
+                        ownerDomainId=systemDomainId;
+                    } else {
+                        SecurityDomain ownerDomain = domainAccessManager.getDomainByName(jsDomain.getOwnerDomain());
+                        if (ownerDomain == null){
+                            throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "SecurityDomain","Could not find owner domain with name "+jsDomain.getOwnerDomain()+"for domain with name "+jsDomain.getName()}));
+                        }
+                        ownerDomainId=ownerDomain.getDomainId();
+                    }
+                } else {
+                    // remote domains always need an owner domain. Set the default domain if owner domain is not specified
+                    if (jsDomain.isRemote()){
+                        ownerDomainId=defaultDomainId;
+                    }
+                }
+                
+                SecurityDomainImpl newDomain = new SecurityDomainImpl();
+                newDomain.setName(jsDomain.getName());
+                newDomain.setOwnerDomainId(ownerDomainId);
+                newDomain.setRemote(jsDomain.isRemote());
+                newDomain.setEnabled(jsDomain.isEnabled());
+                try{
+                    domainStorageManager.addDomain(newDomain);    
+                  } catch (Exception e){
+                  throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "SecurityDomain",
+                          e.getMessage() }), e);
+              }
+                
+            }
+            
+        }
+    }
+    
     /**
      * import the groups, roles and finally the users to the current environment
      * 

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/stubs/StubJetspeedPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/stubs/StubJetspeedPrincipal.java?rev=736069&r1=736068&r2=736069&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/stubs/StubJetspeedPrincipal.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/stubs/StubJetspeedPrincipal.java Tue Jan 20 11:10:43 2009
@@ -150,4 +150,10 @@
 
     }
 
+    public Long getDomainId()
+    {
+        // TODO Auto-generated method stub
+        return 1L;
+    }
+
 }



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