portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r731466 [12/12] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: ./ components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/ components/jetspeed-cm/src/main/java/org/apache/jetspeed/test/ components/jetspeed-page-manager/ co...
Date Mon, 05 Jan 2009 06:04:18 GMT
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.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/OpenJPADatabasePageManagerServer.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/OpenJPADatabasePageManagerServer.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.page.cache;
+
+import org.apache.jetspeed.page.jpa.DatabasePageManagerContext;
+
+/**
+ * OpenJPADatabasePageManagerServer
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class OpenJPADatabasePageManagerServer extends DatabasePageManagerServer
+{
+    private DatabasePageManagerContext context;
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.DatabasePageManagerServer#getConfigurations()
+     */
+    protected String [] getConfigurations()
+    {
+        return new String[]{"openjpa-database-page-manager.xml"};        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.DatabasePageManagerServer#startConversationalTxn()
+     */
+    protected void startConversationalTxn()
+    {
+        // create scoped context bean for thread transaction
+        context = (DatabasePageManagerContext)getComponentManager().createPrototypeComponent("pageManagerContext");
+    }    
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.DatabasePageManagerServer#endConversationalTxn()
+     */
+    protected void endConversationalTxn()
+    {
+        // destroy scoped context bean for thread transaction
+        getComponentManager().destroyPrototypeComponent("pageManagerContext", context);
+    }
+        
+    /**
+     * Server main entry point.
+     * 
+     * @param args not used
+     */
+    public static void main(final String [] args)
+    {
+        main(new OpenJPADatabasePageManagerServer());
+    }
+}

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=731466&r1=731465&r2=731466&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 Sun Jan  4 22:04:13 2009
@@ -67,8 +67,8 @@
         String result;
         
         // create and start servers
-        final TestProgram server0 = new TestProgram("server-0", DatabasePageManagerServer.class, 0);
-        final TestProgram server1 = new TestProgram("server-1", DatabasePageManagerServer.class, 1);
+        final TestProgram server0 = new TestProgram("server-0", getServerClass(), 0);
+        final TestProgram server1 = new TestProgram("server-1", getServerClass(), 1);
         try
         {
             // start servers
@@ -210,6 +210,12 @@
             assertTrue(result.endsWith("Deep Page 1"));
             result = server1.execute("pageManager.getPageSecurity().getPath();");
             assertTrue(result.endsWith("/page.security"));
+
+            // reset listeners
+            result = server0.execute("pageManagerListener.reset();");
+            assertTrue(!result.contains("Exception"));
+            result = server1.execute("pageManagerListener.reset();");
+            assertTrue(!result.contains("Exception"));
             
             // update/remove objects in second page manager
             result = server1.execute("page = pageManager.getPage(\"/default-page.psml\");");
@@ -239,13 +245,19 @@
             result = server1.execute("pageManager.removeFolder(folder);");
             assertTrue(!result.contains("Exception"));            
             
+            // start new conversational transactions
+            result = server0.execute("pageManagerServer.resetConversationalTxn();");
+            assertTrue(!result.contains("Exception"));            
+            result = server1.execute("pageManagerServer.resetConversationalTxn();");
+            assertTrue(!result.contains("Exception"));            
+
             // test objects in both page managers for cache coherency
             result = server1.execute("pageManager.getPage(\"/default-page.psml\").getTitle();");
             assertTrue(result.endsWith("Edited Default Page"));
             result = server1.execute("pageManager.getPage(\"/some-other-page.psml\");");
             assertTrue(result.contains("PageNotFoundException"));
             result = server1.execute("pageManager.getFolder(\"/\").getPages().size();");
-            assertTrue(result.endsWith("2"));
+            assertTrue(result.endsWith(" 2"));
             result = server1.execute("pageManager.getLink(\"/default.link\").getTitle();");
             assertTrue(result.endsWith("Edited Default Link"));
             result = server1.execute("pageManager.getFolder(\"/deep-0\").getTitle();");
@@ -255,7 +267,11 @@
             result = server1.execute("pageManager.getFolder(\"/deep-1\");");
             assertTrue(result.contains("FolderNotFoundException"));
             result = server1.execute("pageManager.getFolder(\"/\").getFolders().size();");
-            assertTrue(result.endsWith("1"));
+            assertTrue(result.endsWith(" 1"));
+            result = server1.execute("pageManagerListener.getUpdatedNodeCount();");
+            assertTrue(!result.contains("Exception") && !result.endsWith(" 0"));
+            result = server1.execute("pageManagerListener.getRemovedNodeCount();");
+            assertTrue(!result.contains("Exception") && !result.endsWith(" 0"));            
             boolean defaultPageUpdated = false;
             boolean someOtherPageRemoved = false;
             boolean rootFolderPagesCountTwo = false;
@@ -264,6 +280,7 @@
             boolean deepPage1Removed = false;
             boolean deep1FolderRemoved = false;
             boolean rootFolderFoldersCountOne = false;
+            boolean notifiedOfUpdate = false;
             long coherencyCheckStarted = System.currentTimeMillis();
             do
             {
@@ -281,7 +298,7 @@
                 if (!rootFolderPagesCountTwo)
                 {
                     result = server0.execute("pageManager.getFolder(\"/\").getPages().size();");
-                    rootFolderPagesCountTwo = result.endsWith("2");
+                    rootFolderPagesCountTwo = result.endsWith(" 2");
                 }
                 if (!defaultLinkUpdated)
                 {
@@ -306,16 +323,21 @@
                 if (!rootFolderFoldersCountOne)
                 {
                     result = server0.execute("pageManager.getFolder(\"/\").getFolders().size();");
-                    rootFolderFoldersCountOne = result.endsWith("1");
+                    rootFolderFoldersCountOne = result.endsWith(" 1");
+                }
+                if (!notifiedOfUpdate)
+                {
+                    result = server0.execute("pageManagerListener.getUpdatedNodeCount();");
+                    notifiedOfUpdate = !result.contains("Exception") && !result.endsWith(" 0");                    
                 }
                 
                 // wait for cache coherency
-                if (!defaultPageUpdated || !someOtherPageRemoved || !rootFolderPagesCountTwo || !defaultLinkUpdated || !deep0FolderUpdated || !deepPage1Removed || !deep1FolderRemoved || !rootFolderFoldersCountOne)
+                if (!defaultPageUpdated || !someOtherPageRemoved || !rootFolderPagesCountTwo || !defaultLinkUpdated || !deep0FolderUpdated || !deepPage1Removed || !deep1FolderRemoved || !rootFolderFoldersCountOne || !notifiedOfUpdate)
                 {
                     Thread.sleep(250);
                 }
             }
-            while ((!defaultPageUpdated || !someOtherPageRemoved || !rootFolderPagesCountTwo || !defaultLinkUpdated || !deep0FolderUpdated || !deepPage1Removed || !deep1FolderRemoved || !rootFolderFoldersCountOne) && (System.currentTimeMillis()-coherencyCheckStarted < 5000));
+            while ((!defaultPageUpdated || !someOtherPageRemoved || !rootFolderPagesCountTwo || !defaultLinkUpdated || !deep0FolderUpdated || !deepPage1Removed || !deep1FolderRemoved || !rootFolderFoldersCountOne || !notifiedOfUpdate) && (System.currentTimeMillis()-coherencyCheckStarted < 5000));
             assertTrue(defaultPageUpdated);
             assertTrue(someOtherPageRemoved);
             assertTrue(rootFolderPagesCountTwo);
@@ -324,7 +346,14 @@
             assertTrue(deepPage1Removed);
             assertTrue(deep1FolderRemoved);
             assertTrue(rootFolderFoldersCountOne);
+            assertTrue(notifiedOfUpdate);
 
+            // reset listeners
+            result = server0.execute("pageManagerListener.reset();");
+            assertTrue(!result.contains("Exception"));
+            result = server1.execute("pageManagerListener.reset();");
+            assertTrue(!result.contains("Exception"));
+            
             // add new objects in first page manager
             result = server0.execute("page = pageManager.newPage(\"/new-page.psml\");");
             assertTrue(result.indexOf("Exception") == -1);
@@ -339,19 +368,28 @@
             result = server0.execute("pageManager.updateFolder(folder);");
             assertTrue(result.indexOf("Exception") == -1);
             
+            // start new conversational transactions
+            result = server0.execute("pageManagerServer.resetConversationalTxn();");
+            assertTrue(!result.contains("Exception"));            
+            result = server1.execute("pageManagerServer.resetConversationalTxn();");
+            assertTrue(!result.contains("Exception"));            
+            
             // test objects in both page managers for cache coherency
             result = server0.execute("pageManager.getFolder(\"/\").getPages().size();");
-            assertTrue(result.endsWith("3"));
+            assertTrue(result.endsWith(" 3"));
             result = server0.execute("pageManager.getFolder(\"/\").getFolders().size();");
-            assertTrue(result.endsWith("2"));
+            assertTrue(result.endsWith(" 2"));
             result = server0.execute("pageManager.getPage(\"/new-page.psml\").getTitle();");
             assertTrue(result.endsWith("New Page"));
             result = server0.execute("pageManager.getFolder(\"/deep-2\").getTitle();");
             assertTrue(result.endsWith("Deep 2 Folder"));
+            result = server0.execute("pageManagerListener.getNewNodeCount();");
+            assertTrue(!result.contains("Exception") && !result.endsWith(" 0"));
             boolean rootFolderPagesCountThree = false;
             boolean rootFolderFoldersCountTwo = false;
             boolean newPageCreated = false;
             boolean deep2FolderCreated = false;
+            notifiedOfUpdate = false;
             coherencyCheckStarted = System.currentTimeMillis();
             do
             {
@@ -359,12 +397,12 @@
                 if (!rootFolderPagesCountThree)
                 {
                     result = server1.execute("pageManager.getFolder(\"/\").getPages().size();");
-                    rootFolderPagesCountThree = result.endsWith("3");
+                    rootFolderPagesCountThree = result.endsWith(" 3");
                 }
                 if (!rootFolderFoldersCountTwo)
                 {
                     result = server1.execute("pageManager.getFolder(\"/\").getFolders().size();");
-                    rootFolderFoldersCountTwo = result.endsWith("2");
+                    rootFolderFoldersCountTwo = result.endsWith(" 2");
                 }
                 if (!newPageCreated)
                 {
@@ -376,18 +414,24 @@
                     result = server1.execute("pageManager.getFolder(\"/deep-2\").getTitle();");
                     deep2FolderCreated = result.endsWith("Deep 2 Folder");
                 }
+                if (!notifiedOfUpdate)
+                {
+                    result = server1.execute("pageManagerListener.getUpdatedNodeCount();");
+                    notifiedOfUpdate = !result.contains("Exception") && !result.endsWith(" 0");                    
+                }
 
                 // wait for cache coherency
-                if (!rootFolderPagesCountThree || !rootFolderFoldersCountTwo || !newPageCreated || !deep2FolderCreated)
+                if (!rootFolderPagesCountThree || !rootFolderFoldersCountTwo || !newPageCreated || !deep2FolderCreated || !notifiedOfUpdate)
                 {
                     Thread.sleep(250);
                 }
             }
-            while ((!rootFolderPagesCountThree || !rootFolderFoldersCountTwo || !newPageCreated || !deep2FolderCreated) && (System.currentTimeMillis()-coherencyCheckStarted < 5000));
+            while ((!rootFolderPagesCountThree || !rootFolderFoldersCountTwo || !newPageCreated || !deep2FolderCreated || !notifiedOfUpdate) && (System.currentTimeMillis()-coherencyCheckStarted < 5000));
             assertTrue(rootFolderPagesCountThree);
             assertTrue(rootFolderFoldersCountTwo);
             assertTrue(newPageCreated);
             assertTrue(deep2FolderCreated);
+            assertTrue(notifiedOfUpdate);
 
             // reset database page managers
             result = server0.execute("pageManager.reset();");
@@ -446,6 +490,7 @@
             assertNull(process);
 
             // configure launcher with paths, properties, and indexed properties
+            final String serverPortPropertyName = getServerPortPropertyName();
             final ProcessBuilder launcher = new ProcessBuilder();
             final List<String> commandAndArgs = new ArrayList<String>();
             commandAndArgs.add(javaExecutablePath.getCanonicalPath());
@@ -453,7 +498,7 @@
             {
                 final String propertyName = systemProperty.getKey();
                 String propertyValue = systemProperty.getValue();
-                if (propertyName.equals(EhCacheConfigResource.EHCACHE_PORT_PROP_NAME))
+                if (propertyName.equals(serverPortPropertyName))
                 {
                     propertyValue = Integer.toString(Integer.parseInt(propertyValue)+index);
                 }
@@ -582,7 +627,7 @@
     protected void setUp() throws Exception
     {
         // setup cache properties
-        EhCacheConfigResource.getInstance(EhCacheConfigResource.EHCACHE_CONFIG_RESOURCE_DISTRIBUTED_CACHE, true);
+        setCacheSystemProperties();
         
         // environment setup
         osExecutableExtension = (System.getProperty("os.name").startsWith("Windows") ? ".exe" : "");
@@ -625,15 +670,35 @@
         // continue setup
         super.setUp();
     }
+    
+    /**
+     * Setup cache system properties.
+     */
+    protected void setCacheSystemProperties()
+    {
+        EhCacheConfigResource.getInstance(EhCacheConfigResource.EHCACHE_CONFIG_RESOURCE_DISTRIBUTED_CACHE, true);
+    }
 
-    /* (non-Javadoc)
-     * @see junit.framework.TestCase#tearDown()
+    /**
+     * Return class of server to launch and test against.
+     * 
+     * @return class of server.
      */
-    protected void tearDown() throws Exception
+    protected Class getServerClass()
     {
-        super.tearDown();
+        return DatabasePageManagerServer.class;
     }
-    
+
+    /**
+     * Return server port property name to increment on launch.
+     * 
+     * @return property name.
+     */
+    protected String getServerPortPropertyName()
+    {
+        return EhCacheConfigResource.EHCACHE_PORT_PROP_NAME;
+    }
+
     // Application entry point
 
     /**

Added: 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=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestOpenJPADatabasePageManagerCache.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/TestOpenJPADatabasePageManagerCache.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,79 @@
+/*
+ * 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.page.cache;
+
+import org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerProperties;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * TestOpenJPADatabasePageManagerCache
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class TestOpenJPADatabasePageManagerCache extends TestDatabasePageManagerCache
+{
+    // TestCase implementation
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.TestDatabasePageManagerCache#setCacheSystemProperties()
+     */
+    protected void setCacheSystemProperties()
+    {
+        OpenJPADatabasePageManagerProperties.getInstance("5636", "localhost:5636;localhost:5637");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.TestDatabasePageManagerCache#getServerClass()
+     */
+    protected Class getServerClass()
+    {
+        return OpenJPADatabasePageManagerServer.class;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.cache.TestDatabasePageManagerCache#getServerPortPropertyName()
+     */
+    protected String getServerPortPropertyName()
+    {
+        return OpenJPADatabasePageManagerProperties.OPENJPA_CACHE_PORT_PROP_NAME;
+    }
+
+    // Application entry point
+
+    /**
+     * Start the tests.
+     * 
+     * @param args not used
+     */
+    public static void main(final String [] args)
+    {
+        junit.awtui.TestRunner.main(new String[]{TestOpenJPADatabasePageManagerCache.class.getName()});
+    }
+
+    /**
+     * Creates the test suite.
+     * 
+     * @return a test suite that includes all methods starting with "test"
+     */
+    public static Test suite()
+    {
+        return new TestSuite(TestOpenJPADatabasePageManagerCache.class);
+    }
+}

Added: 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=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jpa-database-page-manager.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/jpa-database-page-manager.xml Sun Jan  4 22:04:13 2009
@@ -0,0 +1,69 @@
+<?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 Configuration -->
+    <bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
+        <property name="dataSources">
+            <map>
+                <entry key="jetspeed" value-ref="JetspeedDS"/>
+            </map>
+        </property>
+        <property name="defaultDataSource" ref="JetspeedDS"/>
+        <property name="persistenceXmlLocations">
+            <list>
+                <value>classpath*:META-INF/persistence.xml</value>
+            </list>
+        </property>
+    </bean>
+    <bean id="abstractEntityManagerFactory" abstract="true" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+        <property name="persistenceUnitManager" ref="persistenceUnitManager"/>
+    </bean>
+
+    <!-- Spring/JPA Transaction Manager -->
+    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+        <property name="entityManagerFactory" ref="entityManagerFactory"/>
+    </bean>
+    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
+
+    <!-- Spring Transaction Annotations -->
+    <tx:annotation-driven/>
+
+    <!-- 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="arguments">
+            <list>
+                <ref bean="pageManager"/>
+            </list>
+        </property>
+    </bean>
+
+    <!-- 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>
+    </bean>
+
+</beans>

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=731466&r1=731465&r2=731466&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 Sun Jan  4 22:04:13 2009
@@ -21,9 +21,44 @@
 #
 # ------------------------------------------------------------------------
 
-log4j.rootLogger = ERROR, errorlogging 
+log4j.rootCategory = ERROR, errorlogging
 
-log4j.category.org.apache.jetspeed = INFO, infologging
+#log4j.category.openjpa.Tool = INFO, infologging
+#log4j.category.openjpa.Runtime = INFO, infologging
+#log4j.category.openjpa.Remote = WARN, infologging
+#log4j.category.openjpa.DataCache = WARN, infologging
+#log4j.category.openjpa.MetaData = WARN, infologging
+#log4j.category.openjpa.Enhance = WARN, infologging
+#log4j.category.openjpa.Query = WARN, infologging
+#log4j.category.openjpa.jdbc.SQL = WARN, infologging
+#log4j.category.openjpa.jdbc.JDBC = WARN, infologging
+#log4j.category.openjpa.jdbc.Schema = WARN, infologging
+
+log4j.category.org.springframework = DEBUG, infologging
+log4j.additivity.org.springframework = false
+
+log4j.category.openjpa.Tool = TRACE, infologging
+log4j.additivity.openjpa.Tool = false
+log4j.category.openjpa.Runtime = TRACE, infologging
+log4j.additivity.openjpa.Runtime = false
+log4j.category.openjpa.Remote = TRACE, infologging
+log4j.additivity.openjpa.Remote = false
+log4j.category.openjpa.DataCache = TRACE, infologging
+log4j.additivity.openjpa.DataCache = false
+log4j.category.openjpa.MetaData = TRACE, infologging
+log4j.additivity.openjpa.MetaData = false
+log4j.category.openjpa.Enhance = TRACE, infologging
+log4j.additivity.openjpa.Enhance = false
+log4j.category.openjpa.Query = TRACE, infologging
+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.additivity.openjpa.jdbc.JDBC = false
+log4j.category.openjpa.jdbc.Schema = TRACE, infologging
+log4j.additivity.openjpa.jdbc.Schema = false
+
+log4j.category.org.apache.jetspeed = DEBUG, infologging
 log4j.additivity.org.apache.jetspeed = false
 
 log4j.appender.errorlogging = org.apache.log4j.FileAppender

Added: 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=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager-base.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager-base.xml Sun Jan  4 22:04:13 2009
@@ -0,0 +1,34 @@
+<?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">
+
+    <import resource="jpa-database-page-manager.xml"/>
+
+    <!-- OpenJPA Configuration -->
+    <bean id="jpaPageManagerProperties" class="org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerProperties"/>
+    <bean id="entityManagerFactory" parent="abstractEntityManagerFactory">
+        <property name="jpaProperties" ref="jpaPageManagerProperties"/>
+    </bean>
+
+</beans>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager.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.xml?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/openjpa-database-page-manager.xml Sun Jan  4 22:04:13 2009
@@ -0,0 +1,36 @@
+<?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">
+
+    <import resource="openjpa-database-page-manager-base.xml"/>
+
+    <!-- OpenJPA Database Page Manager -->
+    <bean id="pageManager" class="org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerImpl" init-method="initialize" destroy-method="terminate">
+        <!-- permissions security enabled flag, default=false -->
+        <constructor-arg index="0"><value>false</value></constructor-arg>
+        <!-- constraints security enabled flag, default=true -->
+        <constructor-arg index="1"><value>false</value></constructor-arg>
+    </bean>
+
+</beans>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-openjpa-database-page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-openjpa-database-page-manager.xml?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-openjpa-database-page-manager.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-openjpa-database-page-manager.xml Sun Jan  4 22:04:13 2009
@@ -0,0 +1,36 @@
+<?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">
+
+    <import resource="openjpa-database-page-manager-base.xml"/>
+
+    <!-- OpenJPA Database Page Manager -->
+    <bean id="pageManager" class="org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerImpl" init-method="initialize" destroy-method="terminate">
+        <!-- permissions security enabled flag, default=false -->
+        <constructor-arg index="0"><value>false</value></constructor-arg>
+        <!-- constraints security enabled flag, default=true -->
+        <constructor-arg index="1"><value>true</value></constructor-arg>
+    </bean>
+
+</beans>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-permissions-openjpa-database-page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-permissions-openjpa-database-page-manager.xml?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-permissions-openjpa-database-page-manager.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/resources/secure-permissions-openjpa-database-page-manager.xml Sun Jan  4 22:04:13 2009
@@ -0,0 +1,36 @@
+<?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">
+
+    <import resource="openjpa-database-page-manager-base.xml"/>
+
+    <!-- OpenJPA Database Page Manager -->
+    <bean id="pageManager" class="org.apache.jetspeed.page.jpa.OpenJPADatabasePageManagerImpl" init-method="initialize" destroy-method="terminate">
+        <!-- permissions security enabled flag, default=false -->
+        <constructor-arg index="0"><value>true</value></constructor-arg>
+        <!-- constraints security enabled flag, default=true -->
+        <constructor-arg index="1"><value>true</value></constructor-arg>
+    </bean>
+
+</beans>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java Sun Jan  4 22:04:13 2009
@@ -22,7 +22,7 @@
 import java.util.Map;
 
 import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
 import org.apache.jetspeed.om.page.Fragment;
 
 /**
@@ -54,24 +54,24 @@
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraints()
+     * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraintsContext()
      */
-    public SecurityConstraints getSecurityConstraints()
+    public SecurityConstraintsContext getSecurityConstraintsContext()
     {
         return null;
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+     * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraintsContext(org.apache.jetspeed.om.common.SecurityConstraintsContext)
      */
-    public void setSecurityConstraints(SecurityConstraints constraints)
+    public void setSecurityConstraintsContext(SecurityConstraintsContext constraintsContext)
     {
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsContext()
      */
-    public SecurityConstraints newSecurityConstraints()
+    public SecurityConstraintsContext newSecurityConstraintsContext()
     {
         return null;
     }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseGetResourceAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseGetResourceAction.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseGetResourceAction.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseGetResourceAction.java Sun Jan  4 22:04:13 2009
@@ -62,11 +62,11 @@
 
     protected void putSecurityInformation(Map resultMap, SecuredResource resource)
     {
-        if (resource.getSecurityConstraints() != null)
+        if (resource.getSecurityConstraintsContext() != null)
         {
-            resultMap.put(SECURITY_REFS, resource.getSecurityConstraints().getSecurityConstraintsRefs());
-            resultMap.put(SECURITY_DEFS, resource.getSecurityConstraints().getSecurityConstraints());
-            resultMap.put(SECURITY_OWNER, resource.getSecurityConstraints().getOwner());
+            resultMap.put(SECURITY_REFS, resource.getSecurityConstraintsContext().getSecurityConstraintsRefs());
+            resultMap.put(SECURITY_DEFS, resource.getSecurityConstraintsContext().getSecurityConstraints());
+            resultMap.put(SECURITY_OWNER, resource.getSecurityConstraintsContext().getOwner());
         }
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseSiteUpdateAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseSiteUpdateAction.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseSiteUpdateAction.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/BaseSiteUpdateAction.java Sun Jan  4 22:04:13 2009
@@ -28,7 +28,7 @@
 import org.apache.jetspeed.ajax.AjaxAction;
 import org.apache.jetspeed.ajax.AjaxBuilder;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
 import org.apache.jetspeed.om.portlet.LocalizedField;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.page.document.Node;
@@ -162,18 +162,18 @@
         String kind = getActionParameter(requestContext, "kind");
         if (isBlank(name) || isBlank(kind))
             throw new AJAXException("Invalid Security Ref: name invalid data.");
-        if (node.getSecurityConstraints() == null)
+        if (node.getSecurityConstraintsContext() == null)
         {
-            SecurityConstraints cons = node.newSecurityConstraints();
-            node.setSecurityConstraints(cons);             
+            SecurityConstraintsContext context = node.newSecurityConstraintsContext();
+            node.setSecurityConstraintsContext(context);             
         }
         if (kind.equals("Owner"))
         {
-            node.getSecurityConstraints().setOwner(name);
+            node.getSecurityConstraintsContext().setOwner(name);
         }
         else
         {
-            List refs = node.getSecurityConstraints().getSecurityConstraintsRefs();
+            List refs = node.getSecurityConstraintsContext().getSecurityConstraintsRefs();
             if (refs.contains(name))
                 return 0; // do nothing
             refs.add(name);
@@ -189,12 +189,12 @@
         String kind = getActionParameter(requestContext, "kind");
         if (isBlank(name) || isBlank(oldName) || isBlank(kind))
             throw new AJAXException("Invalid Security Ref: name invalid data.");
-        if (node.getSecurityConstraints() == null)
+        if (node.getSecurityConstraintsContext() == null)
         {
-            SecurityConstraints cons = node.newSecurityConstraints();
-            node.setSecurityConstraints(cons);             
+            SecurityConstraintsContext context = node.newSecurityConstraintsContext();
+            node.setSecurityConstraintsContext(context);             
         }                
-        List refs = node.getSecurityConstraints().getSecurityConstraintsRefs();        
+        List refs = node.getSecurityConstraintsContext().getSecurityConstraintsRefs();        
         if (refs == null || refs.size() == 0)
         {
             return insertSecurityReference(requestContext, resultMap, node);            
@@ -202,7 +202,7 @@
         boolean found = false;
         if (kind.equals("Owner"))
         {
-            node.getSecurityConstraints().setOwner(name);
+            node.getSecurityConstraintsContext().setOwner(name);
             found = true;
         }
         else
@@ -230,17 +230,17 @@
         String kind = getActionParameter(requestContext, "kind");
         if (isBlank(name) || isBlank(kind))
             throw new AJAXException("Invalid Security Ref: name invalid data.");
-        if (node.getSecurityConstraints() == null)
+        if (node.getSecurityConstraintsContext() == null)
         {
             return 0;
         }
         if (kind.equals("Owner"))
         {
-            node.getSecurityConstraints().setOwner(null);
+            node.getSecurityConstraintsContext().setOwner(null);
         }
         else
         {
-            List refs = node.getSecurityConstraints().getSecurityConstraintsRefs();
+            List refs = node.getSecurityConstraintsContext().getSecurityConstraintsRefs();
             if (!refs.contains(name))
                 return 0; // nothing to do
             refs.remove(name);
@@ -254,11 +254,11 @@
         String id = getActionParameter(requestContext, "id");
         if (isBlank(id))
             throw new AJAXException("Invalid Security Ref: id invalid data.");
-        if (node.getSecurityConstraints() == null)
+        if (node.getSecurityConstraintsContext() == null)
         {
             return 0;
         }
-        List defs = node.getSecurityConstraints().getSecurityConstraints();
+        List defs = node.getSecurityConstraintsContext().getSecurityConstraints();
         if (defs == null || defs.size() == 0)
         {
             return 0;

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/jpa/OpenJPAConfigurationProperties.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/jpa/OpenJPAConfigurationProperties.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/jpa/OpenJPAConfigurationProperties.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/jpa/OpenJPAConfigurationProperties.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,324 @@
+/*
+ * 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.rdbms.jpa;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.springframework.beans.factory.InitializingBean;
+
+/**
+ * OpenJPAConfigurationProperties
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class OpenJPAConfigurationProperties extends Properties implements InitializingBean
+{
+    private static final long serialVersionUID = 262872106653952686L;
+
+    // Constants
+
+    public static final String OPENJPA_CACHE_SIZE_PROP_NAME = "org.apache.jetspeed.openjpa.cache.size";
+    public static final String OPENJPA_CACHE_SIZE_PROP_DEFAULT_VALUE = "1000";
+    public static final String OPENJPA_QUERY_CACHE_SIZE_PROP_NAME = "org.apache.jetspeed.openjpa.query.cache.size";
+    public static final String OPENJPA_QUERY_CACHE_SIZE_PROP_DEFAULT_VALUE = "100";
+    public static final String OPENJPA_CACHE_TIMEOUT_PROP_NAME = "org.apache.jetspeed.openjpa.cache.timeout";
+    public static final String OPENJPA_CACHE_TIMEOUT_PROP_DEFAULT_VALUE = "3600000";
+    public static final String OPENJPA_CACHE_PORT_PROP_NAME = "org.apache.jetspeed.openjpa.cache.port";
+    public static final String OPENJPA_CACHE_PORT_PROP_DEFAULT_VALUE = "5636";
+    public static final String OPENJPA_CACHE_ADDRESSES_PROP_NAME = "org.apache.jetspeed.openjpa.cache.addresses";
+    
+    protected static final String OPENJPA_PROPERTY_NAME_PREFIX = "openjpa.";
+    
+    protected static final String OPENJPA_LOG_PROP_NAME = "openjpa.Log";
+    protected static final String OPENJPA_LOG_PROP_DEFAULT_VALUE = "commons"; // jetspeed uses commons logging
+    protected static final String OPENJPA_SCHEMA_FACTORY_PROP_NAME = "openjpa.jdbc.SchemaFactory";
+    protected static final String OPENJPA_SCHEMA_FACTORY_PROP_DEFAULT_VALUE = "native(ForeignKeys=true)"; // allow JPA schema to extract foreign keys constraints from database
+    protected static final String OPENJPA_UPDATE_MANAGER_PROP_NAME = "openjpa.jdbc.UpdateManager";
+    protected static final String OPENJPA_UPDATE_MANAGER_PROP_DEFAULT_VALUE = "operation-order"; // revert default constraints update manager: it fails to operate correctly with ON DELETE CASCADE database constraints, (see:https://issues.apache.org/jira/browse/OPENJPA-235)
+    protected static final String OPENJPA_DATA_CACHE_PROP_NAME = "openjpa.DataCache";
+    protected static final String OPENJPA_DATA_CACHE_PROP_DEFAULT_VALUE = "true(CacheSize=${"+OPENJPA_CACHE_SIZE_PROP_NAME+"},SoftReferenceSize=0)"; // enable cache and set data cache size
+    protected static final String OPENJPA_QUERY_CACHE_PROP_NAME = "openjpa.QueryCache";
+    protected static final String OPENJPA_QUERY_CACHE_PROP_DEFAULT_VALUE = "CacheSize=${"+OPENJPA_QUERY_CACHE_SIZE_PROP_NAME+"},SoftReferenceSize=0"; // enable query cache and set query cache size
+    protected static final String OPENJPA_DATA_CACHE_TIMEOUT_PROP_NAME = "openjpa.DataCacheTimeout";
+    protected static final String OPENJPA_DATA_CACHE_TIMEOUT_PROP_DEFAULT_VALUE = "${"+OPENJPA_CACHE_TIMEOUT_PROP_NAME+"}"; // set data cache timeout
+    protected static final String OPENJPA_REMOTE_COMMIT_PROVIDER_PROP_NAME = "openjpa.RemoteCommitProvider";
+    protected static final String OPENJPA_REMOTE_COMMIT_PROVIDER_PROP_DEFAULT_VALUE = "sjvm"; // stand alone default value
+    protected static final String OPENJPA_REMOTE_COMMIT_PROVIDER_PROP_TCP_VALUE = "tcp(Port=${"+OPENJPA_CACHE_PORT_PROP_NAME+"},Addresses=${"+OPENJPA_CACHE_ADDRESSES_PROP_NAME+"})"; // distributed TCP configuration value
+
+    // Singleton implementation
+    
+    private static OpenJPAConfigurationProperties instance;
+    
+    public static OpenJPAConfigurationProperties getInstance(final String cachePort, final String cacheAddresses)
+    {
+        // construct and return a default instance
+        if ( instance == null)
+        {
+            instance = new OpenJPAConfigurationProperties();
+            instance.setCachePort(cachePort);
+            instance.setCacheAddresses(cacheAddresses);
+            instance.afterPropertiesSet();
+        }
+        return instance;
+    }
+    
+    // Members
+    
+    private Properties jpaProperties;
+    private String cacheSize;
+    private String queryCacheSize;
+    private String cacheTimeout;
+    private String cachePort;
+    private String cacheAddresses;
+    
+    // Protocol
+    
+    /**
+     * Default cache size property name used to inject
+     * specific configuration.
+     * 
+     * @return default property name or null.
+     */
+    protected String defaultCacheSizePropertyName()
+    {
+        return null;
+    }
+    
+    /**
+     * Default query cache size property name used to inject
+     * specific configuration.
+     * 
+     * @return default property name or null.
+     */
+    protected String defaultQueryCacheSizePropertyName()
+    {
+        return null;
+    }
+    
+    /**
+     * Default cache timeout property name used to inject
+     * specific configuration.
+     * 
+     * @return default property name or null.
+     */
+    protected String defaultCacheTimeoutPropertyName()
+    {
+        return null;
+    }
+    
+    // InitializingBean implementation
+
+    /* (non-Javadoc)
+     * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+     */
+    public void afterPropertiesSet()
+    {
+        // inject specified system properties
+        if (cacheSize == null)
+        {
+            String defaultCacheSizePropName = defaultCacheSizePropertyName();
+            if (defaultCacheSizePropName == null)
+            {
+                defaultCacheSizePropName = OPENJPA_CACHE_SIZE_PROP_NAME;
+            }
+            cacheSize = System.getProperty(defaultCacheSizePropName, OPENJPA_CACHE_SIZE_PROP_DEFAULT_VALUE);
+        }
+        System.setProperty(OPENJPA_CACHE_SIZE_PROP_NAME, cacheSize);
+        if (queryCacheSize == null)
+        {
+            String defaultQueryCacheSizePropName = defaultQueryCacheSizePropertyName();
+            if (defaultQueryCacheSizePropName == null)
+            {
+                defaultQueryCacheSizePropName = OPENJPA_QUERY_CACHE_SIZE_PROP_NAME;
+            }
+            queryCacheSize = System.getProperty(defaultQueryCacheSizePropName, OPENJPA_QUERY_CACHE_SIZE_PROP_DEFAULT_VALUE);
+            // limit query cache size
+            final int cacheSizeInt = Integer.parseInt(cacheSize);
+            final int queryCacheSizeInt = Integer.parseInt(queryCacheSize);
+            if (queryCacheSizeInt > cacheSizeInt/2)
+            {
+                queryCacheSize = Integer.toString(cacheSizeInt/2);
+            }
+        }
+        System.setProperty(OPENJPA_QUERY_CACHE_SIZE_PROP_NAME, queryCacheSize);
+        if (cacheTimeout == null)
+        {
+            String defaultCacheTimeoutPropName = defaultCacheTimeoutPropertyName();
+            if (defaultCacheTimeoutPropName == null)
+            {
+                defaultCacheTimeoutPropName = OPENJPA_CACHE_TIMEOUT_PROP_NAME;
+            }
+            cacheTimeout = System.getProperty(defaultCacheTimeoutPropName, OPENJPA_CACHE_TIMEOUT_PROP_DEFAULT_VALUE);
+            // convert seconds to milliseconds
+            final long cacheTimeoutLong = Long.parseLong(cacheTimeout);
+            if (cacheTimeoutLong < 28800)
+            {
+                cacheTimeout = Long.toString(cacheTimeoutLong*1000);
+            }
+        }
+        System.setProperty(OPENJPA_CACHE_TIMEOUT_PROP_NAME, cacheTimeout);
+        if (cachePort == null)
+        {
+            cachePort = System.getProperty(OPENJPA_CACHE_PORT_PROP_NAME, OPENJPA_CACHE_PORT_PROP_DEFAULT_VALUE);
+        }
+        System.setProperty(OPENJPA_CACHE_PORT_PROP_NAME, cachePort);
+        if (cacheAddresses != null)
+        {
+            System.setProperty(OPENJPA_CACHE_ADDRESSES_PROP_NAME, cacheAddresses);
+        }
+        
+        // copy override properties to this
+        if ((jpaProperties != null) && (!jpaProperties.isEmpty()))
+        {
+            for (final Map.Entry<Object,Object> property : jpaProperties.entrySet())
+            {
+                if (property.getKey().toString().startsWith(OPENJPA_PROPERTY_NAME_PREFIX))
+                {
+                    setProperty(property.getKey().toString(), expandSystemPropertyExpressions(property.getValue().toString()));
+                }
+            }
+        }
+        
+        // default properties not overridden
+        if (!contains(OPENJPA_LOG_PROP_NAME))
+        {
+            setProperty(OPENJPA_LOG_PROP_NAME, expandSystemPropertyExpressions(OPENJPA_LOG_PROP_DEFAULT_VALUE));
+        }
+        if (!contains(OPENJPA_SCHEMA_FACTORY_PROP_NAME))
+        {
+            setProperty(OPENJPA_SCHEMA_FACTORY_PROP_NAME, expandSystemPropertyExpressions(OPENJPA_SCHEMA_FACTORY_PROP_DEFAULT_VALUE));
+        }
+        if (!contains(OPENJPA_UPDATE_MANAGER_PROP_NAME))
+        {
+            setProperty(OPENJPA_UPDATE_MANAGER_PROP_NAME, expandSystemPropertyExpressions(OPENJPA_UPDATE_MANAGER_PROP_DEFAULT_VALUE));
+        }
+        if (!contains(OPENJPA_DATA_CACHE_PROP_NAME))
+        {
+            setProperty(OPENJPA_DATA_CACHE_PROP_NAME, expandSystemPropertyExpressions(OPENJPA_DATA_CACHE_PROP_DEFAULT_VALUE));
+        }
+        if (!contains(OPENJPA_QUERY_CACHE_PROP_NAME))
+        {
+            setProperty(OPENJPA_QUERY_CACHE_PROP_NAME, expandSystemPropertyExpressions(OPENJPA_QUERY_CACHE_PROP_DEFAULT_VALUE));
+        }
+        if (!contains(OPENJPA_DATA_CACHE_TIMEOUT_PROP_NAME))
+        {
+            setProperty(OPENJPA_DATA_CACHE_TIMEOUT_PROP_NAME, expandSystemPropertyExpressions(OPENJPA_DATA_CACHE_TIMEOUT_PROP_DEFAULT_VALUE));
+        }
+        if (!contains(OPENJPA_REMOTE_COMMIT_PROVIDER_PROP_NAME))
+        {
+            // use distributed cache configuration if enabled; otherwise,
+            // fall back to standalone cache.
+            String propValue = expandSystemPropertyExpressions(OPENJPA_REMOTE_COMMIT_PROVIDER_PROP_TCP_VALUE);
+            if (propValue == null)
+            {
+                propValue = expandSystemPropertyExpressions(OPENJPA_REMOTE_COMMIT_PROVIDER_PROP_DEFAULT_VALUE);
+            }
+            setProperty(OPENJPA_REMOTE_COMMIT_PROVIDER_PROP_NAME, propValue);
+        }
+    }
+    
+    // Implementation
+    
+    private String expandSystemPropertyExpressions(final String value)
+    {
+        final int expressionIndex = value.indexOf("${");
+        if (expressionIndex > -1)
+        {
+            final int endExpressionIndex = value.indexOf('}', expressionIndex);
+            if (endExpressionIndex > -1)
+            {
+                final String propName = value.substring(expressionIndex+2, endExpressionIndex);
+                final String propValue = System.getProperty(propName);
+                if (propValue == null)
+                {
+                    return null;
+                }
+                final String remainingPropValue = expandSystemPropertyExpressions(value.substring(endExpressionIndex+1));
+                if (remainingPropValue == null)
+                {
+                    return null;
+                }
+                return value.substring(0, expressionIndex)+propValue+remainingPropValue;
+            }
+        }
+        return value;
+    }
+
+    // Data access
+
+    /**
+     * Set optional JPA override properties.
+     * 
+     * @param jpaProperties properties to set.
+     */
+    public void setJpaProperties(Properties jpaProperties)
+    {
+        this.jpaProperties = jpaProperties;
+    }
+
+    /**
+     * Set override cache size.
+     * 
+     * @param cacheSize the cache size to set
+     */
+    public void setCacheSize(String cacheSize)
+    {
+        this.cacheSize = cacheSize;
+    }
+
+    /**
+     * Set override query cache size.
+     * 
+     * @param queryCacheSize the query cache size to set
+     */
+    public void setQueryCacheSize(String queryCacheSize)
+    {
+        this.queryCacheSize = queryCacheSize;
+    }
+
+    /**
+     * Set override cache timeout.
+     * 
+     * @param cacheTimeout the timeout to set
+     */
+    public void setCacheTimeout(String cacheTimeout)
+    {
+        this.cacheTimeout = cacheTimeout;
+    }
+
+    /**
+     * Set override distributed cache port.
+     * 
+     * @param cachePort the cachePort to set
+     */
+    public void setCachePort(String cachePort)
+    {
+        this.cachePort = cachePort;
+    }
+
+    /**
+     * Set override distributed cache addresses.
+     * 
+     * @param cacheAddresses the cacheAddresses to set
+     */
+    public void setCacheAddresses(String cacheAddresses)
+    {
+        this.cacheAddresses = cacheAddresses;
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java Sun Jan  4 22:04:13 2009
@@ -23,7 +23,7 @@
 import org.apache.jetspeed.aggregator.PortletContent;
 import org.apache.jetspeed.decoration.Decoration;
 import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.Fragment;
 
@@ -96,9 +96,9 @@
         return f.newSecurityConstraint();
     }
 
-    public SecurityConstraints newSecurityConstraints()
+    public SecurityConstraintsContext newSecurityConstraintsContext()
     {
-        return f.newSecurityConstraints();
+        return f.newSecurityConstraintsContext();
     }
 
     /** 
@@ -159,11 +159,11 @@
 
 
     /**
-     * @return security constraints
+     * @return security constraints context
      */
-    public SecurityConstraints getSecurityConstraints()
+    public SecurityConstraintsContext getSecurityConstraintsContext()
     {
-        return f.getSecurityConstraints();
+        return f.getSecurityConstraintsContext();
     }
 
     /**
@@ -249,9 +249,9 @@
     /**
      * @param constraints
      */
-    public void setSecurityConstraints(SecurityConstraints constraints)
+    public void setSecurityConstraintsContext(SecurityConstraintsContext constraintsContext)
     {
-        f.setSecurityConstraints(constraints);
+        f.setSecurityConstraintsContext(constraintsContext);
     }
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/ComponentManagement.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/ComponentManagement.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/ComponentManagement.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/ComponentManagement.java Sun Jan  4 22:04:13 2009
@@ -28,5 +28,25 @@
     
     Object getComponent(Object containerName, Object componentName);
     
-    void addComponent(String name, Object bean);    
+    void addComponent(String name, Object bean);
+    
+    /**
+     * Create prototype component instance from component management
+     * definition. Created components must be destroyed explicitly
+     * using destroy, since container does not manage lifecycle of
+     * prototype components.
+     * 
+     * @param componentName name of component to create.
+     * @return prototype component instance.
+     */
+    Object createPrototypeComponent(Object componentName);
+    
+    /**
+     * Destroy prototype component instance created using this
+     * component manager.
+     * 
+     * @param componentName name of component to destroy.
+     * @param component prototype component instance.
+     */
+    void destroyPrototypeComponent(Object componentName, Object component);
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecuredResource.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecuredResource.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecuredResource.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecuredResource.java Sun Jan  4 22:04:13 2009
@@ -44,21 +44,21 @@
     
     /**
      * <p>
-     * getSecurityConstraints
+     * getSecurityConstraintsContext
      * </p>
      *
-     * @return security constraints for resource
+     * @return security constraints context for resource
      */
-    SecurityConstraints getSecurityConstraints();
+    SecurityConstraintsContext getSecurityConstraintsContext();
     
     /**
      * <p>
-     * newSecurityConstraints
+     * newSecurityConstraintsContext
      * </p>
      *
-     * @return a newly created SecurityConstraints object for use in SecuredResource
+     * @return a newly created SecurityConstraints context object for use in SecuredResource
      */
-    SecurityConstraints newSecurityConstraints();
+    SecurityConstraintsContext newSecurityConstraintsContext();
 
     /**
      * <p>
@@ -71,12 +71,12 @@
 
     /**
      * <p>
-     * setSecurityConstraints
+     * setSecurityConstraintsContext
      * </p>
      *
-     * @param constraints security constraints for resource
+     * @param constraintsContext security constraints context for resource
      */
-    void setSecurityConstraints(SecurityConstraints constraints);
+    void setSecurityConstraintsContext(SecurityConstraintsContext constraintsContext);
 
     /**
      * <p>

Copied: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecurityConstraintsContext.java (from r728362, portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecurityConstraints.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecurityConstraintsContext.java?p2=portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecurityConstraintsContext.java&p1=portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecurityConstraints.java&r1=728362&r2=731466&rev=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecurityConstraints.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/common/SecurityConstraintsContext.java Sun Jan  4 22:04:13 2009
@@ -20,17 +20,17 @@
 
 /**
  * <p>
- * SecurityConstraints
+ * SecurityConstraintsContext
  * </p>
  * <p>
- * Used to specify security constraints for a resource.
+ * Used to specify security constraints context for a resource.
  *
  * </p>
  * @author <a href="mailto:rwatler@finali.com">Randy Watler</a>
  * @version $Id$
  *
  */
-public interface SecurityConstraints
+public interface SecurityConstraintsContext
 {   
     /**
      * <p>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/page/PageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/page/PageManager.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/page/PageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/page/PageManager.java Sun Jan  4 22:04:13 2009
@@ -20,7 +20,7 @@
 import javax.security.auth.Subject;
 
 import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.folder.InvalidFolderException;
@@ -76,6 +76,27 @@
     public boolean getPermissionsEnabled();
 
     /**
+     * Register page manager context with current thread.
+     * 
+     * @param context page manager context.
+     */
+    public void registerContext(Object context);
+
+    /**
+     * Get page manager context registered with current thread.
+     * 
+     * @return page manager context.
+     */
+    public Object getContext();
+
+    /**
+     * Unregister page manager context with current thread.
+     * 
+     * @param context page manager context.
+     */
+    public void unregisterContext(Object context);
+
+    /**
      * Creates a new empty Page instance
      *
      * @return a newly created Page object
@@ -188,11 +209,11 @@
     public MenuSeparatorDefinition newPageMenuSeparatorDefinition();
 
     /**
-     * newSecurityConstraints - creates a new empty security constraints definition
+     * newSecurityConstraintsContext - creates a new empty security constraints context definition
      *
-     * @return a newly created SecurityConstraints object
+     * @return a newly created SecurityConstraintsContext object
      */
-    public SecurityConstraints newSecurityConstraints();
+    public SecurityConstraintsContext newSecurityConstraintsContext();
 
     /**
      * newFolderSecurityConstraint - creates a new security constraint definition

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/jpa-schema.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/jpa-schema.xml?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/jpa-schema.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/jpa-schema.xml Sun Jan  4 22:04:13 2009
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+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.
+-->
+<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_2.dtd">
+<!-- Autogenerated by JDBCToXMLSchema! -->
+<database name="j2">
+
+    <!--
+       JPA Auto GeneratedValue Support
+    -->
+
+    <table name="OPENJPA_SEQUENCE_TABLE">
+        <column name="ID" primaryKey="true" required="true" type="TINYINT"/>
+        <column name="SEQUENCE_VALUE" required="false" type="BIGINT"/>
+    </table>
+    
+</database>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/phase2-schema.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/phase2-schema.xml?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/phase2-schema.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/ddl-schema/phase2-schema.xml Sun Jan  4 22:04:13 2009
@@ -52,6 +52,7 @@
         <unique name="UN_FOLDER_1">
             <unique-column name="PATH"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
     
     <table name="FOLDER_METADATA">
@@ -72,6 +73,7 @@
             <unique-column name="LOCALE"/>
             <unique-column name="VALUE"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FOLDER_CONSTRAINT">
@@ -88,6 +90,7 @@
         <index name="IX_FOLDER_CONSTRAINT_1">
             <index-column name="FOLDER_ID"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FOLDER_CONSTRAINTS_REF">
@@ -105,6 +108,7 @@
             <unique-column name="FOLDER_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FOLDER_ORDER">
@@ -122,6 +126,7 @@
             <unique-column name="FOLDER_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FOLDER_MENU">
@@ -155,6 +160,7 @@
             <index-column name="FOLDER_ID"/>
             <index-column name="NAME"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FOLDER_MENU_METADATA">
@@ -175,6 +181,7 @@
             <unique-column name="LOCALE"/>
             <unique-column name="VALUE"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <!--
@@ -211,6 +218,7 @@
         <unique name="UN_PAGE_1">
             <unique-column name="PATH"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
     
     <table name="PAGE_METADATA">
@@ -231,6 +239,7 @@
             <unique-column name="LOCALE"/>
             <unique-column name="VALUE"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="PAGE_CONSTRAINT">
@@ -247,6 +256,7 @@
         <index name="IX_PAGE_CONSTRAINT_1">
             <index-column name="PAGE_ID"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="PAGE_CONSTRAINTS_REF">
@@ -264,6 +274,7 @@
             <unique-column name="PAGE_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="PAGE_MENU">
@@ -297,6 +308,7 @@
             <index-column name="PAGE_ID"/>
             <index-column name="NAME"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="PAGE_MENU_METADATA">
@@ -317,6 +329,7 @@
             <unique-column name="LOCALE"/>
             <unique-column name="VALUE"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <!--
@@ -360,6 +373,7 @@
         <index name="UN_FRAGMENT_1">
             <index-column name="PAGE_ID"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FRAGMENT_CONSTRAINT">
@@ -376,6 +390,7 @@
         <index name="IX_FRAGMENT_CONSTRAINT_1">
             <index-column name="FRAGMENT_ID"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FRAGMENT_CONSTRAINTS_REF">
@@ -393,6 +408,7 @@
             <unique-column name="FRAGMENT_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FRAGMENT_PREF">
@@ -410,6 +426,7 @@
             <unique-column name="FRAGMENT_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="FRAGMENT_PREF_VALUE">
@@ -423,6 +440,7 @@
         <index name="IX_FRAGMENT_PREF_VALUE_1">
             <index-column name="PREF_ID"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <!--
@@ -459,6 +477,7 @@
         <unique name="UN_LINK_1">
             <unique-column name="PATH"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
     
     <table name="LINK_METADATA">
@@ -479,6 +498,7 @@
             <unique-column name="LOCALE"/>
             <unique-column name="VALUE"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="LINK_CONSTRAINT">
@@ -495,6 +515,7 @@
         <index name="IX_LINK_CONSTRAINT_1">
             <index-column name="LINK_ID"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="LINK_CONSTRAINTS_REF">
@@ -512,6 +533,7 @@
             <unique-column name="LINK_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <!--
@@ -541,6 +563,7 @@
         <unique name="UN_PAGE_SECURITY_2">
             <unique-column name="PATH"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
     
     <table name="PAGE_SEC_CONSTRAINTS_DEF">
@@ -557,6 +580,7 @@
             <unique-column name="PAGE_SECURITY_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="PAGE_SEC_CONSTRAINT_DEF">
@@ -573,6 +597,7 @@
         <index name="IX_PAGE_SEC_CONSTRAINT_DEF_1">
             <index-column name="CONSTRAINTS_DEF_ID"/>
         </index>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <table name="PAGE_SEC_CONSTRAINTS_REF">
@@ -590,6 +615,7 @@
             <unique-column name="PAGE_SECURITY_ID"/>
             <unique-column name="NAME"/>
         </unique>
+        <column name="JPA_VERSION" type="INTEGER"/>
     </table>
 
     <!--

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/ddl/mssql/create-schema.sql
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/ddl/mssql/create-schema.sql?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/ddl/mssql/create-schema.sql (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-portal-resources/src/main/resources/ddl/mssql/create-schema.sql Sun Jan  4 22:04:13 2009
@@ -210,6 +210,7 @@
     EXT_ATTR_NAME VARCHAR(15),
     EXT_ATTR_VALUE VARCHAR(40),
     OWNER_PRINCIPAL VARCHAR(40),
+    JPA_VERSION INT,
     PRIMARY KEY (FOLDER_ID)
 );
  
@@ -228,6 +229,7 @@
     NAME VARCHAR(15) NOT NULL,
     LOCALE VARCHAR(20) NOT NULL,
     VALUE VARCHAR(100) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (METADATA_ID)
 );
  
@@ -248,6 +250,7 @@
     ROLE_PRINCIPALS_ACL VARCHAR(120),
     GROUP_PRINCIPALS_ACL VARCHAR(120),
     PERMISSIONS_ACL VARCHAR(120),
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINT_ID)
 );
 
@@ -263,6 +266,7 @@
     FOLDER_ID INT NOT NULL,
     APPLY_ORDER INT NOT NULL,
     NAME VARCHAR(40) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINTS_REF_ID)
 );
 
@@ -280,6 +284,7 @@
     FOLDER_ID INT NOT NULL,
     SORT_ORDER INT NOT NULL,
     NAME VARCHAR(80) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (ORDER_ID)
 );
 
@@ -310,6 +315,7 @@
     OPTIONS_ORDER VARCHAR(255),
     SKIN VARCHAR(80),
     IS_NEST SMALLINT,
+    JPA_VERSION INT,
     PRIMARY KEY (MENU_ID)
 );
 
@@ -328,6 +334,7 @@
     NAME VARCHAR(15) NOT NULL,
     LOCALE VARCHAR(20) NOT NULL,
     VALUE VARCHAR(100) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (METADATA_ID)
 );
 
@@ -361,6 +368,7 @@
     EXT_ATTR_NAME VARCHAR(15),
     EXT_ATTR_VALUE VARCHAR(40),
     OWNER_PRINCIPAL VARCHAR(40),
+    JPA_VERSION INT,
     PRIMARY KEY (PAGE_ID)
 );
 
@@ -379,6 +387,7 @@
     NAME VARCHAR(15) NOT NULL,
     LOCALE VARCHAR(20) NOT NULL,
     VALUE VARCHAR(100) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (METADATA_ID)
 );
 
@@ -399,6 +408,7 @@
     ROLE_PRINCIPALS_ACL VARCHAR(120),
     GROUP_PRINCIPALS_ACL VARCHAR(120),
     PERMISSIONS_ACL VARCHAR(120),
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINT_ID)
 );
 
@@ -414,6 +424,7 @@
     PAGE_ID INT NOT NULL,
     APPLY_ORDER INT NOT NULL,
     NAME VARCHAR(40) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINTS_REF_ID)
 );
 
@@ -444,6 +455,7 @@
     OPTIONS_ORDER VARCHAR(255),
     SKIN VARCHAR(80),
     IS_NEST SMALLINT,
+    JPA_VERSION INT,
     PRIMARY KEY (MENU_ID)
 );
 
@@ -462,6 +474,7 @@
     NAME VARCHAR(15) NOT NULL,
     LOCALE VARCHAR(20) NOT NULL,
     VALUE VARCHAR(100) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (METADATA_ID)
 );
 
@@ -499,6 +512,7 @@
     EXT_PROP_NAME_2 VARCHAR(40),
     EXT_PROP_VALUE_2 VARCHAR(80),
     OWNER_PRINCIPAL VARCHAR(40),
+    JPA_VERSION INT,
     PRIMARY KEY (FRAGMENT_ID)
 );
 
@@ -519,6 +533,7 @@
     ROLE_PRINCIPALS_ACL VARCHAR(120),
     GROUP_PRINCIPALS_ACL VARCHAR(120),
     PERMISSIONS_ACL VARCHAR(120),
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINT_ID)
 );
 
@@ -534,6 +549,7 @@
     FRAGMENT_ID INT NOT NULL,
     APPLY_ORDER INT NOT NULL,
     NAME VARCHAR(40) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINTS_REF_ID)
 );
 
@@ -551,6 +567,7 @@
     FRAGMENT_ID INT NOT NULL,
     NAME VARCHAR(40) NOT NULL,
     IS_READ_ONLY SMALLINT NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (PREF_ID)
 );
 
@@ -568,6 +585,7 @@
     PREF_ID INT NOT NULL,
     VALUE_ORDER INT NOT NULL,
     VALUE VARCHAR(100) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (PREF_VALUE_ID)
 );
 
@@ -599,6 +617,7 @@
     EXT_ATTR_NAME VARCHAR(15),
     EXT_ATTR_VALUE VARCHAR(40),
     OWNER_PRINCIPAL VARCHAR(40),
+    JPA_VERSION INT,
     PRIMARY KEY (LINK_ID)
 );
 
@@ -617,6 +636,7 @@
     NAME VARCHAR(15) NOT NULL,
     LOCALE VARCHAR(20) NOT NULL,
     VALUE VARCHAR(100) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (METADATA_ID)
 );
 
@@ -637,6 +657,7 @@
     ROLE_PRINCIPALS_ACL VARCHAR(120),
     GROUP_PRINCIPALS_ACL VARCHAR(120),
     PERMISSIONS_ACL VARCHAR(120),
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINT_ID)
 );
 
@@ -652,6 +673,7 @@
     LINK_ID INT NOT NULL,
     APPLY_ORDER INT NOT NULL,
     NAME VARCHAR(40) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINTS_REF_ID)
 );
 
@@ -678,6 +700,7 @@
     LOCALE VARCHAR(20),
     EXT_ATTR_NAME VARCHAR(15),
     EXT_ATTR_VALUE VARCHAR(40),
+    JPA_VERSION INT,
     PRIMARY KEY (PAGE_SECURITY_ID)
 );
 
@@ -694,6 +717,7 @@
     CONSTRAINTS_DEF_ID INT NOT NULL,
     PAGE_SECURITY_ID INT NOT NULL,
     NAME VARCHAR(40) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINTS_DEF_ID)
 );
 
@@ -714,6 +738,7 @@
     ROLE_PRINCIPALS_ACL VARCHAR(120),
     GROUP_PRINCIPALS_ACL VARCHAR(120),
     PERMISSIONS_ACL VARCHAR(120),
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINT_DEF_ID)
 );
 
@@ -729,6 +754,7 @@
     PAGE_SECURITY_ID INT NOT NULL,
     APPLY_ORDER INT NOT NULL,
     NAME VARCHAR(40) NOT NULL,
+    JPA_VERSION INT,
     PRIMARY KEY (CONSTRAINTS_REF_ID)
 );
 
@@ -906,6 +932,17 @@
 );
 
 -- ----------------------------------------------------------------------- 
+-- OPENJPA_SEQUENCE_TABLE 
+-- ----------------------------------------------------------------------- 
+
+CREATE TABLE OPENJPA_SEQUENCE_TABLE
+(
+    ID SMALLINT NOT NULL,
+    SEQUENCE_VALUE DECIMAL(19,0),
+    PRIMARY KEY (ID)
+) ;
+
+-- ----------------------------------------------------------------------- 
 -- PORTLET_DEFINITION 
 -- ----------------------------------------------------------------------- 
 

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml Sun Jan  4 22:04:13 2009
@@ -307,6 +307,7 @@
     <myfaces.version>1.1.5</myfaces.version>
     <nekohtml.version>0.9.5</nekohtml.version>
     <ojb.version>1.0.3</ojb.version>
+    <openjpa.version>1.2.0</openjpa.version>
     <org.apache.derby.version>10.3.2.1</org.apache.derby.version>
     <org.apache.pluto.version>2.0.0-SNAPSHOT</org.apache.pluto.version>
     <org.apache.portals.bridges.common.version>1.0.4</org.apache.portals.bridges.common.version>
@@ -611,6 +612,19 @@
         <version>${ojb.version}</version>
       </dependency>
 
+      <!-- JPA -->
+      <dependency>
+        <groupId>org.apache.openjpa</groupId>
+        <artifactId>openjpa-persistence-jdbc</artifactId>
+        <version>${openjpa.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>ant</groupId>
+            <artifactId>ant</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>        
+
       <!-- Spring Framework -->
       <dependency>
         <groupId>cglib</groupId>



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