[jboss-cvs] JBossAS SVN: r110856 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/connectionmanager and 13 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 8 15:05:28 EST 2011


Author: jesper.pedersen
Date: 2011-03-08 15:05:27 -0500 (Tue, 08 Mar 2011)
New Revision: 110856

Added:
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/SubjectTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/package.html
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnection.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactory.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactoryImpl.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionImpl.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnection.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionFactory.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionMetaData.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthResourceAdapter.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthSocket.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/package.html
   projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/
   projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/
   projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ironjacamar.xml
   projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ra.xml
Modified:
   projects/jboss-jca/trunk/core/build.xml
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/NoTxConnectionListenerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListenerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/SerializableTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/SerializableTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
   projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/cri/META-INF/ironjacamar.xml
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java
Log:
[JBJCA-94] Subject based resource adapter. Fixes for security domain lookups

Modified: projects/jboss-jca/trunk/core/build.xml
===================================================================
--- projects/jboss-jca/trunk/core/build.xml	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/build.xml	2011-03-08 20:05:27 UTC (rev 110856)
@@ -306,6 +306,38 @@
       <fileset dir="${build.core.dir}/test/rars/security/reauth/cri"/>
     </jar>
 
+    <!-- Reauth Subject resource adapter -->
+    <jar destfile="${build.core.dir}/test/reauth-subject.jar"
+         basedir="${build.core.dir}/test"
+         index="true"
+         indexMetaInf="true"
+         update="true"
+         level="9"
+         includes="**/reauth/ra/subject/**">
+      <manifest>
+        <attribute name="Implementation-Title" value="IronJacamar Test - Reauth Subject"/>
+        <attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>
+        <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
+        <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
+      </manifest>
+    </jar>
+    <jar destfile="${build.core.dir}/test/reauth-subject.rar"
+         index="true"
+         indexMetaInf="true"
+         update="true"
+         level="9">
+      <manifest>
+        <attribute name="Implementation-Title" value="IronJacamar Test - Reauth CRI RAR"/>
+        <attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>
+        <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
+        <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
+      </manifest>
+      <fileset dir="${build.core.dir}/test">
+        <include name="reauth-subject.jar"/>
+      </fileset>
+      <fileset dir="${build.core.dir}/test/rars/security/reauth/subject"/>
+    </jar>
+
   </target>
 
   <!-- ================================= 

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -75,8 +75,8 @@
    /** The pool */
    private Pool pool;
 
-   /** Security domain jndi name */
-   private String securityDomainJndiName;
+   /** Security domain */
+   private String securityDomain;
 
    /** SubjectFactory */
    private SubjectFactory subjectFactory;
@@ -177,27 +177,27 @@
    }
 
    /**
-    * Sets security domain jndi name.
-    * @param securityDomainJndiName security jndi name
+    * Sets security domain
+    * @param securityDomain security domain
     */
-   public void setSecurityDomainJndiName(String securityDomainJndiName)
+   public void setSecurityDomain(String securityDomain)
    {
-      if (securityDomainJndiName != null && securityDomainJndiName.startsWith(SECURITY_MGR_PATH))
+      if (securityDomain != null && securityDomain.startsWith(SECURITY_MGR_PATH))
       {
-         securityDomainJndiName = securityDomainJndiName.substring(SECURITY_MGR_PATH.length());
-         log.warn("WARNING: UPDATE YOUR SecurityDomainJndiName! REMOVE " + SECURITY_MGR_PATH);
+         securityDomain = securityDomain.substring(SECURITY_MGR_PATH.length());
+         log.warn("WARNING: UPDATE YOUR SecurityDomain! REMOVE " + SECURITY_MGR_PATH);
       }
 
-      this.securityDomainJndiName = securityDomainJndiName;
+      this.securityDomain = securityDomain;
    }
 
    /**
-    * Gets security domain jndi name.
-    * @return security domain jndi name
+    * Gets security domain.
+    * @return security domain
     */
-   public String getSecurityDomainJndiName()
+   public String getSecurityDomain()
    {
-      return securityDomainJndiName;
+      return securityDomain;
    }
 
    /**
@@ -650,15 +650,10 @@
    {
       Subject subject = null;
 
-      if (subjectFactory != null && securityDomainJndiName != null)
-      {
-         subject = subjectFactory.createSubject(securityDomainJndiName);
-      }
+      if (subjectFactory != null && securityDomain != null)
+         subject = subjectFactory.createSubject(securityDomain);
 
-      if (trace)
-      {
-         log.trace("subject: " + subject);
-      }
+      log.tracef("Subject: %s", subject);
 
       return subject;
    }

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -50,7 +50,8 @@
     * Create a connection manager
     * @param tsl The transaction support level
     * @param pool The pool for the connection manager
-    * @param subjectFactory the subjectFactory for connection manager
+    * @param subjectFactory The subject factory
+    * @param securityDomain The security domain 
     * @param allocationRetry The allocation retry value
     * @param allocationRetryWaitMillis The allocation retry millis value
     * @return The connection manager instance
@@ -58,6 +59,7 @@
    public NoTxConnectionManager createNonTransactional(final TransactionSupportLevel tsl,
                                                        final Pool pool,
                                                        final SubjectFactory subjectFactory,
+                                                       final String securityDomain,
                                                        final Integer allocationRetry,
                                                        final Long allocationRetryWaitMillis)
    {
@@ -85,9 +87,7 @@
             throw new IllegalArgumentException("Unknown transaction support level " + tsl);
       }
 
-      cm.setSubjectFactory(subjectFactory);
-
-      setProperties(cm, pool, allocationRetry, allocationRetryWaitMillis, null);
+      setProperties(cm, pool, subjectFactory, securityDomain, allocationRetry, allocationRetryWaitMillis, null);
       setNoTxProperties(cm);
 
       return cm;
@@ -97,7 +97,8 @@
     * Create a transactional connection manager
     * @param tsl The transaction support level
     * @param pool The pool for the connection manager
-    * @param subjectFactory the subjectFactory for connection manager
+    * @param subjectFactory The subject factory
+    * @param securityDomain The security domain 
     * @param allocationRetry The allocation retry value
     * @param allocationRetryWaitMillis The allocation retry millis value
     * @param tm The transaction manager
@@ -111,6 +112,7 @@
    public TxConnectionManager createTransactional(final TransactionSupportLevel tsl,
                                                   final Pool pool,
                                                   final SubjectFactory subjectFactory,
+                                                  final String securityDomain,
                                                   final Integer allocationRetry,
                                                   final Long allocationRetryWaitMillis,
                                                   final TransactionManager tm,
@@ -148,9 +150,7 @@
             throw new IllegalArgumentException("Unknown transaction support level " + tsl);
       }
 
-      cm.setSubjectFactory(subjectFactory);
-
-      setProperties(cm, pool, allocationRetry, allocationRetryWaitMillis, tm);
+      setProperties(cm, pool, subjectFactory, securityDomain, allocationRetry, allocationRetryWaitMillis, tm);
       setTxProperties(cm, interleaving, xaResourceTimeout, isSameRMOverride, wrapXAResource, padXid);
       handleTxIntegration(tm);
 
@@ -161,12 +161,16 @@
     * Common properties
     * @param cm The connection manager
     * @param pool The pool
+    * @param subjectFactory The subject factory
+    * @param securityDomain The security domain
     * @param allocationRetry The allocation retry value
     * @param allocationRetryWaitMillis The allocation retry millis value
     * @param tm The transaction manager
     */
    private void setProperties(AbstractConnectionManager cm,
                               Pool pool,
+                              SubjectFactory subjectFactory,
+                              String securityDomain,
                               Integer allocationRetry,
                               Long allocationRetryWaitMillis,
                               TransactionManager tm)
@@ -174,6 +178,9 @@
       pool.setConnectionListenerFactory(cm);
       cm.setPool(pool);
 
+      cm.setSubjectFactory(subjectFactory);
+      cm.setSecurityDomain(securityDomain);
+
       if (allocationRetry != null)
          cm.setAllocationRetry(allocationRetry.intValue());
 

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/NoTxConnectionListenerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/NoTxConnectionListenerTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/NoTxConnectionListenerTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -84,9 +84,9 @@
 
       Subject subject = null;
 
-      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomainJndiName() != null)
+      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomain() != null)
       {
-         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomainJndiName());
+         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomain());
       }
       MockConnectionRequestInfo cri = new MockConnectionRequestInfo();
 
@@ -116,9 +116,9 @@
 
       Subject subject = null;
 
-      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomainJndiName() != null)
+      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomain() != null)
       {
-         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomainJndiName());
+         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomain());
       }
       MockConnectionRequestInfo cri = new MockConnectionRequestInfo();
 
@@ -148,9 +148,9 @@
 
       Subject subject = null;
 
-      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomainJndiName() != null)
+      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomain() != null)
       {
-         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomainJndiName());
+         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomain());
       }
       MockConnectionRequestInfo cri = new MockConnectionRequestInfo();
 
@@ -179,9 +179,9 @@
 
       Subject subject = null;
 
-      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomainJndiName() != null)
+      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomain() != null)
       {
-         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomainJndiName());
+         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomain());
       }
       MockConnectionRequestInfo cri = new MockConnectionRequestInfo();
 
@@ -224,8 +224,9 @@
       pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager connectionManager = cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, pool,
-         null, null, null);
+      ConnectionManager connectionManager = 
+         cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, pool,
+                                    null, null, null, null);
 
       noTxCm = ((NoTxConnectionManagerImpl) connectionManager);
 

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListenerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListenerTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListenerTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -675,8 +675,9 @@
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.LocalTransaction, pool,
-         null, null, null, tm, null, null, null, null, null);
+      ConnectionManager connectionManager =
+         cmf.createTransactional(TransactionSupportLevel.LocalTransaction, pool,
+                                 null, null, null, null, tm, null, null, null, null, null);
 
       txConnectionManager = (TxConnectionManager) connectionManager;
    }

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/NoTxConnectionManagerTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -77,7 +77,8 @@
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      connectionManager = cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, pool, null, null, null);
+      connectionManager = 
+         cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, pool, null, null, null, null);
       assertNotNull(connectionManager);
 
       assertTrue(connectionManager instanceof NoTxConnectionManager);
@@ -110,9 +111,9 @@
 
       Subject subject = null;
 
-      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomainJndiName() != null)
+      if (noTxCm.getSubjectFactory() != null && noTxCm.getSecurityDomain() != null)
       {
-         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomainJndiName());
+         subject = noTxCm.getSubjectFactory().createSubject(noTxCm.getSecurityDomain());
       }
 
       listener = noTxCm.getManagedConnection(subject, new MockConnectionRequestInfo());

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/SerializableTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/SerializableTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/notx/SerializableTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -65,7 +65,7 @@
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
 
       ConnectionManager connectionManager = cmf.createNonTransactional(TransactionSupportLevel.NoTransaction,
-                                                                       pool, null, null, null);
+                                                                       pool, null, null, null, null);
       assertNotNull(connectionManager);
 
       ByteArrayOutputStream baos = new ByteArrayOutputStream();

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/SerializableTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/SerializableTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/SerializableTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -73,9 +73,8 @@
 
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
       ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.XATransaction,
-                                                                    pool,
-                                                                    null, null, null, tm, Boolean.FALSE, null, null,
-         null, null);
+                                                                    pool, null, null, null, null, tm, 
+                                                                    Boolean.FALSE, null, null, null, null);
       assertNotNull(connectionManager);
 
       ByteArrayOutputStream baos = new ByteArrayOutputStream();

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -278,9 +278,9 @@
 
       Subject subject = null;
 
-      if (txCm.getSubjectFactory() != null && txCm.getSecurityDomainJndiName() != null)
+      if (txCm.getSubjectFactory() != null && txCm.getSecurityDomain() != null)
       {
-         subject = txCm.getSubjectFactory().createSubject(txCm.getSecurityDomainJndiName());
+         subject = txCm.getSubjectFactory().createSubject(txCm.getSecurityDomain());
       }
 
       listener = txCm.getManagedConnection(subject, new MockConnectionRequestInfo());
@@ -318,8 +318,9 @@
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.LocalTransaction, pool,
-         null, null, null, tm, null, null, null, null, null);
+      ConnectionManager connectionManager = 
+         cmf.createTransactional(TransactionSupportLevel.LocalTransaction, pool,
+                                 null, null, null, null, tm, null, null, null, null, null);
 
       txConnectionManager = (TxConnectionManager) connectionManager;
    }

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -245,9 +245,9 @@
 
       Subject subject = null;
 
-      if (txCm.getSubjectFactory() != null && txCm.getSecurityDomainJndiName() != null)
+      if (txCm.getSubjectFactory() != null && txCm.getSecurityDomain() != null)
       {
-         subject = txCm.getSubjectFactory().createSubject(txCm.getSecurityDomainJndiName());
+         subject = txCm.getSubjectFactory().createSubject(txCm.getSecurityDomain());
       }
 
       listener = txCm.getManagedConnection(subject, new MockConnectionRequestInfo());
@@ -286,8 +286,9 @@
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager connectionManager = cmf.createTransactional(TransactionSupportLevel.XATransaction, pool,
-         null, null, null, tm, Boolean.FALSE, null, null, null, null);
+      ConnectionManager connectionManager =
+         cmf.createTransactional(TransactionSupportLevel.XATransaction, pool,
+                                 null, null, null, null, tm, Boolean.FALSE, null, null, null, null);
       assertNotNull(connectionManager);
 
       assertTrue(connectionManager instanceof TxConnectionManager);

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -94,16 +94,16 @@
    }
 
    /**
-    * testSecDomainJndiName.
+    * testSecDomain.
     */
    @Test
-   public void testSecDomainJndiName()
+   public void testSecDomain()
    {
       AbstractConnectionManager connectionManager = new MockConnectionManager();
-      assertNull(connectionManager.getSecurityDomainJndiName());
-      connectionManager.setSecurityDomainJndiName("jndi_name");
-      assertNotNull(connectionManager.getSecurityDomainJndiName());
-      assertEquals("jndi_name", connectionManager.getSecurityDomainJndiName());
+      assertNull(connectionManager.getSecurityDomain());
+      connectionManager.setSecurityDomain("my_domain");
+      assertNotNull(connectionManager.getSecurityDomain());
+      assertEquals("my_domain", connectionManager.getSecurityDomain());
    }
 
    /**

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/SubjectTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/SubjectTestCase.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/SubjectTestCase.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.core.security.reauth;
+
+import org.jboss.jca.core.security.reauth.eis.ReauthServer;
+import org.jboss.jca.core.security.reauth.ra.subject.ReauthConnection;
+import org.jboss.jca.core.security.reauth.ra.subject.ReauthConnectionFactory;
+import org.jboss.jca.embedded.Embedded;
+import org.jboss.jca.embedded.EmbeddedFactory;
+
+import java.net.URL;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Tests for CRO based reauthentication.
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class SubjectTestCase
+{
+
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static Logger log = Logger.getLogger(SubjectTestCase.class);
+
+   private static Embedded embedded;
+
+   // EIS server
+   private static String host = "localhost";
+   private static int port = 19000;
+   private static ReauthServer reauthServer = null;
+
+
+   // --------------------------------------------------------------------------------||
+   // Tests --------------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Basic
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testBasic() throws Throwable
+   {
+      Context context = null;
+      URL deployment = null;
+      try
+      {
+         reauthServer = new ReauthServer();
+         reauthServer.setHostName(host);
+         reauthServer.setPort(port);
+         reauthServer.setMaxConnections(1);
+         reauthServer.start();
+
+         deployment = SubjectTestCase.class.getClassLoader().getResource("reauth-subject.rar");
+
+         embedded.deploy(deployment);
+
+         context = new InitialContext();
+
+         String user = "user";
+         String password = "password";
+
+         ReauthConnectionFactory rcf = (ReauthConnectionFactory)context.lookup("java:/eis/Reauth");
+
+         assertNotNull(rcf);
+
+         ReauthConnection rc = rcf.getConnection(user, password);
+
+         assertNotNull(rc);
+
+         assertEquals(user, rc.getAuth());
+
+         assertTrue(rc.logout());
+      }
+      finally
+      {
+         if (deployment != null)
+         {
+            embedded.undeploy(deployment);
+         }
+
+         if (reauthServer != null)
+         {
+            reauthServer.stop();
+            reauthServer = null;
+         }
+
+         if (context != null)
+         {
+            context.close();
+         }
+      }
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Lifecycle Methods --------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Lifecycle start, before each test is executed
+    * @throws Throwable throwable exception 
+    */
+   @Before
+   public void before() throws Throwable
+   {
+      embedded = EmbeddedFactory.create(true);
+      embedded.startup();
+   }
+
+   /**
+    * Lifecycle stop, after each test is executed
+    * @throws Throwable throwable exception 
+    */
+   @After
+   public void after() throws Throwable
+   {
+      embedded.shutdown();
+      embedded = null;
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/package.html	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,3 @@
+<body>
+This package contains test cases for reauthentication.
+</body>

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnection.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnection.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnection.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import javax.resource.ResourceException;
+
+/**
+ * ReauthConnection
+ *
+ * @version $Revision: $
+ */
+public interface ReauthConnection
+{
+   /**
+    * login
+    * @param username username
+    * @param password password
+    * @return String
+    * @throws ResourceException Thrown if an error occurs
+    */
+   public String login(String username, String password) throws ResourceException;
+
+   /**
+    * logout
+    * @return boolean
+    * @throws ResourceException Thrown if an error occurs
+    */
+   public boolean logout() throws ResourceException;
+
+   /**
+    * get auth
+    * @return String
+    * @throws ResourceException Thrown if an error occurs
+    */
+   public String getAuth() throws ResourceException;
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactory.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactory.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import java.io.Serializable;
+
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
+
+/**
+ * ReauthConnectionFactory
+ *
+ * @version $Revision: $
+ */
+public interface ReauthConnectionFactory extends Serializable, Referenceable
+{
+   /** 
+    * Get connection from factory
+    *
+    * @param userName The user name
+    * @param password The password
+    * @return ReauthConnection instance
+    * @exception ResourceException Thrown if a connection can't be obtained
+    */
+   public ReauthConnection getConnection(String userName, String password) throws ResourceException;
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactoryImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactoryImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionFactoryImpl.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ManagedConnectionFactory;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ReauthConnectionFactoryImpl
+ *
+ * @version $Revision: $
+ */
+public class ReauthConnectionFactoryImpl implements ReauthConnectionFactory
+{
+   /** The serial version UID */
+   private static final long serialVersionUID = 1L;
+
+   /** The logger */
+   private static Logger log = Logger.getLogger(ReauthConnectionFactoryImpl.class);
+
+   /** The managed connection factory */
+   private ManagedConnectionFactory mcf;
+
+   /** The connection manager */
+   private ConnectionManager connectionManager;
+
+   /** Reference */
+   private Reference reference;
+
+   /**
+    * Constructor
+    * @param mcf The managed connection factory
+    * @param cxManager The connection manager
+    */
+   public ReauthConnectionFactoryImpl(ManagedConnectionFactory mcf,
+                                      ConnectionManager cxManager)
+   {
+      this.mcf = mcf;
+      this.connectionManager = cxManager;
+      this.reference = null;
+   }
+
+   /** 
+    * Get connection from factory
+    *
+    * @param userName The user name
+    * @param password The password
+    * @return ReauthConnection instance
+    * @exception ResourceException Thrown if a connection can't be obtained
+    */
+   @Override
+   public ReauthConnection getConnection(String userName, String password) throws ResourceException
+   {
+      log.tracef("getConnection()");
+
+      return (ReauthConnection)connectionManager.allocateConnection(mcf, null);
+   }
+
+   /**
+    * Get the Reference instance.
+    *
+    * @return Reference instance
+    * @exception NamingException Thrown if a reference can't be obtained
+    */
+   @Override
+   public Reference getReference() throws NamingException
+   {
+      log.tracef("getReference()");
+
+      return reference;
+   }
+
+   /**
+    * Set the Reference instance.
+    *
+    * @param reference A Reference instance
+    */
+   @Override
+   public void setReference(Reference reference)
+   {
+      log.tracef("setReference(%s)", reference);
+
+      this.reference = reference;
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthConnectionImpl.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import javax.resource.ResourceException;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ReauthConnectionImpl
+ *
+ * @version $Revision: $
+ */
+public class ReauthConnectionImpl implements ReauthConnection
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(ReauthConnectionImpl.class);
+
+   /** The reauth socket */
+   private ReauthSocket socket;
+
+   /** The user name */
+   private String userName;
+
+   /** The password */
+   private String password;
+
+   /**
+    * Constructor
+    * @param socket The socket
+    * @param userName The user name
+    * @param password The password
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public ReauthConnectionImpl(ReauthSocket socket, String userName, String password) throws ResourceException
+   {
+      log.tracef("constructor(%s, %s, %s)", socket, userName, password);
+
+      this.socket = socket;
+      this.userName = userName;
+      this.password = password;
+   }
+
+   /**
+    * Call login
+    * @param username String
+    * @param password String
+    * @return String
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public String login(String username, String password) throws ResourceException
+   {
+      log.tracef("login(%s, %s)", username, password);
+
+      return socket.login(username, password);
+   }
+
+   /**
+    * Call logout
+    * @return boolean
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public boolean logout() throws ResourceException
+   {
+      log.tracef("logout()");
+
+      return socket.logout();
+   }
+
+   /**
+    * get auth
+    * @return String
+    * @throws ResourceException Thrown if an error occurs
+    */
+   public String getAuth() throws ResourceException
+   {
+      log.tracef("getAuth()");
+
+      return socket.getAuth();
+   }
+
+   /**
+    * Get the user name
+    * @return The value
+    */
+   String getUserName()
+   {
+      return userName;
+   }
+
+   /**
+    * Get the password
+    * @return The value
+    */
+   String getPassword()
+   {
+      return password;
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnection.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnection.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnection.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,254 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.resource.NotSupportedException;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.resource.spi.security.PasswordCredential;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ReauthManagedConnection
+ *
+ * @version $Revision: $
+ */
+public class ReauthManagedConnection implements ManagedConnection
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(ReauthManagedConnection.class);
+
+   /** The managed connection factory */
+   private ReauthManagedConnectionFactory mcf;
+
+   /** The connection listeners */
+   private Set<ConnectionEventListener> listeners;
+
+   /** The logwriter */
+   private PrintWriter logwriter;
+
+   /** Current connection */
+   private ReauthConnectionImpl connection;
+
+   /** The socket */
+   private ReauthSocket socket;
+
+   /**
+    * Constructor
+    * @param mcf The managed connection factory
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public ReauthManagedConnection(ReauthManagedConnectionFactory mcf) throws ResourceException
+   {
+      this.mcf = mcf;
+      this.listeners = new HashSet<ConnectionEventListener>(1);
+      this.logwriter = null;
+
+      ReauthResourceAdapter rra = (ReauthResourceAdapter)mcf.getResourceAdapter();
+
+      this.socket = new ReauthSocket(rra.getServer(), rra.getPort());
+   }
+
+   /**
+    * Creates a new connection handle for the underlying physical connection 
+    * represented by the ManagedConnection instance. 
+    *
+    * @param subject Security context as JAAS subject
+    * @param cxRequestInfo ConnectionRequestInfo instance
+    * @return generic Object instance representing the connection handle. 
+    * @throws ResourceException generic exception if operation fails
+    */
+   public Object getConnection(Subject subject,
+                               ConnectionRequestInfo cxRequestInfo)
+      throws ResourceException
+   {
+      log.tracef("getConnection(%s, %s)", subject, cxRequestInfo);
+
+      if (subject == null)
+         throw new ResourceException("Subject is null");
+
+      Set<PasswordCredential> privateCredentials = subject.getPrivateCredentials(PasswordCredential.class);
+
+      if (privateCredentials == null || privateCredentials.size() == 0)
+         throw new ResourceException("No password credentials found");
+
+      PasswordCredential pc = privateCredentials.iterator().next();
+      boolean auth = true;
+
+      if (connection == null)
+      {
+         connection = new ReauthConnectionImpl(socket, pc.getUserName(), new String(pc.getPassword()));
+      }
+      else
+      {
+         if (connection.getUserName().equals(pc.getUserName()))
+            auth = false;
+      }
+
+      if (auth)
+      {
+         connection.login(pc.getUserName(), new String(pc.getPassword()));
+      }
+
+      return connection;
+   }
+
+   /**
+    * Used by the container to change the association of an 
+    * application-level connection handle with a ManagedConneciton instance.
+    *
+    * @param connection Application-level connection handle
+    * @throws ResourceException generic exception if operation fails
+    */
+   public void associateConnection(Object connection) throws ResourceException
+   {
+      log.tracef("associateConnection(%s)", connection);
+
+      if (!(connection instanceof ReauthConnectionImpl))
+         throw new ResourceException("Unable to associate connection: " + connection.getClass().getName());
+
+      this.connection = (ReauthConnectionImpl)connection;
+   }
+
+   /**
+    * Application server calls this method to force any cleanup on the ManagedConnection instance.
+    *
+    * @throws ResourceException generic exception if operation fails
+    */
+   public void cleanup() throws ResourceException
+   {
+      log.tracef("cleanup");
+
+      // TODO - connection listeners
+
+      socket.cleanup();
+   }
+
+   /**
+    * Destroys the physical connection to the underlying resource manager.
+    *
+    * @throws ResourceException generic exception if operation fails
+    */
+   public void destroy() throws ResourceException
+   {
+      log.tracef("destroy");
+
+      socket.destroy();
+      socket = null;
+   }
+
+   /**
+    * Adds a connection event listener to the ManagedConnection instance.
+    *
+    * @param listener A new ConnectionEventListener to be registered
+    */
+   public void addConnectionEventListener(ConnectionEventListener listener)
+   {
+      log.tracef("addConnectionEventListener");
+      listeners.add(listener);
+   }
+
+   /**
+    * Removes an already registered connection event listener from the ManagedConnection instance.
+    *
+    * @param listener already registered connection event listener to be removed
+    */
+   public void removeConnectionEventListener(ConnectionEventListener listener)
+   {
+      log.tracef("removeConnectionEventListener");
+      listeners.remove(listener);
+   }
+
+   /**
+    * Gets the log writer for this ManagedConnection instance.
+    *
+    * @return Character ourput stream associated with this Managed-Connection instance
+    * @throws ResourceException generic exception if operation fails
+    */
+   public PrintWriter getLogWriter() throws ResourceException
+   {
+      log.tracef("getLogWriter");
+      return logwriter;
+   }
+
+   /**
+    * Sets the log writer for this ManagedConnection instance.
+    *
+    * @param out Character Output stream to be associated
+    * @throws ResourceException  generic exception if operation fails
+    */
+   public void setLogWriter(PrintWriter out) throws ResourceException
+   {
+      log.tracef("setLogWriter(%s)", out);
+      this.logwriter = out;
+   }
+
+   /**
+    * Returns an <code>javax.resource.spi.LocalTransaction</code> instance.
+    *
+    * @return LocalTransaction instance
+    * @throws ResourceException generic exception if operation fails
+    */
+   public LocalTransaction getLocalTransaction() throws ResourceException
+   {
+      log.tracef("getLocalTransaction()");
+
+      throw new NotSupportedException();
+   }
+
+   /**
+    * Returns an <code>javax.transaction.xa.XAresource</code> instance. 
+    *
+    * @return XAResource instance
+    * @throws ResourceException generic exception if operation fails
+    */
+   public XAResource getXAResource() throws ResourceException
+   {
+      log.tracef("getXAResource()");
+
+      throw new NotSupportedException();
+   }
+
+   /**
+    * Gets the metadata information for this connection's underlying EIS resource manager instance. 
+    *
+    * @return ManagedConnectionMetaData instance
+    * @throws ResourceException generic exception if operation fails
+    */
+   public ManagedConnectionMetaData getMetaData() throws ResourceException
+   {
+      log.tracef("getMetaData()");
+
+      return new ReauthManagedConnectionMetaData(socket);
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionFactory.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionFactory.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.security.auth.Subject;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ReauthManagedConnectionFactory
+ *
+ * @version $Revision: $
+ */
+public class ReauthManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation
+{
+   /** The serial version UID */
+   private static final long serialVersionUID = 1L;
+
+   /** The logger */
+   private static Logger log = Logger.getLogger(ReauthManagedConnectionFactory.class);
+
+   /** The resource adapter */
+   private ResourceAdapter ra;
+
+   /** The logwriter */
+   private PrintWriter logwriter;
+
+   /**
+    * Default constructor
+    */
+   public ReauthManagedConnectionFactory()
+   {
+      this.ra = null;
+      this.logwriter = null;
+   }
+
+   /**
+    * Creates a Connection Factory instance. 
+    *
+    * @param cxManager ConnectionManager to be associated with created EIS connection factory instance
+    * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+    * @throws ResourceException Generic exception
+    */
+   public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+   {
+      if (ra == null)
+         throw new IllegalStateException("RA is null");
+
+      log.tracef("createConnectionFactory(%s)", cxManager);
+
+      return new ReauthConnectionFactoryImpl(this, cxManager);
+   }
+
+   /**
+    * Creates a Connection Factory instance. 
+    *
+    * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+    * @throws ResourceException Generic exception
+    */
+   public Object createConnectionFactory() throws ResourceException
+   {
+      throw new ResourceException("Non-managed environment not supported");
+   }
+
+   /**
+    * Creates a new physical connection to the underlying EIS resource manager.
+    *
+    * @param subject Caller's security information
+    * @param cxRequestInfo Additional resource adapter specific connection request information
+    * @return ManagedConnection instance 
+    * @throws ResourceException generic exception
+    */
+   public ManagedConnection createManagedConnection(Subject subject,
+                                                    ConnectionRequestInfo cxRequestInfo)
+      throws ResourceException
+   {
+      if (ra == null)
+         throw new IllegalStateException("RA is null");
+
+      log.tracef("createManagedConnection(%s, %s)", subject, cxRequestInfo);
+
+      return new ReauthManagedConnection(this);
+   }
+
+   /**
+    * Returns a matched connection from the candidate set of connections. 
+    *
+    * @param connectionSet Candidate connection set
+    * @param subject Caller's security information
+    * @param cxRequestInfo Additional resource adapter specific connection request information
+    * @return ManagedConnection if resource adapter finds an acceptable match otherwise null 
+    * @throws ResourceException generic exception
+    */
+   public ManagedConnection matchManagedConnections(Set connectionSet,
+                                                    Subject subject,
+                                                    ConnectionRequestInfo cxRequestInfo)
+      throws ResourceException
+   {
+      if (ra == null)
+         throw new IllegalStateException("RA is null");
+
+      log.tracef("matchManagedConnections(%s, %s, %s)", connectionSet, subject, cxRequestInfo);
+
+      ManagedConnection result = null;
+
+      Iterator it = connectionSet.iterator();
+      while (result == null && it.hasNext())
+      {
+         ManagedConnection mc = (ManagedConnection)it.next();
+
+         if (mc instanceof ReauthManagedConnection)
+         {
+            result = mc;
+         }
+      }
+
+      return result;
+   }
+
+   /**
+    * Get the log writer for this ManagedConnectionFactory instance.
+    *
+    * @return PrintWriter
+    * @throws ResourceException generic exception
+    */
+   public PrintWriter getLogWriter() throws ResourceException
+   {
+      log.tracef("getLogWriter()");
+      return logwriter;
+   }
+
+   /**
+    * Set the log writer for this ManagedConnectionFactory instance.
+    *
+    * @param out PrintWriter - an out stream for error logging and tracing
+    * @throws ResourceException generic exception
+    */
+   public void setLogWriter(PrintWriter out) throws ResourceException
+   {
+      log.tracef("setLogWriter(%s)", out);
+      logwriter = out;
+   }
+
+   /**
+    * Get the resource adapter
+    *
+    * @return The handle
+    */
+   public ResourceAdapter getResourceAdapter()
+   {
+      log.tracef("getResourceAdapter()");
+      return ra;
+   }
+
+   /**
+    * Set the resource adapter
+    *
+    * @param ra The handle
+    */
+   public void setResourceAdapter(ResourceAdapter ra)
+   {
+      log.tracef("setResourceAdapter(%s)", ra);
+      this.ra = ra;
+   }
+
+   /** 
+    * Returns a hash code value for the object.
+    * @return A hash code value for this object.
+    */
+   @Override
+   public int hashCode()
+   {
+      return 17;
+   }
+
+   /** 
+    * Indicates whether some other object is equal to this one.
+    * @param other The reference object with which to compare.
+    * @return true if this object is the same as the obj argument, false otherwise.
+    */
+   @Override
+   public boolean equals(Object other)
+   {
+      if (other == null)
+         return false;
+
+      if (other == this)
+         return true;
+
+      if (!(other instanceof ReauthManagedConnectionFactory))
+         return false;
+
+      ReauthManagedConnectionFactory obj = (ReauthManagedConnectionFactory)other;
+
+      return true;
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionMetaData.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionMetaData.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthManagedConnectionMetaData.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnectionMetaData;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ReauthManagedConnectionMetaData
+ *
+ * @version $Revision: $
+ */
+public class ReauthManagedConnectionMetaData implements ManagedConnectionMetaData
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(ReauthManagedConnectionMetaData.class);
+
+   /** The socket */
+   private ReauthSocket socket;
+
+   /**
+    * Constructor
+    * @param socket The socket
+    */
+   public ReauthManagedConnectionMetaData(ReauthSocket socket)
+   {
+      this.socket = socket;
+   }
+
+   /**
+    * Returns Product name of the underlying EIS instance connected through the ManagedConnection.
+    *
+    * @return Product name of the EIS instance
+    * @throws ResourceException Thrown if an error occurs
+    */
+   @Override
+   public String getEISProductName() throws ResourceException
+   {
+      log.tracef("getEISProductName()");
+
+      return "Reauth resource adapter (CRI)";
+   }
+
+   /**
+    * Returns Product version of the underlying EIS instance connected through the ManagedConnection.
+    *
+    * @return Product version of the EIS instance
+    * @throws ResourceException Thrown if an error occurs
+    */
+   @Override
+   public String getEISProductVersion() throws ResourceException
+   {
+      log.tracef("getEISProductVersion()");
+
+      return "1.0";
+   }
+
+   /**
+    * Returns maximum limit on number of active concurrent connections 
+    *
+    * @return Maximum limit for number of active concurrent connections
+    * @throws ResourceException Thrown if an error occurs
+    */
+   @Override
+   public int getMaxConnections() throws ResourceException
+   {
+      log.tracef("getMaxConnections()");
+      
+      return socket.getMaxConnections();
+   }
+
+   /**
+    * Returns name of the user associated with the ManagedConnection instance
+    *
+    * @return Name of the user
+    * @throws ResourceException Thrown if an error occurs
+    */
+   @Override
+   public String getUserName() throws ResourceException
+   {
+      log.tracef("getUserName()");
+
+      return socket.getAuth();
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthResourceAdapter.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthResourceAdapter.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthResourceAdapter.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+
+import javax.transaction.xa.XAResource;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ReauthResourceAdapter
+ *
+ * @version $Revision: $
+ */
+public class ReauthResourceAdapter implements ResourceAdapter
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(ReauthResourceAdapter.class);
+
+   /** Server */
+   private String server;
+
+   /** Port */
+   private Integer port;
+
+   /**
+    * Default constructor
+    */
+   public ReauthResourceAdapter()
+   {
+      this.server = null;
+      this.port = null;
+   }
+
+   /** 
+    * Set server
+    * @param server The value
+    */
+   public void setServer(String server)
+   {
+      this.server = server;
+   }
+
+   /** 
+    * Get server
+    * @return The value
+    */
+   public String getServer()
+   {
+      return server;
+   }
+
+   /** 
+    * Set port
+    * @param port The value
+    */
+   public void setPort(Integer port)
+   {
+      this.port = port;
+   }
+
+   /** 
+    * Get Port
+    * @return The value
+    */
+   public Integer getPort()
+   {
+      return port;
+   }
+
+   /**
+    * This is called during the activation of a message endpoint.
+    *
+    * @param endpointFactory A message endpoint factory instance.
+    * @param spec An activation spec JavaBean instance.
+    * @throws ResourceException generic exception 
+    */
+   public void endpointActivation(MessageEndpointFactory endpointFactory,
+                                  ActivationSpec spec)
+      throws ResourceException
+   {
+      log.tracef("endpointActivation");
+   }
+
+   /**
+    * This is called when a message endpoint is deactivated. 
+    *
+    * @param endpointFactory A message endpoint factory instance.
+    * @param spec An activation spec JavaBean instance.
+    */
+   public void endpointDeactivation(MessageEndpointFactory endpointFactory,
+                                    ActivationSpec spec)
+   {
+      log.tracef("endpointDeactivation");
+   }
+
+   /**
+    * This is called when a resource adapter instance is bootstrapped.
+    *
+    * @param ctx A bootstrap context containing references 
+    * @throws ResourceAdapterInternalException indicates bootstrap failure.
+    */
+   public void start(BootstrapContext ctx) throws ResourceAdapterInternalException
+   {
+      log.tracef("start");
+   }
+
+   /**
+    * This is called when a resource adapter instance is undeployed or
+    * during application server shutdown. 
+    */
+   public void stop()
+   {
+      log.tracef("stop");
+   }
+
+   /**
+    * This method is called by the application server during crash recovery.
+    *
+    * @param specs An array of ActivationSpec JavaBeans 
+    * @throws ResourceException generic exception 
+    * @return An array of XAResource objects
+    */
+   public XAResource[] getXAResources(ActivationSpec[] specs)
+      throws ResourceException
+   {
+      log.tracef("getXAResources");
+      return null;
+   }
+
+   /** 
+    * Returns a hash code value for the object.
+    * @return A hash code value for this object.
+    */
+   @Override
+   public int hashCode()
+   {
+      int result = 17;
+
+      if (server != null)
+         result += 31 * result + 7 * server.hashCode();
+      else
+         result += 31 * result + 7;
+
+      if (port != null)
+         result += 31 * result + 7 * port.hashCode();
+      else
+         result += 31 * result + 7;
+
+      return result;
+   }
+
+   /** 
+    * Indicates whether some other object is equal to this one.
+    * @param other The reference object with which to compare.
+    * @return true if this object is the same as the obj argument, false otherwise.
+    */
+   @Override
+   public boolean equals(Object other)
+   {
+      if (other == null)
+         return false;
+
+      if (other == this)
+         return true;
+
+      if (!(other instanceof ReauthResourceAdapter))
+         return false;
+
+      ReauthResourceAdapter obj = (ReauthResourceAdapter)other;
+      boolean result = true; 
+
+      if (result)
+      {
+         if (server == null)
+            result = obj.getServer() == null;
+         else
+            result = server.equals(obj.getServer());
+      }
+
+      if (result)
+      {
+         if (port == null)
+            result = obj.getPort() == null;
+         else
+            result = port.equals(obj.getPort());
+      }
+
+      return result;
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthSocket.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthSocket.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/ReauthSocket.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.security.reauth.ra.subject;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.Socket;
+
+import javax.resource.ResourceException;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ReauthSocket
+ *
+ * @version $Revision: $
+ */
+public class ReauthSocket
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(ReauthSocket.class);
+
+   /** The socket */
+   private Socket socket;
+
+   /** Input */
+   private ObjectInputStream ois;
+
+   /** Output */
+   private ObjectOutputStream oos;
+
+   /**
+    * Constructor
+    * @param server The server name
+    * @param port The port
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public ReauthSocket(String server, int port) throws ResourceException
+   {
+      try
+      {
+         this.socket = new Socket(server, port);
+         this.ois = null;
+         this.oos = null;
+
+         // Connect
+         getOutput().writeByte(0);
+         getOutput().flush();
+
+         Boolean granted = (Boolean)getInput().readObject();
+         
+         if (!granted.booleanValue())
+            throw new ResourceException("Connection not granted");
+      }
+      catch (Throwable t)
+      {
+         throw new ResourceException("Unable to establish a connection", t);
+      }
+   }
+
+   /**
+    * Call login
+    * @param username String
+    * @param password String
+    * @return String
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public synchronized String login(String username, String password) throws ResourceException
+   {
+      log.tracef("login(%s, %s)", username, password);
+
+      try
+      {
+         getOutput().writeByte(3);
+         getOutput().writeUTF(username);
+         getOutput().writeUTF(password);
+         getOutput().flush();
+
+         return (String)getInput().readObject();
+      }
+      catch (Throwable t)
+      {
+         throw new ResourceException("Error during login", t);
+      }
+   }
+
+   /**
+    * Call logout
+    * @return boolean
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public synchronized boolean logout() throws ResourceException
+   {
+      log.tracef("logout()");
+
+      try
+      {
+         getOutput().writeByte(4);
+         getOutput().flush();
+
+         Boolean result = (Boolean)getInput().readObject();
+
+         return result.booleanValue();
+      }
+      catch (Throwable t)
+      {
+         throw new ResourceException("Error during logout", t);
+      }
+   }
+
+   /**
+    * get auth
+    * @return String
+    * @throws ResourceException Thrown if an error occurs
+    */
+   public synchronized String getAuth() throws ResourceException
+   {
+      log.tracef("getAuth()");
+
+      try
+      {
+         getOutput().writeByte(5);
+         getOutput().flush();
+
+         return (String)getInput().readObject();
+      }
+      catch (Throwable t)
+      {
+         throw new ResourceException("Error during getAuth", t);
+      }
+   }
+
+   /**
+    * Returns maximum limit on number of active concurrent connections 
+    *
+    * @return Maximum limit for number of active concurrent connections
+    * @throws ResourceException Thrown if an error occurs
+    */
+   public synchronized int getMaxConnections() throws ResourceException
+   {
+      log.tracef("getMaxConnections()");
+
+      try
+      {
+         getOutput().writeByte(6);
+         getOutput().flush();
+
+         Integer result = (Integer)getInput().readObject();
+
+         return result.intValue();
+      }
+      catch (Throwable t)
+      {
+         throw new ResourceException("Error during getUserName()", t);
+      }
+   }
+
+   /**
+    * Application server calls this method to force any cleanup on the ManagedConnection instance.
+    *
+    * @throws ResourceException generic exception if operation fails
+    */
+   public synchronized void cleanup() throws ResourceException
+   {
+      log.tracef("cleanup");
+
+      try
+      {
+         // Unauth the interaction
+         getOutput().writeByte(4);
+         getOutput().flush();
+
+         socket.close();
+      }
+      catch (Throwable t)
+      {
+         throw new ResourceException("Error during cleanup", t);
+      }
+   }
+
+   /**
+    * Destroys the physical connection to the underlying resource manager.
+    *
+    * @throws ResourceException generic exception if operation fails
+    */
+   public synchronized void destroy() throws ResourceException
+   {
+      log.tracef("destroy");
+
+      try
+      {
+         // Close the interaction
+         getOutput().writeByte(1);
+         getOutput().flush();
+
+         socket.close();
+      }
+      catch (Throwable t)
+      {
+         throw new ResourceException("Error during destroy", t);
+      }
+   }
+
+   /**
+    * Get input stream
+    * @return The value
+    * @exception IOException Thrown in case of an error
+    */
+   private ObjectInputStream getInput() throws IOException
+   {
+      if (ois == null)
+         ois = new ObjectInputStream(new BufferedInputStream(socket.getInputStream(), 8192));
+      
+      return ois;
+   }
+
+   /**
+    * Get output stream
+    * @return The value
+    * @exception IOException Thrown in case of an error
+    */
+   private ObjectOutputStream getOutput() throws IOException
+   {
+      if (oos == null)
+         oos = new ObjectOutputStream(new BufferedOutputStream(socket.getOutputStream(), 8192));
+      
+      return oos;
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/security/reauth/ra/subject/package.html	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,3 @@
+<body>
+This package contains the reauth resource adapter using Subject.
+</body>

Modified: projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/cri/META-INF/ironjacamar.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/cri/META-INF/ironjacamar.xml	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/cri/META-INF/ironjacamar.xml	2011-03-08 20:05:27 UTC (rev 110856)
@@ -41,6 +41,9 @@
         <min-pool-size>0</min-pool-size>
         <max-pool-size>1</max-pool-size>
       </pool>
+      <security>
+        <application/>
+      </security>
     </connection-definition>
   </connection-definitions>
 

Added: projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ironjacamar.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ironjacamar.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ironjacamar.xml	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+-->
+
+<ironjacamar xmlns="http://www.jboss.org/ironjacamar/schema"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema 
+             http://www.jboss.org/ironjacamar/schema/ironjacamar_1_0.xsd">
+  <config-property name="Server">localhost</config-property>
+  <config-property name="Port">19000</config-property>
+
+  <transaction-support>NoTransaction</transaction-support>
+  
+  <connection-definitions>
+    <connection-definition class-name="org.jboss.jca.core.security.reauth.ra.subject.ReauthManagedConnectionFactory" 
+                           enabled="true" jndi-name="java:/eis/Reauth" 
+                           use-java-context="true" pool-name="Reauth">
+      <pool>
+        <min-pool-size>0</min-pool-size>
+        <max-pool-size>1</max-pool-size>
+      </pool>
+      <security>
+        <security-domain>DefaultSecurityDomain</security-domain>
+      </security>
+    </connection-definition>
+  </connection-definitions>
+
+</ironjacamar>

Added: projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ra.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/rars/security/reauth/subject/META-INF/ra.xml	2011-03-08 20:05:27 UTC (rev 110856)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+-->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+           http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+           version="1.5">
+
+   <vendor-name>JBoss, Red Hat</vendor-name>
+   <eis-type>Reauth resource adapter (SUBJECT)</eis-type>
+   <resourceadapter-version>1.0</resourceadapter-version>
+   <resourceadapter>
+      <resourceadapter-class>org.jboss.jca.core.security.reauth.ra.subject.ReauthResourceAdapter</resourceadapter-class>
+      <config-property>
+         <config-property-name>Server</config-property-name>
+         <config-property-type>java.lang.String</config-property-type>
+         <config-property-value>localhost</config-property-value>
+      </config-property>
+
+      <config-property>
+         <config-property-name>Port</config-property-name>
+         <config-property-type>java.lang.Integer</config-property-type>
+         <config-property-value>19000</config-property-value>
+      </config-property>
+
+      <outbound-resourceadapter>
+         <connection-definition>
+            <managedconnectionfactory-class>org.jboss.jca.core.security.reauth.ra.subject.ReauthManagedConnectionFactory</managedconnectionfactory-class>
+            <connectionfactory-interface>org.jboss.jca.core.security.reauth.ra.subject.ReauthConnectionFactory</connectionfactory-interface>
+            <connectionfactory-impl-class>org.jboss.jca.core.security.reauth.ra.subject.ReauthConnectionFactoryImpl</connectionfactory-impl-class>
+            <connection-interface>org.jboss.jca.core.security.reauth.ra.subject.ReauthConnection</connection-interface>
+            <connection-impl-class>org.jboss.jca.core.security.reauth.ra.subject.ReauthConnectionImpl</connection-impl-class>
+         </connection-definition>
+         <transaction-support>NoTransaction</transaction-support>
+         <reauthentication-support>true</reauthentication-support>
+      </outbound-resourceadapter>
+   </resourceadapter>
+</connector>

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -275,8 +275,9 @@
       // Select the correct connection manager
       TransactionSupportLevel tsl = TransactionSupportLevel.LocalTransaction;
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager cm = cmf.createTransactional(tsl, pool, null, allocationRetry, allocationRetryWaitMillis,
-         getTransactionManager(), null, null, null, null, null);
+      ConnectionManager cm = 
+         cmf.createTransactional(tsl, pool, null, null, allocationRetry, allocationRetryWaitMillis,
+                                 getTransactionManager(), null, null, null, null, null);
 
       cm.setJndiName(jndiName);
 
@@ -366,8 +367,11 @@
       // Select the correct connection manager
       TransactionSupportLevel tsl = TransactionSupportLevel.XATransaction;
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager cm = cmf.createTransactional(tsl, pool, null, allocationRetry, allocationRetryWaitMillis,
-         getTransactionManager(), interleaving, xaResourceTimeout, isSameRMOverride, wrapXAResource, padXid);
+      ConnectionManager cm =
+         cmf.createTransactional(tsl, pool, null, null,
+                                 allocationRetry, allocationRetryWaitMillis,
+                                 getTransactionManager(), interleaving, 
+                                 xaResourceTimeout, isSameRMOverride, wrapXAResource, padXid);
 
       cm.setJndiName(jndiName);
 

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -876,25 +876,32 @@
                      PoolFactory pf = new PoolFactory();
 
                      Boolean noTxSeparatePool = Boolean.FALSE;
-                     CommonSecurity security = null;
                      if (cdRaXml != null && cdRaXml.getPool() != null && cdRaXml.isXa())
                      {
                         CommonXaPool ijXaPool = (CommonXaPool) cdRaXml.getPool();
-                        security = cdRaXml.getSecurity();
                         if (ijXaPool != null)
                            noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
                      }
                      else if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
                      {
                         CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
-                        security = ijCD.getSecurity();
                         if (ijXaPool != null)
                            noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
                      }
 
                      PoolStrategy strategy = PoolStrategy.ONE_POOL;
+                     String securityDomain = null;
 
-                     String securityDomain = null;
+                     CommonSecurity security = null;
+                     if (cdRaXml != null && cdRaXml.getSecurity() != null)
+                     {
+                        security = cdRaXml.getSecurity();
+                     }
+                     else if (ijCD != null && ijCD.getSecurity() != null)
+                     {
+                        security = ijCD.getSecurity();
+                     }
+
                      if (security != null)
                      {
                         if (security.isApplication())
@@ -982,9 +989,9 @@
                      // Select the correct connection manager
                      if (tsl == TransactionSupportLevel.NoTransaction)
                      {
-                        cm = cmf.createNonTransactional(tsl, pool, getSubjectFactory(securityDomain),
-                           allocationRetry,
-                           allocationRetryWaitMillis);
+                        cm = cmf.createNonTransactional(tsl, pool, 
+                                                        getSubjectFactory(securityDomain), securityDomain,
+                                                        allocationRetry, allocationRetryWaitMillis);
                      }
                      else
                      {
@@ -1023,10 +1030,12 @@
                            }
                         }
 
-                        cm = cmf.createTransactional(tsl, pool, getSubjectFactory(securityDomain), allocationRetry,
-                           allocationRetryWaitMillis,
-                           getTransactionManager(), interleaving, xaResourceTimeout, isSameRMOverride,
-                           wrapXAResource, padXid);
+                        cm = cmf.createTransactional(tsl, pool, 
+                                                     getSubjectFactory(securityDomain), securityDomain,
+                                                     allocationRetry, allocationRetryWaitMillis,
+                                                     getTransactionManager(), interleaving, 
+                                                     xaResourceTimeout, isSameRMOverride,
+                                                     wrapXAResource, padXid);
                      }
 
                      // ConnectionFactory
@@ -1214,25 +1223,32 @@
                                  PoolFactory pf = new PoolFactory();
 
                                  Boolean noTxSeparatePool = Boolean.FALSE;
-                                 CommonSecurity security = null;
                                  if (cdRaXml != null && cdRaXml.getPool() != null && cdRaXml.isXa())
                                  {
                                     CommonXaPool ijXaPool = (CommonXaPool) cdRaXml.getPool();
-                                    security = cdRaXml.getSecurity();
                                     if (ijXaPool != null)
                                        noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
                                  }
                                  else if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
                                  {
                                     CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
-                                    security = ijCD.getSecurity();
                                     if (ijXaPool != null)
                                        noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
                                  }
 
+                                 CommonSecurity security = null;
+                                 if (cdRaXml != null && cdRaXml.getSecurity() != null)
+                                 {
+                                    security = cdRaXml.getSecurity();
+                                 }
+                                 else if (ijCD != null && ijCD.getSecurity() != null)
+                                 {
+                                    security = ijCD.getSecurity();
+                                 }
+
                                  PoolStrategy strategy = PoolStrategy.ONE_POOL;
+                                 String securityDomain = null;
 
-                                 String securityDomain = null;
                                  if (security != null)
                                  {
                                     if (security.isApplication())
@@ -1251,7 +1267,6 @@
                                        strategy = PoolStrategy.POOL_BY_SUBJECT_AND_CRI;
                                        securityDomain = security.getSecurityDomainAndApplication();
                                     }
-
                                  }
 
                                  if (ra.getOutboundResourceadapter().getReauthenticationSupport())
@@ -1317,9 +1332,9 @@
                                  // Select the correct connection manager
                                  if (tsl == TransactionSupportLevel.NoTransaction)
                                  {
-                                    cm = cmf.createNonTransactional(tsl, pool, getSubjectFactory(securityDomain),
-                                       allocationRetry,
-                                       allocationRetryWaitMillis);
+                                    cm = cmf.createNonTransactional(tsl, pool, 
+                                                                    getSubjectFactory(securityDomain), securityDomain,
+                                                                    allocationRetry, allocationRetryWaitMillis);
                                  }
                                  else
                                  {
@@ -1355,10 +1370,12 @@
                                           padXid = ijXaPool.isPadXid();
                                     }
 
-                                    cm = cmf.createTransactional(tsl, pool, getSubjectFactory(securityDomain),
-                                       allocationRetry,
-                                       allocationRetryWaitMillis, getTransactionManager(), interleaving,
-                                       xaResourceTimeout, isSameRMOverride, wrapXAResource, padXid);
+                                    cm = cmf.createTransactional(tsl, pool, 
+                                                                 getSubjectFactory(securityDomain), securityDomain,
+                                                                 allocationRetry, allocationRetryWaitMillis,
+                                                                 getTransactionManager(), interleaving,
+                                                                 xaResourceTimeout, isSameRMOverride, 
+                                                                 wrapXAResource, padXid);
                                  }
 
                                  // ConnectionFactory

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java	2011-03-08 19:47:44 UTC (rev 110855)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java	2011-03-08 20:05:27 UTC (rev 110856)
@@ -574,6 +574,8 @@
    @Override
    protected SubjectFactory getSubjectFactory(String securityDomain) throws DeployException
    {
+      log.tracef("getSubjectFactory(%s)", securityDomain);
+
       if (securityDomain == null || securityDomain.trim().equals(""))
          return null;
 



More information about the jboss-cvs-commits mailing list