portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r735387 [1/2] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: ./ components/jetspeed-page-manager/ components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/ components/jetspeed-page-manager/src/main/resources/META-IN...
Date Sun, 18 Jan 2009 05:19:26 GMT
Author: rwatler
Date: Sat Jan 17 21:19:24 2009
New Revision: 735387

URL: http://svn.apache.org/viewvc?rev=735387&view=rev
Log:
JPA Support JTA/Atomikos Integration
-----------------------------------------------
- using JTA to support multiple persistence unit transactions per J2 component for JPA
- deprecate tyrex and use apache directory naming JNDI implementation in its place, (due primarily to bogus jndi.properties included in tyrex jar)
- use Atomikos TransactionsEssentials Apache2 licensed JTA implementation
- implement JTA/XA jetspeedXADS datasource using Atomikos datasource factories
- add new org.apache.jetspeed.database.xatype database property to allow native XA database driver impls for jetspeedXADS
- support "fake" XA support fallback via Atomikos non-XA database wrapper support if above xatype property not specified
- Atomikos "fake" XA datasource will support safe JTA 2PC transactions against a single database, (default for J2)
- add OpenJPA DBPM+Registry 2PC test case to verify atomic multi-component transaction functionality  


Added:
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/Transactional2PCTestComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jndi.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-registry.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-transactional-2pc-test.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/BoundAtomikosXADatasourceComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/NamingJavaJNDIComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/AtomikosUserTransactionComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/BoundAtomikosUserTransactionComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/UserTransactionComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jndi.properties
Removed:
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/TyrexJNDIComponent.java
Modified:
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerContext.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerImpl.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestOpenJPADatabasePageManagerCache.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jpa-database-page-manager.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j-stdout.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager-base.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-profiler/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DatasourceComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JNDIComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JetspeedTestJNDIComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceTestCase.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/jpa/JPADatasourceEnabledSpringTestCase.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/RegistryManagerContext.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/openjpa-registry-base.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-statistics/pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/jetspeed-mvn-database-pom.xml
    portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml

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=735387&r1=735386&r2=735387&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 Sat Jan 17 21:19:24 2009
@@ -85,13 +85,9 @@
             <artifactId>commons-logging</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.openjpa</groupId>
-            <artifactId>openjpa-persistence-jdbc</artifactId>
-        </dependency>        
-        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring</artifactId>
-        </dependency>    
+        </dependency>
         
         <!-- Test Dependencies -->
         <dependency>
@@ -116,18 +112,13 @@
             <scope>test</scope>
         </dependency>      
         <!--
-            Note: tyrex and junit is normally required only for test, but 
+            Note: junit is normally required only for test, but 
             in this case, abstract test cases are included in the
             component build... this should probably be fixed...
             for now, assume that junit will be provided if these
             test classes are used.
         -->
         <dependency>
-            <groupId>tyrex</groupId>
-            <artifactId>tyrex</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>provided</scope>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerContext.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerContext.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerContext.java Sat Jan 17 21:19:24 2009
@@ -78,6 +78,5 @@
     public void terminate()
     {
         databasePageManager.unregisterContext(this);
-        extendedEntityManager.close();
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerImpl.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/DatabasePageManagerImpl.java Sat Jan 17 21:19:24 2009
@@ -31,6 +31,8 @@
 
 import javax.security.auth.Subject;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraintsContext;
@@ -106,6 +108,8 @@
 @Repository
 public class DatabasePageManagerImpl implements DatabasePageManager
 {
+    private static final Log log = LogFactory.getLog(DatabasePageManagerImpl.class);
+
     private static Map modelClasses = new HashMap();
     static
     {
@@ -490,7 +494,7 @@
      /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPage(java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={PageNotFoundException.class, SecurityException.class})
     public Page getPage(String path) throws PageNotFoundException, NodeException
     {
         // construct page attributes from path
@@ -541,7 +545,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getContentPage(java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={PageNotFoundException.class, SecurityException.class})
     public ContentPage getContentPage(String path) throws PageNotFoundException, NodeException
     {
         // return proxied page
@@ -551,7 +555,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getLink(java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={DocumentNotFoundException.class, SecurityException.class})
     public Link getLink(String path) throws DocumentNotFoundException, NodeException
     {
         // construct link attributes from path
@@ -623,7 +627,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPageSecurity()
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={DocumentNotFoundException.class, SecurityException.class})
     public PageSecurity getPageSecurity() throws DocumentNotFoundException, NodeException
     {
         // construct document attributes from path
@@ -674,7 +678,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getFolder(java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={FolderNotFoundException.class, SecurityException.class})
     public Folder getFolder(String folderPath) throws FolderNotFoundException, InvalidFolderException, NodeException
     {
         // construct folder attributes from path
@@ -726,7 +730,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getFolders(org.apache.jetspeed.om.folder.Folder)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor=DocumentException.class)
     public NodeSet getFolders(Folder folder) throws DocumentException
     {
         FolderImpl folderImpl = (FolderImpl)folder;
@@ -759,7 +763,7 @@
             {
                 folderImpl.resetFolders(false);
             }
-            throw new DocumentException("Unable to access folders for folder " + folder.getPath() + ".");
+            throw new DocumentException("Unable to access folders for folder " + folder.getPath() + ".", e);
         }
 
         // folder folders cache populated, get folders from folder
@@ -770,7 +774,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getFolder(org.apache.jetspeed.om.folder.Folder,java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={FolderNotFoundException.class, SecurityException.class})
     public Folder getFolder(Folder folder, String name) throws FolderNotFoundException, DocumentException
     {
         // perform lookup by path so that cache can be used
@@ -783,6 +787,10 @@
         {
             throw fnfe;
         }
+        catch (SecurityException se)
+        {
+            throw se;
+        }
         catch (Exception e)
         {
             throw new FolderNotFoundException("Folder " + folderPath + " not found.", e);
@@ -792,7 +800,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPages(org.apache.jetspeed.om.folder.Folder)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor=NodeException.class)
     public NodeSet getPages(Folder folder) throws NodeException
     {
         FolderImpl folderImpl = (FolderImpl)folder;
@@ -825,7 +833,7 @@
             {
                 folderImpl.resetPages(false);
             }
-            throw new NodeException("Unable to access pages for folder " + folder.getPath() + ".");
+            throw new NodeException("Unable to access pages for folder " + folder.getPath() + ".", e);
         }
 
         // folder pages cache populated, get pages from folder
@@ -836,7 +844,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPage(org.apache.jetspeed.om.folder.Folder,java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={PageNotFoundException.class, SecurityException.class})
     public Page getPage(Folder folder, String name) throws PageNotFoundException, NodeException
     {
         // perform lookup by path so that cache can be used
@@ -849,6 +857,10 @@
         {
             throw pnfe;
         }
+        catch (SecurityException se)
+        {
+            throw se;
+        }
         catch (Exception e)
         {
             throw new PageNotFoundException("Page " + pagePath + " not found.", e);
@@ -858,7 +870,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getLinks(org.apache.jetspeed.om.folder.Folder)
      */    
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor=NodeException.class)
     public NodeSet getLinks(Folder folder) throws NodeException
     {
         FolderImpl folderImpl = (FolderImpl)folder;
@@ -891,7 +903,7 @@
             {
                 folderImpl.resetLinks(false);
             }
-            throw new NodeException("Unable to access links for folder " + folder.getPath() + ".");
+            throw new NodeException("Unable to access links for folder " + folder.getPath() + ".", e);
         }
 
         // folder links cache populated, get links from folder
@@ -902,7 +914,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getLink(org.apache.jetspeed.om.folder.Folder,java.lang.String)
      */    
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={DocumentNotFoundException.class, SecurityException.class})
     public Link getLink(Folder folder, String name) throws DocumentNotFoundException, NodeException
     {
         // perform lookup by path so that cache can be used
@@ -915,6 +927,10 @@
         {
             throw dnfe;
         }
+        catch (SecurityException se)
+        {
+            throw se;
+        }
         catch (Exception e)
         {
             throw new DocumentNotFoundException("Link " + linkPath + " not found.", e);
@@ -924,7 +940,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPageSecurity(org.apache.jetspeed.om.folder.Folder)
      */    
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor=NodeException.class)
     public PageSecurity getPageSecurity(Folder folder) throws DocumentNotFoundException, NodeException
     {
         FolderImpl folderImpl = (FolderImpl)folder;
@@ -958,7 +974,7 @@
             {
                 // reset page security in folder
                 folderImpl.resetPageSecurity(null, true);
-                throw new NodeException("Unable to access page security for folder " + folder.getPath() + ".");
+                throw new NodeException("Unable to access page security for folder " + folder.getPath() + ".", e);
             }
         }
         else
@@ -975,7 +991,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getAll(org.apache.jetspeed.om.folder.Folder)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor=DocumentException.class)
     public NodeSet getAll(Folder folder) throws DocumentException
     {
         FolderImpl folderImpl = (FolderImpl)folder;
@@ -1042,7 +1058,7 @@
             {
                 folderImpl.resetAll(false);
             }
-            throw new DocumentException("Unable to access all nodes for folder " + folder.getPath() + ".");
+            throw new DocumentException("Unable to access all nodes for folder " + folder.getPath() + ".", e);
         }
 
         // folder all nodes cache populated, get all from folder
@@ -1053,7 +1069,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updatePage(org.apache.jetspeed.om.page.Page)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void updatePage(Page page) throws NodeException, PageNotUpdatedException
     {
         try
@@ -1140,7 +1156,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#removePage(org.apache.jetspeed.om.page.Page)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void removePage(Page page) throws NodeException, PageNotRemovedException
     {
         try
@@ -1190,7 +1206,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updateFolder(org.apache.jetspeed.om.folder.Folder)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void updateFolder(Folder folder) throws NodeException, FolderNotUpdatedException
     {
         // shallow update by default
@@ -1200,7 +1216,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updateFolder(org.apache.jetspeed.om.folder.Folder,boolean)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void updateFolder(Folder folder, boolean deep) throws NodeException, FolderNotUpdatedException
     {
         try
@@ -1386,7 +1402,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#removeFolder(org.apache.jetspeed.om.folder.Folder)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void removeFolder(Folder folder) throws NodeException, FolderNotRemovedException
     {
         try
@@ -1518,7 +1534,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updateLink(org.apache.jetspeed.om.page.Link)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void updateLink(Link link) throws NodeException, LinkNotUpdatedException
     {
         try
@@ -1598,7 +1614,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#removeLink(org.apache.jetspeed.om.page.Link)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void removeLink(Link link) throws NodeException, LinkNotRemovedException
     {
         try
@@ -1642,7 +1658,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#updatePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void updatePageSecurity(PageSecurity pageSecurity) throws NodeException, FailedToUpdateDocumentException
     {
         try
@@ -1738,7 +1754,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#removePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void removePageSecurity(PageSecurity pageSecurity) throws NodeException, FailedToDeleteDocumentException
     {
         try
@@ -1837,7 +1853,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getUserPage(java.lang.String,java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={PageNotFoundException.class, SecurityException.class})
     public Page getUserPage(String userName, String pageName) throws PageNotFoundException, NodeException
     {
         return getPage(Folder.USER_FOLDER + userName + Folder.PATH_SEPARATOR + pageName);
@@ -1846,7 +1862,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getUserFolder(java.lang.String)
      */
-    @Transactional (readOnly=true)
+    @Transactional (readOnly=true, noRollbackFor={FolderNotFoundException.class, SecurityException.class})
     public Folder getUserFolder(String userName) throws FolderNotFoundException, InvalidFolderException, NodeException
     {
         return getFolder(Folder.USER_FOLDER + userName);        
@@ -1940,7 +1956,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#createUserHomePagesFromRoles(java.security.auth.Subject)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void createUserHomePagesFromRoles(Subject subject) throws NodeException
     {
         PageManagerUtils.createUserHomePagesFromRoles(this, subject);
@@ -1949,7 +1965,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#deepCopyFolder(org.apache.jetspeed.om.folder.Folder,java.lang.String,java.lang.String)
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void deepCopyFolder(Folder srcFolder, String destinationPath, String owner) throws NodeException, PageNotUpdatedException
     {
         PageManagerUtils.deepCopyFolder(this, srcFolder, destinationPath, owner);
@@ -1958,6 +1974,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#deepMergeFolder(org.apache.jetspeed.om.folder.Folder, java.lang.String, java.lang.String)
      */
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public void deepMergeFolder(Folder srcFolder, String destinationPath, String owner) throws NodeException, PageNotUpdatedException
     {
         PageManagerUtils.deepMergeFolder(this, srcFolder, destinationPath, owner);
@@ -1966,7 +1983,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#addPages(org.apache.jetspeed.om.page.Page[])
      */
-    @Transactional (readOnly=false, rollbackFor=NodeException.class)
+    @Transactional (readOnly=false, rollbackFor={NodeException.class, SecurityException.class})
     public int addPages(Page[] pages) throws NodeException
     {   
         if (pages.length > 0 && pages[0].getPath().equals("/tx__test1.psml"))

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml Sat Jan 17 21:19:24 2009
@@ -17,10 +17,11 @@
 -->
 <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
 
-    <persistence-unit name="jetspeed-page-manager">
+    <persistence-unit name="jetspeed-page-manager" transaction-type="JTA">
 
         <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
 
+        <jta-data-source>jetspeed-xa</jta-data-source>
         <non-jta-data-source>jetspeed</non-jta-data-source>
 
         <class>org.apache.jetspeed.om.folder.jpa.FolderBaseMenuDefinitionElement</class>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/TestOpenJPA2PCTransactions.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,167 @@
+/*
+ * 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.components;
+
+import java.util.Iterator;
+
+import junit.framework.Test;
+
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.components.portletregistry.jpa.RegistryManagerContext;
+import org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase;
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.jpa.DatabasePageManagerContext;
+
+/**
+ * TestOpenJPA2PCTransactions
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class TestOpenJPA2PCTransactions extends JPADatasourceEnabledSpringTestCase
+{
+    private DatabasePageManagerContext dbpmContext;
+    private RegistryManagerContext rmContext;
+
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
+    {
+        return createFixturedTestSuite(TestOpenJPA2PCTransactions.class, new String[]{"setup2PCTx", "test2PCTx", "teardown2PCTx"});
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
+     */
+    protected String[] getConfigurations()
+    {
+        return new String[]{"openjpa-database-page-manager.xml", "openjpa-registry.xml", "openjpa-transactional-2pc-test.xml"};
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase#startConversationalTxn()
+     */
+    protected void startConversationalTxn()
+    {
+        // create scoped context beans for thread transaction
+        dbpmContext = (DatabasePageManagerContext)scm.createPrototypeComponent("pageManagerContext");
+        rmContext = (RegistryManagerContext)scm.createPrototypeComponent("registryManagerContext");
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase#endConversationalTxn()
+     */
+    protected void endConversationalTxn()
+    {
+        // destroy scoped context beans for thread transaction
+        scm.destroyPrototypeComponent("registryManagerContext", rmContext);
+        scm.destroyPrototypeComponent("pageManagerContext", dbpmContext);
+    }
+
+    public void setup2PCTx() throws Exception
+    {
+        // get components
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        PortletRegistry portletRegistry = (PortletRegistry)scm.getComponent("portletRegistry");
+
+        // setup page manager data
+        if (pageManager.folderExists("/"))
+        {
+            pageManager.removeFolder(pageManager.getFolder("/"));
+        }
+        Folder root = pageManager.newFolder("/");
+        root.setTitle("root");
+        pageManager.updateFolder(root);        
+
+        // setup portlet registry data
+        Iterator itr = portletRegistry.getPortletApplications().iterator();
+        while (itr.hasNext())
+        {
+            portletRegistry.removeApplication((PortletApplication) itr.next());
+        }
+        PortletApplication app = portletRegistry.newPortletApplication();
+        app.setName("application");
+        app.setContextRoot("/application");
+        app.setVersion("0");
+        portletRegistry.updatePortletApplication(app);        
+    }
+
+    public void test2PCTx() throws Exception
+    {
+        // get components
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        PortletRegistry portletRegistry = (PortletRegistry)scm.getComponent("portletRegistry");
+        Transactional2PCTestComponent transactional2PCTest = (Transactional2PCTestComponent)scm.getComponent("transactional2PCTest");
+        
+        // invoke 2PC test
+        try
+        {
+            transactional2PCTest.transactional2PCTestMethod(pageManager, portletRegistry, true);
+            fail("Transactional 2PC test method did not rollback on exception");
+        }
+        catch (SecurityException se)
+        {
+            if (!se.getMessage().equals("ROLLBACK"))
+            {
+                throw se;
+            }            
+        }
+        
+        // verify page manager data rolled back
+        Folder root = pageManager.getFolder("/");
+        assertEquals(root.getTitle(), "root");
+        
+        // verify portlet registry data rolled back
+        PortletApplication app = portletRegistry.getPortletApplication("application");
+        assertEquals(app.getVersion(), "0");
+    }
+    
+    public void teardown2PCTx() throws Exception
+    {
+        // get components
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        PortletRegistry portletRegistry = (PortletRegistry)scm.getComponent("portletRegistry");
+
+        // teardown page manager data
+        if (pageManager.folderExists("/"))
+        {
+            pageManager.removeFolder(pageManager.getFolder("/"));
+        }
+
+        // teardown portlet registry data
+        Iterator itr = portletRegistry.getPortletApplications().iterator();
+        while (itr.hasNext())
+        {
+            portletRegistry.removeApplication((PortletApplication) itr.next());
+        }
+    }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestOpenJPA2PCTransactions.class.getName()});
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/Transactional2PCTestComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/Transactional2PCTestComponent.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/Transactional2PCTestComponent.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/components/Transactional2PCTestComponent.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,63 @@
+/*
+ * 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.components;
+
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.components.portletregistry.RegistryException;
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.document.NodeException;
+import org.apache.jetspeed.page.document.NodeNotFoundException;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Transactional2PCTestComponent
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+@Repository
+public class Transactional2PCTestComponent
+{
+    // Implementation
+    
+    @Transactional (readOnly=false, rollbackFor={NodeException.class,NodeNotFoundException.class,RegistryException.class,SecurityException.class})
+    public void transactional2PCTestMethod(PageManager pageManager, PortletRegistry portletRegistry, boolean rollback) throws NodeException, NodeNotFoundException, RegistryException
+    {
+        // modify page manager data
+        Folder root = pageManager.getFolder("/");
+        root.setTitle(root.getTitle()+"-2PC-MODIFIED");
+        pageManager.updateFolder(root);
+
+        // modify portlet registry data
+        PortletApplication app = portletRegistry.getPortletApplication("application");
+        if (app == null)
+        {
+            throw new NodeNotFoundException("Unable to find portlet application");
+        }
+        app.setVersion(app.getVersion()+"-2PC-MODIFIED");
+        portletRegistry.updatePortletApplication(app);
+        
+        // throw exception to rollback in transactional method
+        if (rollback)
+        {
+            throw new SecurityException("ROLLBACK");
+        }
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java Sat Jan 17 21:19:24 2009
@@ -20,6 +20,9 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase;
 import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraintsContext;
@@ -52,6 +55,8 @@
  */
 public class TestDatabasePageManager extends JPADatasourceEnabledSpringTestCase implements PageManagerTestShared
 {
+    private static final Log log = LogFactory.getLog(TestDatabasePageManager.class);
+
     private static final String deepFolderPath = "/__subsite-rootx/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
     private static final String deepPagePath = deepFolderPath + "/default-page.psml";       
 

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java Sat Jan 17 21:19:24 2009
@@ -65,6 +65,8 @@
      */
     public void initialize() throws Exception
     {
+        log.info( "DatabasePageManager server initializing");
+
         // setup jetspeed test datasource and component manager
         jndiDS = new JetspeedTestJNDIComponent();
         jndiDS.setup();
@@ -126,6 +128,8 @@
      */
     public void terminate() throws Exception
     {
+        log.info( "DatabasePageManager server terminating");
+
         // shutdown page manager
         pageManager.shutdown();
 

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java Sat Jan 17 21:19:24 2009
@@ -502,7 +502,25 @@
                 {
                     propertyValue = Integer.toString(Integer.parseInt(propertyValue)+index);
                 }
-                commandAndArgs.add( "-D"+propertyName+"="+propertyValue);
+                commandAndArgs.add("-D"+propertyName+"="+propertyValue);
+            }
+            Map<String,String> nameProperties = getServerNamePropertyNamesAndSuffix();
+            if (nameProperties != null)
+            {
+                for (Map.Entry<String,String> nameProperty : nameProperties.entrySet())
+                {
+                    final String propertyName = nameProperty.getKey();
+                    final String propertyValue = name+nameProperty.getValue();
+                    commandAndArgs.add("-D"+propertyName+"="+propertyValue);                    
+                }
+            }
+            Map<String,String> properties = getServerPropertyNamesAndValues();
+            if (properties != null)
+            {
+                for (Map.Entry<String,String> property : properties.entrySet())
+                {
+                    commandAndArgs.add("-D"+property.getKey()+"="+property.getValue());
+                }
             }
             commandAndArgs.add("-Dlog4j.configuration=log4j-stdout.properties");
             commandAndArgs.add("-classpath");
@@ -608,7 +626,7 @@
         
         private void logProcessLine(final String line)
         {
-            if (!line.contains("INFO") && (line.contains("ERROR") || line.contains("Exception") || line.startsWith("   at ")))
+            if (!line.contains("INFO") && !line.contains("DEBUG") && !line.contains("TRACE") && !line.contains("WARN") && (line.contains("ERROR") || line.contains("Exception") || line.startsWith("   at ")))
             {
                 log.error("{"+name+"} "+line);
             }
@@ -699,6 +717,26 @@
         return EhCacheConfigResource.EHCACHE_PORT_PROP_NAME;
     }
 
+    /**
+     * Return server name property names and suffix to set on launch.
+     * 
+     * @return property names/suffix map.
+     */
+    protected Map<String,String> getServerNamePropertyNamesAndSuffix()
+    {
+        return null;
+    }
+
+    /**
+     * Return server property names and values to set on launch.
+     * 
+     * @return property names/values map.
+     */
+    protected Map<String,String> getServerPropertyNamesAndValues()
+    {
+        return null;
+    }
+
     // Application entry point
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestOpenJPADatabasePageManagerCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestOpenJPADatabasePageManagerCache.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestOpenJPADatabasePageManagerCache.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestOpenJPADatabasePageManagerCache.java Sat Jan 17 21:19:24 2009
@@ -16,11 +16,16 @@
  */
 package org.apache.jetspeed.page.cache;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerProperties;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase;
+
 /**
  * TestOpenJPADatabasePageManagerCache
  * 
@@ -55,6 +60,31 @@
         return OpenJPADatabasePageManagerProperties.OPENJPA_CACHE_PORT_PROP_NAME;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.TestDatabasePageManagerCache#getServerNamePropertyNamesAndSuffix()
+     */
+    protected Map<String,String> getServerNamePropertyNamesAndSuffix()
+    {
+        // set Atomikos runtime properties
+        final Map<String,String> nameProperties = new HashMap<String,String>();
+        nameProperties.put(JPADatasourceEnabledSpringTestCase.ATOMIKOS_TRANSACTION_MANAGER_NAME_PROPERTY, JPADatasourceEnabledSpringTestCase.ATOMIKOS_TRANSACTION_MANAGER_NAME_SUFFIX);
+        nameProperties.put(JPADatasourceEnabledSpringTestCase.ATOMIKOS_LOG_BASE_NAME_PROPERTY, JPADatasourceEnabledSpringTestCase.ATOMIKOS_LOG_BASE_NAME_SUFFIX);
+        nameProperties.put(JPADatasourceEnabledSpringTestCase.ATOMIKOS_CONSOLE_FILE_NAME_PROPERTY, JPADatasourceEnabledSpringTestCase.ATOMIKOS_CONSOLE_FILE_NAME_SUFFIX);
+        return nameProperties;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.TestDatabasePageManagerCache#getServerPropertyNamesAndValues()
+     */
+    protected Map<String,String> getServerPropertyNamesAndValues()
+    {
+        // set Atomikos runtime properties
+        final Map<String,String> properties = new HashMap<String,String>();
+        properties.put(JPADatasourceEnabledSpringTestCase.ATOMIKOS_LOG_DIRECTORY_PATH_PROPERTY, System.getProperty("basedir")+"/target/atomikos");
+        properties.put(JPADatasourceEnabledSpringTestCase.ATOMIKOS_CONSOLE_DIRECTORY_PATH_PROPERTY, System.getProperty("basedir")+"/target/atomikos");
+        return properties;
+    }
+
     // Application entry point
 
     /**

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jndi.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jndi.properties?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jndi.properties (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jndi.properties Sat Jan 17 21:19:24 2009
@@ -0,0 +1,25 @@
+# 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.
+
+# ------------------------------------------------------------------------
+#
+# JNDI Naming Configuration
+#
+# $Id: $
+#
+# ------------------------------------------------------------------------
+
+java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
+java.naming.factory.url.pkgs=org.apache.naming

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jpa-database-page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jpa-database-page-manager.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jpa-database-page-manager.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jpa-database-page-manager.xml Sat Jan 17 21:19:24 2009
@@ -23,14 +23,21 @@
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx.xsd">
 
+    <!-- Jetspeed XA DataSource -->
+    <bean id="JetspeedXADS" class="org.springframework.jndi.JndiObjectFactoryBean">
+        <property name="resourceRef" value="false"/>
+        <property name="jndiName" value="java:comp/env/jdbc/jetspeed-xa"/>
+    </bean>
+
     <!-- JPA Configuration -->
     <bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
         <property name="dataSources">
             <map>
+                <entry key="jetspeed-xa" value-ref="JetspeedXADS"/>
                 <entry key="jetspeed" value-ref="JetspeedDS"/>
             </map>
         </property>
-        <property name="defaultDataSource" ref="JetspeedDS"/>
+        <property name="defaultDataSource" ref="JetspeedXADS"/>
         <property name="persistenceXmlLocations">
             <list>
                 <value>classpath*:META-INF/persistence.xml</value>
@@ -39,22 +46,39 @@
     </bean>
     <bean id="abstractEntityManagerFactory" abstract="true" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
         <property name="persistenceUnitManager" ref="persistenceUnitManager"/>
-        <property name="persistenceUnitName" value="jetspeed-page-manager"/>
     </bean>
 
-    <!-- Spring/JPA Transaction Manager -->
-    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
-        <property name="entityManagerFactory" ref="entityManagerFactory"/>
+    <!-- Spring/Atomikos/JTA Transaction Manager -->
+    <bean id="atomikosUserTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp" init-method="init" destroy-method="shutdownForce">
+        <constructor-arg>
+            <props>
+                <!-- standard atomikos standalone configuration -->
+                <prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop>
+                <!-- server/process name overrides for log file names -->
+                <prop key="com.atomikos.icatch.tm_unique_name">${com.atomikos.icatch.tm_unique_name}</prop>
+                <prop key="com.atomikos.icatch.log_base_dir">${com.atomikos.icatch.log_base_dir}</prop>
+                <prop key="com.atomikos.icatch.log_base_name">${com.atomikos.icatch.log_base_name}</prop>
+                <prop key="com.atomikos.icatch.output_dir">${com.atomikos.icatch.output_dir}</prop>
+                <prop key="com.atomikos.icatch.console_file_name">${com.atomikos.icatch.console_file_name}</prop>
+            </props>
+        </constructor-arg>
+    </bean>
+    <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close" depends-on="atomikosUserTransactionService">
+        <property name="forceShutdown" value="true"/>
+    </bean>
+    <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
+        <property name="transactionManager" ref="atomikosTransactionManager"/>
+        <property name="userTransactionName" value="java:comp/UserTransaction"/>
     </bean>
     <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
 
     <!-- Spring Transaction Annotations -->
-    <tx:annotation-driven/>
+    <tx:annotation-driven transaction-manager="jtaTransactionManager"/>
 
     <!-- Inject Database Page Manager Proxy into Database Page Manager -->
     <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
-        <property name="targetObject"><ref bean="pageManager"/></property>
-        <property name="targetMethod"><value>setDatabasePageManagerProxy</value></property>
+        <property name="targetObject" ref="pageManager"/>
+        <property name="targetMethod" value="setDatabasePageManagerProxy"/>
         <property name="arguments">
             <list>
                 <ref bean="pageManager"/>
@@ -64,7 +88,7 @@
 
     <!-- JPA Database Page Manager Context -->
     <bean id="pageManagerContext" class="org.apache.jetspeed.page.jpa.DatabasePageManagerContext" scope="prototype" init-method="initialize" destroy-method="terminate">
-        <property name="databasePageManager"><ref bean="pageManager"/></property>
+        <property name="databasePageManager" ref="pageManager"/>
     </bean>
 
 </beans>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j-stdout.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j-stdout.properties?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j-stdout.properties (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j-stdout.properties Sat Jan 17 21:19:24 2009
@@ -23,9 +23,37 @@
 
 log4j.rootLogger = ERROR, stdout
 
+log4j.category.org.springframework = DEBUG, stdout
+log4j.additivity.org.springframework = false
+
+log4j.category.openjpa.Tool = TRACE, stdout
+log4j.additivity.openjpa.Tool = false
+log4j.category.openjpa.Runtime = TRACE, stdout
+log4j.additivity.openjpa.Runtime = false
+log4j.category.openjpa.Remote = TRACE, stdout
+log4j.additivity.openjpa.Remote = false
+log4j.category.openjpa.DataCache = TRACE, stdout
+log4j.additivity.openjpa.DataCache = false
+log4j.category.openjpa.MetaData = TRACE, stdout
+log4j.additivity.openjpa.MetaData = false
+log4j.category.openjpa.Enhance = TRACE, stdout
+log4j.additivity.openjpa.Enhance = false
+log4j.category.openjpa.Query = TRACE, stdout
+log4j.additivity.openjpa.Query = false
+log4j.category.openjpa.jdbc.SQL = TRACE, stdout
+log4j.additivity.openjpa.jdbc.SQL = false
+#log4j.category.openjpa.jdbc.JDBC = TRACE, stdout
+log4j.category.openjpa.jdbc.JDBC = DEBUG, stdout
+log4j.additivity.openjpa.jdbc.JDBC = false
+log4j.category.openjpa.jdbc.Schema = TRACE, stdout
+log4j.additivity.openjpa.jdbc.Schema = false
+
 log4j.category.org.apache.jetspeed = INFO, stdout
 log4j.additivity.org.apache.jetspeed = false
 
+log4j.category.atomikos = DEBUG, stdout
+log4j.additivity.atomikos = false
+
 log4j.appender.stdout = org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.conversionPattern = %d [%t] %-5p %c - %m%n

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j.properties?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j.properties (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/log4j.properties Sat Jan 17 21:19:24 2009
@@ -53,7 +53,8 @@
 log4j.additivity.openjpa.Query = false
 log4j.category.openjpa.jdbc.SQL = TRACE, infologging
 log4j.additivity.openjpa.jdbc.SQL = false
-log4j.category.openjpa.jdbc.JDBC = TRACE, infologging
+#log4j.category.openjpa.jdbc.JDBC = TRACE, infologging
+log4j.category.openjpa.jdbc.JDBC = DEBUG, infologging
 log4j.additivity.openjpa.jdbc.JDBC = false
 log4j.category.openjpa.jdbc.Schema = TRACE, infologging
 log4j.additivity.openjpa.jdbc.Schema = false
@@ -61,6 +62,9 @@
 log4j.category.org.apache.jetspeed = DEBUG, infologging
 log4j.additivity.org.apache.jetspeed = false
 
+log4j.category.atomikos = DEBUG, infologging
+log4j.additivity.atomikos = false
+
 log4j.appender.errorlogging = org.apache.log4j.FileAppender
 log4j.appender.errorlogging.file = ${basedir}/target/surefire-reports/tests-error.log
 log4j.appender.errorlogging.layout = org.apache.log4j.PatternLayout

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager-base.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager-base.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager-base.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager-base.xml Sat Jan 17 21:19:24 2009
@@ -25,10 +25,22 @@
 
     <import resource="jpa-database-page-manager.xml"/>
 
-    <!-- OpenJPA Configuration -->
-    <bean id="jpaPageManagerProperties" class="org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerProperties"/>
-    <bean id="entityManagerFactory" parent="abstractEntityManagerFactory">
+    <!-- OpenJPA/Atomikos Configuration -->
+    <bean id="jpaPageManagerProperties" class="org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerProperties">
+        <property name="jpaProperties">
+            <props>
+		        <prop key="openjpa.ConnectionFactoryMode">managed</prop>
+		        <prop key="openjpa.TransactionMode">managed</prop>
+		        <prop key="openjpa.ManagedRuntime">invocation(TransactionManagerMethod=com.atomikos.icatch.jta.TransactionManagerImp.getTransactionManager)</prop>
+            </props>
+        </property>
+    </bean>
+    <bean id="pageManagerEntityManagerFactory" parent="abstractEntityManagerFactory">
+        <property name="persistenceUnitName" value="jetspeed-page-manager"/>
         <property name="jpaProperties" ref="jpaPageManagerProperties"/>
+        <property name="jpaDialect">
+            <bean class="org.springframework.orm.jpa.vendor.OpenJpaDialect"/>
+        </property>
     </bean>
 
 </beans>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-registry.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-registry.xml?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-registry.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-registry.xml Sat Jan 17 21:19:24 2009
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:tx="http://www.springframework.org/schema/tx"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans
+      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+      http://www.springframework.org/schema/tx
+      http://www.springframework.org/schema/tx/spring-tx.xsd">
+
+    <!-- OpenJPA/Atomikos Configuration -->
+    <bean id="jpaRegistryProperties" class="org.apache.jetspeed.components.rdbms.jpa.OpenJPAConfigurationProperties">
+        <property name="jpaProperties">
+            <props>
+		        <prop key="openjpa.ConnectionFactoryMode">managed</prop>
+		        <prop key="openjpa.TransactionMode">managed</prop>
+		        <prop key="openjpa.ManagedRuntime">invocation(TransactionManagerMethod=com.atomikos.icatch.jta.TransactionManagerImp.getTransactionManager)</prop>
+            </props>
+        </property>
+    </bean>
+    <bean id="registryEntityManagerFactory" parent="abstractEntityManagerFactory">
+        <property name="persistenceUnitName" value="jetspeed-registry"/>
+        <property name="jpaProperties" ref="jpaRegistryProperties"/>
+        <property name="jpaDialect">
+            <bean class="org.springframework.orm.jpa.vendor.OpenJpaDialect"/>
+        </property>
+    </bean>
+
+    <!-- JPA/OpenJPA Registry Components -->
+    <bean id="portletFactory" class="org.apache.jetspeed.factory.JetspeedPortletFactory"/>
+    <bean id="registryManager" class="org.apache.jetspeed.components.portletregistry.jpa.RegistryManagerImpl"/>
+    <bean id="portletPreferencesProvider" class="org.apache.jetspeed.components.portletpreferences.jpa.PortletPreferencesProviderImpl" init-method="init" destroy-method="destroy">
+        <constructor-arg index="0"><ref bean="registryManager"/></constructor-arg>
+        <constructor-arg index="1"><ref bean="portletFactory"/></constructor-arg>
+        <property name="useEntityPreferences"><value>true</value></property>
+    </bean>
+    <bean id="portletRegistry" class="org.apache.jetspeed.components.portletregistry.jpa.OpenJPAPortletRegistryImpl" init-method="initialize" destroy-method="terminate">
+        <constructor-arg index="0"><ref bean="registryManager"/></constructor-arg>
+        <constructor-arg index="1"><ref bean="portletPreferencesProvider"/></constructor-arg>
+    </bean>
+    <bean id="portletEntityAccess" class="org.apache.jetspeed.components.portletentity.jpa.PortletEntityAccessComponentImpl">
+        <constructor-arg index="0"><ref bean="registryManager"/></constructor-arg>
+        <constructor-arg index="1"><ref bean="portletRegistry"/></constructor-arg>
+        <constructor-arg index="2"><value>false</value></constructor-arg>
+    </bean>
+
+    <!-- JPA Registry Component Injection, (consider component/object infusion to eliminate these) -->
+    <bean class="org.apache.jetspeed.components.LifecycleAwareStaticClassInitializer">
+        <property name="className" value="org.apache.jetspeed.om.portlet.jpa.PortletDefinitionImpl"/>
+        <property name="methodName" value="setPortletFactory"/>
+        <property name="typeName" value="org.apache.jetspeed.factory.PortletFactory"/>
+        <property name="value" ref="portletFactory"/>
+    </bean>
+    <bean class="org.apache.jetspeed.components.LifecycleAwareStaticClassInitializer">
+        <property name="className" value="org.apache.jetspeed.om.portlet.jpa.PortletDefinitionImpl"/>
+        <property name="methodName" value="setPortletPreferencesProvider"/>
+        <property name="typeName" value="org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider"/>
+        <property name="value" ref="portletPreferencesProvider"/>
+    </bean>
+    <bean class="org.apache.jetspeed.components.LifecycleAwareStaticClassInitializer">
+        <property name="className" value="org.apache.jetspeed.components.portletentity.jpa.PortletEntityImpl"/>
+        <property name="methodName" value="setPortletRegistry"/>
+        <property name="typeName" value="org.apache.jetspeed.components.portletregistry.PortletRegistry"/>
+        <property name="value" ref="portletRegistry"/>
+    </bean>
+
+    <!-- JPA Registry Manager Context -->
+    <bean id="registryManagerContext" class="org.apache.jetspeed.components.portletregistry.jpa.RegistryManagerContext" scope="prototype" init-method="initialize" destroy-method="terminate">
+        <property name="registryManager" ref="registryManager"/>
+    </bean>
+
+</beans>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-transactional-2pc-test.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-transactional-2pc-test.xml?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-transactional-2pc-test.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-transactional-2pc-test.xml Sat Jan 17 21:19:24 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:tx="http://www.springframework.org/schema/tx"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans
+      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+      http://www.springframework.org/schema/tx
+      http://www.springframework.org/schema/tx/spring-tx.xsd">
+
+    <!-- JPA Transactional 2PC Test Component -->
+    <bean id="transactional2PCTest" class="org.apache.jetspeed.components.Transactional2PCTestComponent"/>
+
+</beans>

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=735387&r1=735386&r2=735387&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 Sat Jan 17 21:19:24 2009
@@ -136,14 +136,6 @@
         </dependency>
 
         <dependency>
-        	<groupId>asm</groupId>
-        	<artifactId>asm</artifactId>
-        </dependency>
-        <dependency>
-        	<groupId>asm</groupId>
-        	<artifactId>asm-attrs</artifactId>
-        </dependency>
-        <dependency>
         	<groupId>commonj</groupId>
         	<artifactId>commonj-twm</artifactId>
             <scope>provided</scope>
@@ -218,11 +210,6 @@
             <version>${org.apache.jetspeed.test.jdbc.driver.version}</version>
             <scope>test</scope>
         </dependency>      
-        <dependency>
-            <groupId>tyrex</groupId>
-            <artifactId>tyrex</artifactId>
-            <scope>provided</scope>
-        </dependency>
         
         <!-- Runtime Dependencies -->
         <dependency>

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=735387&r1=735386&r2=735387&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 Sat Jan 17 21:19:24 2009
@@ -99,18 +99,6 @@
             <version>${org.apache.jetspeed.test.jdbc.driver.version}</version>
             <scope>test</scope>
         </dependency>      
-        <!--
-            Note: tyrex and junit is normally required only for test, but 
-            in this case, abstract test cases are included in the
-            component build... this should probably be fixed...
-            for now, assume that junit will be provided if these
-            test classes are used.
-        -->
-        <dependency>
-            <groupId>tyrex</groupId>
-            <artifactId>tyrex</artifactId>
-            <scope>provided</scope>
-        </dependency>
     </dependencies>
 
     <build>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/pom.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/pom.xml Sat Jan 17 21:19:24 2009
@@ -77,21 +77,28 @@
       <artifactId>openjpa-persistence-jdbc</artifactId>
     </dependency>        
     <dependency>
+      <groupId>com.atomikos</groupId>
+      <artifactId>transactions-jdbc</artifactId>
+    </dependency>        
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-jcl</artifactId>
+    </dependency>
+    <dependency>
       <groupId>${org.apache.jetspeed.test.jdbc.driver.groupId}</groupId>
       <artifactId>${org.apache.jetspeed.test.jdbc.driver.artifactId}</artifactId>
       <version>${org.apache.jetspeed.test.jdbc.driver.version}</version>
       <scope>test</scope>
     </dependency>      
     <!--
-      Note: tyrex and junit are normally required only for test, but 
+      Note: naming=java and junit are normally required only for test, but 
       in this case, abstract test cases are included in the component
       build... this should probably be fixed... for now, assume that
-      tyrex and/or junit will be provided if these test classes are
-      used.
+      junit will be provided if these test classes are used.
     -->
     <dependency>
-      <groupId>tyrex</groupId>
-      <artifactId>tyrex</artifactId>
+      <groupId>directory-naming</groupId>
+      <artifactId>naming-java</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,198 @@
+/*
+ * 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.components.datasource;
+
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.atomikos.jdbc.AbstractDataSourceBean;
+import com.atomikos.jdbc.AtomikosDataSourceBean;
+import com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean;
+
+/**
+ * AtomikosXADatasourceComponent
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class AtomikosXADatasourceComponent implements DatasourceComponent
+{
+    private static final Log log = LogFactory.getLog(AtomikosXADatasourceComponent.class);
+
+    // Members
+    
+    private String xatypeClassName;
+    private String driverClassName;
+    private String user;    
+    private String password;
+    private String url;
+    private int maxActive = -1;
+    private int maxIdle = -1;
+    private int maxWait = -1;
+    private String bindName;
+    
+    private DataSource dataSource;
+
+    // Constructor
+    
+    /**
+     * Construct resource DataSource using factory, type, and connection parameters.
+     * 
+     * @param xatypeClassName XADataSource type class name.
+     * @param driverClassName data source driver class name.
+     * @param user connection user name.
+     * @param password connection password.
+     * @param url connection URL.
+     * @param maxActive connection pool max active.
+     * @param maxIdle connection pool max idle.
+     * @param maxWait connection pool max wait.
+     * @param bindName bind name for DataSource.
+     * @param jndi JNDI context for DataSource.
+     */
+    public AtomikosXADatasourceComponent(String xatypeClassName, String driverClassName, String user, String password, String url, int maxActive, int maxIdle, int maxWait, String bindName)
+    {
+        if ((xatypeClassName == null) && (driverClassName == null))
+        {
+            throw new IllegalArgumentException("xatypeClassName and driverClassName arguments cannot both be null for AtomikosXADatasourceComponent");
+        }        
+        if (url == null)
+        {
+            throw new IllegalArgumentException("url argument cannot be null for AtomikosXADatasourceComponent");
+        }        
+        if (bindName == null)
+        {
+            throw new IllegalArgumentException("bindName argument cannot be null for AtomikosXADatasourceComponent");
+        }        
+
+        this.xatypeClassName = xatypeClassName;
+        this.driverClassName = driverClassName;
+        this.user = user;    
+        this.password = password;
+        this.url = url;
+        this.maxActive = maxActive;
+        this.maxIdle = maxIdle;
+        this.maxWait = maxWait;
+        this.bindName = bindName;
+    }
+
+    // Implementation
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.datasource.DatasourceComponent#getDatasource()
+     */
+    public DataSource getDatasource()
+    {
+        return dataSource;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.datasource.DatasourceComponent#start()
+     */
+    public void start()
+    {
+        try
+        {
+            // use XA or non-xa datasource as specified
+            AbstractDataSourceBean datasourceBean = null;
+            if (xatypeClassName != null)
+            {
+                log.info("Full XA access to multiple databases for JTA transactions supported using "+bindName+" datasource.");
+                // configure and return Atomikos compatible XA datasource
+                AtomikosDataSourceBean xaDatasourceBean = new AtomikosDataSourceBean();
+                datasourceBean = xaDatasourceBean;
+                // required data source configurations
+                xaDatasourceBean.setXaDataSourceClassName(xatypeClassName);
+                xaDatasourceBean.setUniqueResourceName(bindName);
+                Properties properties = new Properties();
+                properties.put("url", url);
+                // optional data source configurations
+                if (user != null)
+                {
+                    properties.put("user", user);
+                }
+                if (password != null)
+                {
+                    properties.put("password", password);
+                }
+                // set property configurations
+                xaDatasourceBean.setXaProperties(properties);
+            }
+            else if (driverClassName != null)
+            {
+                log.warn("Only single threaded access to single database for JTA transactions supported using "+bindName+" datasource.");
+                // configure and return Atomikos compatible non-XA datasource
+                AtomikosNonXADataSourceBean nonXADatasourceBean = new AtomikosNonXADataSourceBean();
+                datasourceBean = nonXADatasourceBean;
+                // required data source configurations
+                nonXADatasourceBean.setUniqueResourceName(bindName);
+                nonXADatasourceBean.setDriverClassName(driverClassName);
+                nonXADatasourceBean.setUrl(url);
+                // optional data source configurations
+                if (user != null)
+                {
+                    nonXADatasourceBean.setUser(user);
+                }
+                if (password != null)
+                {
+                    nonXADatasourceBean.setPassword(password);
+                }
+            }
+            else
+            {
+                throw new IllegalArgumentException("xatypeClassName and driverClassName arguments cannot both be null for AtomikosXADatasourceComponent");
+            }
+            // optional data source pool configurations
+            if (maxActive > -1)
+            {
+                datasourceBean.setMaxPoolSize(maxActive);
+            }
+            if (maxIdle > -1)
+            {
+                datasourceBean.setMinPoolSize(maxIdle);
+            }
+            if (maxWait > -1)
+            {
+                datasourceBean.setBorrowConnectionTimeout(maxWait/1000);
+            }
+            // save data source bean
+            dataSource = datasourceBean;
+        }
+        catch (Throwable t)
+        {
+            IllegalStateException ise = new IllegalStateException("Unable to create XADataSource resource: "+t);
+            ise.initCause(t);
+            throw ise;
+        }
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.datasource.DatasourceComponent#stop()
+     */
+    public void stop()
+    {
+        // datasource must be explicitly closed on stop
+        if (dataSource != null)
+        {
+            AbstractDataSourceBean datasourceBean = (AbstractDataSourceBean)dataSource;
+            datasourceBean.close();
+        }
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/BoundAtomikosXADatasourceComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/BoundAtomikosXADatasourceComponent.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/BoundAtomikosXADatasourceComponent.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/BoundAtomikosXADatasourceComponent.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,109 @@
+/*
+ * 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.components.datasource;
+
+import javax.naming.NamingException;
+
+import org.apache.jetspeed.components.jndi.JNDIComponent;
+
+/**
+ * BoundAtomikosXADatasourceComponent
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class BoundAtomikosXADatasourceComponent extends AtomikosXADatasourceComponent
+{
+    // Members
+    
+    private String bindName;
+    private JNDIComponent jndi;
+
+    // Constructor
+    
+    /**
+     * Construct resource DataSource using factory, type, and connection parameters
+     * and bind to specified JNDI context and name.
+     * 
+     * @param xatypeClassName XADataSource type class name.
+     * @param driverClassName data source driver type class name.
+     * @param user connection user name.
+     * @param password connection password.
+     * @param url connection URL.
+     * @param maxActive connection pool max active.
+     * @param maxIdle connection pool max idle.
+     * @param maxWait connection pool max wait.
+     * @param bindName bind name for DataSource.
+     * @param jndi JNDI context for DataSource.
+     */
+    public BoundAtomikosXADatasourceComponent(String xatypeClassName, String driverClassName, String user, String password, String url, int maxActive, int maxIdle, int maxWait, String bindName, JNDIComponent jndi)
+    {        
+        super(xatypeClassName, driverClassName, user, password, url, maxActive, maxIdle, maxWait, bindName);
+
+        if (jndi == null)
+        {
+            throw new IllegalArgumentException("jndi argument cannot be null for BoundAtomikosXADatasourceComponent");
+        }        
+        if( bindName == null)
+        {
+            throw new IllegalArgumentException("bindName argument cannot be null for BoundAtomikosXADatasourceComponent");
+        }
+        
+        this.bindName = bindName;
+        this.jndi = jndi;
+    }
+
+    // Implementation
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.datasource.AtomikosXADatasourceComponent#start()
+     */
+    public void start()
+    {        
+        super.start();
+        try
+        {
+            jndi.bindObject("comp/env/jdbc/"+bindName, getDatasource());
+            jndi.bindObject("jdbc/"+bindName, getDatasource());
+        }
+        catch (NamingException ne)
+        {
+            IllegalStateException ise = new IllegalStateException("Naming exception "+ne.toString());
+            ise.initCause(ne);
+            throw ise;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.datasource.AtomikosXADatasourceComponent#stop()
+     */
+    public void stop()
+    {        
+        try
+        {
+            jndi.unbindObject("comp/env/jdbc/"+bindName);
+            jndi.unbindObject("jdbc/" + bindName);
+        }
+        catch (NamingException ne)
+        {
+            IllegalStateException ise = new IllegalStateException("Naming exception "+ne.toString());
+            ise.initCause(ne);
+            throw ise;
+        }
+        super.stop();
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java Sat Jan 17 21:19:24 2009
@@ -201,8 +201,7 @@
                 Driver driver = (Driver)dc.newInstance();                
                 Properties info = new Properties();
                 info.put( "user", user );
-                info.put( "password", password );
-                
+                info.put( "password", password );                
                 driver.connect(shutDownURI, info);
             }
 



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