[jboss-cvs] JBossAS SVN: r80403 - in projects/integration/trunk: jboss-corba-ots-spi and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 3 15:23:14 EST 2008
Author: adrian at jboss.org
Date: 2008-11-03 15:23:14 -0500 (Mon, 03 Nov 2008)
New Revision: 80403
Added:
projects/integration/trunk/jboss-jca-spi/src/main/java/org/jboss/jca/spi/ComponentStack.java
projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionListener.java
projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionProvider.java
projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionRegistry.java
Modified:
projects/integration/trunk/jboss-classloading-spi/.classpath
projects/integration/trunk/jboss-corba-ots-spi/.classpath
projects/integration/trunk/jboss-jca-spi/.classpath
projects/integration/trunk/jboss-transaction-spi/.classpath
projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/client/ServerVMClientUserTransaction.java
Log:
[JBAS-6159] - Integration api for UserTransactionListener and CachedConnectionManager/ContextStack
Modified: projects/integration/trunk/jboss-classloading-spi/.classpath
===================================================================
--- projects/integration/trunk/jboss-classloading-spi/.classpath 2008-11-03 20:23:10 UTC (rev 80402)
+++ projects/integration/trunk/jboss-classloading-spi/.classpath 2008-11-03 20:23:14 UTC (rev 80403)
@@ -2,6 +2,6 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
</classpath>
\ No newline at end of file
Modified: projects/integration/trunk/jboss-corba-ots-spi/.classpath
===================================================================
--- projects/integration/trunk/jboss-corba-ots-spi/.classpath 2008-11-03 20:23:10 UTC (rev 80402)
+++ projects/integration/trunk/jboss-corba-ots-spi/.classpath 2008-11-03 20:23:14 UTC (rev 80403)
@@ -3,5 +3,5 @@
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/jacorb/jacorb/2.3.0jboss.patch5-brew/jacorb-2.3.0jboss.patch5-brew.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR2/jboss-transaction-api-1.0.1.CR2.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR2/jboss-transaction-api-1.0.1.CR2-sources.jar"/>
</classpath>
\ No newline at end of file
Modified: projects/integration/trunk/jboss-jca-spi/.classpath
===================================================================
--- projects/integration/trunk/jboss-jca-spi/.classpath 2008-11-03 20:23:10 UTC (rev 80402)
+++ projects/integration/trunk/jboss-jca-spi/.classpath 2008-11-03 20:23:14 UTC (rev 80403)
@@ -2,8 +2,8 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/jboss/aop/jboss-aop-jdk50-client/2.0.0.CR8/jboss-aop-jdk50-client-2.0.0.CR8.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR1/jboss-jca-api-1.5.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR1/jboss-jca-api-1.5.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop-jdk50-client/2.0.0.CR16/jboss-aop-jdk50-client-2.0.0.CR16.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR2/jboss-jca-api-1.5.0.CR2.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR2/jboss-jca-api-1.5.0.CR2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
</classpath>
\ No newline at end of file
Added: projects/integration/trunk/jboss-jca-spi/src/main/java/org/jboss/jca/spi/ComponentStack.java
===================================================================
--- projects/integration/trunk/jboss-jca-spi/src/main/java/org/jboss/jca/spi/ComponentStack.java (rev 0)
+++ projects/integration/trunk/jboss-jca-spi/src/main/java/org/jboss/jca/spi/ComponentStack.java 2008-11-03 20:23:14 UTC (rev 80403)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.spi;
+
+import java.util.Set;
+
+import javax.resource.ResourceException;
+
+/**
+ * ComponentStack.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ComponentStack
+{
+ /**
+ * Push a component context
+ *
+ * @param rawKey the raw key, e.g. the servlet or ejb context
+ * @param unsharableResources a set of real jndi names marked as unshareable
+ * @throws ResourceException for any error
+ */
+ @SuppressWarnings("unchecked")
+ void pushMetaAwareObject(final Object rawKey, Set unsharableResources) throws ResourceException;
+
+ /**
+ * Pop a component context
+ *
+ * @param unsharableResources a set of real jndi names marked as unshareable
+ * @throws ResourceException for any error
+ */
+ @SuppressWarnings("unchecked")
+ void popMetaAwareObject(Set unsharableResources) throws ResourceException;
+}
Modified: projects/integration/trunk/jboss-transaction-spi/.classpath
===================================================================
--- projects/integration/trunk/jboss-transaction-spi/.classpath 2008-11-03 20:23:10 UTC (rev 80402)
+++ projects/integration/trunk/jboss-transaction-spi/.classpath 2008-11-03 20:23:14 UTC (rev 80403)
@@ -2,8 +2,8 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.5.GA/jboss-common-core-2.2.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR1/jboss-jca-api-1.5.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR1/jboss-jca-api-1.5.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR2/jboss-jca-api-1.5.0.CR2.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.CR2/jboss-jca-api-1.5.0.CR2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR2/jboss-transaction-api-1.0.1.CR2.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR2/jboss-transaction-api-1.0.1.CR2-sources.jar"/>
</classpath>
\ No newline at end of file
Added: projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionListener.java
===================================================================
--- projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionListener.java (rev 0)
+++ projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionListener.java 2008-11-03 20:23:14 UTC (rev 80403)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.tm.usertx;
+
+import java.util.EventListener;
+
+import javax.transaction.SystemException;
+
+/**
+ * UserTransactionListener.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UserTransactionListener extends EventListener
+{
+ void userTransactionStarted() throws SystemException;
+}
Added: projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionProvider.java
===================================================================
--- projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionProvider.java (rev 0)
+++ projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionProvider.java 2008-11-03 20:23:14 UTC (rev 80403)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.tm.usertx;
+
+/**
+ * UserTransactionProvider.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UserTransactionProvider
+{
+ /**
+ * Set the user transaction registry
+ *
+ * @param registry the registry
+ */
+ void setTransactionRegistry(UserTransactionRegistry registry);
+}
Added: projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionRegistry.java
===================================================================
--- projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionRegistry.java (rev 0)
+++ projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/UserTransactionRegistry.java 2008-11-03 20:23:14 UTC (rev 80403)
@@ -0,0 +1,129 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.tm.usertx;
+
+import java.util.Collection;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import org.jboss.logging.Logger;
+
+/**
+ * UserTransactionRegistry.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserTransactionRegistry
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(UserTransactionRegistry.class);
+
+ /** The providers */
+ private Collection<UserTransactionProvider> providers = new CopyOnWriteArraySet<UserTransactionProvider>();
+
+ /** The listeners */
+ private Collection<UserTransactionListener> listeners = new CopyOnWriteArraySet<UserTransactionListener>();
+
+ /**
+ * Add a listener
+ *
+ * @param listener the listener
+ * @throws IllegalArgumentException for a null listener
+ */
+ public void addListener(UserTransactionListener listener)
+ {
+ if (listener == null)
+ throw new IllegalArgumentException("Null listener");
+ listeners.add(listener);
+ log.debug(this + " addListener " + listener);
+ }
+
+ /**
+ * Remove a listener
+ *
+ * @param listener the listener
+ * @throws IllegalArgumentException for a null listener
+ */
+ public void removeListener(UserTransactionListener listener)
+ {
+ if (listener == null)
+ throw new IllegalArgumentException("Null listener");
+ listeners.remove(listener);
+ log.debug(this + " removeListener " + listener);
+ }
+
+ /**
+ * Add a provider
+ *
+ * @param provider the provider
+ * @throws IllegalArgumentException for a null provider
+ */
+ public void addProvider(UserTransactionProvider provider)
+ {
+ if (provider == null)
+ throw new IllegalArgumentException("Null provider");
+ provider.setTransactionRegistry(this);
+ providers.add(provider);
+ log.debug(this + " addProvider " + provider);
+ }
+
+ /**
+ * Remove a provider
+ *
+ * @param provider the provider
+ * @throws IllegalArgumentException for a null provider
+ */
+ public void removeProvider(UserTransactionProvider provider)
+ {
+ if (provider == null)
+ throw new IllegalArgumentException("Null provider");
+ if (providers.remove(provider))
+ {
+ provider.setTransactionRegistry(null);
+ log.debug(this + " removeProvider " + provider);
+ }
+ }
+
+ /**
+ * Fire a user transaction started event
+ */
+ public void userTransactionStarted()
+ {
+ if (listeners.isEmpty() == false)
+ {
+ for (UserTransactionListener listener : listeners)
+ {
+ if (listener != null)
+ {
+ try
+ {
+ listener.userTransactionStarted();
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error notifying listener " + listener + " of userTransactionStarted", t);
+ }
+ }
+ }
+ }
+ }
+}
Modified: projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/client/ServerVMClientUserTransaction.java
===================================================================
--- projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/client/ServerVMClientUserTransaction.java 2008-11-03 20:23:10 UTC (rev 80402)
+++ projects/integration/trunk/jboss-transaction-spi/src/main/java/org/jboss/tm/usertx/client/ServerVMClientUserTransaction.java 2008-11-03 20:23:14 UTC (rev 80403)
@@ -34,6 +34,8 @@
import javax.transaction.UserTransaction;
import org.jboss.tm.TransactionManagerLocator;
+import org.jboss.tm.usertx.UserTransactionProvider;
+import org.jboss.tm.usertx.UserTransactionRegistry;
/**
@@ -48,7 +50,7 @@
* @version $Revision: 37459 $
*/
public class ServerVMClientUserTransaction
- implements UserTransaction
+ implements UserTransaction, UserTransactionProvider
{
// Static --------------------------------------------------------
@@ -64,6 +66,10 @@
private final TransactionManager tm;
+ /** Any registry */
+ private volatile UserTransactionRegistry registry;
+
+ /** The listeners */
private final Collection<UserTransactionStartedListener> listeners = new CopyOnWriteArrayList<UserTransactionStartedListener>();
/**
@@ -128,16 +134,33 @@
listeners.remove(txStartedListener);
}
+ public void setTransactionRegistry(UserTransactionRegistry registry)
+ {
+ this.registry = registry;
+ }
+
//
// implements interface UserTransaction
//
+
public void begin() throws NotSupportedException, SystemException
{
tm.begin();
- for (UserTransactionStartedListener listener : listeners)
- listener.userTransactionStarted();
+ UserTransactionRegistry registry = this.registry;
+ if (registry != null)
+ registry.userTransactionStarted();
+
+ try
+ {
+ for (UserTransactionStartedListener listener : listeners)
+ listener.userTransactionStarted();
+ }
+ catch (SystemException e)
+ {
+ rollback();
+ }
}
public void commit()
@@ -178,6 +201,12 @@
tm.setTransactionTimeout(seconds);
}
+ /**
+ * UserTransactionStartedListener.
+ *
+ * @Deprecated use {@link UserTransactionRegistry} instead
+ */
+ @Deprecated
public interface UserTransactionStartedListener extends EventListener
{
void userTransactionStarted() throws SystemException;
More information about the jboss-cvs-commits
mailing list