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 [2/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
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DatasourceComponent.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/DatasourceComponent.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/DatasourceComponent.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DatasourceComponent.java Sat Jan 17 21:19:24 2009
@@ -19,29 +19,27 @@
 import javax.sql.DataSource;
 
 /**
- * <p>
  * DatasourceComponent
- * </p>
  * 
- * 
- * @
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
  * @version $ $
- *
  */
 public interface DatasourceComponent
 {
     /**
-     * 
-     * <p>
-     * getDatasource
-     * </p>
-     * 
-     * <p>
-     *   returns the datasource created by this component
-     * </p>
-     * @return
+     * Return the datasource created by this component.
      *
+     * @return new datasource.
      */
     public abstract DataSource getDatasource();
+
+    /**
+     * Initialize and start component.
+     */
+    public abstract void start();
+    
+    /**
+     * Stop and terminate component.
+     */
+    public abstract void stop();
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JNDIComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JNDIComponent.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/jndi/JNDIComponent.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JNDIComponent.java Sat Jan 17 21:19:24 2009
@@ -32,7 +32,17 @@
  */
 public interface JNDIComponent
 {
-	Context getRootContext();
+    /**
+     * Initialize and start component.
+     */
+    void start();
+    
+    /**
+     * Stop and terminate component.
+     */
+    void stop();
+
+    Context getRootContext();
 	
 	void bindToCurrentThread() throws NamingException;
 	
@@ -41,5 +51,4 @@
 	void bindObject(String bindToName, Object obj) throws NamingException;
 	
 	void unbindObject(String name) throws NamingException;
-
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JetspeedTestJNDIComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JetspeedTestJNDIComponent.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/jndi/JetspeedTestJNDIComponent.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JetspeedTestJNDIComponent.java Sat Jan 17 21:19:24 2009
@@ -17,13 +17,18 @@
 package org.apache.jetspeed.components.jndi;
 
 import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.jetspeed.components.datasource.DatasourceComponent;
 import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent;
+import org.apache.jetspeed.components.datasource.BoundAtomikosXADatasourceComponent;
+import org.apache.jetspeed.components.transaction.UserTransactionComponent;
+import org.apache.jetspeed.components.transaction.BoundAtomikosUserTransactionComponent;
 
 /**
  * JetspeedDSTestJNDIComponent
- * <p>
- * Uses TyrexJNDIComponent to define a jetspeed Datasource for testing purposes only.
- * </p>
+ *
+ * Uses TyrexJNDIComponent to define a jetspeed Datasources and
+ * Transactions for testing purposes only.
+ * 
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
  * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
  * @version $Id$
@@ -31,25 +36,112 @@
 public class JetspeedTestJNDIComponent
 {
     public static final String JNDI_DS_NAME = "jetspeed";
-    
-    protected BoundDBCPDatasourceComponent datasourceComponent;
+    public static final String JNDI_XADS_NAME = "jetspeed-xa";
+
+    protected DatasourceComponent datasourceComponent;
+    protected DatasourceComponent xaDatasourceComponent;
+    protected UserTransactionComponent userTransactionComponent;
     protected JNDIComponent jndi;
     
     public void setup() throws Exception
     {
-        jndi = new TyrexJNDIComponent();
-        String url = System.getProperty("org.apache.jetspeed.database.url");
-        String driver = System.getProperty("org.apache.jetspeed.database.driver");
-        String user = System.getProperty("org.apache.jetspeed.database.user");
-        String password = System.getProperty("org.apache.jetspeed.database.password");
-        datasourceComponent = new BoundDBCPDatasourceComponent(user, password, driver, url, 20, 5000,
-                GenericObjectPool.WHEN_EXHAUSTED_GROW, true, JNDI_DS_NAME, jndi);
+        jndi = createJNDIComponent();
+        jndi.start();
+        datasourceComponent = createDataSourceComponent(jndi);
         datasourceComponent.start();
+        xaDatasourceComponent = createXADatasourceComponent(jndi);
+        if (xaDatasourceComponent != null)
+        {
+            xaDatasourceComponent.start();
+            userTransactionComponent = createUserTransactionComponent(jndi);
+            userTransactionComponent.start();
+        }
     }
     
     public void tearDown() throws Exception
     {
+        if (xaDatasourceComponent != null)
+        {
+            userTransactionComponent.stop();
+            xaDatasourceComponent.stop();
+        }
         datasourceComponent.stop();
-        jndi.unbindFromCurrentThread();
+        jndi.stop();
+    }
+    
+    /**
+     * Construct JNDI context component.
+     * 
+     * @return JNDI context
+     * @throws Exception
+     */
+    public static JNDIComponent createJNDIComponent() throws Exception
+    {
+        return new NamingJavaJNDIComponent();
+    }
+
+    /**
+     * Construct DataSource component from system properties configuration.
+     * 
+     * @param jndi JNDI context
+     * @return XA data source component instance.
+     * @throws Exception
+     */
+    public static DatasourceComponent createDataSourceComponent(JNDIComponent jndi) throws Exception
+    {
+        // standard connection properties
+        String url = getSystemProperty("org.apache.jetspeed.database.url");
+        String driver = getSystemProperty("org.apache.jetspeed.database.driver");
+        String user = getSystemProperty("org.apache.jetspeed.database.user");
+        String password = getSystemProperty("org.apache.jetspeed.database.password");
+        return new BoundDBCPDatasourceComponent(user, password, driver, url, Integer.MAX_VALUE, 1000, GenericObjectPool.WHEN_EXHAUSTED_GROW, true, JNDI_DS_NAME, jndi);
+    }
+    
+    /**
+     * Construct XA DataSource component from system properties configuration.
+     * 
+     * @param jndi JNDI context
+     * @return XA data source component instance.
+     * @throws Exception
+     */
+    public static DatasourceComponent createXADatasourceComponent(JNDIComponent jndi) throws Exception
+    {
+        // standard connection properties
+        String url = getSystemProperty("org.apache.jetspeed.database.url");
+        String driver = getSystemProperty("org.apache.jetspeed.database.driver");
+        String user = getSystemProperty("org.apache.jetspeed.database.user");
+        String password = getSystemProperty("org.apache.jetspeed.database.password");
+        // supported XA type property
+        String xatype = getSystemProperty("org.apache.jetspeed.database.xatype");
+        return new BoundAtomikosXADatasourceComponent(xatype, driver, user, password, url, Integer.MAX_VALUE, 0, 1000, JNDI_XADS_NAME, jndi);
+    }
+    
+    /**
+     * Construct UserTransaction/TransactionManager component.
+     * 
+     * @param jndi JNDI context
+     * @return user transaction component instance.
+     * @throws Exception
+     */
+    public static UserTransactionComponent createUserTransactionComponent(JNDIComponent jndi) throws Exception
+    {
+        return new BoundAtomikosUserTransactionComponent(jndi);
+    }
+    
+    /**
+     * Return valid property value; empty strings or unexpanded
+     * expression values are stripped.
+     * 
+     * @param name system property name.
+     * @return valid property value.
+     */
+    private static String getSystemProperty(String name)
+    {
+        String property = System.getProperty(name);
+        if ((property != null) && ((property.length() == 0) || (property.startsWith("${") && property.endsWith("}"))))
+        {
+            property = null;
+        }
+        return property;
     }
 }

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/NamingJavaJNDIComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/NamingJavaJNDIComponent.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/NamingJavaJNDIComponent.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/NamingJavaJNDIComponent.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,139 @@
+/*
+ * 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.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.naming.ContextBindings;
+
+/**
+ * NamingJavaJNDIComponent
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class NamingJavaJNDIComponent implements JNDIComponent
+{
+    // Members
+    
+    private Context rootContext;
+    
+    // Constructors
+    
+    public NamingJavaJNDIComponent()
+    {
+        Hashtable env = new Hashtable();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
+        env.put(Context.URL_PKG_PREFIXES,"org.apache.naming");
+        try
+        {
+            rootContext = new InitialContext(env);
+        }
+        catch (NamingException ne)
+        {
+            IllegalStateException ise = new IllegalStateException("Naming exception on create: "+ne.toString());
+            ise.initCause(ne);
+            throw ise;            
+        }
+    }
+    
+    // Implementation
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.jndi.JNDIComponent#start()
+     */
+    public void start()
+    {
+        try
+        {
+            rootContext.createSubcontext("java:comp").createSubcontext("env").createSubcontext("jdbc");
+            rootContext.createSubcontext("java:jdbc");
+        }
+        catch (NamingException ne)
+        {
+            IllegalStateException ise = new IllegalStateException("Naming exception on start: "+ne.toString());
+            ise.initCause(ne);
+            throw ise;            
+        }        
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.jndi.JNDIComponent#stop()
+     */
+    public void stop()
+    {
+        try
+        {
+            rootContext.destroySubcontext("java:comp");
+            rootContext.destroySubcontext("java:jdbc");
+        }
+        catch (NamingException ne)
+        {
+            IllegalStateException ise = new IllegalStateException("Naming exception on stop: "+ne.toString());
+            ise.initCause(ne);
+            throw ise;
+        }
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.jndi.JNDIComponent#bindObject(java.lang.String, java.lang.Object)
+     */
+    public void bindObject(String bindToName, Object obj) throws NamingException
+    {
+        rootContext.bind("java:"+bindToName, obj);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.jndi.JNDIComponent#bindToCurrentThread()
+     */
+    public void bindToCurrentThread() throws NamingException
+    {
+        String threadName = Thread.currentThread().getName();
+        ContextBindings.bindContext(threadName, rootContext);
+        ContextBindings.bindThread(threadName);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.jndi.JNDIComponent#getRootContext()
+     */
+    public Context getRootContext()
+    {
+        return rootContext;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.jndi.JNDIComponent#unbindFromCurrentThread()
+     */
+    public void unbindFromCurrentThread() throws NamingException
+    {
+        String threadName = Thread.currentThread().getName();
+        ContextBindings.unbindThread(threadName);
+        ContextBindings.unbindContext(threadName);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.jndi.JNDIComponent#unbindObject(java.lang.String)
+     */
+    public void unbindObject(String name) throws NamingException
+    {
+        rootContext.unbind("java:"+name);
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.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/jndi/SpringJNDIStarter.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java Sat Jan 17 21:19:24 2009
@@ -32,27 +32,18 @@
 
 import java.util.Map;
 
-import org.apache.commons.pool.impl.GenericObjectPool;
 import org.apache.jetspeed.components.SpringComponentManager;
-import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent;
+import org.apache.jetspeed.components.datasource.DatasourceComponent;
 import org.apache.jetspeed.components.jndi.JNDIComponent;
-import org.apache.jetspeed.components.jndi.TyrexJNDIComponent;
+import org.apache.jetspeed.components.transaction.UserTransactionComponent;
 
 public class SpringJNDIStarter
 {
-
-	   public static final String JNDI_DS_NAME = "jetspeed";
-		public static final String DATASOURCE_DRIVER = "org.apache.jetspeed.database.driver".intern();
-		public static final String DATASOURCE_URL = "org.apache.jetspeed.database.url".intern();
-		public static final String DATASOURCE_USERNAME = "org.apache.jetspeed.database.user".intern();
-		public static final String DATASOURCE_PASSWORD = "org.apache.jetspeed.database.password".intern();
-
-
-		
-		
 		private final Map context;
 	   
-	    protected BoundDBCPDatasourceComponent datasourceComponent;
+        protected DatasourceComponent datasourceComponent;
+        protected DatasourceComponent xaDatasourceComponent;
+        protected UserTransactionComponent userTransactionComponent;
 	    protected JNDIComponent jndi;
 	    String appRoot = null; 
 	    String[] bootConfig = null;
@@ -78,11 +69,7 @@
 
 /**
  * The main startup routine.
- * Establishes a JNDI connection based on the following System parameters:
- * <p> org.apache.jetspeed.database.url
- * <p> org.apache.jetspeed.database.driver
- * <p> org.apache.jetspeed.database.user
- * <p> org.apache.jetspeed.database.password
+ * Establishes a JNDI connection based on the following System parameters.
  * @throws Exception
  */
     public void setUp() throws Exception
@@ -93,6 +80,30 @@
 
     public void tearDown() throws Exception
     {
+        if (userTransactionComponent != null)
+        {
+            try
+            {
+                userTransactionComponent.stop();
+            }
+            catch (Exception e)
+            {
+                System.out.println("userTransactionComponent stop failed with " + e.getLocalizedMessage());
+                e.printStackTrace();
+            }
+        }
+        if (xaDatasourceComponent != null)
+        {
+            try
+            {
+                xaDatasourceComponent.stop();
+            }
+            catch (Exception e)
+            {
+                System.out.println("xaDatasourceComponent stop failed with " + e.getLocalizedMessage());
+                e.printStackTrace();
+            }
+        }
     	try
     	{
     		datasourceComponent.stop();
@@ -114,11 +125,11 @@
     	
     	try
     	{
-    		jndi.unbindFromCurrentThread();
+    		jndi.stop();
 		}
 		catch (Exception e)
 		{
-			System.out.println("JNDI  unbindFromCurrentThread failed with " + e.getLocalizedMessage());
+			System.out.println("JNDI stop failed with " + e.getLocalizedMessage());
 			e.printStackTrace();
 		}
     }
@@ -143,14 +154,17 @@
     
     public void setupJNDI() throws Exception
     {
-        jndi = new TyrexJNDIComponent();
-        String url = getProperty("org.apache.jetspeed.database.url");
-        String driver = getProperty("org.apache.jetspeed.database.driver");
-        String user = getProperty("org.apache.jetspeed.database.user");
-        String password = getProperty("org.apache.jetspeed.database.password");
-        datasourceComponent = new BoundDBCPDatasourceComponent(user, password, driver, url, 20, 5000,
-                GenericObjectPool.WHEN_EXHAUSTED_GROW, true, JNDI_DS_NAME, jndi);
+        jndi = JetspeedTestJNDIComponent.createJNDIComponent();
+        jndi.start();
+        datasourceComponent = JetspeedTestJNDIComponent.createDataSourceComponent(jndi);
         datasourceComponent.start();
+        xaDatasourceComponent = JetspeedTestJNDIComponent.createXADatasourceComponent(jndi);
+        if (xaDatasourceComponent != null)
+        {
+            xaDatasourceComponent.start();
+            userTransactionComponent = JetspeedTestJNDIComponent.createUserTransactionComponent(jndi);
+            userTransactionComponent.start();
+        }
     }
 
 	public SpringComponentManager getComponentManager()

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/AtomikosUserTransactionComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/AtomikosUserTransactionComponent.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/AtomikosUserTransactionComponent.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/AtomikosUserTransactionComponent.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,69 @@
+/*
+ * 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.transaction;
+
+import com.atomikos.icatch.jta.UserTransactionImp;
+
+/**
+ * AtomikosUserTransactionComponent
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class AtomikosUserTransactionComponent implements UserTransactionComponent
+{
+    // Members
+    
+    UserTransactionImp userTransaction;
+    
+    // Implementation
+        
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.transaction.UserTransactionComponent#getUserTransaction()
+     */
+    public Object getUserTransaction()
+    {
+        return userTransaction;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.transaction.UserTransactionComponent#start()
+     */
+    public void start()
+    {
+        if (userTransaction == null)
+        {
+            try
+            {
+                userTransaction = new UserTransactionImp();
+            }
+            catch (Throwable t)
+            {                
+                IllegalStateException ise = new IllegalStateException("Unable to create UserTransaction resource: "+t);
+                ise.initCause(t);
+                throw ise;
+            }
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.transaction.UserTransactionComponent#stop()
+     */
+    public void stop()
+    {
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/BoundAtomikosUserTransactionComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/BoundAtomikosUserTransactionComponent.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/BoundAtomikosUserTransactionComponent.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/BoundAtomikosUserTransactionComponent.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,92 @@
+/*
+ * 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.transaction;
+
+import javax.naming.NamingException;
+
+import org.apache.jetspeed.components.jndi.JNDIComponent;
+
+/**
+ * BoundAtomikosUserTransactionComponent
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class BoundAtomikosUserTransactionComponent extends AtomikosUserTransactionComponent
+{
+    // Members
+    
+    private JNDIComponent jndi;
+
+    // Constructor
+    
+    /**
+     * Construct user transaction component and bind to specified
+     * JNDI context and name.
+     * 
+     * @param jndi JNDI context for UserTransaction.
+     */
+    public BoundAtomikosUserTransactionComponent(JNDIComponent jndi)
+    {        
+        super();
+
+        if (jndi == null)
+        {
+            throw new IllegalArgumentException("jndi argument cannot be null for BoundAtomikosUserTransactionComponent");
+        }        
+        
+        this.jndi = jndi;
+    }
+
+    // Implementation
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.transaction.AtomikosUserTransactionComponent#start()
+     */
+    public void start()
+    {        
+        super.start();
+        try
+        {
+            jndi.bindObject("comp/UserTransaction", getUserTransaction());
+        }
+        catch (NamingException ne)
+        {
+            IllegalStateException ise = new IllegalStateException("Naming exception "+ne.toString());
+            ise.initCause(ne);
+            throw ise;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.transaction.AtomikosUserTransactionComponent#stop()
+     */
+    public void stop()
+    {        
+        try
+        {
+            jndi.unbindObject("comp/UserTransaction");
+        }
+        catch (NamingException ne)
+        {
+            IllegalStateException ise = new IllegalStateException("Naming exception "+ne.toString());
+            ise.initCause(ne);
+            throw ise;
+        }
+        super.stop();
+    }    
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/UserTransactionComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/UserTransactionComponent.java?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/UserTransactionComponent.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/transaction/UserTransactionComponent.java Sat Jan 17 21:19:24 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.transaction;
+
+/**
+ * UserTransactionComponent
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public interface UserTransactionComponent
+{
+    /**
+     * Return UserTransaction and TransactionManager implementation.
+     * 
+     * @return user transaction implementation.
+     */
+    public abstract Object getUserTransaction();
+
+    /**
+     * Initialize and start component.
+     */
+    public abstract void start();
+    
+    /**
+     * Stop and terminate component.
+     */
+    public abstract void stop();
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceTestCase.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/util/DatasourceTestCase.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceTestCase.java Sat Jan 17 21:19:24 2009
@@ -18,10 +18,10 @@
 
 import junit.framework.TestCase;
 
-import org.apache.commons.pool.impl.GenericObjectPool;
-import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent;
+import org.apache.jetspeed.components.datasource.DatasourceComponent;
 import org.apache.jetspeed.components.jndi.JNDIComponent;
-import org.apache.jetspeed.components.jndi.TyrexJNDIComponent;
+import org.apache.jetspeed.components.jndi.JetspeedTestJNDIComponent;
+import org.apache.jetspeed.components.transaction.UserTransactionComponent;
 
 /**
  * @author <a href="mailto:sweaver@einnovation.com">Scott T. Weaver </a>
@@ -29,9 +29,9 @@
  */
 public class DatasourceTestCase extends TestCase
 {
-
-    protected BoundDBCPDatasourceComponent datasourceComponent;
-
+    protected DatasourceComponent datasourceComponent;
+    protected DatasourceComponent xaDatasourceComponent;
+    protected UserTransactionComponent userTransactionComponent;
     protected JNDIComponent jndi;
 
     /**
@@ -58,15 +58,17 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        jndi = new TyrexJNDIComponent();
-        String url = System.getProperty("org.apache.jetspeed.database.url");
-        String driver = System.getProperty("org.apache.jetspeed.database.driver");
-        String user = System.getProperty("org.apache.jetspeed.database.user");
-        String password = System.getProperty("org.apache.jetspeed.database.password");
-        datasourceComponent = new BoundDBCPDatasourceComponent(user, password, driver, url, 20, 5000,
-                GenericObjectPool.WHEN_EXHAUSTED_GROW, true, "jetspeed", jndi);
+        jndi = JetspeedTestJNDIComponent.createJNDIComponent();
+        jndi.start();
+        datasourceComponent = JetspeedTestJNDIComponent.createDataSourceComponent(jndi);
         datasourceComponent.start();
-
+        xaDatasourceComponent = JetspeedTestJNDIComponent.createXADatasourceComponent(jndi);
+        if (xaDatasourceComponent != null)
+        {
+            xaDatasourceComponent.start();
+            userTransactionComponent = JetspeedTestJNDIComponent.createUserTransactionComponent(jndi);
+            userTransactionComponent.start();
+        }
     }
 
     /**
@@ -74,9 +76,13 @@
      */
     protected void tearDown() throws Exception
     {
+        if (xaDatasourceComponent != null)
+        {
+            userTransactionComponent.stop();
+            xaDatasourceComponent.stop();
+        }
         datasourceComponent.stop();
-        jndi.unbindFromCurrentThread();
+        jndi.stop();
         super.tearDown();
     }
-
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/jpa/JPADatasourceEnabledSpringTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/jpa/JPADatasourceEnabledSpringTestCase.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/util/jpa/JPADatasourceEnabledSpringTestCase.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/jpa/JPADatasourceEnabledSpringTestCase.java Sat Jan 17 21:19:24 2009
@@ -26,11 +26,31 @@
  */
 public abstract class JPADatasourceEnabledSpringTestCase extends DatasourceEnabledSpringTestCase
 {
+    // Atomikos runtime properties
+
+    public static final String ATOMIKOS_TRANSACTION_MANAGER_NAME_PROPERTY = "com.atomikos.icatch.tm_unique_name";
+    public static final String ATOMIKOS_TRANSACTION_MANAGER_NAME_SUFFIX = "-tm";
+    public static final String ATOMIKOS_TRANSACTION_MANAGER_NAME = "jetspeed"+ATOMIKOS_TRANSACTION_MANAGER_NAME_SUFFIX;
+    public static final String ATOMIKOS_LOG_DIRECTORY_PATH_PROPERTY = "com.atomikos.icatch.log_base_dir";
+    public static final String ATOMIKOS_LOG_BASE_NAME_PROPERTY = "com.atomikos.icatch.log_base_name";
+    public static final String ATOMIKOS_LOG_BASE_NAME_SUFFIX = "-tm-txn";
+    public static final String ATOMIKOS_LOG_BASE_NAME = "jetspeed"+ATOMIKOS_LOG_BASE_NAME_SUFFIX;
+    public static final String ATOMIKOS_CONSOLE_DIRECTORY_PATH_PROPERTY = "com.atomikos.icatch.output_dir";
+    public static final String ATOMIKOS_CONSOLE_FILE_NAME_PROPERTY = "com.atomikos.icatch.console_file_name";
+    public static final String ATOMIKOS_CONSOLE_FILE_NAME_SUFFIX = "-tm.log";
+    public static final String ATOMIKOS_CONSOLE_FILE_NAME = "jetspeed"+ATOMIKOS_CONSOLE_FILE_NAME_SUFFIX;
+    
     /* (non-Javadoc)
      * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#setUp()
      */
     protected void setUp() throws Exception
     {
+        // set Atomikos runtime properties
+        System.setProperty(ATOMIKOS_LOG_DIRECTORY_PATH_PROPERTY, System.getProperty("basedir")+"/target/atomikos");
+        System.setProperty(ATOMIKOS_TRANSACTION_MANAGER_NAME_PROPERTY, ATOMIKOS_TRANSACTION_MANAGER_NAME);
+        System.setProperty(ATOMIKOS_LOG_BASE_NAME_PROPERTY, ATOMIKOS_LOG_BASE_NAME);
+        System.setProperty(ATOMIKOS_CONSOLE_DIRECTORY_PATH_PROPERTY, System.getProperty("basedir")+"/target/atomikos");
+        System.setProperty(ATOMIKOS_CONSOLE_FILE_NAME_PROPERTY, ATOMIKOS_CONSOLE_FILE_NAME);
         // setup
         super.setUp();
         // start optional test JPA conversational transaction

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/pom.xml Sat Jan 17 21:19:24 2009
@@ -71,10 +71,6 @@
             <artifactId>commons-collections</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.openjpa</groupId>
-            <artifactId>openjpa-persistence-jdbc</artifactId>
-        </dependency>        
-        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring</artifactId>
         </dependency>    
@@ -102,18 +98,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-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/RegistryManagerContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/RegistryManagerContext.java?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/RegistryManagerContext.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/RegistryManagerContext.java Sat Jan 17 21:19:24 2009
@@ -78,6 +78,5 @@
     public void terminate()
     {
         registryManager.unregisterContext(this);
-        extendedEntityManager.close();
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/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-registry">
+    <persistence-unit name="jetspeed-registry" 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.components.portletentity.jpa.PortletEntityImpl</class>

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jndi.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jndi.properties?rev=735387&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jndi.properties (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/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-registry/src/test/resources/jpa-registry.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml Sat Jan 17 21:19:24 2009
@@ -23,10 +23,17 @@
       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>
@@ -39,17 +46,34 @@
     </bean>
     <bean id="abstractEntityManagerFactory" abstract="true" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
         <property name="persistenceUnitManager" ref="persistenceUnitManager"/>
-        <property name="persistenceUnitName" value="jetspeed-registry"/>
     </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"/>
 
     <!-- JPA/OpenJPA Registry Components -->
     <bean id="portletFactory" class="org.apache.jetspeed.factory.JetspeedPortletFactory"/>
@@ -70,24 +94,24 @@
         <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 bean="portletFactory"/></property>
+        <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 bean="portletPreferencesProvider"/></property>
+        <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 bean="portletRegistry"/></property>
+        <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 bean="registryManager"/></property>
+        <property name="registryManager" ref="registryManager"/>
     </bean>
 
 </beans>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/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-registry/src/test/resources/openjpa-registry-base.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/openjpa-registry-base.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/openjpa-registry-base.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/openjpa-registry-base.xml Sat Jan 17 21:19:24 2009
@@ -25,10 +25,22 @@
 
     <import resource="jpa-registry.xml"/>
 
-    <!-- OpenJPA Configuration -->
-    <bean id="jpaRegistryProperties" class="org.apache.jetspeed.components.rdbms.jpa.OpenJPAConfigurationProperties"/>
-    <bean id="entityManagerFactory" parent="abstractEntityManagerFactory">
+    <!-- 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>
 
 </beans>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/pom.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/pom.xml Sat Jan 17 21:19:24 2009
@@ -89,18 +89,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-serializer/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/pom.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-serializer/pom.xml Sat Jan 17 21:19:24 2009
@@ -141,11 +141,6 @@
             <scope>test</scope>
         </dependency>
          -->
-        <dependency>
-            <groupId>tyrex</groupId>
-            <artifactId>tyrex</artifactId>
-            <scope>provided</scope>
-        </dependency>
 
         <dependency>
             <groupId>${org.apache.jetspeed.test.jdbc.driver.groupId}</groupId>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/pom.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-sso/pom.xml Sat Jan 17 21:19:24 2009
@@ -75,11 +75,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>
         
     </dependencies>
 

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-statistics/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-statistics/pom.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-statistics/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-statistics/pom.xml Sat Jan 17 21:19:24 2009
@@ -85,11 +85,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>
     </dependencies>
 
     <build>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/jetspeed-mvn-database-pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/jetspeed-mvn-database-pom.xml?rev=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/jetspeed-mvn-database-pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/jetspeed-mvn-database-pom.xml Sat Jan 17 21:19:24 2009
@@ -58,14 +58,6 @@
     </dependency>
 
     <dependency>
-      <groupId>tyrex</groupId>
-      <artifactId>tyrex</artifactId>
-      <version>${tyrex.version}</version>
-      <scope>runtime</scope>
-      <type>jar</type>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.portals.jetspeed-2</groupId>
       <artifactId>jetspeed-ant-tasks</artifactId>
       <version>${org.apache.portals.jetspeed.version}</version>

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=735387&r1=735386&r2=735387&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/pom.xml Sat Jan 17 21:19:24 2009
@@ -269,6 +269,7 @@
 
     <!-- Project Dependency Version Properties -->
     <aopalliance.version>1.0</aopalliance.version>
+    <atomikos.version>3.5.0</atomikos.version>
     <castor.version>1.1.1-xml</castor.version>
     <cglib.version>2.1_3</cglib.version>
     <commons-beanutils.version>1.7.0</commons-beanutils.version>
@@ -305,6 +306,7 @@
     <log4j.version>1.2.14</log4j.version>
     <lucene.version>2.0.0</lucene.version>
     <myfaces.version>1.1.5</myfaces.version>
+    <naming-java.version>0.8</naming-java.version>
     <nekohtml.version>0.9.5</nekohtml.version>
     <ojb.version>1.0.3</ojb.version>
     <openjpa.version>1.2.0</openjpa.version>
@@ -323,6 +325,7 @@
     <regexp.version>1.2</regexp.version>
     <rome.version>0.8</rome.version>
     <saxpath.version>1.0-FCS</saxpath.version>
+    <slf4j.version>1.4.3</slf4j.version>
     <spring.version>2.5.2</spring.version>
     <spring.ldap.version>1.2.1</spring.ldap.version>
     <spring.portlet.version>2.0.6</spring.portlet.version>
@@ -335,10 +338,8 @@
     <xalan.version>2.4.1</xalan.version>
     <xerces.version>2.3.0</xerces.version>
     <xml-apis.version>2.0.2</xml-apis.version>
-    <asm.version>2.2</asm.version>
     <ccpp.version>1.0</ccpp.version>
     <commonj.version>1.1</commonj.version>
-    <tyrex.version>1.0.1</tyrex.version>
   </properties>
 
   <!-- Dependency Configuration -->
@@ -624,18 +625,22 @@
           </exclusion>
         </exclusions>
       </dependency>        
+      <dependency>
+        <groupId>com.atomikos</groupId>
+        <artifactId>transactions-jdbc</artifactId>
+        <version>${atomikos.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-jcl</artifactId>
+        <version>${slf4j.version}</version>
+      </dependency>
 
       <!-- Spring Framework -->
       <dependency>
         <groupId>cglib</groupId>
         <artifactId>cglib</artifactId>
         <version>${cglib.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>asm</groupId>
-            <artifactId>asm</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
       <dependency>
         <groupId>aopalliance</groupId>
@@ -904,9 +909,9 @@
         <scope>test</scope>
       </dependency>
       <dependency>
-        <groupId>tyrex</groupId>
-        <artifactId>tyrex</artifactId>
-        <version>${tyrex.version}</version>
+        <groupId>directory-naming</groupId>
+        <artifactId>naming-java</artifactId>
+        <version>${naming-java.version}</version>
         <scope>test</scope>
       </dependency>
 
@@ -1183,18 +1188,6 @@
         <version>${ant.version}</version>
       </dependency>
 
-      <!-- ASM -->
-      <dependency>
-        <groupId>asm</groupId>
-        <artifactId>asm</artifactId>
-        <version>${asm.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>asm</groupId>
-        <artifactId>asm-attrs</artifactId>
-        <version>${asm.version}</version>
-      </dependency>
-
       <!-- CommonJ -->
       <dependency>
         <groupId>commonj</groupId>
@@ -1259,6 +1252,11 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>directory-naming</groupId>
+      <artifactId>naming-java</artifactId>
+      <scope>test</scope>
+    </dependency>
 
   </dependencies>
 
@@ -1321,6 +1319,10 @@
                 <name>org.apache.jetspeed.database.driver</name>
                 <value>${org.apache.jetspeed.test.database.driver}</value>
               </property>
+              <property>
+                <name>org.apache.jetspeed.database.xatype</name>
+                <value>${org.apache.jetspeed.test.database.xatype}</value>
+              </property>
             </systemProperties>
           </configuration>
         </plugin>



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