[jboss-cvs] JBossAS SVN: r108363 - in projects/jboss-jca/trunk: deployers/src/main/java/org/jboss/jca/deployers/fungal and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 28 07:23:09 EDT 2010
Author: maeste
Date: 2010-09-28 07:23:08 -0400 (Tue, 28 Sep 2010)
New Revision: 108363
Modified:
projects/jboss-jca/trunk/.gitignore
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ao/AOTestCase.java
Log:
generalization of deployers
Modified: projects/jboss-jca/trunk/.gitignore
===================================================================
--- projects/jboss-jca/trunk/.gitignore 2010-09-28 10:55:49 UTC (rev 108362)
+++ projects/jboss-jca/trunk/.gitignore 2010-09-28 11:23:08 UTC (rev 108363)
@@ -34,3 +34,6 @@
common/src/main/resources/schema/connector_1_0.xsd
common/src/test/resources/todo/
logtest
+${test.dir}/
+.checkstyle
+
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java 2010-09-28 10:55:49 UTC (rev 108362)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java 2010-09-28 11:23:08 UTC (rev 108363)
@@ -22,39 +22,75 @@
package org.jboss.jca.deployers.fungal;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.CommonPool;
import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
import org.jboss.jca.common.api.metadata.common.CommonValidation;
+import org.jboss.jca.common.api.metadata.common.CommonXaPool;
+import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
+import org.jboss.jca.common.api.metadata.ra.AdminObject;
import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.common.api.metadata.ra.Connector.Version;
+import org.jboss.jca.common.api.metadata.ra.MessageListener;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
+import org.jboss.jca.common.api.metadata.ra.ra10.ResourceAdapter10;
import org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext;
+import org.jboss.jca.core.connectionmanager.ConnectionManager;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.spi.mdr.AlreadyExistsException;
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
import org.jboss.jca.core.spi.naming.JndiStrategy;
import org.jboss.jca.validator.Failure;
import org.jboss.jca.validator.FailureHelper;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Severity;
import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
+import org.jboss.jca.validator.ValidateObject;
import org.jboss.jca.validator.Validator;
+import org.jboss.jca.validator.ValidatorException;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Set;
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ManagedConnectionFactory;
import javax.resource.spi.ResourceAdapter;
import javax.resource.spi.ResourceAdapterAssociation;
+import javax.resource.spi.TransactionSupport;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
import org.jboss.logging.Logger;
+import com.github.fungal.api.classloading.KernelClassLoader;
import com.github.fungal.api.util.Injection;
import com.github.fungal.api.util.JarFilter;
import com.github.fungal.spi.deployers.DeployException;
+import com.github.fungal.spi.deployers.Deployment;
/**
* An abstract resource adapter deployer which contains common functionality
@@ -70,11 +106,18 @@
/** The configuration */
private RAConfiguration raConfiguration = null;
+ private final boolean validateClasses;
+
/**
- * Constructor
+ * Create a new AbstractResourceAdapterDeployer.
+ *
+ * @param activateDeployment
+ * @param validateClasses
*/
- AbstractResourceAdapterDeployer()
+ public AbstractResourceAdapterDeployer(boolean validateClasses)
{
+ super();
+ this.validateClasses = validateClasses;
}
/**
@@ -100,20 +143,39 @@
*
* @param url of the archive
* @param archiveValidation classes and/or to validate.
- * @return The list of failures gotten. Null in case of no failures or if validation is not run according to
- * {@link #getArchiveValidation()} Settin
+ * @param failures original list of failures
+ * @return The list of failures gotten with all new failures added. Null in case of no failures
+ * or if validation is not run according to {@link #getArchiveValidation()} Setting. It returns null also if
+ * the concrete implementation of this class set validateClasses instance variable to flase and the list of
+ * archiveValidation contains one or more instance of {@link ValidateClass} type
*/
//IT IS PACKAGE PROTECTED ONLY FOR TESTS ACCESSIBILITY
- List<Failure> validateArchive(URL url, List<Validate> archiveValidation)
+ Set<Failure> validateArchive(URL url, List<Validate> archiveValidation, Set<Failure> failures)
{
// Archive validation
if (!getConfiguration().getArchiveValidation())
{
return null;
}
+
+ for (Validate validate : archiveValidation)
+ {
+ if (!(validate instanceof ValidateObject) && !this.validateClasses)
+ return null;
+ }
+
Validator validator = new Validator();
- List<Failure> failures = validator.validate(archiveValidation);
+ List<Failure> partialFailures = validator.validate(archiveValidation);
+ if (partialFailures != null)
+ {
+ if (failures == null)
+ {
+ failures = new HashSet<Failure>();
+ }
+ failures.addAll(partialFailures);
+ }
+
return failures;
}
@@ -130,8 +192,8 @@
*
*/
//IT IS PACKAGE PROTECTED ONLY FOR TESTS ACCESSIBILITY
- String printFailuresLog(String urlFileName, Validator validator, Collection<Failure> failures,
- File reportDirectory, FailureHelper... fhInput)
+ String printFailuresLog(String urlFileName, Validator validator, Collection<Failure> failures, File reportDirectory,
+ FailureHelper... fhInput)
{
String errorText = "";
FailureHelper fh = null;
@@ -239,7 +301,8 @@
try
{
Class clz = resourceAdapter.getClass();
- Method start = clz.getMethod("start", new Class[] {BootstrapContext.class});
+ Method start = clz.getMethod("start", new Class[]
+ { BootstrapContext.class });
CloneableBootstrapContext cbc = null;
@@ -255,12 +318,11 @@
cbc = getConfiguration().getDefaultBootstrapContext().clone();
start.invoke(resourceAdapter, new Object[]
- {cbc});
+ { cbc });
}
catch (InvocationTargetException ite)
{
- throw new DeployException("Unable to start " +
- resourceAdapter.getClass().getName(), ite.getTargetException());
+ throw new DeployException("Unable to start " + resourceAdapter.getClass().getName(), ite.getTargetException());
}
catch (Throwable t)
{
@@ -275,8 +337,7 @@
* @throws DeployException Thrown if the resource adapter cant be started
*/
@SuppressWarnings("unchecked")
- protected void associateResourceAdapter(ResourceAdapter resourceAdapter, Object object)
- throws DeployException
+ protected void associateResourceAdapter(ResourceAdapter resourceAdapter, Object object) throws DeployException
{
if (resourceAdapter != null && object != null)
{
@@ -286,12 +347,11 @@
{
Class clz = object.getClass();
- Method setResourceAdapter = clz.getMethod("setResourceAdapter",
- new Class[]
- {ResourceAdapter.class});
+ Method setResourceAdapter = clz.getMethod("setResourceAdapter", new Class[]
+ { ResourceAdapter.class });
setResourceAdapter.invoke(object, new Object[]
- {resourceAdapter});
+ { resourceAdapter });
}
catch (Throwable t)
{
@@ -309,9 +369,7 @@
* @return The object
* @throws DeployException Thrown if the object cant be initialized
*/
- protected Object initAndInject(String className,
- List<? extends ConfigProperty> configs,
- ClassLoader cl)
+ protected Object initAndInject(String className, List<? extends ConfigProperty> configs, ClassLoader cl)
throws DeployException
{
try
@@ -326,7 +384,7 @@
{
if (cpmd.isValueSet())
injector.inject(cpmd.getConfigPropertyType().getValue(), cpmd.getConfigPropertyName().getValue(),
- cpmd.getConfigPropertyValue().getValue(), o);
+ cpmd.getConfigPropertyValue().getValue(), o);
}
}
@@ -368,7 +426,6 @@
return list.toArray(new URL[list.size()]);
}
-
/**
* Bind connection factory into JNDI
* @param url The deployment URL
@@ -381,10 +438,10 @@
{
JndiStrategy js = getConfiguration().getJndiStrategy().clone();
- String[] result = js.bindConnectionFactories(deployment, new Object[] {cf});
+ String[] result = js.bindConnectionFactories(deployment, new Object[]
+ { cf });
- getConfiguration().getMetadataRepository().
- registerJndiMapping(url, cf.getClass().getName(), result[0]);
+ getConfiguration().getMetadataRepository().registerJndiMapping(url, cf.getClass().getName(), result[0]);
return result;
}
@@ -402,10 +459,11 @@
{
JndiStrategy js = getConfiguration().getJndiStrategy().clone();
- String[] result = js.bindConnectionFactories(deployment, new Object[] {cf}, new String[] {jndi});
+ String[] result = js.bindConnectionFactories(deployment, new Object[]
+ { cf }, new String[]
+ { jndi });
- getConfiguration().getMetadataRepository().
- registerJndiMapping(url, cf.getClass().getName(), jndi);
+ getConfiguration().getMetadataRepository().registerJndiMapping(url, cf.getClass().getName(), jndi);
return result;
}
@@ -416,9 +474,8 @@
* @param defs The connection definitions
* @return The connection definiton; <code>null</code> if none could be found
*/
- protected org.jboss.jca.common.api.metadata.common.CommonConnDef
- findConnectionDefinition(String clz,
- List<org.jboss.jca.common.api.metadata.common.CommonConnDef> defs)
+ protected org.jboss.jca.common.api.metadata.common.CommonConnDef findConnectionDefinition(String clz,
+ List<org.jboss.jca.common.api.metadata.common.CommonConnDef> defs)
{
if (defs != null)
{
@@ -457,9 +514,7 @@
* @param vp The validation parameters
* @return The configuration
*/
- protected PoolConfiguration createPoolConfiguration(CommonPool pp,
- CommonTimeOut tp,
- CommonValidation vp)
+ protected PoolConfiguration createPoolConfiguration(CommonPool pp, CommonTimeOut tp, CommonValidation vp)
{
PoolConfiguration pc = new PoolConfiguration();
@@ -467,13 +522,13 @@
{
if (pp.getMinPoolSize() != null)
pc.setMinSize(pp.getMinPoolSize().intValue());
-
+
if (pp.getMaxPoolSize() != null)
pc.setMaxSize(pp.getMaxPoolSize().intValue());
if (pp.isPrefill() != null)
pc.setPrefill(pp.isPrefill());
-
+
if (pp.isUseStrictMin() != null)
pc.setStrictMin(pp.isUseStrictMin());
}
@@ -510,4 +565,690 @@
if (raConfiguration == null)
throw new IllegalStateException("Configuration not defined");
}
+
+ /**
+ * init the acrtivation spec
+ *
+ * @param cl cl
+ * @param cmd cmd
+ * @param resourceAdapter resourceAdapter
+ * @param archiveValidationObjects archiveValidationObjects
+ * @param beanValidationObjects beanValidationObjects
+ * @throws DeployException in case of error
+ */
+ protected Set<Failure> initActivationSpec(KernelClassLoader cl, Connector cmd, ResourceAdapter resourceAdapter,
+ List<Validate> archiveValidationObjects, List<Object> beanValidationObjects, Set<Failure> failures, URL url,
+ boolean activateDeployment) throws DeployException
+ {
+ // ActivationSpec
+ if (cmd.getVersion() != Version.V_10)
+ {
+ ResourceAdapter1516 ra1516 = (ResourceAdapter1516) cmd.getResourceadapter();
+ if (ra1516 != null && ra1516.getInboundResourceadapter() != null &&
+ ra1516.getInboundResourceadapter().getMessageadapter() != null &&
+ ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null)
+ {
+ List<MessageListener> mlMetas = ra1516.getInboundResourceadapter().getMessageadapter()
+ .getMessagelisteners();
+
+ if (mlMetas.size() > 0)
+ {
+ for (MessageListener mlMeta : mlMetas)
+ {
+ if (mlMeta.getActivationspec() != null &&
+ mlMeta.getActivationspec().getActivationspecClass().getValue() != null)
+ {
+ failures = validateArchive(
+ url,
+ Arrays.asList((Validate) new ValidateClass(Key.ACTIVATION_SPEC, mlMeta.getActivationspec()
+ .getActivationspecClass().getValue(), cl, mlMeta.getActivationspec().getConfigProperties())),
+ failures);
+ if (!(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures,
+ Severity.ERROR)))
+ {
+ if (activateDeployment)
+ {
+ List<? extends ConfigProperty> cpm = mlMeta.getActivationspec().getConfigProperties();
+
+ Object o = initAndInject(mlMeta.getActivationspec().getActivationspecClass().getValue(),
+ cpm, cl);
+
+ if (trace)
+ {
+ log.trace("ActivationSpec: " + o.getClass().getName());
+ log.trace("ActivationSpec defined in classloader: " + o.getClass().getClassLoader());
+ }
+
+ archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o, cpm));
+ beanValidationObjects.add(o);
+ associateResourceAdapter(resourceAdapter, o);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return failures;
+ }
+
+ /**
+ * init an Admin Object
+ *
+ * @param cmd cmd
+ * @param cl cl
+ * @param archiveValidationObjects archiveValidationObjects
+ * @param beanValidationObjects beanValidationObjects
+ * @throws DeployException in case of errors
+ */
+ protected Set<Failure> initAdminObject(Connector cmd, KernelClassLoader cl, List<Validate> archiveValidationObjects,
+ List<Object> beanValidationObjects, Set<Failure> failures, URL url, boolean activateDeployment)
+ throws DeployException
+ {
+ // AdminObject
+ if (cmd.getVersion() != Version.V_10)
+ {
+ ResourceAdapter1516 ra1516 = (ResourceAdapter1516) cmd.getResourceadapter();
+ if (ra1516 != null && ra1516.getAdminObjects() != null)
+ {
+ List<AdminObject> aoMetas = ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminObjects();
+ if (aoMetas.size() > 0)
+ {
+ for (AdminObject aoMeta : aoMetas)
+ {
+ if (aoMeta.getAdminobjectClass() != null && aoMeta.getAdminobjectClass().getValue() != null)
+ {
+ failures = validateArchive(url,
+ Arrays.asList((Validate) new ValidateClass(Key.ADMIN_OBJECT, aoMeta.getAdminobjectClass()
+ .getValue(), cl, aoMeta.getConfigProperties())), failures);
+ if (!(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures,
+ Severity.ERROR)))
+ {
+ if (activateDeployment)
+ {
+ Object o = initAndInject(aoMeta.getAdminobjectClass().getValue(),
+ aoMeta.getConfigProperties(), cl);
+
+ if (trace)
+ {
+ log.trace("AdminObject: " + o.getClass().getName());
+ log.trace("AdminObject defined in classloader: " + o.getClass().getClassLoader());
+ }
+
+ archiveValidationObjects.add(new ValidateObject(Key.ADMIN_OBJECT, o, aoMeta
+ .getConfigProperties()));
+ beanValidationObjects.add(o);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return failures;
+ }
+
+ /**
+ *
+ * FIXME Comment this
+ *
+ * @param url
+ * @param f
+ * @param root
+ * @param destination
+ * @param cl
+ * @param cmd
+ * @param ijmd
+ * @return
+ * @throws DeployException
+ * @throws ResourceException
+ * @throws Throwable
+ * @throws ValidatorException
+ * @throws AlreadyExistsException
+ * @throws ClassNotFoundException
+ */
+ protected Deployment createObjectsAndInjectValue(URL url, String deploymentName, File root, File destination,
+ KernelClassLoader cl, Connector cmd, IronJacamar ijmd, URL deployment) throws DeployException, ResourceException,
+ Throwable, ValidatorException, AlreadyExistsException, ClassNotFoundException
+ {
+ Set<Failure> failures = null;
+ try
+ {
+ // Notify regarding license terms
+ if (cmd != null && cmd.getLicense() != null && cmd.getLicense().isLicenseRequired())
+ log.info("Required license terms for " + url.toExternalForm());
+
+ ResourceAdapter resourceAdapter = null;
+ List<Validate> archiveValidationObjects = new ArrayList<Validate>();
+ List<Object> beanValidationObjects = new ArrayList<Object>();
+ Object[] cfs = null;
+ String[] jndiNames = null;
+
+ // Check metadata for JNDI information and activate explicit
+ boolean activateDeployment = checkActivation(cmd, ijmd);
+
+ // Create objects and inject values
+ if (cmd != null)
+ {
+ // ResourceAdapter
+ if (cmd.getVersion() != Version.V_10)
+ {
+ ResourceAdapter1516 ra1516 = (ResourceAdapter1516) cmd.getResourceadapter();
+ if (ra1516 != null && ra1516.getResourceadapterClass() != null)
+ {
+ failures = validateArchive(url,
+ Arrays.asList((Validate) new ValidateClass(Key.RESOURCE_ADAPTER, ra1516.getResourceadapterClass(),
+ cl, cmd.getResourceadapter().getConfigProperties())),
+ failures);
+
+ if (!(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures,
+ Severity.ERROR)))
+ {
+ if (activateDeployment)
+ {
+ resourceAdapter = (ResourceAdapter) initAndInject(ra1516.getResourceadapterClass(),
+ ra1516.getConfigProperties(), cl);
+
+ if (trace)
+ {
+ log.trace("ResourceAdapter: " + resourceAdapter.getClass().getName());
+ log.trace("ResourceAdapter defined in classloader: " +
+ resourceAdapter.getClass().getClassLoader());
+ }
+
+ archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER, resourceAdapter, ra1516
+ .getConfigProperties()));
+ beanValidationObjects.add(resourceAdapter);
+ }
+ }
+ }
+ }
+
+ // ManagedConnectionFactory
+ if (cmd.getVersion() == Version.V_10)
+ {
+ ResourceAdapter10 ra10 = (ResourceAdapter10) cmd.getResourceadapter();
+
+ if (activateDeployment)
+ {
+ CommonConnDef ijCD = null;
+
+ if (ijmd != null)
+ {
+ ijCD = findConnectionDefinition(ra10.getManagedConnectionFactoryClass().getValue(),
+ ijmd.getConnectionDefinitions());
+ }
+ //
+ // if (ijmd == null || ijCD == null || ijCD.isEnabled())
+ if (ijCD == null || ijCD.isEnabled())
+ {
+ ManagedConnectionFactory mcf = (ManagedConnectionFactory) initAndInject(ra10
+ .getManagedConnectionFactoryClass().getValue(), ra10.getConfigProperties(), cl);
+
+ if (trace)
+ {
+ log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+ log.trace("ManagedConnectionFactory defined in classloader: " + mcf.getClass().getClassLoader());
+ }
+
+ mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+
+ archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, mcf, ra10
+ .getConfigProperties()));
+ beanValidationObjects.add(mcf);
+ associateResourceAdapter(resourceAdapter, mcf);
+
+ // Create the pool
+ PoolConfiguration pc = createPoolConfiguration(ijCD != null ? ijCD.getPool() : null, ijCD != null
+ ? ijCD.getTimeOut()
+ : null, ijCD != null ? ijCD.getValidation() : null);
+ PoolFactory pf = new PoolFactory();
+
+ Boolean noTxSeparatePool = Boolean.FALSE;
+
+ if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+ {
+ CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
+
+ if (ijXaPool != null)
+ noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+ }
+
+ Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+
+ // Add a connection manager
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ConnectionManager cm = null;
+
+ TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+
+ if (ijmd != null && ijmd.getTransactionSupport() != null)
+ {
+ tsmd = ijmd.getTransactionSupport();
+ }
+ else
+ {
+ tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).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 (ijCD != null && ijCD.getTimeOut() != null)
+ {
+ allocationRetry = ijCD.getTimeOut().getAllocationRetry();
+ allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+ }
+
+ // Select the correct connection manager
+ if (tsl == TransactionSupportLevel.NoTransaction)
+ {
+ cm = cmf.createNonTransactional(tsl, pool, allocationRetry, allocationRetryWaitMillis);
+ }
+ else
+ {
+ Boolean interleaving = null;
+ Integer xaResourceTimeout = null;
+ Boolean isSameRMOverride = null;
+ Boolean wrapXAResource = null;
+ Boolean padXid = null;
+
+ if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+ {
+ CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
+
+ if (ijXaPool != null)
+ {
+ interleaving = ijXaPool.isInterleaving();
+ isSameRMOverride = ijXaPool.isSameRmOverride();
+ wrapXAResource = ijXaPool.isWrapXaDataSource();
+ padXid = ijXaPool.isPadXid();
+ }
+ }
+
+ cm = cmf.createTransactional(tsl, pool, allocationRetry, allocationRetryWaitMillis,
+ getConfiguration().getTransactionManager(), interleaving, xaResourceTimeout,
+ isSameRMOverride, wrapXAResource, padXid);
+ }
+
+ // ConnectionFactory
+ Object cf = mcf.createConnectionFactory(cm);
+
+ if (cf == null)
+ {
+ log.error("ConnectionFactory is null");
+ }
+ else
+ {
+ if (trace)
+ {
+ log.trace("ConnectionFactory: " + cf.getClass().getName());
+ log.trace("ConnectionFactory defined in classloader: " + cf.getClass().getClassLoader());
+ }
+ }
+
+ archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+
+ if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+ {
+ if (ijCD != null)
+ {
+ String jndiName = ijCD.getJndiName();
+
+ bindConnectionFactory(url, deploymentName, cf, jndiName);
+ cfs = new Object[]
+ { cf };
+ jndiNames = new String[]
+ { jndiName };
+
+ cm.setJndiName(jndiName);
+ }
+ else
+ {
+ jndiNames = bindConnectionFactory(url, deploymentName, cf);
+ cfs = new Object[]
+ { cf };
+
+ cm.setJndiName(jndiNames[0]);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ ResourceAdapter1516 ra = (ResourceAdapter1516) cmd.getResourceadapter();
+ if (ra != null && ra.getOutboundResourceadapter() != null &&
+ ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ List<ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions();
+ if (cdMetas.size() > 0)
+ {
+// if (cdMetas.size() == 1)
+// {
+// ConnectionDefinition cdMeta = cdMetas.get(0);
+ cfs = new Object[cdMetas.size()];
+ jndiNames = new String[cdMetas.size()];
+
+ for (int cdIndex = 0; cdIndex < cdMetas.size(); cdIndex++)
+ {
+ ConnectionDefinition cdMeta = cdMetas.get(cdIndex);
+
+ failures = validateArchive(url,
+ Arrays.asList((Validate) new ValidateClass(Key.MANAGED_CONNECTION_FACTORY, cdMeta
+ .getManagedConnectionFactoryClass().getValue(), cl, cdMeta.getConfigProperties())),
+ failures);
+
+ if (!(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures,
+ Severity.ERROR)))
+ {
+ if (activateDeployment)
+ {
+ org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
+
+ if (ijmd != null)
+ {
+ ijCD = findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass().getValue(),
+ ijmd.getConnectionDefinitions());
+ }
+
+// if (ijmd == null || ijCD == null || ijCD.isEnabled())
+// {
+ if (ijCD == null || ijCD.isEnabled())
+ {
+ ManagedConnectionFactory mcf = (ManagedConnectionFactory) initAndInject(cdMeta
+ .getManagedConnectionFactoryClass().getValue(), cdMeta.getConfigProperties(), cl);
+
+ if (trace)
+ {
+ log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+ log.trace("ManagedConnectionFactory defined in classloader: " +
+ mcf.getClass().getClassLoader());
+ }
+
+ mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+
+ archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, mcf,
+ cdMeta.getConfigProperties()));
+ beanValidationObjects.add(mcf);
+ associateResourceAdapter(resourceAdapter, mcf);
+
+ // Create the pool
+ PoolConfiguration pc = createPoolConfiguration(ijCD != null ? ijCD.getPool() : null,
+ ijCD != null ? ijCD.getTimeOut() : null, ijCD != null ? ijCD.getValidation() : null);
+ PoolFactory pf = new PoolFactory();
+
+ Boolean noTxSeparatePool = Boolean.FALSE;
+
+ if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+ {
+ org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool = (org.jboss.jca.common.api.metadata.common.CommonXaPool) ijCD
+ .getPool();
+
+ if (ijXaPool != null)
+ noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+ }
+
+ Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+
+ // Add a connection manager
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ConnectionManager cm = null;
+ TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+ TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+
+ 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();
+
+ // Connection manager properties
+ Integer allocationRetry = null;
+ Long allocationRetryWaitMillis = null;
+
+ if (ijCD != null && ijCD.getTimeOut() != null)
+ {
+ allocationRetry = ijCD.getTimeOut().getAllocationRetry();
+ allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+ }
+
+ // Select the correct connection manager
+ if (tsl == TransactionSupportLevel.NoTransaction)
+ {
+ cm = cmf.createNonTransactional(tsl, pool, allocationRetry,
+ allocationRetryWaitMillis);
+ }
+ else
+ {
+ Boolean interleaving = null;
+ Integer xaResourceTimeout = null;
+ Boolean isSameRMOverride = null;
+ Boolean wrapXAResource = null;
+ Boolean padXid = null;
+
+ if (ijCD != null && ijCD.isXa())
+ {
+ CommonXaPool ijXaPool = (CommonXaPool) ijCD.getPool();
+
+ interleaving = ijXaPool.isInterleaving();
+ isSameRMOverride = ijXaPool.isSameRmOverride();
+ wrapXAResource = ijXaPool.isWrapXaDataSource();
+ padXid = ijXaPool.isPadXid();
+ }
+
+ cm = cmf.createTransactional(tsl, pool, allocationRetry, allocationRetryWaitMillis,
+ getConfiguration().getTransactionManager(), interleaving, xaResourceTimeout,
+ isSameRMOverride, wrapXAResource, padXid);
+ }
+
+ // ConnectionFactory
+ Object cf = mcf.createConnectionFactory(cm);
+
+ if (cf == null)
+ {
+ log.error("ConnectionFactory is null");
+ }
+ else
+ {
+ if (trace)
+ {
+ log.trace("ConnectionFactory: " + cf.getClass().getName());
+ log.trace("ConnectionFactory defined in classloader: " +
+ cf.getClass().getClassLoader());
+ }
+ }
+
+ archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+
+ if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+ {
+ if (ijCD != null)
+ {
+ String jndiName = ijCD.getJndiName();
+
+ bindConnectionFactory(url, deploymentName, cf, jndiName);
+ cfs[cdIndex] = cf;
+ jndiNames[cdIndex] = jndiName;
+
+ cm.setJndiName(jndiName);
+ }
+ else
+ {
+ jndiNames = bindConnectionFactory(url, deploymentName, cf);
+ cfs = new Object[]
+ { cf };
+
+ cm.setJndiName(jndiNames[0]);
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ failures = initActivationSpec(cl, cmd, resourceAdapter, archiveValidationObjects, beanValidationObjects,
+ failures, url, activateDeployment);
+
+ failures = initAdminObject(cmd, cl, archiveValidationObjects, beanValidationObjects, failures, url,
+ activateDeployment);
+ }
+
+ // Archive validation
+ failures = validateArchive(url, archiveValidationObjects, failures);
+
+ if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
+ (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+ {
+ throw new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures);
+ }
+ else
+ {
+ printFailuresLog(url.getPath(), new Validator(), failures, null);
+ }
+
+ if (cmd != null)
+ {
+ try
+ {
+ // Register with MDR
+ getConfiguration().getMetadataRepository().registerResourceAdapter(url, root, cmd, ijmd);
+ }
+ catch (AlreadyExistsException e)
+ {
+ //ignore it, RA already registered
+ }
+ }
+
+ if (activateDeployment)
+ {
+ // Bean validation
+ if (getConfiguration().getBeanValidation())
+ {
+ List<Class> groupsClasses = null;
+
+ if (ijmd != null && ijmd.getBeanValidationGroups() != null && ijmd.getBeanValidationGroups().size() > 0)
+ {
+ groupsClasses = new ArrayList<Class>();
+ for (String group : ijmd.getBeanValidationGroups())
+ {
+ groupsClasses.add(Class.forName(group, true, cl));
+ }
+ }
+
+ if (beanValidationObjects.size() > 0)
+ {
+ BeanValidation beanValidator = new BeanValidation();
+ for (Object o : beanValidationObjects)
+ {
+ beanValidator.validate(o, groupsClasses);
+ }
+ }
+ }
+
+ // Activate deployment
+ if (resourceAdapter != null)
+ {
+ String bootstrapIdentifier = null;
+
+ if (ijmd != null)
+ {
+ bootstrapIdentifier = ijmd.getBootstrapContext();
+ }
+
+ startContext(resourceAdapter, bootstrapIdentifier);
+ }
+ }
+
+ if (activateDeployment)
+ {
+ log.info("Deployed: " + url.toExternalForm());
+ }
+ else
+ {
+ log.debug("Activated: " + url.toExternalForm());
+ }
+
+ return createDeployment(url, deploymentName, activateDeployment, resourceAdapter, getConfiguration()
+ .getJndiStrategy(), getConfiguration().getMetadataRepository(), cfs, destination, cl, log, jndiNames,
+ deployment, activateDeployment);
+
+ }
+ catch (DeployException de)
+ {
+ // Just rethrow
+ throw de;
+ }
+ catch (Throwable t)
+ {
+ if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
+ (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+ {
+ throw new DeployException("Deployment " + url.toExternalForm() + " failed",
+ new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures,
+ null), failures));
+ }
+ else
+ {
+ printFailuresLog(url.getPath(), new Validator(), failures, null);
+ throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+ }
+ }
+ }
+
+ /**
+ * Check if the resource adapter should be activated based on the ironjacamar.xml input
+ * @param cmd The connector metadata
+ * @param ijmd The IronJacamar metadata
+ * @return True if the deployment should be activated; otherwise false
+ */
+ protected abstract boolean checkActivation(Connector cmd, IronJacamar ijmd);
+
+ public abstract Deployment createDeployment(URL deploymentUrl, String deploymentName, boolean activator,
+ ResourceAdapter resourceAdapter, JndiStrategy jndiStrategy, MetadataRepository metadataRepository, Object[] cfs,
+ File destination, ClassLoader cl, Logger log, String[] jndis, URL deployment, boolean activateDeployemnt);
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java 2010-09-28 10:55:49 UTC (rev 108362)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java 2010-09-28 11:23:08 UTC (rev 108363)
@@ -22,46 +22,21 @@
package org.jboss.jca.deployers.fungal;
-import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
-import org.jboss.jca.common.api.metadata.ra.AdminObject;
-import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
-import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.ra.Connector;
-import org.jboss.jca.common.api.metadata.ra.Connector.Version;
-import org.jboss.jca.common.api.metadata.ra.MessageListener;
-import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
-import org.jboss.jca.common.api.metadata.ra.ra10.ResourceAdapter10;
import org.jboss.jca.common.metadata.merge.Merger;
-import org.jboss.jca.core.connectionmanager.ConnectionManager;
-import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.Pool;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
import org.jboss.jca.validator.Failure;
-import org.jboss.jca.validator.Key;
-import org.jboss.jca.validator.Severity;
-import org.jboss.jca.validator.Validate;
-import org.jboss.jca.validator.ValidateObject;
-import org.jboss.jca.validator.Validator;
-import org.jboss.jca.validator.ValidatorException;
import java.io.File;
-import java.io.PrintWriter;
-import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.resource.Referenceable;
-import javax.resource.spi.ManagedConnectionFactory;
import javax.resource.spi.ResourceAdapter;
-import javax.resource.spi.TransactionSupport;
-import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
import org.jboss.logging.Logger;
@@ -80,10 +55,10 @@
public final class RAActivator extends AbstractResourceAdapterDeployer implements DeployerPhases
{
/** The logger */
- private static Logger log = Logger.getLogger(RAActivator.class);
+ static Logger log = Logger.getLogger(RAActivator.class);
/** Trace enabled */
- private static boolean trace = log.isTraceEnabled();
+ static boolean trace = log.isTraceEnabled();
/** The kernel */
private Kernel kernel;
@@ -102,10 +77,12 @@
*/
public RAActivator()
{
+ super(false);
kernel = null;
enabled = true;
excludeArchives = null;
deployments = null;
+
}
/**
@@ -161,6 +138,7 @@
{
this.enabled = value;
}
+
/**
* Pre deploy
* @exception Throwable Thrown if an error occurs
@@ -197,8 +175,8 @@
if (include)
{
- Map<String, List<String>> jndiMappings =
- getConfiguration().getMetadataRepository().getJndiMappings(deployment);
+ Map<String, List<String>> jndiMappings = getConfiguration().getMetadataRepository().getJndiMappings(
+ deployment);
// If there isn't any JNDI mappings then the archive isn't active
// so activate it
@@ -286,6 +264,7 @@
{
root = f;
}
+ String deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
// Create classloader
URL[] urls = getUrls(root);
@@ -306,543 +285,22 @@
cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(ijmd, cmd);
- ResourceAdapter resourceAdapter = null;
- List<Validate> archiveValidationObjects = new ArrayList<Validate>();
- List<Failure> partialFailures = null;
- List<Object> beanValidationObjects = new ArrayList<Object>();
- String deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
- Object[] cfs = null;
- String[] jndis = null;
+ return createObjectsAndInjectValue(url, deploymentName, root, destination, cl, cmd, ijmd, null);
- // Create objects and inject values
- if (cmd != null)
- {
- // ResourceAdapter
- if (cmd.getVersion() != Version.V_10)
- {
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516)cmd.getResourceadapter();
- if (ra1516 != null && ra1516.getResourceadapterClass() != null)
- {
- resourceAdapter =
- (ResourceAdapter) initAndInject(
- ra1516.getResourceadapterClass(), ra1516.getConfigProperties(), cl);
-
- if (trace)
- {
- log.trace("ResourceAdapter: " + resourceAdapter.getClass().getName());
- log.trace("ResourceAdapter defined in classloader: " +
- resourceAdapter.getClass().getClassLoader());
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER,
- resourceAdapter,
- ra1516.getConfigProperties()));
- beanValidationObjects.add(resourceAdapter);
- }
- }
-
- // ManagedConnectionFactory
- if (cmd.getVersion() == Version.V_10)
- {
- org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
-
- if (ijmd != null)
- {
- ijCD = findConnectionDefinition(((ResourceAdapter10) cmd.getResourceadapter())
- .getManagedConnectionFactoryClass().getValue(),
- ijmd.getConnectionDefinitions());
- }
-
- if (ijmd == null || ijCD == null || ijCD.isEnabled())
- {
- ManagedConnectionFactory mcf =
- (ManagedConnectionFactory) initAndInject(((ResourceAdapter10) cmd.getResourceadapter())
- .getManagedConnectionFactoryClass().getValue(),
- ((ResourceAdapter10) cmd.getResourceadapter())
- .getConfigProperties(), cl);
-
- if (trace)
- {
- log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
- log.trace("ManagedConnectionFactory defined in classloader: " +
- mcf.getClass().getClassLoader());
- }
-
- mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
-
- archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
- mcf,
- ((ResourceAdapter10) cmd.getResourceadapter())
- .getConfigProperties()));
- beanValidationObjects.add(mcf);
- associateResourceAdapter(resourceAdapter, mcf);
-
- // Create the pool
- PoolConfiguration pc = createPoolConfiguration(ijCD != null ? ijCD.getPool() : null,
- ijCD != null ? ijCD.getTimeOut() : null,
- ijCD != null ? ijCD.getValidation() : null);
- PoolFactory pf = new PoolFactory();
-
- Boolean noTxSeparatePool = Boolean.FALSE;
-
- if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
-
- Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
-
- // Add a connection manager
- ConnectionManagerFactory cmf = new ConnectionManagerFactory();
- ConnectionManager cm = null;
-
- TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
- TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
-
- tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).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();
-
- // Connection manager properties
- Integer allocationRetry = null;
- Long allocationRetryWaitMillis = null;
-
- if (ijCD != null && ijCD.getTimeOut() != null)
- {
- allocationRetry = ijCD.getTimeOut().getAllocationRetry();
- allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- // Select the correct connection manager
- if (tsl == TransactionSupportLevel.NoTransaction)
- {
- cm = cmf.createNonTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis);
- }
- else
- {
- Boolean interleaving = null;
- Integer xaResourceTimeout = null;
- Boolean isSameRMOverride = null;
- Boolean wrapXAResource = null;
- Boolean padXid = null;
-
- if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- if (ijXaPool != null)
- {
- interleaving = ijXaPool.isInterleaving();
- isSameRMOverride = ijXaPool.isSameRmOverride();
- wrapXAResource = ijXaPool.isWrapXaDataSource();
- padXid = ijXaPool.isPadXid();
- }
- }
-
- cm = cmf.createTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis,
- getConfiguration().getTransactionManager(),
- interleaving,
- xaResourceTimeout,
- isSameRMOverride,
- wrapXAResource,
- padXid);
- }
-
- // ConnectionFactory
- Object cf = mcf.createConnectionFactory(cm);
-
- if (cf == null)
- {
- log.error("ConnectionFactory is null");
- }
- else
- {
- if (trace)
- {
- log.trace("ConnectionFactory: " + cf.getClass().getName());
- log.trace("ConnectionFactory defined in classloader: "
- + cf.getClass().getClassLoader());
- }
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
- {
- String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
- cfs = new Object[] {cf};
- jndis = new String[] {jndiNames[0]};
-
- cm.setJndiName(jndiNames[0]);
- }
- }
- }
- else
- {
- ResourceAdapter1516 ra = (ResourceAdapter1516) cmd.getResourceadapter();
- if (ra != null &&
- ra.getOutboundResourceadapter() != null &&
- ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
- {
- List<ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions();
- if (cdMetas.size() > 0)
- {
- if (cdMetas.size() == 1)
- {
- ConnectionDefinition cdMeta = cdMetas.get(0);
-
- org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
-
- if (ijmd != null)
- {
- ijCD = findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass().getValue(),
- ijmd.getConnectionDefinitions());
- }
-
- if (ijmd == null || ijCD == null || ijCD.isEnabled())
- {
- ManagedConnectionFactory mcf =
- (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
- .getValue(), cdMeta
- .getConfigProperties(), cl);
-
- if (trace)
- {
- log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
- log.trace("ManagedConnectionFactory defined in classloader: " +
- mcf.getClass().getClassLoader());
- }
-
- mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
-
- archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
- mcf,
- cdMeta.getConfigProperties()));
- beanValidationObjects.add(mcf);
- associateResourceAdapter(resourceAdapter, mcf);
-
- // Create the pool
- PoolConfiguration pc = createPoolConfiguration(ijCD != null ? ijCD.getPool() : null,
- ijCD != null ? ijCD.getTimeOut() : null,
- ijCD != null ? ijCD.getValidation() : null);
- PoolFactory pf = new PoolFactory();
-
- Boolean noTxSeparatePool = Boolean.FALSE;
-
- if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
-
- Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
-
- // Add a connection manager
- ConnectionManagerFactory cmf = new ConnectionManagerFactory();
- ConnectionManager cm = null;
- TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
- TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
-
- 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();
-
- // Connection manager properties
- Integer allocationRetry = null;
- Long allocationRetryWaitMillis = null;
-
- if (ijCD != null && ijCD.getTimeOut() != null)
- {
- allocationRetry = ijCD.getTimeOut().getAllocationRetry();
- allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- // Select the correct connection manager
- if (tsl == TransactionSupportLevel.NoTransaction)
- {
- cm = cmf.createNonTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis);
- }
- else
- {
- Boolean interleaving = null;
- Integer xaResourceTimeout = null;
- Boolean isSameRMOverride = null;
- Boolean wrapXAResource = null;
- Boolean padXid = null;
-
- if (ijCD != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- interleaving = ijXaPool.isInterleaving();
- isSameRMOverride = ijXaPool.isSameRmOverride();
- wrapXAResource = ijXaPool.isWrapXaDataSource();
- padXid = ijXaPool.isPadXid();
- }
-
- cm = cmf.createTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis,
- getConfiguration().getTransactionManager(),
- interleaving,
- xaResourceTimeout,
- isSameRMOverride,
- wrapXAResource,
- padXid);
- }
-
- // ConnectionFactory
- Object cf = mcf.createConnectionFactory(cm);
-
- if (cf == null)
- {
- log.error("ConnectionFactory is null");
- }
- else
- {
- if (trace)
- {
- log.trace("ConnectionFactory: " + cf.getClass().getName());
- log.trace("ConnectionFactory defined in classloader: "
- + cf.getClass().getClassLoader());
- }
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
- {
- deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
- String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
- cfs = new Object[] {cf};
- jndis = new String[] {jndiNames[0]};
-
- cm.setJndiName(jndiNames[0]);
- }
- }
- else
- {
- log.warn("There are multiple connection factories for: " + f.getName());
- log.warn("Use an ironjacamar.xml or a -ra.xml to activate the deployment");
- }
- }
- }
- }
- }
-
- // ActivationSpec
- if (cmd.getVersion() != Version.V_10)
- {
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516) cmd.getResourceadapter();
- if (ra1516 != null &&
- ra1516.getInboundResourceadapter() != null &&
- ra1516.getInboundResourceadapter().getMessageadapter() != null &&
- ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null)
- {
- List<MessageListener> mlMetas =
- ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners();
-
- if (mlMetas.size() > 0)
- {
- for (MessageListener mlMeta : mlMetas)
- {
- if (mlMeta.getActivationspec() != null &&
- mlMeta.getActivationspec().getActivationspecClass().getValue() != null)
- {
- List<? extends ConfigProperty> cpm = mlMeta
- .getActivationspec().getConfigProperties();
-
- Object o = initAndInject(mlMeta
- .getActivationspec().getActivationspecClass().getValue(), cpm, cl);
-
- if (trace)
- {
- log.trace("ActivationSpec: " + o.getClass().getName());
- log.trace("ActivationSpec defined in classloader: " + o.getClass().getClassLoader());
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o, cpm));
- beanValidationObjects.add(o);
- associateResourceAdapter(resourceAdapter, o);
- }
- }
- }
- }
- }
-
- // AdminObject
- if (cmd.getVersion() != Version.V_10)
- {
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516) cmd.getResourceadapter();
- if (ra1516 != null && ra1516.getAdminObjects() != null)
- {
- List<AdminObject> aoMetas = ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminObjects();
- if (aoMetas.size() > 0)
- {
- for (AdminObject aoMeta : aoMetas)
- {
- if (aoMeta.getAdminobjectClass() != null &&
- aoMeta.getAdminobjectClass().getValue() != null)
- {
- Object o =
- initAndInject(aoMeta.getAdminobjectClass().getValue(), aoMeta.getConfigProperties(),
- cl);
-
- if (trace)
- {
- log.trace("AdminObject: " + o.getClass().getName());
- log.trace("AdminObject defined in classloader: " + o.getClass().getClassLoader());
- }
-
- archiveValidationObjects
- .add(new ValidateObject(Key.ADMIN_OBJECT, o, aoMeta.getConfigProperties()));
- beanValidationObjects.add(o);
- }
- }
- }
- }
- }
- }
-
- // Archive validation
- partialFailures = validateArchive(url, archiveValidationObjects);
-
- if (partialFailures != null)
- {
- if (failures == null)
- {
- failures = new HashSet<Failure>();
- }
- failures.addAll(partialFailures);
- }
-
- if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
- (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
- {
- throw new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures);
- }
- else
- {
- printFailuresLog(url.getPath(), new Validator(), failures, null);
- }
-
- // Bean validation
- if (getConfiguration().getBeanValidation())
- {
- List<Class> groupsClasses = null;
-
- if (ijmd != null && ijmd.getBeanValidationGroups() != null &&
- ijmd.getBeanValidationGroups().size() > 0)
- {
- groupsClasses = new ArrayList<Class>();
- for (String group : ijmd.getBeanValidationGroups())
- {
- groupsClasses.add(Class.forName(group, true, cl));
- }
- }
-
- if (beanValidationObjects.size() > 0)
- {
- BeanValidation beanValidator = new BeanValidation();
- for (Object o : beanValidationObjects)
- {
- beanValidator.validate(o, groupsClasses);
- }
- }
- }
-
- // Activate deployment
- if (resourceAdapter != null)
- {
- String bootstrapIdentifier = null;
-
- if (ijmd != null)
- {
- bootstrapIdentifier = ijmd.getBootstrapContext();
- }
-
- startContext(resourceAdapter, bootstrapIdentifier);
- }
-
- log.info("Deployed: " + url.toExternalForm());
-
- return new RAActivatorDeployment(url,
- deploymentName,
- resourceAdapter,
- getConfiguration().getJndiStrategy(),
- getConfiguration().getMetadataRepository(),
- cfs,
- jndis,
- cl,
- log);
}
catch (DeployException de)
{
- // Just rethrow
+ //just rethrow
throw de;
}
catch (Throwable t)
{
- if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
- (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
- throw new DeployException("Deployment " + url.toExternalForm() + " failed",
- new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures));
- else
- {
- printFailuresLog(url.getPath(), new Validator(), failures, null);
- throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
- }
+
+ throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+
}
+
finally
{
SecurityActions.setThreadContextClassLoader(oldTCCL);
@@ -860,4 +318,19 @@
if (kernel == null)
throw new IllegalStateException("Kernel not defined");
}
+
+ @Override
+ protected boolean checkActivation(Connector cmd, IronJacamar ijmd)
+ {
+ return true;
+ }
+
+ @Override
+ public Deployment createDeployment(URL deploymentUrl, String deploymentName, boolean activator,
+ ResourceAdapter resourceAdapter, JndiStrategy jndiStrategy, MetadataRepository metadataRepository, Object[] cfs,
+ File destination, ClassLoader cl, Logger log, String[] jndis, URL deployment, boolean activateDeployment)
+ {
+ return new RAActivatorDeployment(deploymentUrl, deploymentName, resourceAdapter, getConfiguration()
+ .getJndiStrategy(), getConfiguration().getMetadataRepository(), cfs, jndis, cl, log);
+ }
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-09-28 10:55:49 UTC (rev 108362)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-09-28 11:23:08 UTC (rev 108363)
@@ -23,14 +23,10 @@
package org.jboss.jca.deployers.fungal;
import org.jboss.jca.common.annotations.Annotations;
-import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
-import org.jboss.jca.common.api.metadata.ra.AdminObject;
-import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.ra.Connector;
import org.jboss.jca.common.api.metadata.ra.Connector.Version;
-import org.jboss.jca.common.api.metadata.ra.MessageListener;
import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
import org.jboss.jca.common.api.metadata.ra.ra10.ResourceAdapter10;
import org.jboss.jca.common.metadata.MetadataFactory;
@@ -38,37 +34,17 @@
import org.jboss.jca.common.spi.annotations.repository.AnnotationRepository;
import org.jboss.jca.common.spi.annotations.repository.AnnotationScanner;
import org.jboss.jca.common.spi.annotations.repository.AnnotationScannerFactory;
-import org.jboss.jca.core.connectionmanager.ConnectionManager;
-import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.Pool;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
-import org.jboss.jca.validator.Failure;
-import org.jboss.jca.validator.Key;
-import org.jboss.jca.validator.Severity;
-import org.jboss.jca.validator.Validate;
-import org.jboss.jca.validator.ValidateClass;
-import org.jboss.jca.validator.ValidateObject;
-import org.jboss.jca.validator.Validator;
-import org.jboss.jca.validator.ValidatorException;
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
import java.io.File;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Serializable;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import javax.resource.Referenceable;
-import javax.resource.spi.ManagedConnectionFactory;
import javax.resource.spi.ResourceAdapter;
-import javax.resource.spi.TransactionSupport;
-import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
import org.jboss.logging.Logger;
@@ -87,19 +63,22 @@
* @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
* @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
*/
-public final class RADeployer extends AbstractResourceAdapterDeployer implements Deployer,
- MultiStageDeployer,
- DeployerOrder
+public final class RADeployer extends AbstractResourceAdapterDeployer
+ implements
+ Deployer,
+ MultiStageDeployer,
+ DeployerOrder
{
- private static Logger log = Logger.getLogger(RADeployer.class);
+ static Logger log = Logger.getLogger(RADeployer.class);
- private static boolean trace = log.isTraceEnabled();
+ static boolean trace = log.isTraceEnabled();
/**
* Constructor
*/
public RADeployer()
{
+ super(true);
}
/**
@@ -126,8 +105,6 @@
if (url == null || !(url.toExternalForm().endsWith(".rar") || url.toExternalForm().endsWith(".rar/")))
return null;
- Set<Failure> failures = null;
-
log.debug("Deploying: " + url.toExternalForm());
ClassLoader oldTCCL = SecurityActions.getThreadContextClassLoader();
@@ -151,7 +128,9 @@
{
root = f;
}
+ String deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+
// Create classloader
URL[] urls = getUrls(root);
KernelClassLoader cl = null;
@@ -182,671 +161,59 @@
// Merge metadata
cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(ijmd, cmd);
- // Notify regarding license terms
- if (cmd != null && cmd.getLicense() != null && cmd.getLicense().isLicenseRequired())
- log.info("Required license terms for " + url.toExternalForm());
+ return createObjectsAndInjectValue(url, deploymentName, root, destination, cl, cmd, ijmd, null);
- ResourceAdapter resourceAdapter = null;
- List<Validate> archiveValidationObjects = new ArrayList<Validate>();
- List<Failure> partialFailures = null;
- List<Object> beanValidationObjects = new ArrayList<Object>();
- Object[] cfs = null;
- String[] jndiNames = null;
-
- String deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
-
- // Check metadata for JNDI information and activate explicit
- boolean activateDeployment = checkActivation(cmd, ijmd);
-
- // Create objects and inject values
- if (cmd != null)
- {
- // ResourceAdapter
- if (cmd.getVersion() != Version.V_10)
- {
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516)cmd.getResourceadapter();
- if (ra1516 != null && ra1516.getResourceadapterClass() != null)
- {
- partialFailures =
- validateArchive(url, Arrays.asList((Validate) new ValidateClass(Key.RESOURCE_ADAPTER,
- ra1516.getResourceadapterClass(), cl, cmd.getResourceadapter().getConfigProperties())));
-
- if (partialFailures != null)
- {
- failures = new HashSet<Failure>();
- failures.addAll(partialFailures);
- }
-
- if (!(getConfiguration().getArchiveValidationFailOnError() &&
- hasFailuresLevel(failures, Severity.ERROR)))
- {
- if (activateDeployment)
- {
- resourceAdapter =
- (ResourceAdapter)initAndInject(ra1516.getResourceadapterClass(),
- ra1516.getConfigProperties(), cl);
-
- if (trace)
- {
- log.trace("ResourceAdapter: " + resourceAdapter.getClass().getName());
- log.trace("ResourceAdapter defined in classloader: " +
- resourceAdapter.getClass().getClassLoader());
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER,
- resourceAdapter,
- ra1516.getConfigProperties()));
- beanValidationObjects.add(resourceAdapter);
- }
- }
- }
- }
-
- // ManagedConnectionFactory
- if (cmd.getVersion() == Version.V_10)
- {
- ResourceAdapter10 ra10 = (ResourceAdapter10)cmd.getResourceadapter();
-
- if (activateDeployment)
- {
- org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD =
- findConnectionDefinition(ra10.getManagedConnectionFactoryClass().getValue(),
- ijmd.getConnectionDefinitions());
-
- if (ijCD.isEnabled())
- {
- ManagedConnectionFactory mcf =
- (ManagedConnectionFactory) initAndInject(ra10.getManagedConnectionFactoryClass().getValue(),
- ra10.getConfigProperties(), cl);
-
- if (trace)
- {
- log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
- log.trace("ManagedConnectionFactory defined in classloader: " +
- mcf.getClass().getClassLoader());
- }
-
- mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
-
- archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
- mcf, ra10.getConfigProperties()));
- beanValidationObjects.add(mcf);
- associateResourceAdapter(resourceAdapter, mcf);
-
- // Create the pool
- PoolConfiguration pc = createPoolConfiguration(ijCD != null ? ijCD.getPool() : null,
- ijCD != null ? ijCD.getTimeOut() : null,
- ijCD != null ? ijCD.getValidation() : null);
- PoolFactory pf = new PoolFactory();
-
- Boolean noTxSeparatePool = Boolean.FALSE;
-
- if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
-
- Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
-
- // Add a connection manager
- ConnectionManagerFactory cmf = new ConnectionManagerFactory();
- ConnectionManager cm = null;
-
- TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
- TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
-
- if (ijmd != null && ijmd.getTransactionSupport() != null)
- {
- tsmd = ijmd.getTransactionSupport();
- }
- else
- {
- tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
- }
-
- if (tsmd == TransactionSupportEnum.NoTransaction)
- {
- tsl = TransactionSupportLevel.NoTransaction;
- }
- else if (tsmd == TransactionSupportEnum.LocalTransaction)
- {
- tsl = TransactionSupportLevel.LocalTransaction;
- }
- else if (tsmd == TransactionSupportEnum.XATransaction)
- {
- tsl = TransactionSupportLevel.XATransaction;
- }
-
- // Connection manager properties
- Integer allocationRetry = null;
- Long allocationRetryWaitMillis = null;
-
- if (ijCD != null && ijCD.getTimeOut() != null)
- {
- allocationRetry = ijCD.getTimeOut().getAllocationRetry();
- allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- // Select the correct connection manager
- if (tsl == TransactionSupportLevel.NoTransaction)
- {
- cm = cmf.createNonTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis);
- }
- else
- {
- Boolean interleaving = null;
- Integer xaResourceTimeout = null;
- Boolean isSameRMOverride = null;
- Boolean wrapXAResource = null;
- Boolean padXid = null;
-
- if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- if (ijXaPool != null)
- {
- interleaving = ijXaPool.isInterleaving();
- isSameRMOverride = ijXaPool.isSameRmOverride();
- wrapXAResource = ijXaPool.isWrapXaDataSource();
- padXid = ijXaPool.isPadXid();
- }
- }
-
- cm = cmf.createTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis,
- getConfiguration().getTransactionManager(),
- interleaving,
- xaResourceTimeout,
- isSameRMOverride,
- wrapXAResource,
- padXid);
- }
-
- // ConnectionFactory
- Object cf = mcf.createConnectionFactory(cm);
-
- if (cf == null)
- {
- log.error("ConnectionFactory is null");
- }
- else
- {
- if (trace)
- {
- log.trace("ConnectionFactory: " + cf.getClass().getName());
- log.trace("ConnectionFactory defined in classloader: "
- + cf.getClass().getClassLoader());
- }
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
- {
- String jndiName = ijCD.getJndiName();
-
- bindConnectionFactory(url, deploymentName, cf, jndiName);
- cfs = new Object[] {cf};
- jndiNames = new String[] {jndiName};
-
- cm.setJndiName(jndiName);
- }
- }
- }
- }
- else
- {
- ResourceAdapter1516 ra = (ResourceAdapter1516) cmd.getResourceadapter();
- if (ra != null && ra.getOutboundResourceadapter() != null &&
- ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
- {
- List<ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions();
- if (cdMetas.size() > 0)
- {
- cfs = new Object[cdMetas.size()];
- jndiNames = new String[cdMetas.size()];
-
- for (int cdIndex = 0; cdIndex < cdMetas.size(); cdIndex++)
- {
- org.jboss.jca.common.api.metadata.ra.ConnectionDefinition cdMeta = cdMetas.get(cdIndex);
-
- partialFailures =
- validateArchive(url, Arrays
- .asList((Validate) new ValidateClass(Key.MANAGED_CONNECTION_FACTORY, cdMeta
- .getManagedConnectionFactoryClass().getValue(), cl, cdMeta
- .getConfigProperties())));
- if (partialFailures != null)
- {
- failures = new HashSet<Failure>();
- failures.addAll(partialFailures);
- }
-
- if (!(getConfiguration().getArchiveValidationFailOnError() &&
- hasFailuresLevel(failures, Severity.ERROR)))
- {
- if (activateDeployment)
- {
- org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD =
- findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass().getValue(),
- ijmd.getConnectionDefinitions());
-
- if (ijCD.isEnabled())
- {
- ManagedConnectionFactory mcf =
- (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
- .getValue(), cdMeta
- .getConfigProperties(), cl);
-
- if (trace)
- {
- log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
- log.trace("ManagedConnectionFactory defined in classloader: " +
- mcf.getClass().getClassLoader());
- }
-
- mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
-
- archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
- mcf,
- cdMeta.getConfigProperties()));
- beanValidationObjects.add(mcf);
- associateResourceAdapter(resourceAdapter, mcf);
-
- // Create the pool
- PoolConfiguration pc =
- createPoolConfiguration(ijCD != null ? ijCD.getPool() : null,
- ijCD != null ? ijCD.getTimeOut() : null,
- ijCD != null ? ijCD.getValidation() : null);
- PoolFactory pf = new PoolFactory();
-
- Boolean noTxSeparatePool = Boolean.FALSE;
-
- if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- if (ijXaPool != null)
- noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
- }
-
- Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
-
- // Add a connection manager
- ConnectionManagerFactory cmf = new ConnectionManagerFactory();
- ConnectionManager cm = null;
- TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
- TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
-
- 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();
-
- // Connection manager properties
- Integer allocationRetry = null;
- Long allocationRetryWaitMillis = null;
-
- if (ijCD != null && ijCD.getTimeOut() != null)
- {
- allocationRetry = ijCD.getTimeOut().getAllocationRetry();
- allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
- }
-
- // Select the correct connection manager
- if (tsl == TransactionSupportLevel.NoTransaction)
- {
- cm = cmf.createNonTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis);
- }
- else
- {
- Boolean interleaving = null;
- Integer xaResourceTimeout = null;
- Boolean isSameRMOverride = null;
- Boolean wrapXAResource = null;
- Boolean padXid = null;
-
- if (ijCD != null && ijCD.isXa())
- {
- org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
- (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
- interleaving = ijXaPool.isInterleaving();
- isSameRMOverride = ijXaPool.isSameRmOverride();
- wrapXAResource = ijXaPool.isWrapXaDataSource();
- padXid = ijXaPool.isPadXid();
- }
-
- cm = cmf.createTransactional(tsl,
- pool,
- allocationRetry,
- allocationRetryWaitMillis,
- getConfiguration().getTransactionManager(),
- interleaving,
- xaResourceTimeout,
- isSameRMOverride,
- wrapXAResource,
- padXid);
- }
-
- // ConnectionFactory
- Object cf = mcf.createConnectionFactory(cm);
-
- if (cf == null)
- {
- log.error("ConnectionFactory is null");
- }
- else
- {
- if (trace)
- {
- log.trace("ConnectionFactory: " + cf.getClass().getName());
- log.trace("ConnectionFactory defined in classloader: "
- + cf.getClass().getClassLoader());
- }
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
- {
- String jndiName = ijCD.getJndiName();
-
- bindConnectionFactory(url, deploymentName, cf, jndiName);
- cfs[cdIndex] = cf;
- jndiNames[cdIndex] = jndiName;
-
- cm.setJndiName(jndiName);
- }
- }
- }
- }
- }
- }
- }
- }
-
- // ActivationSpec
- if (cmd.getVersion() != Version.V_10)
- {
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516)cmd.getResourceadapter();
- if (ra1516 != null &&
- ra1516.getInboundResourceadapter() != null &&
- ra1516.getInboundResourceadapter().getMessageadapter() != null &&
- ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null)
- {
- List<MessageListener> mlMetas = ra1516.getInboundResourceadapter().getMessageadapter().
- getMessagelisteners();
-
- if (mlMetas.size() > 0)
- {
- for (MessageListener mlMeta : mlMetas)
- {
- if (mlMeta.getActivationspec() != null &&
- mlMeta.getActivationspec().getActivationspecClass().getValue() != null)
- {
- partialFailures =
- validateArchive(url, Arrays.asList((Validate) new ValidateClass(Key.ACTIVATION_SPEC,
- mlMeta.getActivationspec().getActivationspecClass().getValue(), cl,
- mlMeta.getActivationspec().getConfigProperties())));
-
- if (partialFailures != null)
- {
- failures = new HashSet<Failure>();
- failures.addAll(partialFailures);
- }
-
- if (!(getConfiguration().getArchiveValidationFailOnError() &&
- hasFailuresLevel(failures, Severity.ERROR)))
- {
- if (activateDeployment)
- {
- List<? extends ConfigProperty> cpm = mlMeta.getActivationspec().getConfigProperties();
-
- Object o = initAndInject(mlMeta
- .getActivationspec().getActivationspecClass().getValue(), cpm, cl);
-
- if (trace)
- {
- log.trace("ActivationSpec: " + o.getClass().getName());
- log.trace("ActivationSpec defined in classloader: " +
- o.getClass().getClassLoader());
- }
-
- archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o, cpm));
- beanValidationObjects.add(o);
- associateResourceAdapter(resourceAdapter, o);
- }
- }
- }
- }
- }
- }
- }
-
- // AdminObject
- if (cmd.getVersion() != Version.V_10)
- {
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516)cmd.getResourceadapter();
- if (ra1516 != null && ra1516.getAdminObjects() != null)
- {
- List<AdminObject> aoMetas = ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminObjects();
- if (aoMetas.size() > 0)
- {
- for (AdminObject aoMeta : aoMetas)
- {
- if (aoMeta.getAdminobjectClass() != null &&
- aoMeta.getAdminobjectClass().getValue() != null)
- {
- partialFailures =
- validateArchive(url, Arrays.asList((Validate) new ValidateClass(Key.ADMIN_OBJECT,
- aoMeta.getAdminobjectClass().getValue(), cl, aoMeta.getConfigProperties())));
-
- if (partialFailures != null)
- {
- failures = new HashSet<Failure>();
- failures.addAll(partialFailures);
- }
-
- if (!(getConfiguration().getArchiveValidationFailOnError() &&
- hasFailuresLevel(failures, Severity.ERROR)))
- {
- if (activateDeployment)
- {
- Object o =
- initAndInject(aoMeta.getAdminobjectClass().getValue(), aoMeta.getConfigProperties(),
- cl);
-
- if (trace)
- {
- log.trace("AdminObject: " + o.getClass().getName());
- log.trace("AdminObject defined in classloader: " + o.getClass().getClassLoader());
- }
-
- archiveValidationObjects
- .add(new ValidateObject(Key.ADMIN_OBJECT, o, aoMeta.getConfigProperties()));
- beanValidationObjects.add(o);
- }
- }
- }
- }
- }
- }
- }
- }
-
- // Archive validation
- partialFailures = validateArchive(url, archiveValidationObjects);
-
- if (partialFailures != null)
- {
- if (failures == null)
- {
- failures = new HashSet<Failure>();
- }
- failures.addAll(partialFailures);
- }
-
- if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
- (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
- {
- throw new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures);
- }
- else
- {
- printFailuresLog(url.getPath(), new Validator(), failures, null);
- }
-
- if (cmd != null)
- {
- // Register with MDR
- getConfiguration().getMetadataRepository().registerResourceAdapter(url, root, cmd, ijmd);
- }
-
- if (activateDeployment)
- {
- // Bean validation
- if (getConfiguration().getBeanValidation())
- {
- List<Class> groupsClasses = null;
-
- if (ijmd != null && ijmd.getBeanValidationGroups() != null &&
- ijmd.getBeanValidationGroups().size() > 0)
- {
- groupsClasses = new ArrayList<Class>();
- for (String group : ijmd.getBeanValidationGroups())
- {
- groupsClasses.add(Class.forName(group, true, cl));
- }
- }
-
- if (beanValidationObjects.size() > 0)
- {
- BeanValidation beanValidator = new BeanValidation();
- for (Object o : beanValidationObjects)
- {
- beanValidator.validate(o, groupsClasses);
- }
- }
- }
-
- // Activate deployment
- if (resourceAdapter != null)
- {
- String bootstrapIdentifier = null;
-
- if (ijmd != null)
- {
- bootstrapIdentifier = ijmd.getBootstrapContext();
- }
-
- startContext(resourceAdapter, bootstrapIdentifier);
- }
- }
-
- if (activateDeployment)
- {
- log.info("Deployed: " + url.toExternalForm());
- }
- else
- {
- log.debug("Activated: " + url.toExternalForm());
- }
-
- return new RADeployment(url,
- deploymentName,
- activateDeployment,
- resourceAdapter,
- getConfiguration().getJndiStrategy(),
- getConfiguration().getMetadataRepository(),
- cfs,
- jndiNames,
- destination,
- cl,
- log);
-
}
catch (DeployException de)
{
- // Just rethrow
+ //just rethrow
throw de;
}
catch (Throwable t)
{
- if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
- (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
- {
- throw new DeployException("Deployment " + url.toExternalForm() + " failed",
- new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures));
- }
- else
- {
- printFailuresLog(url.getPath(), new Validator(), failures, null);
- throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
- }
+
+ throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+
}
+
finally
{
SecurityActions.setThreadContextClassLoader(oldTCCL);
}
}
+
+ @Override
+ public Deployment createDeployment(URL deploymentUrl, String deploymentName, boolean activator,
+ ResourceAdapter resourceAdapter, JndiStrategy jndiStrategy, MetadataRepository metadataRepository, Object[] cfs,
+ File destination, ClassLoader cl, Logger log, String[] jndis, URL deployment, boolean activateDeployment)
+ {
+ return new RADeployment(deploymentUrl, deploymentName, activateDeployment, resourceAdapter, jndiStrategy,
+ metadataRepository, cfs, jndis, destination, cl, log);
+ }
+
/**
* Check if the resource adapter should be activated based on the ironjacamar.xml input
* @param cmd The connector metadata
* @param ijmd The IronJacamar metadata
* @return True if the deployment should be activated; otherwise false
*/
- private boolean checkActivation(Connector cmd, IronJacamar ijmd)
+ @Override
+ protected boolean checkActivation(Connector cmd, IronJacamar ijmd)
{
if (cmd != null && ijmd != null)
{
Set<String> raClasses = new HashSet<String>();
Set<String> ijClasses = new HashSet<String>();
-
+
if (cmd.getVersion() == Version.V_10)
{
- ResourceAdapter10 ra10 = (ResourceAdapter10)cmd.getResourceadapter();
+ ResourceAdapter10 ra10 = (ResourceAdapter10) cmd.getResourceadapter();
raClasses.add(ra10.getManagedConnectionFactoryClass().getValue());
}
else
{
- ResourceAdapter1516 ra = (ResourceAdapter1516)cmd.getResourceadapter();
+ ResourceAdapter1516 ra = (ResourceAdapter1516) cmd.getResourceadapter();
if (ra != null && ra.getOutboundResourceadapter() != null &&
ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
{
@@ -889,4 +256,5 @@
return false;
}
+
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-09-28 10:55:49 UTC (rev 108362)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-09-28 11:23:08 UTC (rev 108363)
@@ -40,6 +40,8 @@
import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
import org.jboss.jca.validator.Failure;
import org.jboss.jca.validator.Key;
import org.jboss.jca.validator.Severity;
@@ -56,12 +58,12 @@
import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.resource.Referenceable;
import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
import javax.resource.spi.TransactionSupport;
import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
@@ -101,6 +103,7 @@
*/
public RaXmlDeployer()
{
+ super(false);
}
/**
@@ -362,7 +365,7 @@
.getManagedConnectionFactoryClass().getValue(),
((ResourceAdapter10) cmd.getResourceadapter())
.getConfigProperties(), cl);
-
+
if (trace)
{
log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
@@ -378,7 +381,7 @@
}
mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
-
+
archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
mcf,
((ResourceAdapter10) cmd.getResourceadapter())
@@ -404,9 +407,9 @@
}
PoolFactory pf = new PoolFactory();
-
+
Boolean noTxSeparatePool = Boolean.FALSE;
-
+
if (cdRaXml.getPool() != null && cdRaXml.isXa())
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
@@ -419,20 +422,20 @@
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
(org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
+
if (ijXaPool != null)
noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
}
Pool pool = pf.create(PoolStrategy.ONE_POOL, 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.getTransactionSupport() != null)
{
tsmd = raxml.getTransactionSupport();
@@ -502,7 +505,7 @@
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
(org.jboss.jca.common.api.metadata.common.CommonXaPool)cdRaXml.getPool();
-
+
interleaving = ijXaPool.isInterleaving();
isSameRMOverride = ijXaPool.isSameRmOverride();
wrapXAResource = ijXaPool.isWrapXaDataSource();
@@ -513,7 +516,7 @@
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
(org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
+
if (ijXaPool != null)
{
if (interleaving == null)
@@ -544,7 +547,7 @@
// ConnectionFactory
Object cf = mcf.createConnectionFactory(cm);
-
+
if (cf == null)
{
log.error("ConnectionFactory is null");
@@ -565,13 +568,13 @@
{
org.jboss.jca.common.api.metadata.common.CommonConnDef cd =
findConnectionDefinition(mcf.getClass().getName(), raxml.getConnectionDefinitions());
-
+
String jndiName = cd.getJndiName();
-
+
bindConnectionFactory(deployment, deploymentName, cf, jndiName);
cfs = new Object[] {cf};
jndiNames = new String[] {jndiName};
-
+
cm.setJndiName(jndiName);
}
}
@@ -612,12 +615,12 @@
log.trace("ManagedConnectionFactory defined in classloader: " +
mcf.getClass().getClassLoader());
}
-
+
org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
if (ijmd != null)
{
- ijCD = findConnectionDefinition(mcf.getClass().getName(),
+ ijCD = findConnectionDefinition(mcf.getClass().getName(),
ijmd.getConnectionDefinitions());
}
@@ -634,13 +637,13 @@
if (cdRaXml.getPool() != null || cdRaXml.getPool() != null || cdRaXml.getPool() != null)
{
- pc = createPoolConfiguration(cdRaXml.getPool(),
+ pc = createPoolConfiguration(cdRaXml.getPool(),
cdRaXml.getTimeOut(),
cdRaXml.getValidation());
}
else if (ijCD != null)
{
- pc = createPoolConfiguration(ijCD.getPool(),
+ pc = createPoolConfiguration(ijCD.getPool(),
ijCD.getTimeOut(),
ijCD.getValidation());
}
@@ -653,12 +656,12 @@
PoolFactory pf = new PoolFactory();
Boolean noTxSeparatePool = Boolean.FALSE;
-
+
if (cdRaXml.getPool() != null && cdRaXml.isXa())
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
(org.jboss.jca.common.api.metadata.common.CommonXaPool)cdRaXml.getPool();
-
+
if (ijXaPool != null)
noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
}
@@ -666,11 +669,11 @@
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
(org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
+
if (ijXaPool != null)
noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
}
-
+
Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
// Add a connection manager
@@ -743,12 +746,12 @@
Boolean isSameRMOverride = null;
Boolean wrapXAResource = null;
Boolean padXid = null;
-
+
if (cdRaXml.isXa())
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
(org.jboss.jca.common.api.metadata.common.CommonXaPool)cdRaXml.getPool();
-
+
interleaving = ijXaPool.isInterleaving();
isSameRMOverride = ijXaPool.isSameRmOverride();
wrapXAResource = ijXaPool.isWrapXaDataSource();
@@ -759,7 +762,7 @@
{
org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
(org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
+
if (interleaving == null)
interleaving = ijXaPool.isInterleaving();
@@ -895,17 +898,8 @@
}
// Archive validation
- partialFailures = validateArchive(url, archiveValidationObjects);
+ failures = validateArchive(url, archiveValidationObjects, failures);
- if (partialFailures != null)
- {
- if (failures == null)
- {
- failures = new HashSet<Failure>();
- }
- failures.addAll(partialFailures);
- }
-
if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
{
@@ -1026,4 +1020,19 @@
if (kernel == null)
throw new IllegalStateException("Kernel not defined");
}
+
+ @Override
+ protected boolean checkActivation(Connector cmd, IronJacamar ijmd)
+ {
+ return true;
+ }
+
+ @Override
+ public Deployment createDeployment(URL deploymentUrl, String deploymentName, boolean activator,
+ ResourceAdapter resourceAdapter, JndiStrategy jndiStrategy, MetadataRepository metadataRepository, Object[] cfs,
+ File destination, ClassLoader cl, Logger log, String[] jndis, URL deployment, boolean activateDeployment)
+ {
+ //NYI
+ return null;
+ }
}
Modified: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java 2010-09-28 10:55:49 UTC (rev 108362)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java 2010-09-28 11:23:08 UTC (rev 108363)
@@ -32,6 +32,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
+import java.util.Set;
import org.junit.Test;
@@ -63,14 +64,14 @@
{
//given
RAConfiguration configuration = new RAConfiguration();
- RADeployer deployer = new RADeployer();
+ AbstractResourceAdapterDeployer deployer = new RADeployer();
deployer.setConfiguration(configuration);
deployer.getConfiguration().setArchiveValidation(false);
//when
- List<Failure> returnValue = deployer.validateArchive(null, null);
+ Set<Failure> returnValue = deployer.validateArchive(null, null, null);
//then
- assertThat(returnValue, is((List) null));
+ assertThat(returnValue, is((Set) null));
}
/**
@@ -83,7 +84,7 @@
{
//given
RAConfiguration configuration = new RAConfiguration();
- RADeployer deployer = new RADeployer();
+ AbstractResourceAdapterDeployer deployer = new RADeployer();
deployer.setConfiguration(configuration);
File mockedDirectory = mock(File.class);
@@ -114,7 +115,7 @@
{
//given
RAConfiguration configuration = new RAConfiguration();
- RADeployer deployer = new RADeployer();
+ AbstractResourceAdapterDeployer deployer = new RADeployer();
deployer.setConfiguration(configuration);
File mockedDirectory = mock(File.class);
@@ -146,7 +147,7 @@
//given
RAConfiguration configuration = new RAConfiguration();
- RADeployer deployer = new RADeployer();
+ AbstractResourceAdapterDeployer deployer = new RADeployer();
deployer.setConfiguration(configuration);
deployer.getConfiguration().setArchiveValidationFailOnError(true);
Modified: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ao/AOTestCase.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ao/AOTestCase.java 2010-09-28 10:55:49 UTC (rev 108362)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ao/AOTestCase.java 2010-09-28 11:23:08 UTC (rev 108363)
@@ -32,10 +32,10 @@
import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.junit.Test;
+
import com.github.fungal.spi.deployers.DeployException;
-import org.junit.Test;
-
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNull.notNullValue;
More information about the jboss-cvs-commits
mailing list