jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r679811 - in /jackrabbit/trunk/jackrabbit-jca/src: main/java/org/apache/jackrabbit/jca/JCASessionHandle.java test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
Date Fri, 25 Jul 2008 14:11:58 GMT
Author: jukka
Date: Fri Jul 25 07:11:58 2008
New Revision: 679811

URL: http://svn.apache.org/viewvc?rev=679811&view=rev
Log:
JCR-1682: Session returned does not offer transaction support

Applied patch by Douglas Jose.

Modified:
    jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java
    jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java

Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java?rev=679811&r1=679810&r2=679811&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java
Fri Jul 25 07:11:58 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.jca;
 
+import org.apache.jackrabbit.api.XASession;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -40,6 +41,8 @@
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.version.VersionException;
+import javax.transaction.xa.XAResource;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -48,8 +51,7 @@
 /**
  * This class implements the JCA implementation of session.
  */
-public final class JCASessionHandle
-        implements Session {
+public final class JCASessionHandle implements XASession {
 
     /**
      * Managed connection.
@@ -80,7 +82,7 @@
     /**
      * Return the session.
      */
-    private Session getSession() {
+    private XASession getSession() {
         return mc.getSession(this);
     }
 
@@ -327,4 +329,16 @@
     public void removeLockToken(String arg0) {
         getSession().removeLockToken(arg0);
     }
+
+    //---------------------------------------------------------< XASession >--
+
+    /**
+     * Returns the XAResource associated with this session.
+     *
+     * @return XA resource
+     */
+    public XAResource getXAResource() {
+        return getSession().getXAResource();
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java?rev=679811&r1=679810&r2=679811&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
Fri Jul 25 07:11:58 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.jca.test;
 
+import org.apache.jackrabbit.api.XASession;
 import org.apache.jackrabbit.jca.JCAConnectionRequestInfo;
 import org.apache.jackrabbit.jca.JCARepositoryHandle;
 import org.apache.jackrabbit.jca.JCASessionHandle;
@@ -103,4 +104,19 @@
         assertTrue(cf instanceof Referenceable);
     }
 
+    /**
+     * Test if the session supports transactions
+     */
+    public void testTransactionSupport() throws Exception {
+        // Create the connection factory
+        Object cf = mcf.createConnectionFactory();
+        assertTrue(cf instanceof JCARepositoryHandle);
+        Repository repository = (Repository) cf;
+
+        // Open a session
+        Session session = repository.login(JCR_SUPERUSER);
+        assertTrue(session instanceof XASession);
+        session.logout();
+    }
+
 }



Mime
View raw message