[jboss-cvs] JBossAS SVN: r111532 - in projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core: connectionmanager and 12 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jun 7 06:33:04 EDT 2011
Author: jeff.zhang
Date: 2011-06-07 06:33:03 -0400 (Tue, 07 Jun 2011)
New Revision: 111532
Modified:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java
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/ccm/CachedConnectionManagerImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/AbstractConnectionListener.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPool.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/ActivationImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/EndpointImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/SimpleResourceAdapterRepository.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/jbossts/LocalXAResourceImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkManagerImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkWrapper.java
Log:
[JBJCA-592] messge bundle for core
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,8 +22,8 @@
package org.jboss.jca.core;
+import org.jboss.logging.Message;
import org.jboss.logging.MessageBundle;
-import org.jboss.logging.Message;
/**
* The core bundle.
@@ -33,4 +33,418 @@
@MessageBundle(projectCode = "IJ")
public interface CoreBundle
{
+
+ // CACHED CONNECTION MANAGER (100)
+
+ /**
+ * Some connections were not closed
+ * @return The value
+ */
+ @Message(id = 151, value = "Some connections were not closed, see the log for the allocation stacktraces")
+ public String someConnectionsWereNotClosed();
+
+ // WORK MANAGER (200)
+
+ /**
+ * SecurityContext setup failed
+ * @param message The throwable description
+ * @return The value
+ */
+ @Message(id = 251, value = "SecurityContext setup failed: %s")
+ public String securityContextSetupFailed(String message);
+
+ /**
+ * SecurityContext setup failed since CallbackSecurity was null
+ * @return The value
+ */
+ @Message(id = 252, value = "SecurityContext setup failed since CallbackSecurity was null")
+ public String securityContextSetupFailedSinceCallbackSecurityWasNull();
+
+ /**
+ * Work is null
+ * @return The value
+ */
+ @Message(id = 253, value = "Work is null")
+ public String workIsNull();
+
+ /**
+ * StartTimeout is negative
+ * @param startTimeout timeout of start
+ * @return The value
+ */
+ @Message(id = 254, value = "StartTimeout is negative: %s")
+ public String startTimeoutIsNegative(long startTimeout);
+
+ /**
+ * Interrupted while requesting permit
+ * @return The value
+ */
+ @Message(id = 255, value = "Interrupted while requesting permit")
+ public String interruptedWhileRequestingPermit();
+
+ /**
+ * Work execution context must be null because work instance implements WorkContextProvider
+ * @return The value
+ */
+ @Message(id = 256, value = "Work execution context must be null because " +
+ "work instance implements WorkContextProvider!")
+ public String workExecutionContextMustNullImplementsWorkContextProvider();
+
+ /**
+ * Run method is synchronized
+ * @param classname class name of work
+ * @return The value
+ */
+ @Message(id = 257, value = "%s: Run method is synchronized")
+ public String runMethodIsSynchronized(String classname);
+
+ /**
+ * Release method is synchronized
+ * @param classname class name of work
+ * @return The value
+ */
+ @Message(id = 258, value = "%s: Release method is synchronized")
+ public String releaseMethodIsSynchronized(String classname);
+
+ /**
+ * Unsupported WorkContext class
+ * @param classname class name of work
+ * @return The value
+ */
+ @Message(id = 259, value = "Unsupported WorkContext class: %s")
+ public String unsupportedWorkContextClass(String classname);
+
+ /**
+ * Duplicate TransactionWorkContext class
+ * @param classname class name of work
+ * @return The value
+ */
+ @Message(id = 260, value = "Duplicate TransactionWorkContext class: %s")
+ public String duplicateTransactionWorkContextClass(String classname);
+
+ /**
+ * Duplicate SecurityWorkContext class
+ * @param classname class name of work
+ * @return The value
+ */
+ @Message(id = 261, value = "Duplicate SecurityWorkContext class: %s")
+ public String duplicateSecurityWorkContextClass(String classname);
+
+ /**
+ * Duplicate HintWorkContext class
+ * @param classname class name of work
+ * @return The value
+ */
+ @Message(id = 262, value = "Duplicate HintWorkContext class: %s")
+ public String duplicateHintWorkContextClass(String classname);
+
+
+ // CONNECTION MANAGER LISTENER (300)
+
+ /**
+ * Not correct type in class cast
+ * @param classname class name of work
+ * @return The value
+ */
+ @Message(id = 351, value = "Not correct type: %s")
+ public String notCorrectTypeWhenClassCast(String classname);
+
+ /**
+ * Failure to delist resource
+ * @param obj listener instance
+ * @return The value
+ */
+ @Message(id = 352, value = "Failure to delist resource: %s")
+ public String failureDelistResource(Object obj);
+
+ /**
+ * Unfinished local transaction but managed connection does not provide a local transaction
+ * @param obj listener instance
+ * @return The value
+ */
+ @Message(id = 353, value = "Unfinished local transaction but managed connection does not " +
+ "provide a local transaction: %s")
+ public String unfinishedLocalTransactionNotProvideLocalTransaction(Object obj);
+
+ /**
+ * System exception when failedToEnlist equals currentTx
+ * @param throwable throwable instance
+ * @param currentTx current transaction instance
+ * @return The value
+ */
+ @Message(id = 354, value = "%s tx=%s")
+ public String systemExceptionWhenFailedToEnlistEqualsCurrentTx(Object throwable, Object currentTx);
+
+
+ // CONNECTION MANAGER (400)
+
+ /**
+ * The connection manager is shutdown
+ * @param jndiName jndi name
+ * @return The value
+ */
+ @Message(id = 451, value = "The connection manager is shutdown: %s")
+ public String connectionManagerIsShutdown(String jndiName);
+
+ /**
+ * Unable to get managed connection for
+ * @param jndiName jndi name
+ * @return The value
+ */
+ @Message(id = 452, value = "Unable to get managed connection for %s")
+ public String unableGetManagedConnection(String jndiName);
+
+ /**
+ * You are trying to use a connection factory that has been shut down ManagedConnectionFactory is null
+ * @return The value
+ */
+ @Message(id = 453, value = "You are trying to use a connection factory that has been shut down: " +
+ "ManagedConnectionFactory is null.")
+ public String tryingUseConnectionFactoryShutDown();
+
+ /**
+ * Wrong ManagedConnectionFactory sent to allocateConnection
+ * @return The value
+ */
+ @Message(id = 454, value = "Wrong ManagedConnectionFactory sent to allocateConnection!")
+ public String wrongManagedConnectionFactorySentToAllocateConnection();
+
+ /**
+ * This method is not supported
+ * @return The value
+ */
+ @Message(id = 455, value = "This method is not supported")
+ public String thisMethodNotSupported();
+
+ /**
+ * Transaction is not active
+ * @param obj transaction instance
+ * @return The value
+ */
+ @Message(id = 456, value = "Transaction is not active: tx= ")
+ public String transactionNotActive(Object obj);
+
+ /**
+ * Could not enlist in transaction on entering meta-aware object
+ * @return The value
+ */
+ @Message(id = 457, value = "Could not enlist in transaction on entering meta-aware object!")
+ public String notEnlistInTransactionOnEnteringMetaAwareObject();
+
+ /**
+ * Unable to set XAResource transaction timeout
+ * @param jndiName jndi name
+ * @return The value
+ */
+ @Message(id = 458, value = "Unable to set XAResource transaction timeout: %s")
+ public String unableSetXAResourceTransactionTimeout(String jndiName);
+
+ // TRANSACTION SYNCHRONIZER (500)
+
+ // POOL MANAGER (600)
+
+ /**
+ * Unable to get managed connection pool
+ * @return The value
+ */
+ @Message(id = 651, value = "Unable to get managed connection pool")
+ public String unableGetManagedConnectionPool();
+
+ /**
+ * Unable to obtain lock
+ * @return The value
+ */
+ @Message(id = 652, value = "Unable to obtain lock")
+ public String unableObtainLock();
+
+ /**
+ * The pool has been shutdown
+ * @return The value
+ */
+ @Message(id = 653, value = "The pool has been shutdown")
+ public String thePoolHasBeenShutdown();
+
+ /**
+ * Interrupted while requesting connection
+ * @param end time of end
+ * @return The value
+ */
+ @Message(id = 654, value = "Interrupted while requesting connection! Waited %s ms")
+ public String interruptedWhileRequestingConnection(long end);
+
+ /**
+ * No ManagedConnections available within configured blocking timeout
+ * @param blockingTimeout timeout of blocking
+ * @return The value
+ */
+ @Message(id = 655, value = "No ManagedConnections available within configured blocking timeout ( %s [ms] )")
+ public String noMManagedConnectionsAvailableWithinConfiguredBlockingTimeout(long blockingTimeout);
+
+ /**
+ * This should never happen
+ * @return The value
+ */
+ @Message(id = 656, value = "This should never happen")
+ public String shouldNeverHappen();
+
+ /**
+ * Interrupted while requesting permit
+ * @param end time of end
+ * @return The value
+ */
+ @Message(id = 657, value = "Interrupted while requesting permit! Waited %s ms")
+ public String interruptedWhileRequestingPermit(long end);
+
+ // NAMING (700)
+
+ /**
+ * Deployment failed since jndi name is already deployed
+ * @param className class name
+ * @param jndiName jndi name
+ * @return The value
+ */
+ @Message(id = 751, value = "Deployment %s failed, %s is already deployed")
+ public String deploymentFailedSinceJndiNameHasDeployed(String className, String jndiName);
+
+ // RESOURCE ADPATER REPOSITORY (800)
+
+ /**
+ * ResourceAdapter instance not active
+ * @return The value
+ */
+ @Message(id = 851, value = "ResourceAdapter instance not active")
+ public String resourceAdapterInstanceNotActive();
+
+ /**
+ * Validation exception
+ * @return The value
+ */
+ @Message(id = 852, value = "Validation exception")
+ public String validationException();
+
+ /**
+ * The activation spec class is no longer available
+ * @return The value
+ */
+ @Message(id = 853, value = "The activation spec class is no longer available")
+ public String activationSpecClassNotAvailable();
+
+ /**
+ * The resource adapter is no longer available
+ * @return The value
+ */
+ @Message(id = 854, value = "The resource adapter is no longer available")
+ public String resourceAdapterNotAvailable();
+
+ /**
+ * Key isn't registered
+ * @param key key name
+ * @return The value
+ */
+ @Message(id = 855, value = "%s isn't registered")
+ public String keyNotRegistered(String key);
+
+ /**
+ * Unable to lookup resource adapter in MDR
+ * @param uniqueId key name
+ * @return The value
+ */
+ @Message(id = 856, value = "Unable to lookup resource adapter in MDR: %s")
+ public String unableLookupResourceAdapterInMDR(String uniqueId);
+
+ // RECOVERY (900)
+
+ /**
+ * Error during connection close
+ * @return The value
+ */
+ @Message(id = 951, value = "Error during connection close")
+ public String errorDuringConnectionClose();
+
+ // SECURITY (1000)
+
+
+ // TRANSCATION (1100)
+
+ /**
+ * Trying to start a new tx when old is not complete
+ * @param oldXid old xid
+ * @param newXid new xid
+ * @param flags flags
+ * @return The value
+ */
+ @Message(id = 1151, value = "Trying to start a new tx when old is not complete! old: %s, new %s, flags %s")
+ public String tryingStartNewTxWhenOldNotComplete(Object oldXid, Object newXid, int flags);
+
+ /**
+ * Trying to start a new tx with wrong flags
+ * @param xid xid
+ * @param flags flags
+ * @return The value
+ */
+ @Message(id = 1152, value = "Trying to start a new tx with wrong flags! new %s, flags %s")
+ public String tryingStartNewTxWithWrongFlags(Object xid, int flags);
+
+ /**
+ * Error trying to start local tx
+ * @return The value
+ */
+ @Message(id = 1153, value = "Error trying to start local tx")
+ public String errorTryingStartLocalTx();
+
+ /**
+ * Throwable trying to start local transaction
+ * @return The value
+ */
+ @Message(id = 1154, value = "Throwable trying to start local transaction!")
+ public String throwableTryingStartLocalTx();
+
+ /**
+ * Wrong xid in commit
+ * @param currentXid current xid
+ * @param xid xid
+ * @return The value
+ */
+ @Message(id = 1155, value = "Wrong xid in commit: expected: %s, got: %s")
+ public String wrongXidInCommit(Object currentXid, Object xid);
+
+ /**
+ * Could not commit local tx
+ * @return The value
+ */
+ @Message(id = 1156, value = "Could not commit local tx")
+ public String couldNotCommitLocalTx();
+
+ /**
+ * Forget not supported in local tx
+ * @return The value
+ */
+ @Message(id = 1157, value = "Forget not supported in local tx")
+ public String forgetNotSupportedInLocalTx();
+
+ /**
+ * No recover with local-tx only resource managers
+ * @return The value
+ */
+ @Message(id = 1158, value = "No recover with local-tx only resource managers")
+ public String noRecoverWithLocalTxResourceManagers();
+
+ /**
+ * Wrong xid in rollback
+ * @param currentXid current xid
+ * @param xid xid
+ * @return The value
+ */
+ @Message(id = 1159, value = "Wrong xid in rollback: expected: %s, got: %s")
+ public String wrongXidInRollback(Object currentXid, Object xid);
+
+
+ /**
+ * Could not rollback local tx
+ * @return The value
+ */
+ @Message(id = 1160, value = "Could not rollback local tx")
+ public String couldNotRollbackLocalTx();
+
+ // METADATA REPOSITORY (1200)
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -419,4 +419,7 @@
@Message(id = 1101, value = "Prepare called on a local tx. Use of local transactions on a jta " +
"transaction with more than one branch may result in inconsistent data in some cases of failure.")
public void prepareCalledOnLocaltx();
+
+
+ // METADATA REPOSITORY (1200)
}
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-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -24,6 +24,7 @@
import org.jboss.jca.common.JBossResourceException;
import org.jboss.jca.common.api.metadata.common.FlushStrategy;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager;
import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
@@ -53,6 +54,8 @@
import javax.transaction.SystemException;
import javax.transaction.Transaction;
+import org.jboss.logging.Messages;
+
import org.jboss.security.SubjectFactory;
/**
@@ -68,7 +71,10 @@
/** Log trace */
protected boolean trace;
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** The pool */
private Pool pool;
@@ -337,7 +343,7 @@
if (shutdown.get())
{
- throw new ResourceException("The connection manager is shutdown " + jndiName);
+ throw new ResourceException(bundle.connectionManagerIsShutdown(jndiName));
}
// First attempt
@@ -356,7 +362,7 @@
{
if (shutdown.get())
{
- throw new ResourceException("The connection manager is shutdown " + jndiName);
+ throw new ResourceException(bundle.connectionManagerIsShutdown(jndiName));
}
if (trace)
@@ -387,7 +393,7 @@
}
// If we get here all retries failed, throw the lastest failure
- throw new ResourceException("Unable to get managed connection for " + jndiName, failure);
+ throw new ResourceException(bundle.unableGetManagedConnection(jndiName), failure);
}
/**
@@ -449,14 +455,13 @@
//Check for pooling!
if (pool == null)
{
- throw new ResourceException("You are trying to use a connection factory that has been shut down: " +
- "ManagedConnectionFactory is null.");
+ throw new ResourceException(bundle.tryingUseConnectionFactoryShutDown());
}
//it is an explicit spec requirement that equals be used for matching rather than ==.
if (!pool.getManagedConnectionFactory().equals(mcf))
{
- throw new ResourceException("Wrong ManagedConnectionFactory sent to allocateConnection!");
+ throw new ResourceException(bundle.wrongManagedConnectionFactorySentToAllocateConnection());
}
// Pick a managed connection from the pool
@@ -714,7 +719,7 @@
*/
private void writeObject(ObjectOutputStream out) throws IOException
{
- throw new IOException("This method is not supported");
+ throw new IOException(bundle.thisMethodNotSupported());
}
/**
@@ -725,7 +730,7 @@
*/
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
- throw new IOException("This method is not supported");
+ throw new IOException(bundle.thisMethodNotSupported());
}
/**
@@ -734,6 +739,6 @@
*/
private void readObjectNoData() throws ObjectStreamException
{
- throw new NotSerializableException("This method is not supported");
+ throw new NotSerializableException(bundle.thisMethodNotSupported());
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManagerImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManagerImpl.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManagerImpl.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.core.connectionmanager.ccm;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager;
import org.jboss.jca.core.connectionmanager.ConnectionRecord;
@@ -50,6 +51,7 @@
import javax.transaction.TransactionManager;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
import org.jboss.util.Strings;
/**
@@ -62,10 +64,12 @@
/** Log instance */
private static CoreLogger log = Logger.getMessageLogger(CoreLogger.class,
CachedConnectionManager.class.getName());
-
/** Trace */
private static boolean trace = log.isTraceEnabled();
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** Debugging flag */
private boolean debug = false;
@@ -204,7 +208,7 @@
{
if (closeAll(oldKey.getCMToConnectionsMap()) && error)
{
- throw new ResourceException("Some connections were not closed, see the log for the allocation stacktraces");
+ throw new ResourceException(bundle.someConnectionsWereNotClosed());
}
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/AbstractConnectionListener.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/AbstractConnectionListener.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/AbstractConnectionListener.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.connectionmanager.listener;
import org.jboss.jca.common.api.metadata.common.FlushStrategy;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager;
import org.jboss.jca.core.connectionmanager.ConnectionManager;
@@ -36,6 +37,8 @@
import javax.resource.spi.ManagedConnection;
import javax.transaction.SystemException;
+import org.jboss.logging.Messages;
+
/**
* Abstract implementation of the {@link ConnectionListener} interface
* contract.
@@ -51,6 +54,9 @@
/** Log trace */
protected boolean trace;
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** Connection Manager */
private final ConnectionManager cm;
@@ -395,7 +401,7 @@
return 0;
if (!(o instanceof AbstractConnectionListener))
- throw new ClassCastException("Not correct type: " + o.getClass().getName());
+ throw new ClassCastException(bundle.notCorrectTypeWhenClassCast(o.getClass().getName()));
final AbstractConnectionListener acl = (AbstractConnectionListener)o;
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/listener/TxConnectionListener.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -23,6 +23,7 @@
import org.jboss.jca.common.JBossResourceException;
import org.jboss.jca.common.api.metadata.common.FlushStrategy;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.connectionmanager.ConnectionManager;
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
@@ -46,6 +47,7 @@
import javax.transaction.xa.XAResource;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
/**
* Tx connection listener.
@@ -57,7 +59,10 @@
/** The logger */
private static CoreLogger log = Logger.getMessageLogger(CoreLogger.class,
TxConnectionListener.class.getName());
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/**Transaction synch. instance*/
private TransactionSynchronization transactionSynchronization;
@@ -299,7 +304,7 @@
synchronizer.removeEnlisted(synchronization);
if (!tx.delistResource(getXAResource(), XAResource.TMSUSPEND))
{
- throw new ResourceException("Failure to delist resource: " + this);
+ throw new ResourceException(bundle.failureDelistResource(this));
}
}
}
@@ -415,8 +420,7 @@
"error getting local transaction from " + this, t);
}
if (local == null)
- throw new ResourceException("Unfinished local transaction but managed connection does not " +
- "provide a local transaction. " + this);
+ throw new ResourceException(bundle.unfinishedLocalTransactionNotProvideLocalTransaction(this));
else
{
local.rollback();
@@ -539,7 +543,8 @@
// could have been enlisted by a different thread
if (enlistError == failedToEnlist)
{
- throw new SystemException(failedToEnlist + " tx=" + this.currentTx);
+ throw new SystemException(bundle.systemExceptionWhenFailedToEnlistEqualsCurrentTx(
+ failedToEnlist, this.currentTx));
}
else
{
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPool.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPool.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.connectionmanager.pool;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
import org.jboss.jca.core.api.connectionmanager.pool.PoolStatistics;
@@ -50,6 +51,8 @@
import javax.transaction.TransactionManager;
import javax.transaction.TransactionSynchronizationRegistry;
+import org.jboss.logging.Messages;
+
/**
* Abstract pool implementation.
* <p>
@@ -68,7 +71,10 @@
/** Is trace enabled */
private boolean trace;
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** The managed connection pools, maps key --> pool */
private final ConcurrentMap<Object, ManagedConnectionPool> mcpPools =
new ConcurrentHashMap<Object, ManagedConnectionPool>();
@@ -178,7 +184,7 @@
}
catch (Throwable t)
{
- throw new ResourceException("Unable to get managed connection pool", t);
+ throw new ResourceException(bundle.unableGetManagedConnectionPool(), t);
}
}
@@ -437,7 +443,7 @@
}
catch (InterruptedException ie)
{
- throw new ResourceException("Unable to obtain lock", ie);
+ throw new ResourceException(bundle.unableObtainLock(), ie);
}
try
{
@@ -491,7 +497,7 @@
}
catch (InterruptedException ie)
{
- throw new ResourceException("Unable to obtain lock", ie);
+ throw new ResourceException(bundle.unableObtainLock(), ie);
}
try
{
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -23,6 +23,7 @@
package org.jboss.jca.core.connectionmanager.pool.mcp;
import org.jboss.jca.common.JBossResourceException;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
@@ -53,6 +54,8 @@
import javax.resource.spi.ValidatingManagedConnectionFactory;
import javax.security.auth.Subject;
+import org.jboss.logging.Messages;
+
/**
* A managed connection pool implementation using ArrayBlockingQueue
*
@@ -66,6 +69,9 @@
/** Whether trace is enabled */
private boolean trace;
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** The managed connection factory */
private ManagedConnectionFactory mcf;
@@ -221,7 +227,7 @@
if (getAvailableConnections() > 0)
{
if (shutdown.get())
- throw new RetryableUnavailableException("The pool has been shutdown");
+ throw new RetryableUnavailableException(bundle.thePoolHasBeenShutdown());
cl = cls.peek();
if (cl != null)
@@ -233,7 +239,7 @@
catch (InterruptedException ie)
{
long end = System.currentTimeMillis() - startWait;
- throw new ResourceException("Interrupted while requesting connection! Waited " + end + " ms");
+ throw new ResourceException(bundle.interruptedWhileRequestingConnection(end));
}
}
else
@@ -271,14 +277,14 @@
cl = cls.poll(poolConfiguration.getBlockingTimeout(), TimeUnit.MILLISECONDS);
if (shutdown.get())
- throw new RetryableUnavailableException("The pool has been shutdown");
+ throw new RetryableUnavailableException(bundle.thePoolHasBeenShutdown());
}
catch (InterruptedException ie)
{
if (!poolConfiguration.isUseFastFail())
{
- throw new ResourceException("No ManagedConnections available within configured blocking timeout ( "
- + poolConfiguration.getBlockingTimeout() + " [ms] )");
+ throw new ResourceException(bundle.noMManagedConnectionsAvailableWithinConfiguredBlockingTimeout(
+ poolConfiguration.getBlockingTimeout()));
}
else
{
@@ -374,7 +380,7 @@
}
}
- throw new JBossResourceException("This should never happen", new Throwable("STACKTRACE"));
+ throw new JBossResourceException(bundle.shouldNeverHappen(), new Throwable("STACKTRACE"));
}
/**
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -23,6 +23,7 @@
package org.jboss.jca.core.connectionmanager.pool.mcp;
import org.jboss.jca.common.JBossResourceException;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
@@ -50,6 +51,8 @@
import javax.resource.spi.ValidatingManagedConnectionFactory;
import javax.security.auth.Subject;
+import org.jboss.logging.Messages;
+
import org.jboss.util.UnreachableStatementException;
/**
@@ -68,7 +71,10 @@
/** Whether trace is enabled */
private boolean trace;
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** The managed connection factory */
private ManagedConnectionFactory mcf;
@@ -238,7 +244,7 @@
if (shutdown.get())
{
permits.release();
- throw new RetryableUnavailableException("The pool has been shutdown");
+ throw new RetryableUnavailableException(bundle.thePoolHasBeenShutdown());
}
int clsSize = cls.size();
@@ -348,8 +354,8 @@
else
{
// We timed out
- throw new ResourceException("No ManagedConnections available within configured blocking timeout ( "
- + poolConfiguration.getBlockingTimeout() + " [ms] )");
+ throw new ResourceException(bundle.noMManagedConnectionsAvailableWithinConfiguredBlockingTimeout(
+ poolConfiguration.getBlockingTimeout()));
}
}
@@ -357,7 +363,7 @@
{
long end = System.currentTimeMillis() - startWait;
statistics.deltaTotalBlockingTime(end);
- throw new ResourceException("Interrupted while requesting permit! Waited " + end + " ms");
+ throw new ResourceException(bundle.interruptedWhileRequestingPermit(end));
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.connectionmanager.tx;
import org.jboss.jca.common.JBossResourceException;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.connectionmanager.AbstractConnectionManager;
import org.jboss.jca.core.connectionmanager.ConnectionRecord;
@@ -55,6 +56,7 @@
import javax.transaction.xa.XAResource;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
import org.jboss.util.NestedRuntimeException;
import org.jboss.util.NotImplementedException;
@@ -137,7 +139,10 @@
/** Serial version uid */
private static final long serialVersionUID = 1L;
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** Transaction manager instance */
private transient TransactionManager transactionManager;
@@ -346,7 +351,7 @@
Transaction tx = transactionManager.getTransaction();
if (tx != null && !TxUtils.isActive(tx))
{
- throw new ResourceException("Transaction is not active: tx=" + tx);
+ throw new ResourceException(bundle.transactionNotActive(tx));
}
if (!interleaving)
@@ -425,7 +430,7 @@
if (trace)
log.trace("Could not enlist in transaction on entering meta-aware object! " + cl, t);
- throw new JBossResourceException("Could not enlist in transaction on entering meta-aware object!", t);
+ throw new JBossResourceException(bundle.notEnlistInTransactionOnEnteringMetaAwareObject(), t);
}
}
@@ -534,7 +539,7 @@
}
catch (XAException e)
{
- throw new JBossResourceException("Unable to set XAResource transaction timeout: " + getJndiName(), e);
+ throw new JBossResourceException(bundle.unableSetXAResourceTransactionTimeout(getJndiName()), e);
}
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -24,6 +24,7 @@
import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.spi.mdr.AlreadyExistsException;
import org.jboss.jca.core.spi.mdr.MetadataRepository;
import org.jboss.jca.core.spi.mdr.NotFoundException;
@@ -38,6 +39,8 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import org.jboss.logging.Messages;
+
/**
* A simple implementation of the metadata repository
*
@@ -45,6 +48,9 @@
*/
public class SimpleMetadataRepository implements MetadataRepository
{
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** Resource adapter templates */
private ConcurrentMap<String, Connector> raTemplates;
@@ -89,7 +95,7 @@
// The IronJacamar metadata object can be null
if (raTemplates.containsKey(uniqueId))
- throw new AlreadyExistsException(uniqueId + " already registered");
+ throw new AlreadyExistsException(bundle.keyNotRegistered(uniqueId));
raTemplates.put(uniqueId, md);
raRoots.put(uniqueId, root);
@@ -108,7 +114,7 @@
throw new IllegalArgumentException("UniqueId is empty");
if (!raTemplates.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
raTemplates.remove(uniqueId);
raRoots.remove(uniqueId);
@@ -141,7 +147,7 @@
throw new IllegalArgumentException("UniqueId is empty");
if (!raTemplates.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
Connector md = raTemplates.get(uniqueId);
@@ -169,7 +175,7 @@
throw new IllegalArgumentException("UniqueId is empty");
if (!raRoots.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
return raRoots.get(uniqueId);
}
@@ -186,7 +192,7 @@
throw new IllegalArgumentException("UniqueId is empty");
if (!ironJacamar.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
return ironJacamar.get(uniqueId);
}
@@ -259,7 +265,7 @@
throw new IllegalArgumentException("Jndi is empty");
if (!jndiMappings.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
Map<String, List<String>> mappings = jndiMappings.get(uniqueId);
@@ -310,7 +316,7 @@
throw new IllegalArgumentException("UniqueId is empty");
if (!jndiMappings.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
Map<String, List<String>> mappings = jndiMappings.get(uniqueId);
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.naming;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.spi.naming.JndiStrategy;
@@ -38,6 +39,7 @@
import javax.resource.Referenceable;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
import org.jboss.util.naming.Util;
/**
@@ -50,7 +52,10 @@
private static CoreLogger log = Logger.getMessageLogger(CoreLogger.class, ExplicitJndiStrategy.class.getName());
private static boolean trace = log.isTraceEnabled();
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
private static ConcurrentMap<String, Object> objs = new ConcurrentHashMap<String, Object>();
/**
@@ -133,7 +138,7 @@
ref.add(new StringRefAddr("name", jndiName));
if (objs.putIfAbsent(qualifiedName(jndiName, className), cf) != null)
- throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
+ throw new Exception(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
Referenceable referenceable = (Referenceable)cf;
referenceable.setReference(ref);
@@ -298,7 +303,7 @@
ref.add(new StringRefAddr("name", jndiName));
if (objs.putIfAbsent(qualifiedName(jndiName, className), ao) != null)
- throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
+ throw new Exception(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
Referenceable referenceable = (Referenceable)ao;
referenceable.setReference(ref);
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.naming;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.spi.naming.JndiStrategy;
@@ -38,6 +39,7 @@
import javax.resource.Referenceable;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
import org.jboss.util.naming.Util;
/**
@@ -53,7 +55,10 @@
private static CoreLogger log = Logger.getMessageLogger(CoreLogger.class, SimpleJndiStrategy.class.getName());
private static boolean trace = log.isTraceEnabled();
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** JNDI prefix for connection factories */
private static final String CF_JNDI_PREFIX = "java:/eis/";
@@ -146,7 +151,7 @@
ref.add(new StringRefAddr("name", jndiName));
if (objs.putIfAbsent(qualifiedName(jndiName, className), cf) != null)
- throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
+ throw new Exception(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
Referenceable referenceable = (Referenceable)cf;
referenceable.setReference(ref);
@@ -318,7 +323,7 @@
ref.add(new StringRefAddr("name", jndiName));
if (objs.putIfAbsent(qualifiedName(jndiName, className), ao) != null)
- throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
+ throw new Exception(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
Referenceable referenceable = (Referenceable)ao;
referenceable.setReference(ref);
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/ActivationImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/ActivationImpl.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/ActivationImpl.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.rar;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.spi.rar.Activation;
import org.jboss.jca.core.spi.rar.NotFoundException;
@@ -33,13 +34,18 @@
import javax.resource.spi.ActivationSpec;
import javax.resource.spi.ResourceAdapter;
+import org.jboss.logging.Messages;
+
/**
* An activation implementation
*
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
public class ActivationImpl implements Activation
-{
+{
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** Resource adapter */
private WeakReference<ResourceAdapter> rar;
@@ -95,12 +101,12 @@
Class<?> clz = activationSpecClass.get();
if (clz == null)
- throw new NotFoundException("The activation spec class is no longer available");
+ throw new NotFoundException(bundle.activationSpecClassNotAvailable());
ResourceAdapter ra = rar.get();
if (ra == null)
- throw new NotFoundException("The resource adapter is no longer available");
+ throw new NotFoundException(bundle.resourceAdapterNotAvailable());
ActivationSpec instance = ActivationSpec.class.cast(clz.newInstance());
instance.setResourceAdapter(ra);
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/EndpointImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/EndpointImpl.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/EndpointImpl.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.rar;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.bv.BeanValidationUtil;
import org.jboss.jca.core.spi.rar.Endpoint;
@@ -36,6 +37,8 @@
import javax.validation.Validator;
import javax.validation.groups.Default;
+import org.jboss.logging.Messages;
+
/**
* An endpoint representation
*
@@ -45,7 +48,10 @@
{
/** The reference to the resource adapter instance */
private WeakReference<ResourceAdapter> ra;
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/**
* Constructor
* @param ra The resource adapter reference
@@ -71,7 +77,7 @@
ResourceAdapter rar = ra.get();
if (rar == null)
- throw new ResourceException("ResourceAdapter instance not active");
+ throw new ResourceException(bundle.resourceAdapterInstanceNotActive());
spec.validate();
@@ -80,7 +86,7 @@
if (errors != null && errors.size() > 0)
{
- throw new ResourceException("Validation exception", new ConstraintViolationException(errors));
+ throw new ResourceException(bundle.validationException(), new ConstraintViolationException(errors));
}
rar.endpointActivation(endpointFactory, spec);
@@ -101,7 +107,7 @@
ResourceAdapter rar = ra.get();
if (rar == null)
- throw new ResourceException("ResourceAdapter instance not active");
+ throw new ResourceException(bundle.resourceAdapterInstanceNotActive());
rar.endpointDeactivation(endpointFactory, spec);
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/SimpleResourceAdapterRepository.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/SimpleResourceAdapterRepository.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/rar/SimpleResourceAdapterRepository.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -27,6 +27,7 @@
import org.jboss.jca.common.api.metadata.ra.RequiredConfigProperty;
import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
import org.jboss.jca.common.api.metadata.ra.ra15.Activationspec15;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.spi.mdr.MetadataRepository;
import org.jboss.jca.core.spi.rar.Endpoint;
@@ -47,6 +48,7 @@
import javax.resource.spi.ResourceAdapter;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
/**
* A simple implementation of the resource adapter repository
@@ -54,7 +56,10 @@
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
public class SimpleResourceAdapterRepository implements ResourceAdapterRepository
-{
+{
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** The logger */
private static CoreLogger log = Logger.getMessageLogger(CoreLogger.class,
SimpleResourceAdapterRepository.class.getName());
@@ -120,7 +125,7 @@
throw new IllegalArgumentException("Key is null");
if (!rars.keySet().contains(key))
- throw new NotFoundException(key + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(key));
rars.remove(key);
}
@@ -232,12 +237,12 @@
throw new IllegalArgumentException("UniqueId is empty");
if (!rars.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
WeakReference<ResourceAdapter> ra = rars.get(uniqueId);
if (ra.get() == null)
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
return new EndpointImpl(ra);
}
@@ -255,12 +260,12 @@
throw new IllegalArgumentException("UniqueId is empty");
if (!rars.containsKey(uniqueId))
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
WeakReference<ResourceAdapter> ra = rars.get(uniqueId);
if (ra.get() == null)
- throw new NotFoundException(uniqueId + " isn't registered");
+ throw new NotFoundException(bundle.keyNotRegistered(uniqueId));
if (mdr == null)
throw new IllegalStateException("MDR is null");
@@ -289,12 +294,12 @@
}
catch (Throwable t)
{
- throw new NotFoundException("Unable to lookup resource adapter in MDR: " + uniqueId, t);
+ throw new NotFoundException(bundle.unableLookupResourceAdapterInMDR(uniqueId), t);
}
}
if (md == null)
- throw new NotFoundException("Unable to lookup resource adapter in MDR: " + uniqueId);
+ throw new NotFoundException(bundle.unableLookupResourceAdapterInMDR(uniqueId));
if (md.getResourceadapter() != null && md.getResourceadapter() instanceof ResourceAdapter1516)
{
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.core.recovery;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
@@ -29,6 +30,7 @@
import javax.resource.ResourceException;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
/**
* Default implementation of a recovery plugin.
@@ -41,6 +43,9 @@
/** Log instance */
private static CoreLogger log = Logger.getMessageLogger(CoreLogger.class, DefaultRecoveryPlugin.class.getName());
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/**
* Constructor
*/
@@ -90,7 +95,7 @@
catch (ResourceException re)
{
log.exceptionDuringConnectionClose(re);
- throw new ResourceException("Error during connection close", re);
+ throw new ResourceException(bundle.errorDuringConnectionClose(), re);
}
}
else
@@ -104,7 +109,7 @@
catch (Throwable t)
{
log.debug("Error during connection close()", t);
- throw new ResourceException("Error during connection close()", t);
+ throw new ResourceException(bundle.errorDuringConnectionClose(), t);
}
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/jbossts/LocalXAResourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/jbossts/LocalXAResourceImpl.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/jbossts/LocalXAResourceImpl.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.core.tx.jbossts;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.connectionmanager.ConnectionManager;
import org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener;
@@ -33,6 +34,7 @@
import javax.transaction.xa.Xid;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
/**
* Local XA resource implementation.
@@ -47,6 +49,9 @@
private static boolean trace = log.isTraceEnabled();
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** Connection listener */
private ConnectionListener cl;
@@ -95,14 +100,13 @@
if (currentXid != null && flags == XAResource.TMNOFLAGS)
{
- throw new LocalXAException("Trying to start a new tx when old is not complete! old: " +
- currentXid + ", new " + xid + ", flags " + flags, XAException.XAER_PROTO);
+ throw new LocalXAException(bundle.tryingStartNewTxWhenOldNotComplete(
+ currentXid, xid, flags), XAException.XAER_PROTO);
}
if (currentXid == null && flags != XAResource.TMNOFLAGS)
{
- throw new LocalXAException("Trying to start a new tx with wrong flags! new " + xid +
- ", flags " + flags, XAException.XAER_PROTO);
+ throw new LocalXAException(bundle.tryingStartNewTxWithWrongFlags(xid, flags), XAException.XAER_PROTO);
}
if (currentXid == null)
@@ -113,11 +117,11 @@
}
catch (ResourceException re)
{
- throw new LocalXAException("Error trying to start local tx: ", XAException.XAER_RMERR, re);
+ throw new LocalXAException(bundle.errorTryingStartLocalTx(), XAException.XAER_RMERR, re);
}
catch (Throwable t)
{
- throw new LocalXAException("Throwable trying to start local transaction!", XAException.XAER_RMERR, t);
+ throw new LocalXAException(bundle.throwableTryingStartLocalTx(), XAException.XAER_RMERR, t);
}
currentXid = xid;
@@ -140,8 +144,7 @@
{
if (!xid.equals(currentXid))
{
- throw new LocalXAException("Wrong xid in commit: expected: " + currentXid +
- ", got: " + xid, XAException.XAER_PROTO);
+ throw new LocalXAException(bundle.wrongXidInCommit(currentXid, xid), XAException.XAER_PROTO);
}
@@ -154,7 +157,7 @@
catch (ResourceException re)
{
connectionManager.returnManagedConnection(cl, true);
- throw new LocalXAException("Could not commit local tx", XAException.XA_RBROLLBACK, re);
+ throw new LocalXAException(bundle.couldNotCommitLocalTx(), XAException.XA_RBROLLBACK, re);
}
}
@@ -163,7 +166,7 @@
*/
public void forget(Xid xid) throws XAException
{
- throw new LocalXAException("Forget not supported in local tx", XAException.XAER_RMERR);
+ throw new LocalXAException(bundle.forgetNotSupportedInLocalTx(), XAException.XAER_RMERR);
}
/**
@@ -201,7 +204,7 @@
*/
public Xid[] recover(int flag) throws XAException
{
- throw new LocalXAException("No recover with local-tx only resource managers", XAException.XAER_RMERR);
+ throw new LocalXAException(bundle.noRecoverWithLocalTxResourceManagers(), XAException.XAER_RMERR);
}
/**
@@ -211,8 +214,7 @@
{
if (!xid.equals(currentXid))
{
- throw new LocalXAException("Wrong xid in rollback: expected: " +
- currentXid + ", got: " + xid, XAException.XAER_PROTO);
+ throw new LocalXAException(bundle.wrongXidInRollback(currentXid, xid), XAException.XAER_PROTO);
}
currentXid = null;
try
@@ -222,7 +224,7 @@
catch (ResourceException re)
{
connectionManager.returnManagedConnection(cl, true);
- throw new LocalXAException("Could not rollback local tx", XAException.XAER_RMERR, re);
+ throw new LocalXAException(bundle.couldNotRollbackLocalTx(), XAException.XAER_RMERR, re);
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/tx/noopts/LocalXAResourceImpl.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.core.tx.noopts;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.api.connectionmanager.ConnectionManager;
import org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener;
import org.jboss.jca.core.spi.transaction.local.LocalXAException;
@@ -30,6 +31,8 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import org.jboss.logging.Messages;
+
/**
* Local XA resource implementation.
*
@@ -37,6 +40,9 @@
*/
public class LocalXAResourceImpl implements LocalXAResource
{
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/**
* Creates a new instance.
*/
@@ -84,7 +90,7 @@
*/
public void forget(Xid xid) throws XAException
{
- throw new LocalXAException("Forget not supported in local tx", XAException.XAER_RMERR);
+ throw new LocalXAException(bundle.forgetNotSupportedInLocalTx(), XAException.XAER_RMERR);
}
/**
@@ -116,7 +122,7 @@
*/
public Xid[] recover(int flag) throws XAException
{
- throw new LocalXAException("No recover with local-tx only resource managers", XAException.XAER_RMERR);
+ throw new LocalXAException(bundle.noRecoverWithLocalTxResourceManagers(), XAException.XAER_RMERR);
}
/**
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkManagerImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkManagerImpl.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkManagerImpl.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.workmanager;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import org.jboss.jca.core.api.workmanager.WorkManager;
import org.jboss.jca.core.spi.security.Callback;
@@ -52,6 +53,7 @@
import javax.resource.spi.work.WorkRejectedException;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
import org.jboss.threads.BlockingExecutor;
import org.jboss.threads.ExecutionTimedOutException;
@@ -67,7 +69,10 @@
/** Whether trace is enabled */
private static boolean trace = log.isTraceEnabled();
-
+
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/**Work run method name*/
private static final String RUN_METHOD_NAME = "run";
@@ -238,17 +243,18 @@
WorkListener workListener)
throws WorkException
{
- log.tracef("doWork(%s, %s, %s, %s)", work, startTimeout, execContext, workListener);
+ if (trace)
+ log.tracef("doWork(%s, %s, %s, %s)", work, startTimeout, execContext, workListener);
WorkException exception = null;
WorkWrapper wrapper = null;
try
{
if (work == null)
- throw new WorkRejectedException("Work is null");
+ throw new WorkRejectedException(bundle.workIsNull());
if (startTimeout < 0)
- throw new WorkRejectedException("StartTimeout is negative: " + startTimeout);
+ throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout));
checkAndVerifyWork(work, execContext);
@@ -298,7 +304,7 @@
catch (InterruptedException ie)
{
Thread.currentThread().interrupt();
- exception = new WorkRejectedException("Interrupted while requesting permit");
+ exception = new WorkRejectedException(bundle.interruptedWhileRequestingPermit());
}
finally
{
@@ -342,10 +348,10 @@
try
{
if (work == null)
- throw new WorkRejectedException("Work is null");
+ throw new WorkRejectedException(bundle.workIsNull());
if (startTimeout < 0)
- throw new WorkRejectedException("StartTimeout is negative: " + startTimeout);
+ throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout));
long started = System.currentTimeMillis();
@@ -399,7 +405,7 @@
catch (InterruptedException ie)
{
Thread.currentThread().interrupt();
- exception = new WorkRejectedException("Interrupted while requesting permit");
+ exception = new WorkRejectedException(bundle.interruptedWhileRequestingPermit());
}
finally
{
@@ -445,10 +451,10 @@
try
{
if (work == null)
- throw new WorkRejectedException("Work is null");
+ throw new WorkRejectedException(bundle.workIsNull());
if (startTimeout < 0)
- throw new WorkRejectedException("StartTimeout is negative: " + startTimeout);
+ throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout));
checkAndVerifyWork(work, execContext);
@@ -494,7 +500,7 @@
catch (InterruptedException ie)
{
Thread.currentThread().interrupt();
- exception = new WorkRejectedException("Interrupted while requesting permit");
+ exception = new WorkRejectedException(bundle.interruptedWhileRequestingPermit());
}
finally
{
@@ -570,8 +576,7 @@
//Implements WorkContextProvider and not-null ExecutionContext
if (executionContext != null)
{
- throw new WorkRejectedException("Work execution context must be null because " +
- "work instance implements WorkContextProvider!");
+ throw new WorkRejectedException(bundle.workExecutionContextMustNullImplementsWorkContextProvider());
}
}
}
@@ -593,7 +598,7 @@
if (!result)
{
- throw new WorkException(workClass.getName() + ": Run method is synchronized");
+ throw new WorkException(bundle.runMethodIsSynchronized(workClass.getName()));
}
result = verifyWorkMethods(workClass, RELEASE_METHOD_NAME, null, workClass.getName() +
@@ -601,7 +606,7 @@
if (!result)
{
- throw new WorkException(workClass.getName() + ": Release method is synchronized");
+ throw new WorkException(bundle.releaseMethodIsSynchronized(workClass.getName()));
}
validatedWork.add(work.getClass().getName());
@@ -686,7 +691,7 @@
fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
- throw new WorkCompletedException("Unsupported WorkContext class : " + context.getClass().getName(),
+ throw new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
}
// Duplicate checks
@@ -704,8 +709,8 @@
fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS);
- throw new WorkCompletedException("Duplicate TransactionWorkContext class : " +
- context.getClass().getName(), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
+ throw new WorkCompletedException(bundle.duplicateTransactionWorkContextClass(
+ context.getClass().getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
}
else
{
@@ -724,9 +729,8 @@
fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS);
- throw new WorkCompletedException("Duplicate SecurityWorkContext class : " +
- context.getClass().getName(),
- WorkContextErrorCodes.DUPLICATE_CONTEXTS);
+ throw new WorkCompletedException(bundle.duplicateSecurityWorkContextClass(
+ context.getClass().getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
}
else
{
@@ -745,9 +749,8 @@
fireWorkContextSetupFailed(context, WorkContextErrorCodes.DUPLICATE_CONTEXTS);
- throw new WorkCompletedException("Duplicate HintWorkContext class : " +
- context.getClass().getName(),
- WorkContextErrorCodes.DUPLICATE_CONTEXTS);
+ throw new WorkCompletedException(bundle.duplicateHintWorkContextClass(
+ context.getClass().getName()), WorkContextErrorCodes.DUPLICATE_CONTEXTS);
}
else
{
@@ -759,8 +762,7 @@
{
fireWorkContextSetupFailed(context, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
- throw new WorkCompletedException("Unsupported WorkContext class : " +
- context.getClass().getName(),
+ throw new WorkCompletedException(bundle.unsupportedWorkContextClass(context.getClass().getName()),
WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE);
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkWrapper.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkWrapper.java 2011-06-07 04:30:18 UTC (rev 111531)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/workmanager/WorkWrapper.java 2011-06-07 10:33:03 UTC (rev 111532)
@@ -22,6 +22,7 @@
package org.jboss.jca.core.workmanager;
+import org.jboss.jca.core.CoreBundle;
import org.jboss.jca.core.CoreLogger;
import java.security.Principal;
@@ -51,6 +52,7 @@
import javax.transaction.xa.Xid;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
import org.jboss.security.SecurityContextAssociation;
import org.jboss.security.SecurityContextFactory;
@@ -72,6 +74,9 @@
/** Whether we are tracing */
private static boolean trace = log.isTraceEnabled();
+ /** The bundle */
+ private static CoreBundle bundle = Messages.getBundle(CoreBundle.class);
+
/** The work */
private Work work;
@@ -322,14 +327,14 @@
{
log.securityContextSetupFailed(t.getMessage(), t);
fireWorkContextSetupFailed(ctx);
- throw new WorkException("SecurityContext setup failed: " + t.getMessage(), t);
+ throw new WorkException(bundle.securityContextSetupFailed(t.getMessage()), t);
}
}
else if (securityContext != null && workManager.getCallbackSecurity() == null)
{
log.securityContextSetupFailedCallbackSecurityNull();
fireWorkContextSetupFailed(ctx);
- throw new WorkException("SecurityContext setup failed since CallbackSecurity was null");
+ throw new WorkException(bundle.securityContextSetupFailedSinceCallbackSecurityWasNull());
}
//Fires Context setup complete
More information about the jboss-cvs-commits
mailing list