[jboss-cvs] JBossAS SVN: r112126 - in projects/jboss-jca/branches/Branch_1_0/deployers/src: test/java/org/jboss/jca/test/deployers/spec and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 25 11:11:52 EDT 2011
Author: jesper.pedersen
Date: 2011-08-25 11:11:52 -0400 (Thu, 25 Aug 2011)
New Revision: 112126
Added:
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RaXml2TestCase.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/ra16out2-ra.xml
Modified:
projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
Log:
[JBJCA-658] Double registration fails
Modified: projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-08-25 15:08:05 UTC (rev 112125)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-08-25 15:11:52 UTC (rev 112126)
@@ -416,7 +416,7 @@
* @param ra The metadata
* @return The classes
*/
- private List<String> findAdminObjects(org.jboss.jca.common.api.metadata.ra.ResourceAdapter ra)
+ private List<String> resolveAdminObjects(org.jboss.jca.common.api.metadata.ra.ResourceAdapter ra)
{
List<String> result = new ArrayList<String>(1);
@@ -446,16 +446,17 @@
* @return The metadata; <code>null</code> if none could be found
* @exception DeployException Thrown in case of configuration error
*/
- protected org.jboss.jca.common.api.metadata.common.CommonConnDef findConnectionDefinition(String clz,
- List<String> mcfs,
- List<org.jboss.jca.common.api.metadata.common.CommonConnDef> defs) throws DeployException
+ protected Set<CommonConnDef> findConnectionDefinitions(String clz, List<String> mcfs, List<CommonConnDef> defs)
+ throws DeployException
{
+ Set<CommonConnDef> result = null;
+
if (mcfs != null && defs != null)
{
// If there is only one we will return that
if (mcfs.size() == 1 && defs.size() == 1)
{
- org.jboss.jca.common.api.metadata.common.CommonConnDef cd = defs.get(0);
+ CommonConnDef cd = defs.get(0);
if (cd.getClassName() != null && !clz.equals(cd.getClassName()))
{
@@ -463,21 +464,29 @@
throw new DeployException(clz + " not a valid connection definition");
}
- return cd;
+ result = new HashSet<CommonConnDef>(1);
+ result.add(cd);
+
+ return result;
}
// If there are multiple definitions the MCF class name is mandatory
if (clz == null)
throw new IllegalArgumentException(bundle.undefinedManagedConnectionFactory());
- for (org.jboss.jca.common.api.metadata.common.CommonConnDef cd : defs)
+ for (CommonConnDef cd : defs)
{
if (clz.equals(cd.getClassName()))
- return cd;
+ {
+ if (result == null)
+ result = new HashSet<CommonConnDef>();
+
+ result.add(cd);
+ }
}
}
- return null;
+ return result;
}
/**
@@ -488,10 +497,11 @@
* @return The metadata; <code>null</code> if none could be found
* @exception DeployException Thrown in case of configuration error
*/
- protected org.jboss.jca.common.api.metadata.common.CommonAdminObject findAdminObject(String clz,
- List<String> aos,
- List<org.jboss.jca.common.api.metadata.common.CommonAdminObject> defs) throws DeployException
+ protected Set<CommonAdminObject> findAdminObjects(String clz, List<String> aos, List<CommonAdminObject> defs)
+ throws DeployException
{
+ Set<CommonAdminObject> result = null;
+
if (aos != null && defs != null)
{
// If there is only one we will return that
@@ -505,7 +515,10 @@
throw new DeployException(clz + " not a valid admin object");
}
- return cao;
+ result = new HashSet<CommonAdminObject>(1);
+ result.add(cao);
+
+ return result;
}
// If there are multiple definitions the admin object class name is mandatory
@@ -515,11 +528,16 @@
for (org.jboss.jca.common.api.metadata.common.CommonAdminObject cao : defs)
{
if (clz.equals(cao.getClassName()))
- return cao;
+ {
+ if (result == null)
+ result = new HashSet<CommonAdminObject>();
+
+ result.add(cao);
+ }
}
}
- return null;
+ return result;
}
/**
@@ -698,7 +716,7 @@
List<AdminObject> aoMetas = ra1516.getAdminObjects();
if (aoMetas.size() > 0)
{
- List<String> aosClz = findAdminObjects(ra1516);
+ List<String> aosClz = resolveAdminObjects(ra1516);
for (int i = 0; i < aoMetas.size(); i++)
{
@@ -712,83 +730,77 @@
if (!(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures,
Severity.ERROR)))
{
- CommonAdminObject aoRaXml = null;
- CommonAdminObject ijAO = null;
- boolean aoActivation = false;
+ Set<CommonAdminObject> adminObjects = null;
if (aosRaXml != null)
- aoRaXml = findAdminObject(aoMeta.getAdminobjectClass().getValue(),
- aosClz, aosRaXml);
+ adminObjects = findAdminObjects(aoMeta.getAdminobjectClass().getValue(),
+ aosClz, aosRaXml);
- if (aosIronJacamar != null)
- ijAO = findAdminObject(aoMeta.getAdminobjectClass().getValue(),
- aosClz, aosIronJacamar);
+ if (adminObjects == null && aosIronJacamar != null)
+ adminObjects = findAdminObjects(aoMeta.getAdminobjectClass().getValue(),
+ aosClz, aosIronJacamar);
- if (aoRaXml != null ||
- ijAO != null ||
- (!requireExplicitJndiBindings() &&
- aosRaXml == null &&
- aosIronJacamar == null &&
- aosClz.size() == 1))
+ if (!requireExplicitJndiBindings() &&
+ aosRaXml == null && aosIronJacamar == null &&
+ aosClz.size() == 1)
{
- aoActivation = true;
+ adminObjects = new HashSet<CommonAdminObject>(1);
+ adminObjects.add(null);
}
- if (activateDeployment && aoActivation)
+ if (activateDeployment && adminObjects != null)
{
- Object ao = initAndInject(aoMeta.getAdminobjectClass().getValue(),
- aoMeta.getConfigProperties(), cl);
-
- if (trace)
+ for (CommonAdminObject adminObject : adminObjects)
{
- log.trace("AdminObject: " + ao.getClass().getName());
- log.trace("AdminObject defined in classloader: " + ao.getClass().getClassLoader());
- }
+ Object ao = initAndInject(aoMeta.getAdminobjectClass().getValue(),
+ aoMeta.getConfigProperties(), cl);
- archiveValidationObjects.add(new ValidateObject(Key.ADMIN_OBJECT, ao, aoMeta
- .getConfigProperties()));
- beanValidationObjects.add(ao);
+ if (trace)
+ {
+ log.trace("AdminObject: " + ao.getClass().getName());
+ log.trace("AdminObject defined in classloader: " + ao.getClass().getClassLoader());
+ }
- if (ao != null && ao instanceof Serializable && ao instanceof Referenceable)
- {
- try
+ archiveValidationObjects.add(new ValidateObject(Key.ADMIN_OBJECT, ao, aoMeta
+ .getConfigProperties()));
+ beanValidationObjects.add(ao);
+
+ if (ao != null && ao instanceof Serializable && ao instanceof Referenceable)
{
- String jndiName = null;
- if (aoRaXml != null || ijAO != null)
+ try
{
- if (aoRaXml != null)
+ String jndiName = null;
+ if (adminObject != null)
{
- jndiName = buildJndiName(aoRaXml.getJndiName(), aoRaXml.isUseJavaContext());
+ jndiName = buildJndiName(adminObject.getJndiName(),
+ adminObject.isUseJavaContext());
+
+ bindAdminObject(url, deploymentName, ao, jndiName);
}
else
{
- jndiName = buildJndiName(ijAO.getJndiName(), ijAO.isUseJavaContext());
+ String[] names = bindAdminObject(url, deploymentName, ao);
+ jndiName = names[0];
}
- bindAdminObject(url, deploymentName, ao, jndiName);
- }
- else
- {
- String[] names = bindAdminObject(url, deploymentName, ao);
- jndiName = names[0];
- }
+ aos.add(ao);
+ aoJndiNames.add(jndiName);
- aos.add(ao);
- aoJndiNames.add(jndiName);
+ org.jboss.jca.core.api.management.AdminObject mgtAo =
+ new org.jboss.jca.core.api.management.AdminObject(ao);
- org.jboss.jca.core.api.management.AdminObject mgtAo =
- new org.jboss.jca.core.api.management.AdminObject(ao);
+ mgtAo.getConfigProperties().
+ addAll(createManagementView(aoMeta.getConfigProperties()));
+ mgtAo.setJndiName(jndiName);
- mgtAo.getConfigProperties().
- addAll(createManagementView(aoMeta.getConfigProperties()));
- mgtAo.setJndiName(jndiName);
-
- mgtConnector.getAdminObjects().add(mgtAo);
+ mgtConnector.getAdminObjects().add(mgtAo);
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException(bundle.failedToBindAdminObject(ao.getClass().getName()),
+ t);
+ }
}
- catch (Throwable t)
- {
- throw new DeployException(bundle.failedToBindAdminObject(ao.getClass().getName()), t);
- }
}
}
else
@@ -948,9 +960,7 @@
List<String> mcfs = findManagedConnectionFactories(ra10);
- CommonConnDef ijCD = null;
- CommonConnDef cdRaXml = null;
- boolean mcfActivation = false;
+ Set<CommonConnDef> connectionDefinitions = null;
if (raxml != null)
{
@@ -958,355 +968,303 @@
if (cdDefs != null)
{
- cdRaXml = findConnectionDefinition(ra10.getManagedConnectionFactoryClass().getValue(),
- mcfs, cdDefs);
+ connectionDefinitions =
+ findConnectionDefinitions(ra10.getManagedConnectionFactoryClass().getValue(), mcfs, cdDefs);
}
}
- if (cdRaXml == null && ijmd != null)
+ if (connectionDefinitions == null && ijmd != null)
{
List<CommonConnDef> cdDefs = ijmd.getConnectionDefinitions();
if (cdDefs != null)
{
- ijCD = findConnectionDefinition(ra10.getManagedConnectionFactoryClass().getValue(),
- mcfs, cdDefs);
+ connectionDefinitions =
+ findConnectionDefinitions(ra10.getManagedConnectionFactoryClass().getValue(), mcfs, cdDefs);
}
}
- if (cdRaXml != null ||
- ijCD != null ||
- (!requireExplicitJndiBindings() && raxml == null && ijmd == null && mcfs.size() == 1))
+ if (!requireExplicitJndiBindings() && raxml == null && ijmd == null && mcfs.size() == 1)
{
- mcfActivation = true;
+ connectionDefinitions = new HashSet<CommonConnDef>(1);
+ connectionDefinitions.add(null);
}
- if (activateDeployment && mcfActivation)
+ if (activateDeployment && connectionDefinitions != null)
{
- if (ijCD == null || ijCD.isEnabled() || (cdRaXml != null && cdRaXml.isEnabled()))
+ for (CommonConnDef connectionDefinition : connectionDefinitions)
{
- String mcfClz = ra10.getManagedConnectionFactoryClass().getValue();
- Object om = initAndInject(mcfClz, ra10.getConfigProperties(), cl);
+ if (connectionDefinition == null || connectionDefinition.isEnabled())
+ {
+ String mcfClz = ra10.getManagedConnectionFactoryClass().getValue();
+ Object om = initAndInject(mcfClz, ra10.getConfigProperties(), cl);
- if (om == null || !(om instanceof ManagedConnectionFactory))
- throw new DeployException(bundle.invalidManagedConnectionFactory(mcfClz));
+ if (om == null || !(om instanceof ManagedConnectionFactory))
+ throw new DeployException(bundle.invalidManagedConnectionFactory(mcfClz));
- ManagedConnectionFactory mcf = (ManagedConnectionFactory)om;
+ ManagedConnectionFactory mcf = (ManagedConnectionFactory)om;
- if (trace)
- {
- log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
- log.trace("ManagedConnectionFactory is defined in classloader: " +
- mcf.getClass().getClassLoader());
- }
+ if (trace)
+ {
+ log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+ log.trace("ManagedConnectionFactory is defined in classloader: " +
+ mcf.getClass().getClassLoader());
+ }
- mcf.setLogWriter(getLogPrintWriter());
+ mcf.setLogWriter(getLogPrintWriter());
- archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, mcf, ra10
- .getConfigProperties()));
- beanValidationObjects.add(mcf);
- associateResourceAdapter(resourceAdapter, mcf);
- // Create the pool
- PoolConfiguration pc = null;
- FlushStrategy flushStrategy = FlushStrategy.FAILING_CONNECTION_ONLY;
+ archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, mcf, ra10
+ .getConfigProperties()));
+ beanValidationObjects.add(mcf);
+ associateResourceAdapter(resourceAdapter, mcf);
+ // Create the pool
+ PoolConfiguration pc = null;
+ FlushStrategy flushStrategy = null;
- if (cdRaXml != null)
- {
- pc = createPoolConfiguration(cdRaXml.getPool(), cdRaXml.getTimeOut(), cdRaXml.getValidation());
+ if (connectionDefinition != null)
+ {
+ pc = createPoolConfiguration(connectionDefinition.getPool(),
+ connectionDefinition.getTimeOut(),
+ connectionDefinition.getValidation());
- if (cdRaXml.getPool() != null)
- flushStrategy = cdRaXml.getPool().getFlushStrategy();
- }
- else if (ijCD != null)
- {
- pc = createPoolConfiguration(ijCD.getPool(), ijCD.getTimeOut(), ijCD.getValidation());
+ if (connectionDefinition.getPool() != null)
+ flushStrategy = connectionDefinition.getPool().getFlushStrategy();
+ }
+ else
+ {
+ // Default default settings
+ pc = createPoolConfiguration(null, null, null);
+ }
- if (ijCD.getPool() != null)
- flushStrategy = ijCD.getPool().getFlushStrategy();
- }
- else
- {
- // Default default settings
- pc = createPoolConfiguration(null, null, null);
- }
- PoolFactory pf = new PoolFactory();
+ if (flushStrategy == null)
+ flushStrategy = FlushStrategy.FAILING_CONNECTION_ONLY;
- Boolean noTxSeparatePool = Boolean.FALSE;
+ PoolFactory pf = new PoolFactory();
- if (cdRaXml != null && cdRaXml.getPool() != null && cdRaXml.isXa())
- {
- CommonXaPool ijXaPool = (CommonXaPool) cdRaXml.getPool();
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
- else if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
+ Boolean noTxSeparatePool = Boolean.FALSE;
- PoolStrategy strategy = PoolStrategy.ONE_POOL;
- String securityDomain = null;
+ if (connectionDefinition != null &&
+ connectionDefinition.getPool() != null &&
+ connectionDefinition.isXa())
+ {
+ CommonXaPool xaPool = (CommonXaPool)connectionDefinition.getPool();
+ if (xaPool != null)
+ noTxSeparatePool = xaPool.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;
- if (security != null)
- {
- if (security.isApplication())
+ CommonSecurity security = null;
+ if (connectionDefinition != null && connectionDefinition.getSecurity() != null)
{
- strategy = PoolStrategy.POOL_BY_CRI;
+ security = connectionDefinition.getSecurity();
}
- else if (security.getSecurityDomain() != null &&
- security.getSecurityDomain().trim().length() != 0)
+
+ if (security != null)
{
- strategy = PoolStrategy.POOL_BY_SUBJECT;
- securityDomain = security.getSecurityDomain();
+ if (security.isApplication())
+ {
+ strategy = PoolStrategy.POOL_BY_CRI;
+ }
+ else if (security.getSecurityDomain() != null &&
+ security.getSecurityDomain().trim().length() != 0)
+ {
+ strategy = PoolStrategy.POOL_BY_SUBJECT;
+ securityDomain = security.getSecurityDomain();
+ }
+ else if (security.getSecurityDomainAndApplication() != null &&
+ security.getSecurityDomainAndApplication().trim().length() != 0)
+ {
+ strategy = PoolStrategy.POOL_BY_SUBJECT_AND_CRI;
+ securityDomain = security.getSecurityDomainAndApplication();
+ }
}
- else if (security.getSecurityDomainAndApplication() != null &&
- security.getSecurityDomainAndApplication().trim().length() != 0)
+
+ if (ra10 != null && ra10.getReauthenticationSupport() != null &&
+ ra10.getReauthenticationSupport().booleanValue())
{
- strategy = PoolStrategy.POOL_BY_SUBJECT_AND_CRI;
- securityDomain = security.getSecurityDomainAndApplication();
+ strategy = PoolStrategy.REAUTH;
}
- }
+ Pool pool = pf.create(strategy, mcf, pc, noTxSeparatePool.booleanValue());
- if (ra10 != null && ra10.getReauthenticationSupport() != null &&
- ra10.getReauthenticationSupport().booleanValue())
- {
- strategy = PoolStrategy.REAUTH;
- }
+ // Add a connection manager
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ConnectionManager cm = null;
- Pool pool = pf.create(strategy, mcf, pc, noTxSeparatePool.booleanValue());
-
- // Add a connection manager
- ConnectionManagerFactory cmf = new ConnectionManagerFactory();
- ConnectionManager cm = null;
-
- TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
- if (raxml != null && raxml.getTransactionSupport() != null)
- {
- tsmd = raxml.getTransactionSupport();
- }
- else if (ijmd != null && ijmd.getTransactionSupport() != null)
- {
- tsmd = ijmd.getTransactionSupport();
- }
- else
- {
- tsmd = ra10.getTransactionSupport();
- }
-
- TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-
- if (tsmd == TransactionSupportEnum.NoTransaction)
- {
- tsl = TransactionSupportLevel.NoTransaction;
- }
- else if (tsmd == TransactionSupportEnum.LocalTransaction)
- {
- tsl = TransactionSupportLevel.LocalTransaction;
- }
- else if (tsmd == TransactionSupportEnum.XATransaction)
- {
- tsl = TransactionSupportLevel.XATransaction;
- }
-
- // Section 7.13 -- Read from metadata -> overwrite with specified value if present
- if (mcf instanceof TransactionSupport)
- tsl = ((TransactionSupport) mcf).getTransactionSupport();
-
- // Connection manager properties
- Integer allocationRetry = null;
- Long allocationRetryWaitMillis = null;
- if (cdRaXml != null && cdRaXml.getTimeOut() != null)
- {
- allocationRetry = cdRaXml.getTimeOut().getAllocationRetry();
- allocationRetryWaitMillis = cdRaXml.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- if (ijCD != null && ijCD.getTimeOut() != null)
- {
- if (allocationRetry == null)
- allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-
- if (allocationRetryWaitMillis == null)
- allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- Boolean useCCM = Boolean.TRUE;
- if (ijCD != null)
- useCCM = ijCD.isUseCcm();
-
- // Select the correct connection manager
- if (tsl == TransactionSupportLevel.NoTransaction)
- {
- cm = cmf.createNonTransactional(tsl, pool,
- getSubjectFactory(securityDomain), securityDomain,
- useCCM, getCachedConnectionManager(),
- flushStrategy,
- allocationRetry, allocationRetryWaitMillis);
- }
- else
- {
- Boolean interleaving = null;
- Integer xaResourceTimeout = null;
- Boolean isSameRMOverride = null;
- Boolean wrapXAResource = null;
- Boolean padXid = null;
- if (cdRaXml != null && cdRaXml.isXa())
+ TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+ if (raxml != null && raxml.getTransactionSupport() != null)
{
- CommonXaPool ijXaPool = (CommonXaPool) cdRaXml.getPool();
-
- interleaving = ijXaPool.isInterleaving();
- isSameRMOverride = ijXaPool.isSameRmOverride();
- wrapXAResource = ijXaPool.isWrapXaResource();
- padXid = ijXaPool.isPadXid();
+ tsmd = raxml.getTransactionSupport();
}
-
- if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+ else if (ijmd != null && ijmd.getTransactionSupport() != null)
{
- CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
+ tsmd = ijmd.getTransactionSupport();
+ }
+ else
+ {
+ tsmd = ra10.getTransactionSupport();
+ }
- if (ijXaPool != null)
- {
- if (interleaving == null)
- interleaving = ijXaPool.isInterleaving();
+ TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
- if (isSameRMOverride == null)
- isSameRMOverride = ijXaPool.isSameRmOverride();
-
- if (wrapXAResource == null)
- wrapXAResource = ijXaPool.isWrapXaResource();
-
- if (padXid == null)
- padXid = ijXaPool.isPadXid();
- }
+ if (tsmd == TransactionSupportEnum.NoTransaction)
+ {
+ tsl = TransactionSupportLevel.NoTransaction;
}
+ else if (tsmd == TransactionSupportEnum.LocalTransaction)
+ {
+ tsl = TransactionSupportLevel.LocalTransaction;
+ }
+ else if (tsmd == TransactionSupportEnum.XATransaction)
+ {
+ tsl = TransactionSupportLevel.XATransaction;
+ }
- cm = cmf.createTransactional(tsl, pool,
- getSubjectFactory(securityDomain), securityDomain,
- useCCM, getCachedConnectionManager(),
- flushStrategy,
- allocationRetry, allocationRetryWaitMillis,
- getTransactionIntegration(), interleaving,
- xaResourceTimeout, isSameRMOverride,
- wrapXAResource, padXid);
- }
+ // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+ if (mcf instanceof TransactionSupport)
+ tsl = ((TransactionSupport) mcf).getTransactionSupport();
- // ConnectionFactory
- Object cf = mcf.createConnectionFactory(cm);
+ // Connection manager properties
+ Integer allocationRetry = null;
+ Long allocationRetryWaitMillis = null;
- if (cf == null)
- {
- log.nullConnectionFactory();
- }
- else
- {
- if (trace)
+ if (connectionDefinition != null && connectionDefinition.getTimeOut() != null)
{
- log.trace("ConnectionFactory: " + cf.getClass().getName());
- log.trace("ConnectionFactory defined in classloader: " + cf.getClass().getClassLoader());
+ allocationRetry = connectionDefinition.getTimeOut().getAllocationRetry();
+ allocationRetryWaitMillis = connectionDefinition.getTimeOut().getAllocationRetryWaitMillis();
}
- }
+
+ Boolean useCCM = Boolean.TRUE;
+ if (connectionDefinition != null)
+ useCCM = connectionDefinition.isUseCcm();
- archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
- {
- String jndiName;
- if (cdRaXml != null || ijCD != null)
+ // Select the correct connection manager
+ if (tsl == TransactionSupportLevel.NoTransaction)
{
- if (cdRaXml != null)
+ cm = cmf.createNonTransactional(tsl, pool,
+ getSubjectFactory(securityDomain), securityDomain,
+ useCCM, getCachedConnectionManager(),
+ flushStrategy,
+ allocationRetry, allocationRetryWaitMillis);
+ }
+ else
+ {
+ Boolean interleaving = null;
+ Integer xaResourceTimeout = null;
+ Boolean isSameRMOverride = null;
+ Boolean wrapXAResource = null;
+ Boolean padXid = null;
+ if (connectionDefinition != null && connectionDefinition.isXa())
{
- jndiName = buildJndiName(cdRaXml.getJndiName(), cdRaXml.isUseJavaContext());
- }
- else
- {
- jndiName = buildJndiName(ijCD.getJndiName(), ijCD.isUseJavaContext());
- }
+ CommonXaPool xaPool = (CommonXaPool)connectionDefinition.getPool();
- bindConnectionFactory(url, deploymentName, cf, jndiName);
- cfs.add(cf);
- cfJndiNames.add(jndiName);
-
- cm.setJndiName(jndiName);
-
- String poolName = null;
- if (cdRaXml != null)
- {
- poolName = cdRaXml.getPoolName();
+ interleaving = xaPool.isInterleaving();
+ isSameRMOverride = xaPool.isSameRmOverride();
+ wrapXAResource = xaPool.isWrapXaResource();
+ padXid = xaPool.isPadXid();
}
- else if (ijCD != null)
- {
- poolName = ijCD.getPoolName();
- }
- if (poolName == null)
- poolName = jndiName;
+ cm = cmf.createTransactional(tsl, pool,
+ getSubjectFactory(securityDomain), securityDomain,
+ useCCM, getCachedConnectionManager(),
+ flushStrategy,
+ allocationRetry, allocationRetryWaitMillis,
+ getTransactionIntegration(), interleaving,
+ xaResourceTimeout, isSameRMOverride,
+ wrapXAResource, padXid);
+ }
- pool.setName(poolName);
+ // ConnectionFactory
+ Object cf = mcf.createConnectionFactory(cm);
+
+ if (cf == null)
+ {
+ log.nullConnectionFactory();
}
else
{
- String[] bindCfJndiNames = bindConnectionFactory(url, deploymentName, cf);
-
- cfs.add(cf);
- cfJndiNames.addAll(Arrays.asList(bindCfJndiNames));
-
- cm.setJndiName(bindCfJndiNames[0]);
-
- String poolName = null;
- if (cdRaXml != null)
+ if (trace)
{
- poolName = cdRaXml.getPoolName();
+ log.trace("ConnectionFactory: " + cf.getClass().getName());
+ log.trace("ConnectionFactory defined in classloader: " + cf.getClass().getClassLoader());
}
- else if (ijCD != null)
- {
- poolName = ijCD.getPoolName();
- }
-
- if (poolName == null)
- poolName = cfJndiNames.get(0);
-
- jndiName = poolName;
- pool.setName(poolName);
}
- if (activateDeployment)
+ archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+
+ if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
{
- org.jboss.jca.core.api.management.ConnectionFactory mgtCf =
- new org.jboss.jca.core.api.management.ConnectionFactory(cf, mcf);
+ String jndiName;
+ if (connectionDefinition != null)
+ {
+ jndiName = buildJndiName(connectionDefinition.getJndiName(),
+ connectionDefinition.isUseJavaContext());
+
+ bindConnectionFactory(url, deploymentName, cf, jndiName);
+ cfs.add(cf);
+ cfJndiNames.add(jndiName);
- mgtCf.setPoolConfiguration(pc);
- mgtCf.setPool(pool);
- mgtCf.setJndiName(jndiName);
+ cm.setJndiName(jndiName);
+
+ String poolName = null;
+
+ if (connectionDefinition != null)
+ poolName = connectionDefinition.getPoolName();
+
+ if (poolName == null)
+ poolName = jndiName;
+
+ pool.setName(poolName);
+ }
+ else
+ {
+ String[] bindCfJndiNames = bindConnectionFactory(url, deploymentName, cf);
- mgtCf.getManagedConnectionFactory().getConfigProperties().
- addAll(createManagementView(ra10.getConfigProperties()));
+ cfs.add(cf);
+ cfJndiNames.addAll(Arrays.asList(bindCfJndiNames));
+
+ cm.setJndiName(bindCfJndiNames[0]);
+
+ String poolName = null;
+
+ if (connectionDefinition != null)
+ poolName = connectionDefinition.getPoolName();
+
+ if (poolName == null)
+ poolName = cfJndiNames.get(0);
+
+ jndiName = poolName;
+ pool.setName(poolName);
+ }
- mgtConnector.getConnectionFactories().add(mgtCf);
-
- // Prefill
- if (pool instanceof PrefillPool)
+ if (activateDeployment)
{
- PrefillPool pp = (PrefillPool)pool;
- SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
- Subject subject = null;
-
- if (subjectFactory != null)
- subject = createSubject(subjectFactory, securityDomain, mcf);
-
- pp.prefill(subject, null, noTxSeparatePool.booleanValue());
+ org.jboss.jca.core.api.management.ConnectionFactory mgtCf =
+ new org.jboss.jca.core.api.management.ConnectionFactory(cf, mcf);
+
+ mgtCf.setPoolConfiguration(pc);
+ mgtCf.setPool(pool);
+ mgtCf.setJndiName(jndiName);
+
+ mgtCf.getManagedConnectionFactory().getConfigProperties().
+ addAll(createManagementView(ra10.getConfigProperties()));
+
+ mgtConnector.getConnectionFactories().add(mgtCf);
+
+ // Prefill
+ if (pool instanceof PrefillPool)
+ {
+ PrefillPool pp = (PrefillPool)pool;
+ SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
+ Subject subject = null;
+
+ if (subjectFactory != null)
+ subject = createSubject(subjectFactory, securityDomain, mcf);
+
+ pp.prefill(subject, null, noTxSeparatePool.booleanValue());
+ }
}
}
}
@@ -1343,9 +1301,7 @@
if (!(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures,
Severity.ERROR)))
{
- org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
- org.jboss.jca.common.api.metadata.common.CommonConnDef cdRaXml = null;
- boolean mcfActivation = false;
+ Set<CommonConnDef> connectionDefinitions = null;
if (raxml != null)
{
@@ -1353,332 +1309,295 @@
if (cdDefs != null)
{
- cdRaXml = findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass()
- .getValue(), mcfs, cdDefs);
+ connectionDefinitions =
+ findConnectionDefinitions(cdMeta.getManagedConnectionFactoryClass()
+ .getValue(), mcfs, cdDefs);
}
}
- if (cdRaXml == null && ijmd != null)
+ if (connectionDefinitions == null && ijmd != null)
{
List<CommonConnDef> cdDefs = ijmd.getConnectionDefinitions();
if (cdDefs != null)
{
- ijCD =
- findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass().getValue(),
- mcfs, cdDefs);
+ connectionDefinitions =
+ findConnectionDefinitions(cdMeta.getManagedConnectionFactoryClass().getValue(),
+ mcfs, cdDefs);
}
}
- if (cdRaXml != null ||
- ijCD != null ||
- (!requireExplicitJndiBindings() && raxml == null && ijmd == null && mcfs.size() == 1))
+ if (!requireExplicitJndiBindings() && raxml == null && ijmd == null && mcfs.size() == 1)
{
- mcfActivation = true;
+ connectionDefinitions = new HashSet<CommonConnDef>(1);
+ connectionDefinitions.add(null);
}
- if (activateDeployment && mcfActivation)
+ if (activateDeployment && connectionDefinitions != null)
{
- if (ijCD == null || ijCD.isEnabled() || (cdRaXml != null && cdRaXml.isEnabled()))
+ for (CommonConnDef connectionDefinition : connectionDefinitions)
{
- String mcfClz = cdMeta.getManagedConnectionFactoryClass().getValue();
- Object om = initAndInject(mcfClz, cdMeta.getConfigProperties(), cl);
-
- if (om == null || !(om instanceof ManagedConnectionFactory))
- throw new DeployException(bundle.invalidManagedConnectionFactory(mcfClz));
-
- ManagedConnectionFactory mcf = (ManagedConnectionFactory)om;
-
- if (trace)
+ if (connectionDefinition == null || connectionDefinition.isEnabled())
{
- log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
- log.trace("ManagedConnectionFactory defined in classloader: " +
- mcf.getClass().getClassLoader());
- }
+ String mcfClz = cdMeta.getManagedConnectionFactoryClass().getValue();
+ Object om = initAndInject(mcfClz, cdMeta.getConfigProperties(), cl);
- mcf.setLogWriter(getLogPrintWriter());
+ if (om == null || !(om instanceof ManagedConnectionFactory))
+ throw new DeployException(bundle.invalidManagedConnectionFactory(mcfClz));
- archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, mcf,
- cdMeta.getConfigProperties()));
- beanValidationObjects.add(mcf);
- associateResourceAdapter(resourceAdapter, mcf);
+ ManagedConnectionFactory mcf = (ManagedConnectionFactory)om;
- // Create the pool
- PoolConfiguration pc = null;
- FlushStrategy flushStrategy = FlushStrategy.FAILING_CONNECTION_ONLY;
+ if (trace)
+ {
+ log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+ log.trace("ManagedConnectionFactory defined in classloader: " +
+ mcf.getClass().getClassLoader());
+ }
- if (cdRaXml != null)
- {
- pc = createPoolConfiguration(cdRaXml.getPool(), cdRaXml.getTimeOut(),
- cdRaXml.getValidation());
+ mcf.setLogWriter(getLogPrintWriter());
- if (cdRaXml.getPool() != null)
- flushStrategy = cdRaXml.getPool().getFlushStrategy();
- }
- else if (ijCD != null)
- {
- pc = createPoolConfiguration(ijCD.getPool(), ijCD.getTimeOut(),
- ijCD.getValidation());
+ archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, mcf,
+ cdMeta.getConfigProperties()));
+ beanValidationObjects.add(mcf);
+ associateResourceAdapter(resourceAdapter, mcf);
- if (ijCD.getPool() != null)
- flushStrategy = ijCD.getPool().getFlushStrategy();
- }
- else
- {
- // Default default settings
- pc = createPoolConfiguration(null, null, null);
- }
+ // Create the pool
+ PoolConfiguration pc = null;
+ FlushStrategy flushStrategy = FlushStrategy.FAILING_CONNECTION_ONLY;
- PoolFactory pf = new PoolFactory();
+ if (connectionDefinition != null)
+ {
+ pc = createPoolConfiguration(connectionDefinition.getPool(),
+ connectionDefinition.getTimeOut(),
+ connectionDefinition.getValidation());
- Boolean noTxSeparatePool = Boolean.FALSE;
- if (cdRaXml != null && cdRaXml.getPool() != null && cdRaXml.isXa())
- {
- CommonXaPool ijXaPool = (CommonXaPool) cdRaXml.getPool();
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
- else if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
+ if (connectionDefinition.getPool() != null)
+ flushStrategy = connectionDefinition.getPool().getFlushStrategy();
+ }
+ else
+ {
+ // Default default settings
+ pc = createPoolConfiguration(null, null, null);
+ }
- CommonSecurity security = null;
- if (cdRaXml != null && cdRaXml.getSecurity() != null)
- {
- security = cdRaXml.getSecurity();
- }
- else if (ijCD != null && ijCD.getSecurity() != null)
- {
- security = ijCD.getSecurity();
- }
+ if (flushStrategy == null)
+ flushStrategy = FlushStrategy.FAILING_CONNECTION_ONLY;
+
+ PoolFactory pf = new PoolFactory();
- PoolStrategy strategy = PoolStrategy.ONE_POOL;
- String securityDomain = null;
+ Boolean noTxSeparatePool = Boolean.FALSE;
+ if (connectionDefinition != null &&
+ connectionDefinition.getPool() != null &&
+ connectionDefinition.isXa())
+ {
+ CommonXaPool xaPool = (CommonXaPool)connectionDefinition.getPool();
+ if (xaPool != null)
+ noTxSeparatePool = xaPool.isNoTxSeparatePool();
+ }
- if (security != null)
- {
- if (security.isApplication())
+ CommonSecurity security = null;
+ if (connectionDefinition != null && connectionDefinition.getSecurity() != null)
{
- strategy = PoolStrategy.POOL_BY_CRI;
+ security = connectionDefinition.getSecurity();
}
- else if (security.getSecurityDomain() != null &&
- security.getSecurityDomain().trim().length() != 0)
+
+ PoolStrategy strategy = PoolStrategy.ONE_POOL;
+ String securityDomain = null;
+
+ if (security != null)
{
- strategy = PoolStrategy.POOL_BY_SUBJECT;
- securityDomain = security.getSecurityDomain();
+ if (security.isApplication())
+ {
+ strategy = PoolStrategy.POOL_BY_CRI;
+ }
+ else if (security.getSecurityDomain() != null &&
+ security.getSecurityDomain().trim().length() != 0)
+ {
+ strategy = PoolStrategy.POOL_BY_SUBJECT;
+ securityDomain = security.getSecurityDomain();
+ }
+ else if (security.getSecurityDomainAndApplication() != null &&
+ security.getSecurityDomainAndApplication().trim().length() != 0)
+ {
+ strategy = PoolStrategy.POOL_BY_SUBJECT_AND_CRI;
+ securityDomain = security.getSecurityDomainAndApplication();
+ }
}
- else if (security.getSecurityDomainAndApplication() != null &&
- security.getSecurityDomainAndApplication().trim().length() != 0)
+
+ if (ra.getOutboundResourceadapter().getReauthenticationSupport())
{
- strategy = PoolStrategy.POOL_BY_SUBJECT_AND_CRI;
- securityDomain = security.getSecurityDomainAndApplication();
+ strategy = PoolStrategy.REAUTH;
}
- }
- if (ra.getOutboundResourceadapter().getReauthenticationSupport())
- {
- strategy = PoolStrategy.REAUTH;
- }
+ Pool pool = pf.create(strategy, mcf, pc, noTxSeparatePool.booleanValue());
- Pool pool = pf.create(strategy, mcf, pc, noTxSeparatePool.booleanValue());
-
- // Add a connection manager
- ConnectionManagerFactory cmf = new ConnectionManagerFactory();
- ConnectionManager cm = null;
- TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
- TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
- if (raxml != null && raxml.getTransactionSupport() != null)
- {
- tsmd = raxml.getTransactionSupport();
- }
- else if (ijmd != null && ijmd.getTransactionSupport() != null)
- {
- tsmd = ijmd.getTransactionSupport();
- }
- else
- {
- tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
- }
-
- if (tsmd == TransactionSupportEnum.NoTransaction)
- {
- tsl = TransactionSupportLevel.NoTransaction;
- }
- else if (tsmd == TransactionSupportEnum.LocalTransaction)
- {
- tsl = TransactionSupportLevel.LocalTransaction;
- }
- else if (tsmd == TransactionSupportEnum.XATransaction)
- {
- tsl = TransactionSupportLevel.XATransaction;
- }
-
- // Section 7.13 -- Read from metadata -> overwrite with specified value if present
- if (mcf instanceof TransactionSupport)
- tsl = ((TransactionSupport) mcf).getTransactionSupport();
-
- // XAResource recovery
- XAResourceRecovery recoveryImpl = null;
-
- // Connection manager properties
- Integer allocationRetry = null;
- Long allocationRetryWaitMillis = null;
- if (cdRaXml != null && cdRaXml.getTimeOut() != null)
- {
- allocationRetry = cdRaXml.getTimeOut().getAllocationRetry();
- allocationRetryWaitMillis = cdRaXml.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- if (ijCD != null && ijCD.getTimeOut() != null)
- {
- if (allocationRetry == null)
- allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-
- if (allocationRetryWaitMillis == null)
- allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- Boolean useCCM = Boolean.TRUE;
- if (ijCD != null)
- useCCM = ijCD.isUseCcm();
-
- // Select the correct connection manager
- if (tsl == TransactionSupportLevel.NoTransaction)
- {
- cm = cmf.createNonTransactional(tsl, pool,
- getSubjectFactory(securityDomain),
- securityDomain,
- useCCM, getCachedConnectionManager(),
- flushStrategy,
- allocationRetry, allocationRetryWaitMillis);
- }
- else
- {
- Boolean interleaving = null;
- Integer xaResourceTimeout = null;
- Boolean isSameRMOverride = null;
- Boolean wrapXAResource = null;
- Boolean padXid = null;
- Recovery recoveryMD = null;
- if (cdRaXml != null && cdRaXml.isXa())
+ // Add a connection manager
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ConnectionManager cm = null;
+ TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+ TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+ if (raxml != null && raxml.getTransactionSupport() != null)
{
- CommonXaPool cdRaXmlXaPool = (CommonXaPool) cdRaXml.getPool();
-
- interleaving = cdRaXmlXaPool.isInterleaving();
- isSameRMOverride = cdRaXmlXaPool.isSameRmOverride();
- wrapXAResource = cdRaXmlXaPool.isWrapXaResource();
- padXid = cdRaXmlXaPool.isPadXid();
- recoveryMD = cdRaXml.getRecovery();
+ tsmd = raxml.getTransactionSupport();
}
+ else if (ijmd != null && ijmd.getTransactionSupport() != null)
+ {
+ tsmd = ijmd.getTransactionSupport();
+ }
+ else
+ {
+ tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
+ }
- if (ijCD != null && ijCD.isXa())
+ if (tsmd == TransactionSupportEnum.NoTransaction)
{
- CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
+ tsl = TransactionSupportLevel.NoTransaction;
+ }
+ else if (tsmd == TransactionSupportEnum.LocalTransaction)
+ {
+ tsl = TransactionSupportLevel.LocalTransaction;
+ }
+ else if (tsmd == TransactionSupportEnum.XATransaction)
+ {
+ tsl = TransactionSupportLevel.XATransaction;
+ }
- if (interleaving == null)
- interleaving = ijXaPool.isInterleaving();
+ // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+ if (mcf instanceof TransactionSupport)
+ tsl = ((TransactionSupport) mcf).getTransactionSupport();
- if (isSameRMOverride == null)
- isSameRMOverride = ijXaPool.isSameRmOverride();
+ // XAResource recovery
+ XAResourceRecovery recoveryImpl = null;
- if (wrapXAResource == null)
- wrapXAResource = ijXaPool.isWrapXaResource();
+ // Connection manager properties
+ Integer allocationRetry = null;
+ Long allocationRetryWaitMillis = null;
+ if (connectionDefinition != null && connectionDefinition.getTimeOut() != null)
+ {
+ allocationRetry = connectionDefinition.getTimeOut().getAllocationRetry();
+ allocationRetryWaitMillis =
+ connectionDefinition.getTimeOut().getAllocationRetryWaitMillis();
+ }
- if (padXid == null)
- padXid = ijXaPool.isPadXid();
+ Boolean useCCM = Boolean.TRUE;
+ if (connectionDefinition != null)
+ useCCM = connectionDefinition.isUseCcm();
- if (recoveryMD == null)
- recoveryMD = ijCD.getRecovery();
+ // Select the correct connection manager
+ if (tsl == TransactionSupportLevel.NoTransaction)
+ {
+ cm = cmf.createNonTransactional(tsl, pool,
+ getSubjectFactory(securityDomain),
+ securityDomain,
+ useCCM, getCachedConnectionManager(),
+ flushStrategy,
+ allocationRetry, allocationRetryWaitMillis);
}
-
- cm = cmf.createTransactional(tsl, pool,
- getSubjectFactory(securityDomain), securityDomain,
- useCCM, getCachedConnectionManager(),
- flushStrategy,
- allocationRetry, allocationRetryWaitMillis,
- getTransactionIntegration(),
- interleaving,
- xaResourceTimeout, isSameRMOverride,
- wrapXAResource, padXid);
- if (tsl == TransactionSupportLevel.XATransaction)
+ else
{
- String recoverSecurityDomain = securityDomain;
- String recoverUser = null;
- String recoverPassword = null;
- if (recoveryMD == null || !recoveryMD.getNoRecovery())
+ Boolean interleaving = null;
+ Integer xaResourceTimeout = null;
+ Boolean isSameRMOverride = null;
+ Boolean wrapXAResource = null;
+ Boolean padXid = null;
+ Recovery recoveryMD = null;
+ if (connectionDefinition != null && connectionDefinition.isXa())
{
- // If we have an XAResourceRecoveryRegistry and the deployment is XA
- // lets register it for XA Resource Recovery using the "recover" definitions
- // from the -ds.xml file. Fallback to the standard definitions for
- // user name, password. Keep a seperate reference to the security-domain
+ CommonXaPool xaPool = (CommonXaPool)connectionDefinition.getPool();
- Credential credential =
- recoveryMD != null ? recoveryMD.getCredential() : null;
+ interleaving = xaPool.isInterleaving();
+ isSameRMOverride = xaPool.isSameRmOverride();
+ wrapXAResource = xaPool.isWrapXaResource();
+ padXid = xaPool.isPadXid();
+ recoveryMD = connectionDefinition.getRecovery();
+ }
- if (credential != null)
+ cm = cmf.createTransactional(tsl, pool,
+ getSubjectFactory(securityDomain), securityDomain,
+ useCCM, getCachedConnectionManager(),
+ flushStrategy,
+ allocationRetry, allocationRetryWaitMillis,
+ getTransactionIntegration(),
+ interleaving,
+ xaResourceTimeout, isSameRMOverride,
+ wrapXAResource, padXid);
+ if (tsl == TransactionSupportLevel.XATransaction)
+ {
+ String recoverSecurityDomain = securityDomain;
+ String recoverUser = null;
+ String recoverPassword = null;
+ if (recoveryMD == null || !recoveryMD.getNoRecovery())
{
- recoverSecurityDomain = credential.getSecurityDomain();
+ // If we have an XAResourceRecoveryRegistry and the deployment is XA
+ // lets register it for XA Resource Recovery using the "recover"
+ // definitions from the -ds.xml file. Fallback to the standard definitions
+ // for user name, password. Keep a seperate reference to the
+ // security-domain
- recoverUser = credential.getUserName();
- recoverPassword = credential.getPassword();
- }
+ Credential credential =
+ recoveryMD != null ? recoveryMD.getCredential() : null;
- if (log.isDebugEnabled())
- {
- if (recoverUser != null)
+ if (credential != null)
{
- log.debug("RecoverUser=" + recoverUser);
+ recoverSecurityDomain = credential.getSecurityDomain();
+
+ recoverUser = credential.getUserName();
+ recoverPassword = credential.getPassword();
}
- else if (recoverSecurityDomain != null)
+
+ if (log.isDebugEnabled())
{
- log.debug("RecoverSecurityDomain=" + recoverSecurityDomain);
+ if (recoverUser != null)
+ {
+ log.debug("RecoverUser=" + recoverUser);
+ }
+ else if (recoverSecurityDomain != null)
+ {
+ log.debug("RecoverSecurityDomain=" + recoverSecurityDomain);
+ }
}
- }
- RecoveryPlugin plugin = null;
- if (recoveryMD != null && recoveryMD.getRecoverPlugin() != null)
- {
- List<ConfigProperty> configProperties = null;
- if (recoveryMD
- .getRecoverPlugin()
- .getConfigPropertiesMap() != null)
+ RecoveryPlugin plugin = null;
+ if (recoveryMD != null && recoveryMD.getRecoverPlugin() != null)
{
- configProperties =
- new ArrayList<ConfigProperty>(recoveryMD
- .getRecoverPlugin()
- .getConfigPropertiesMap().size());
-
- for (Entry<String, String> property : recoveryMD.getRecoverPlugin()
- .getConfigPropertiesMap().entrySet())
+ List<ConfigProperty> configProperties = null;
+ if (recoveryMD
+ .getRecoverPlugin()
+ .getConfigPropertiesMap() != null)
{
- ConfigProperty c = new ConfigPropertyImpl(null,
- new XsdString(property
- .getKey(),
- null),
- new XsdString("String",
- null),
- new XsdString(property
- .getValue(),
- null), null);
- configProperties.add(c);
- }
+ configProperties =
+ new ArrayList<ConfigProperty>(recoveryMD
+ .getRecoverPlugin()
+ .getConfigPropertiesMap().size());
- plugin =
- (RecoveryPlugin)initAndInject(recoveryMD
- .getRecoverPlugin().getClassName(),
- configProperties, cl);
+ for (Entry<String, String> property : recoveryMD.getRecoverPlugin()
+ .getConfigPropertiesMap().entrySet())
+ {
+ ConfigProperty c =
+ new ConfigPropertyImpl(null,
+ new XsdString(property.getKey(),
+ null),
+ new XsdString("String",
+ null),
+ new XsdString(property
+ .getValue(),
+ null), null);
+ configProperties.add(c);
+ }
+
+ plugin =
+ (RecoveryPlugin)initAndInject(recoveryMD
+ .getRecoverPlugin().getClassName(),
+ configProperties, cl);
+ }
}
- }
- else
- {
- plugin = new DefaultRecoveryPlugin();
- }
+ else
+ {
+ plugin = new DefaultRecoveryPlugin();
+ }
- recoveryImpl =
- getTransactionIntegration().
+ recoveryImpl =
+ getTransactionIntegration().
createXAResourceRecovery(mcf,
padXid,
isSameRMOverride,
@@ -1689,124 +1608,111 @@
getSubjectFactory(
recoverSecurityDomain),
plugin);
+ }
}
}
- }
- // ConnectionFactory
- Object cf = mcf.createConnectionFactory(cm);
+ // ConnectionFactory
+ Object cf = mcf.createConnectionFactory(cm);
- if (cf == null)
- {
- log.nullConnectionFactory();
- }
- else
- {
- if (trace)
+ if (cf == null)
{
- log.trace("ConnectionFactory: " + cf.getClass().getName());
- log.trace("ConnectionFactory defined in classloader: " +
- cf.getClass().getClassLoader());
+ log.nullConnectionFactory();
}
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
- {
- String jndiName;
- if (cdRaXml != null || ijCD != null)
+ else
{
- if (cdRaXml != null)
+ if (trace)
{
- jndiName = buildJndiName(cdRaXml.getJndiName(), cdRaXml.isUseJavaContext());
+ log.trace("ConnectionFactory: " + cf.getClass().getName());
+ log.trace("ConnectionFactory defined in classloader: " +
+ cf.getClass().getClassLoader());
}
- else
- {
- jndiName = buildJndiName(ijCD.getJndiName(), ijCD.isUseJavaContext());
- }
+ }
- bindConnectionFactory(url, deploymentName, cf, jndiName);
- cfs.add(cf);
- cfJndiNames.add(jndiName);
+ archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
- cm.setJndiName(jndiName);
-
- String poolName = null;
- if (cdRaXml != null)
+ if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+ {
+ String jndiName;
+ if (connectionDefinition != null)
{
- poolName = cdRaXml.getPoolName();
- }
- else if (ijCD != null)
- {
- poolName = ijCD.getPoolName();
- }
+ jndiName = buildJndiName(connectionDefinition.getJndiName(),
+ connectionDefinition.isUseJavaContext());
- if (poolName == null)
- poolName = jndiName;
+ bindConnectionFactory(url, deploymentName, cf, jndiName);
+ cfs.add(cf);
+ cfJndiNames.add(jndiName);
- pool.setName(poolName);
- }
- else
- {
- String[] bindCfJndiNames = bindConnectionFactory(url, deploymentName, cf);
- cfs.add(cf);
- cfJndiNames.addAll(Arrays.asList(bindCfJndiNames));
+ cm.setJndiName(jndiName);
- cm.setJndiName(bindCfJndiNames[0]);
+ String poolName = null;
+ if (connectionDefinition != null)
+ {
+ poolName = connectionDefinition.getPoolName();
+ }
- String poolName = null;
- if (cdRaXml != null)
- {
- poolName = cdRaXml.getPoolName();
+ if (poolName == null)
+ poolName = jndiName;
+
+ pool.setName(poolName);
}
- else if (ijCD != null)
+ else
{
- poolName = ijCD.getPoolName();
- }
+ String[] bindCfJndiNames = bindConnectionFactory(url, deploymentName, cf);
+ cfs.add(cf);
+ cfJndiNames.addAll(Arrays.asList(bindCfJndiNames));
- if (poolName == null)
- poolName = cfJndiNames.get(0);
+ cm.setJndiName(bindCfJndiNames[0]);
- jndiName = poolName;
- pool.setName(poolName);
- }
+ String poolName = null;
+ if (connectionDefinition != null)
+ {
+ poolName = connectionDefinition.getPoolName();
+ }
- if (getTransactionIntegration().getRecoveryRegistry() != null &&
- recoveryImpl != null)
- {
- recoveryImpl.setJndiName(cm.getJndiName());
- getTransactionIntegration().
- getRecoveryRegistry().addXAResourceRecovery(recoveryImpl);
+ if (poolName == null)
+ poolName = cfJndiNames.get(0);
- recoveryModules.add(recoveryImpl);
- }
+ jndiName = poolName;
+ pool.setName(poolName);
+ }
- if (activateDeployment)
- {
- org.jboss.jca.core.api.management.ConnectionFactory mgtCf =
- new org.jboss.jca.core.api.management.ConnectionFactory(cf, mcf);
+ if (getTransactionIntegration().getRecoveryRegistry() != null &&
+ recoveryImpl != null)
+ {
+ recoveryImpl.setJndiName(cm.getJndiName());
+ getTransactionIntegration().
+ getRecoveryRegistry().addXAResourceRecovery(recoveryImpl);
- mgtCf.setPoolConfiguration(pc);
- mgtCf.setPool(pool);
- mgtCf.setJndiName(jndiName);
-
- mgtCf.getManagedConnectionFactory().getConfigProperties().
- addAll(createManagementView(cdMeta.getConfigProperties()));
+ recoveryModules.add(recoveryImpl);
+ }
- mgtConnector.getConnectionFactories().add(mgtCf);
-
- // Prefill
- if (pool instanceof PrefillPool)
+ if (activateDeployment)
{
- PrefillPool pp = (PrefillPool)pool;
- SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
- Subject subject = null;
+ org.jboss.jca.core.api.management.ConnectionFactory mgtCf =
+ new org.jboss.jca.core.api.management.ConnectionFactory(cf, mcf);
+
+ mgtCf.setPoolConfiguration(pc);
+ mgtCf.setPool(pool);
+ mgtCf.setJndiName(jndiName);
+
+ mgtCf.getManagedConnectionFactory().getConfigProperties().
+ addAll(createManagementView(cdMeta.getConfigProperties()));
+
+ mgtConnector.getConnectionFactories().add(mgtCf);
- if (subjectFactory != null)
- subject = createSubject(subjectFactory, securityDomain, mcf);
+ // Prefill
+ if (pool instanceof PrefillPool)
+ {
+ PrefillPool pp = (PrefillPool)pool;
+ SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
+ Subject subject = null;
+
+ if (subjectFactory != null)
+ subject = createSubject(subjectFactory, securityDomain, mcf);
- pp.prefill(subject, null, noTxSeparatePool.booleanValue());
+ pp.prefill(subject, null, noTxSeparatePool.booleanValue());
+ }
}
}
}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RaXml2TestCase.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RaXml2TestCase.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RaXml2TestCase.java 2011-08-25 15:11:52 UTC (rev 112126)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.test.deployers.spec;
+
+import org.jboss.jca.embedded.dsl.InputStreamDescriptor;
+
+import javax.annotation.Resource;
+import javax.resource.cci.ConnectionFactory;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptor;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Test cases for deploying resource adapter archives (.RAR) using -ra.xml files
+ * for activation (double registration)
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+ at RunWith(Arquillian.class)
+public class RaXml2TestCase
+{
+
+ //-------------------------------------------------------------------------------------||
+ //---------------------- GIVEN --------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Define the deployment
+ * @return The deployment archive
+ * @throws Exception in case of errors
+ */
+ @Deployment(order = 1)
+ public static ResourceAdapterArchive createArchive() throws Exception
+ {
+ String archiveName = "ra16out.rar";
+ String packageName = "org.jboss.jca.test.deployers.spec.rars.ra16out";
+ ResourceAdapterArchive raa = ArquillianJCATestUtils.buidShrinkwrapRa(archiveName, packageName);
+ raa.addAsManifestResource(archiveName + "/META-INF/ra.xml", "ra.xml");
+
+ return raa;
+ }
+
+ /**
+ * Define the deployment
+ * @return The deployment archive
+ * @throws Exception in case of errors
+ */
+ @Deployment(order = 2)
+ public static Descriptor createDescriptor() throws Exception
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStreamDescriptor isd = new InputStreamDescriptor("ra16out2-ra.xml",
+ cl.getResourceAsStream("ra16out2-ra.xml"));
+ return isd;
+ }
+
+ //-------------------------------------------------------------------------------------||
+ //---------------------- WHEN --------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+ //
+ @Resource(mappedName = "java:/eis/ra16out1")
+ private ConnectionFactory connectionFactory1;
+
+ @Resource(mappedName = "java:/eis/ra16out2")
+ private ConnectionFactory connectionFactory2;
+
+ //-------------------------------------------------------------------------------------||
+ //---------------------- THEN --------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Basic
+ * @exception Throwable Thrown if case of an error
+ */
+ @Test
+ public void testBasic() throws Throwable
+ {
+ assertNotNull(connectionFactory1);
+ assertNotNull(connectionFactory2);
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/ra16out2-ra.xml
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/ra16out2-ra.xml (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/ra16out2-ra.xml 2011-08-25 15:11:52 UTC (rev 112126)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<resource-adapters>
+ <resource-adapter>
+ <archive>ra16out.rar</archive>
+ <connection-definitions>
+ <connection-definition jndi-name="java:/eis/ra16out1"
+ class-name="org.jboss.jca.test.deployers.spec.rars.ra16out.TestManagedConnectionFactory">
+ </connection-definition>
+ </connection-definitions>
+ <connection-definitions>
+ <connection-definition jndi-name="java:/eis/ra16out2"
+ class-name="org.jboss.jca.test.deployers.spec.rars.ra16out.TestManagedConnectionFactory">
+ </connection-definition>
+ </connection-definitions>
+ </resource-adapter>
+</resource-adapters>
More information about the jboss-cvs-commits
mailing list