[jboss-cvs] JBossAS SVN: r108611 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/spi/naming and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 15 16:13:44 EDT 2010
Author: jesper.pedersen
Date: 2010-10-15 16:13:43 -0400 (Fri, 15 Oct 2010)
New Revision: 108611
Modified:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.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/RAActivatorDeployment.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/RADeployment.java
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/RaXmlDeployment.java
Log:
[JBJCA-444] Register admin objects in JNDI
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -50,7 +50,7 @@
private static boolean trace = log.isTraceEnabled();
- private static ConcurrentMap<String, Object> connectionFactories = new ConcurrentHashMap<String, Object>();
+ private static ConcurrentMap<String, Object> objs = new ConcurrentHashMap<String, Object>();
/**
* Constructor
@@ -70,7 +70,7 @@
String className = (String)ref.get("class").getContent();
String cfname = (String)ref.get("name").getContent();
- return connectionFactories.get(qualifiedName(cfname, className));
+ return objs.get(qualifiedName(cfname, className));
}
/**
@@ -131,7 +131,7 @@
null);
ref.add(new StringRefAddr("name", jndiName));
- if (connectionFactories.putIfAbsent(qualifiedName(jndiName, className), cf) != null)
+ if (objs.putIfAbsent(qualifiedName(jndiName, className), cf) != null)
throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
Referenceable referenceable = (Referenceable)cf;
@@ -212,7 +212,7 @@
Util.unbind(context, jndiName);
- connectionFactories.remove(qualifiedName(jndiName, className));
+ objs.remove(qualifiedName(jndiName, className));
if (log.isDebugEnabled())
log.debug("Unbound " + className + " under " + jndiName);
@@ -239,6 +239,171 @@
}
/**
+ * {@inheritDoc}
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos) throws Throwable
+ {
+ throw new IllegalStateException("JNDI names are required");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable
+ {
+ if (deployment == null)
+ throw new IllegalArgumentException("Deployment is null");
+
+ if (deployment.trim().equals(""))
+ throw new IllegalArgumentException("Deployment is empty");
+
+ if (aos == null)
+ throw new IllegalArgumentException("AOS is null");
+
+ if (aos.length == 0)
+ throw new IllegalArgumentException("AOS is empty");
+
+ if (jndis == null)
+ throw new IllegalArgumentException("JNDIs is null");
+
+ if (jndis.length == 0)
+ throw new IllegalArgumentException("JNDIs is empty");
+
+ if (aos.length != jndis.length)
+ throw new IllegalArgumentException("Number of admin objects doesn't match number of JNDI names");
+
+ Context context = new InitialContext();
+ try
+ {
+ for (int i = 0; i < aos.length; i++)
+ {
+ String jndiName = jndis[i];
+ Object ao = aos[i];
+
+ if (trace)
+ log.trace("Binding " + ao.getClass().getName() + " under " + jndiName);
+
+ if (ao == null)
+ throw new IllegalArgumentException("Admin object is null");
+
+ if (jndiName == null)
+ throw new IllegalArgumentException("JNDI name is null");
+
+ String className = ao.getClass().getName();
+ Reference ref = new Reference(className,
+ new StringRefAddr("class", className),
+ ExplicitJndiStrategy.class.getName(),
+ null);
+ ref.add(new StringRefAddr("name", jndiName));
+
+ if (objs.putIfAbsent(qualifiedName(jndiName, className), ao) != null)
+ throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
+
+ Referenceable referenceable = (Referenceable)ao;
+ referenceable.setReference(ref);
+
+ Util.bind(context, jndiName, ao);
+
+ if (log.isDebugEnabled())
+ log.debug("Bound " + ao.getClass().getName() + " under " + jndiName);
+ }
+ }
+ finally
+ {
+ if (context != null)
+ {
+ try
+ {
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ return jndis;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos) throws Throwable
+ {
+ throw new IllegalStateException("JNDI names are required");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable
+ {
+ if (aos == null)
+ throw new IllegalArgumentException("AOS is null");
+
+ if (aos.length == 0)
+ throw new IllegalArgumentException("AOS is empty");
+
+ if (jndis == null)
+ throw new IllegalArgumentException("JNDIs is null");
+
+ if (jndis.length == 0)
+ throw new IllegalArgumentException("JNDIs is empty");
+
+ if (aos.length != jndis.length)
+ throw new IllegalArgumentException("Number of admin objects doesn't match number of JNDI names");
+
+ Context context = null;
+ try
+ {
+ context = new InitialContext();
+
+ for (int i = 0; i < aos.length; i++)
+ {
+ String jndiName = jndis[i];
+ Object ao = aos[i];
+
+ if (ao == null)
+ throw new IllegalArgumentException("Admin object is null");
+
+ if (jndiName == null)
+ throw new IllegalArgumentException("JNDI name is null");
+
+ String className = ao.getClass().getName();
+
+ if (trace)
+ log.trace("Unbinding " + className + " under " + jndiName);
+
+ Util.unbind(context, jndiName);
+
+ objs.remove(qualifiedName(jndiName, className));
+
+ if (log.isDebugEnabled())
+ log.debug("Unbound " + className + " under " + jndiName);
+ }
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during unbind", t);
+ }
+ finally
+ {
+ if (context != null)
+ {
+ try
+ {
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ /**
* Clone the JNDI strategy implementation
* @return A copy of the implementation
* @exception CloneNotSupportedException Thrown if the copy operation isn't supported
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -88,6 +88,36 @@
}
/**
+ * {@inheritDoc}
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos) throws Throwable
+ {
+ return new String[0];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable
+ {
+ return new String[0];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos) throws Throwable
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable
+ {
+ }
+
+ /**
* Clone the JNDI strategy implementation
* @return A copy of the implementation
* @exception CloneNotSupportedException Thrown if the copy operation isn't supported
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -41,7 +41,9 @@
/**
* A simple JNDI strategy that bind a single connection factory under the
- * name of "java:/eis/<deployment>" by default
+ * name of "java:/eis/<deployment>" by default.
+ *
+ * A single admin object is bound under "java:/eis/ao/<deployment>" by default.
*
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
@@ -51,11 +53,14 @@
private static boolean trace = log.isTraceEnabled();
- /** JNDI prefix */
- private static final String JNDI_PREFIX = "java:/eis/";
+ /** JNDI prefix for connection factories */
+ private static final String CF_JNDI_PREFIX = "java:/eis/";
- private static ConcurrentMap<String, Object> connectionFactories = new ConcurrentHashMap<String, Object>();
+ /** JNDI prefix for admin objects */
+ private static final String AO_JNDI_PREFIX = "java:/eis/ao/";
+ private static ConcurrentMap<String, Object> objs = new ConcurrentHashMap<String, Object>();
+
/**
* Constructor
*/
@@ -74,7 +79,7 @@
String className = (String)ref.get("class").getContent();
String cfname = (String)ref.get("name").getContent();
- return connectionFactories.get(qualifiedName(cfname, className));
+ return objs.get(qualifiedName(cfname, className));
}
/**
@@ -82,7 +87,7 @@
*/
public String[] bindConnectionFactories(String deployment, Object[] cfs) throws Throwable
{
- String jndiName = JNDI_PREFIX + deployment;
+ String jndiName = CF_JNDI_PREFIX + deployment;
return bindConnectionFactories(deployment, cfs, new String[] {jndiName});
}
@@ -139,7 +144,7 @@
null);
ref.add(new StringRefAddr("name", jndiName));
- if (connectionFactories.putIfAbsent(qualifiedName(jndiName, className), cf) != null)
+ if (objs.putIfAbsent(qualifiedName(jndiName, className), cf) != null)
throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
Referenceable referenceable = (Referenceable)cf;
@@ -173,7 +178,7 @@
*/
public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable
{
- String jndiName = JNDI_PREFIX + deployment;
+ String jndiName = CF_JNDI_PREFIX + deployment;
unbindConnectionFactories(deployment, cfs, new String[] {jndiName});
}
@@ -224,7 +229,7 @@
Util.unbind(context, jndiName);
- connectionFactories.remove(qualifiedName(jndiName, className));
+ objs.remove(qualifiedName(jndiName, className));
if (log.isDebugEnabled())
log.debug("Unbound " + className + " under " + jndiName);
@@ -250,6 +255,178 @@
}
/**
+ * {@inheritDoc}
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos) throws Throwable
+ {
+ String jndiName = AO_JNDI_PREFIX + deployment;
+
+ return bindAdminObjects(deployment, aos, new String[] {jndiName});
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable
+ {
+ if (deployment == null)
+ throw new IllegalArgumentException("Deployment is null");
+
+ if (deployment.trim().equals(""))
+ throw new IllegalArgumentException("Deployment is empty");
+
+ if (aos == null)
+ throw new IllegalArgumentException("AOS is null");
+
+ if (aos.length == 0)
+ throw new IllegalArgumentException("AOS is empty");
+
+ if (aos.length > 1)
+ throw new IllegalArgumentException("SimpleJndiStrategy only support " +
+ "a single admin object per deployment");
+ if (jndis == null)
+ throw new IllegalArgumentException("JNDIs is null");
+
+ if (jndis.length == 0)
+ throw new IllegalArgumentException("JNDIs is empty");
+
+ if (jndis.length > 1)
+ throw new IllegalArgumentException("SimpleJndiStrategy only support " +
+ "a single JNDI name per deployment");
+
+ String jndiName = jndis[0];
+ Object ao = aos[0];
+
+ if (trace)
+ log.trace("Binding " + ao.getClass().getName() + " under " + jndiName);
+
+ if (ao == null)
+ throw new IllegalArgumentException("Admin object is null");
+
+ if (jndiName == null)
+ throw new IllegalArgumentException("JNDI name is null");
+
+ Context context = new InitialContext();
+ try
+ {
+ String className = ao.getClass().getName();
+ Reference ref = new Reference(className,
+ new StringRefAddr("class", className),
+ SimpleJndiStrategy.class.getName(),
+ null);
+ ref.add(new StringRefAddr("name", jndiName));
+
+ if (objs.putIfAbsent(qualifiedName(jndiName, className), ao) != null)
+ throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
+
+ Referenceable referenceable = (Referenceable)ao;
+ referenceable.setReference(ref);
+
+ Util.bind(context, jndiName, ao);
+
+ if (log.isDebugEnabled())
+ log.debug("Bound " + ao.getClass().getName() + " under " + jndiName);
+ }
+ finally
+ {
+ if (context != null)
+ {
+ try
+ {
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ return new String[] {jndiName};
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos) throws Throwable
+ {
+ String jndiName = AO_JNDI_PREFIX + deployment;
+
+ unbindAdminObjects(deployment, aos, new String[] {jndiName});
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable
+ {
+ if (aos == null)
+ throw new IllegalArgumentException("AOS is null");
+
+ if (aos.length == 0)
+ throw new IllegalArgumentException("AOS is empty");
+
+ if (aos.length > 1)
+ throw new IllegalArgumentException("SimpleJndiStrategy only support " +
+ "a single admin object per deployment");
+
+ if (jndis == null)
+ throw new IllegalArgumentException("JNDIs is null");
+
+ if (jndis.length == 0)
+ throw new IllegalArgumentException("JNDIs is empty");
+
+ if (jndis.length > 1)
+ throw new IllegalArgumentException("SimpleJndiStrategy only support " +
+ "a single JNDI name per deployment");
+
+ String jndiName = jndis[0];
+ Object ao = aos[0];
+
+ if (ao == null)
+ throw new IllegalArgumentException("Admin object is null");
+
+ if (jndiName == null)
+ throw new IllegalArgumentException("JNDI name is null");
+
+ String className = ao.getClass().getName();
+
+ if (trace)
+ log.trace("Unbinding " + className + " under " + jndiName);
+
+ Context context = null;
+ try
+ {
+ context = new InitialContext();
+
+ Util.unbind(context, jndiName);
+
+ objs.remove(qualifiedName(jndiName, className));
+
+ if (log.isDebugEnabled())
+ log.debug("Unbound " + className + " under " + jndiName);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during unbind", t);
+ }
+ finally
+ {
+ if (context != null)
+ {
+ try
+ {
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ /**
* Clone the JNDI strategy implementation
* @return A copy of the implementation
* @exception CloneNotSupportedException Thrown if the copy operation isn't supported
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -31,7 +31,7 @@
*/
public interface JndiStrategy extends Cloneable, ObjectFactory
{
- /**
+ /**
* Bind connection factories for a deployment
* @param deployment The deployment name
* @param cfs The connection factories
@@ -40,7 +40,7 @@
*/
public String[] bindConnectionFactories(String deployment, Object[] cfs) throws Throwable;
- /**
+ /**
* Bind connection factories for a deployment
* @param deployment The deployment name
* @param cfs The connection factories
@@ -68,6 +68,42 @@
public void unbindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable;
/**
+ * Bind admin objects for a deployment
+ * @param deployment The deployment name
+ * @param aos The admin objects
+ * @return The JNDI names for the admin objects
+ * @exception Throwable Thrown if an error occurs
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos) throws Throwable;
+
+ /**
+ * Bind admin objects for a deployment
+ * @param deployment The deployment name
+ * @param aos The admin objects
+ * @param jndis The JNDI names for the admin objects
+ * @return The JNDI names for the admin objects
+ * @exception Throwable Thrown if an error occurs
+ */
+ public String[] bindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable;
+
+ /**
+ * Unbind admin objects for a deployment
+ * @param deployment The deployment name
+ * @param aos The admin objects
+ * @exception Throwable Thrown if an error occurs
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos) throws Throwable;
+
+ /**
+ * Unbind admin objects for a deployment
+ * @param deployment The deployment name
+ * @param aos The admin objects
+ * @param jndis The JNDI names for the admin objects
+ * @exception Throwable Thrown if an error occurs
+ */
+ public void unbindAdminObjects(String deployment, Object[] aos, String[] jndis) throws Throwable;
+
+ /**
* Clone the JNDI strategy implementation
* @return A copy of the implementation
* @exception CloneNotSupportedException Thrown if the copy operation isn't supported
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -62,7 +62,7 @@
public abstract class AbstractDsDeployer
{
/** log **/
- protected static final Logger log = Logger.getLogger(DsXmlDeployer.class);
+ protected static Logger log = Logger.getLogger(DsXmlDeployer.class);
/** jdbcLocal **/
protected String jdbcLocal;
@@ -266,8 +266,10 @@
log.error("Deployment of XA datasources disabled since jdbc-xa.rar couldn't be found");
}
- return new CommonDeployment(url, deploymentName, true, null, cfs.toArray(new Object[cfs.size()]),
- parentClassLoader, log, jndis.toArray(new String[jndis.size()]));
+ return new CommonDeployment(url, deploymentName, true, null,
+ cfs.toArray(new Object[cfs.size()]), jndis.toArray(new String[jndis.size()]),
+ null, null,
+ parentClassLoader, log);
}
catch (Throwable t)
{
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -22,6 +22,7 @@
package org.jboss.jca.deployers.common;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
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;
@@ -356,10 +357,10 @@
}
/**
- * Find the connection factory for a managed connection factory
- * @param clz clz clz The fully quilified class name for the managed connection factory
- * @param defs defs defs The connection definitions
- * @return The connection definiton; <code>null</code> if none could be found
+ * Find the metadata for a managed connection factory
+ * @param clz The fully quilified class name for the managed connection factory
+ * @param defs The connection definitions
+ * @return The metadata; <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)
@@ -373,7 +374,7 @@
if (cd.getClassName() != null && !clz.equals(cd.getClassName()))
{
- log.warn("Only one connection definitopn found with a mis-match in class-name: " + cd);
+ log.warn("Only one connection definition found with a mismatch in class-name: " + cd);
return null;
}
@@ -395,6 +396,45 @@
}
/**
+ * Find the metadata for an admin object
+ * @param clz The fully quilified class name for the admin object
+ * @param defs The admin object definitions
+ * @return The metadata; <code>null</code> if none could be found
+ */
+ protected org.jboss.jca.common.api.metadata.common.CommonAdminObject findAdminObject(String clz,
+ List<org.jboss.jca.common.api.metadata.common.CommonAdminObject> defs)
+ {
+ if (defs != null)
+ {
+ // If there is only one we will return that
+ if (defs.size() == 1)
+ {
+ org.jboss.jca.common.api.metadata.common.CommonAdminObject cao = defs.get(0);
+
+ if (cao.getClassName() != null && !clz.equals(cao.getClassName()))
+ {
+ log.warn("Only one admin object found with a mismatch in class-name: " + cao);
+ return null;
+ }
+
+ return cao;
+ }
+
+ // If there are multiple definitions the admin object class name is mandatory
+ if (clz == null)
+ throw new IllegalArgumentException("AdminObject must be defined in class-name");
+
+ for (org.jboss.jca.common.api.metadata.common.CommonAdminObject cao : defs)
+ {
+ if (clz.equals(cao.getClassName()))
+ return cao;
+ }
+ }
+
+ return null;
+ }
+
+ /**
* Create an instance of the pool configuration based on the input
* @param pp pp pp The pool parameters
* @param tp tp tp The timeout parameters
@@ -532,12 +572,21 @@
* @param beanValidationObjects beanValidationObjects
* @param failures falures to be updated during implemented operations
* @param url url
+ * @param deploymentName The deployment name
* @param activateDeployment activateDeployment
+ * @param aosRaXml Admin object definitions from -ra.xml
+ * @param aosIronJacamar Admin object definitions from ironjacamar.xml
+ * @param aos The resulting array of admin objects
+ * @param aoJndiNames The resulting array of JNDI names
* @return failures updated after implemented operations
* @throws DeployException DeployException in case of errors
*/
protected Set<Failure> initAdminObject(Connector cmd, ClassLoader cl, List<Validate> archiveValidationObjects,
- List<Object> beanValidationObjects, Set<Failure> failures, URL url, boolean activateDeployment)
+ List<Object> beanValidationObjects, Set<Failure> failures,
+ URL url, String deploymentName, boolean activateDeployment,
+ List<org.jboss.jca.common.api.metadata.common.CommonAdminObject> aosRaXml,
+ List<org.jboss.jca.common.api.metadata.common.CommonAdminObject> aosIronJacamar,
+ Object[] aos, String[] aoJndiNames)
throws DeployException
{
// AdminObject
@@ -549,10 +598,18 @@
List<AdminObject> aoMetas = ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminObjects();
if (aoMetas.size() > 0)
{
- for (AdminObject aoMeta : aoMetas)
+ aos = new Object[aoMetas.size()];
+ aoJndiNames = new String[aoMetas.size()];
+
+ for (int i = 0; i < aoMetas.size(); i++)
{
+ AdminObject aoMeta = aoMetas.get(i);
+
if (aoMeta.getAdminobjectClass() != null && aoMeta.getAdminobjectClass().getValue() != null)
{
+ CommonAdminObject aoRaXml = findAdminObject(aoMeta.getAdminobjectClass().getValue(), aosRaXml);
+ CommonAdminObject ijAO = findAdminObject(aoMeta.getAdminobjectClass().getValue(), aosIronJacamar);
+
failures = validateArchive(url,
Arrays.asList((Validate) new ValidateClass(Key.ADMIN_OBJECT, aoMeta.getAdminobjectClass()
.getValue(), cl, aoMeta.getConfigProperties())), failures);
@@ -561,18 +618,51 @@
{
if (activateDeployment)
{
- Object o = initAndInject(aoMeta.getAdminobjectClass().getValue(),
- aoMeta.getConfigProperties(), cl);
+ Object ao = initAndInject(aoMeta.getAdminobjectClass().getValue(),
+ aoMeta.getConfigProperties(), cl);
if (trace)
{
- log.trace("AdminObject: " + o.getClass().getName());
- log.trace("AdminObject defined in classloader: " + o.getClass().getClassLoader());
+ log.trace("AdminObject: " + ao.getClass().getName());
+ log.trace("AdminObject defined in classloader: " + ao.getClass().getClassLoader());
}
- archiveValidationObjects.add(new ValidateObject(Key.ADMIN_OBJECT, o, aoMeta
- .getConfigProperties()));
- beanValidationObjects.add(o);
+ archiveValidationObjects.add(new ValidateObject(Key.ADMIN_OBJECT, ao, aoMeta
+ .getConfigProperties()));
+ beanValidationObjects.add(ao);
+
+ if (ao != null && ao instanceof Serializable && ao instanceof Referenceable)
+ {
+ try
+ {
+ String jndiName = null;
+ if (aoRaXml != null || ijAO != null)
+ {
+ if (aoRaXml != null)
+ {
+ jndiName = aoRaXml.getJndiName();
+ }
+ else
+ {
+ jndiName = ijAO.getJndiName();
+ }
+
+ bindAdminObject(url, deploymentName, ao, jndiName);
+ }
+ else
+ {
+ String[] names = bindAdminObject(url, deploymentName, ao);
+ jndiName = names[0];
+ }
+
+ aos[i] = ao;
+ aoJndiNames[i] = jndiName;
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException("Failed to bind admin object", t);
+ }
+ }
}
}
}
@@ -645,7 +735,9 @@
List<Validate> archiveValidationObjects = new ArrayList<Validate>();
List<Object> beanValidationObjects = new ArrayList<Object>();
Object[] cfs = null;
- String[] jndiNames = null;
+ String[] cfJndiNames = null;
+ Object[] aos = null;
+ String[] aoJndiNames = null;
// Check metadata for JNDI information and activate explicit
boolean activateDeployment = checkActivation(cmd, ijmd);
@@ -892,16 +984,16 @@
bindConnectionFactory(url, deploymentName, cf, jndiName);
cfs = new Object[]{cf};
- jndiNames = new String[]{jndiName};
+ cfJndiNames = new String[]{jndiName};
cm.setJndiName(jndiName);
}
else
{
- jndiNames = bindConnectionFactory(url, deploymentName, cf);
+ cfJndiNames = bindConnectionFactory(url, deploymentName, cf);
cfs = new Object[]{cf};
- cm.setJndiName(jndiNames[0]);
+ cm.setJndiName(cfJndiNames[0]);
}
}
}
@@ -920,7 +1012,7 @@
// {
// ConnectionDefinition cdMeta = cdMetas.get(0);
cfs = new Object[cdMetas.size()];
- jndiNames = new String[cdMetas.size()];
+ cfJndiNames = new String[cdMetas.size()];
for (int cdIndex = 0; cdIndex < cdMetas.size(); cdIndex++)
{
@@ -1139,16 +1231,16 @@
bindConnectionFactory(url, deploymentName, cf, jndiName);
cfs[cdIndex] = cf;
- jndiNames[cdIndex] = jndiName;
+ cfJndiNames[cdIndex] = jndiName;
cm.setJndiName(jndiName);
}
else
{
- jndiNames = bindConnectionFactory(url, deploymentName, cf);
+ cfJndiNames = bindConnectionFactory(url, deploymentName, cf);
cfs = new Object[]{cf};
- cm.setJndiName(jndiNames[0]);
+ cm.setJndiName(cfJndiNames[0]);
}
}
@@ -1161,10 +1253,13 @@
}
failures = initActivationSpec(cl, cmd, resourceAdapter, archiveValidationObjects, beanValidationObjects,
- failures, url, activateDeployment);
+ failures, url, activateDeployment);
failures = initAdminObject(cmd, cl, archiveValidationObjects, beanValidationObjects, failures, url,
- activateDeployment);
+ deploymentName, activateDeployment,
+ raxml != null ? raxml.getAdminObjects() : null,
+ ijmd != null ? ijmd.getAdminObjects() : null,
+ aos, aoJndiNames);
}
// Archive validation
@@ -1249,8 +1344,8 @@
log.debug("Activated: " + url.toExternalForm());
}
- return new CommonDeployment(url, deploymentName, activateDeployment, resourceAdapter, cfs, cl, log,
- jndiNames);
+ return new CommonDeployment(url, deploymentName, activateDeployment, resourceAdapter, cfs, cfJndiNames,
+ aos, aoJndiNames, cl, log);
}
catch (DeployException de)
@@ -1336,6 +1431,28 @@
throws Throwable;
/**
+ * Bind admin object into JNDI
+ * @param url The deployment URL
+ * @param deploymentName The deployment name
+ * @param ao The admin object
+ * @return The JNDI names bound
+ * @exception Throwable Thrown if an error occurs
+ */
+ protected abstract String[] bindAdminObject(URL url, String deploymentName, Object ao) throws Throwable;
+
+ /**
+ * Bind admin object into JNDI
+ * @param url The deployment URL
+ * @param deploymentName The deployment name
+ * @param ao The admin object
+ * @param jndiName The JNDI name
+ * @return The JNDI names bound
+ * @exception Throwable Thrown if an error occurs
+ */
+ protected abstract String[] bindAdminObject(URL url, String deploymentName, Object ao, String jndiName)
+ throws Throwable;
+
+ /**
* check if the configuration for this deployer has been set to a valid value
*
* @return false if configuration is not valid
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -33,7 +33,7 @@
* A CommonDeployment.
*
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
public class CommonDeployment
{
@@ -48,12 +48,16 @@
private final Object[] cfs;
+ private final String[] cfJndiNames;
+
+ private final Object[] aos;
+
+ private final String[] aoJndiNames;
+
private final ClassLoader cl;
private final Logger log;
- private final String[] jndiNames;
-
/**
* Create a new Deployment.
*
@@ -61,13 +65,17 @@
* @param deploymentName deploymentName
* @param activateDeployment activateDeployment
* @param resourceAdapter resourceAdapter
- * @param cfs cfs
+ * @param cfs The connection factories
+ * @param cfJndiNames The JNDI names for the connection factories
+ * @param aos The admin objects
+ * @param aoJndiNames The JNDI names for the admin objects
* @param cl cl
* @param log log
- * @param jndiNames jndiNames
*/
public CommonDeployment(URL url, String deploymentName, boolean activateDeployment,
- ResourceAdapter resourceAdapter, Object[] cfs, ClassLoader cl, Logger log, String[] jndiNames)
+ ResourceAdapter resourceAdapter, Object[] cfs, String[] cfJndiNames,
+ Object[] aos, String[] aoJndiNames,
+ ClassLoader cl, Logger log)
{
super();
this.url = url;
@@ -75,10 +83,11 @@
this.activateDeployment = activateDeployment;
this.resourceAdapter = resourceAdapter;
this.cfs = cfs != null ? Arrays.copyOf(cfs, cfs.length) : null;
+ this.cfJndiNames = cfJndiNames != null ? Arrays.copyOf(cfJndiNames, cfJndiNames.length) : null;
+ this.aos = aos != null ? Arrays.copyOf(aos, aos.length) : null;
+ this.aoJndiNames = aoJndiNames != null ? Arrays.copyOf(aoJndiNames, aoJndiNames.length) : null;
this.cl = cl;
this.log = log;
- this.jndiNames = jndiNames != null ? Arrays.copyOf(jndiNames, jndiNames.length) : null;
-
}
/**
@@ -132,6 +141,36 @@
}
/**
+ * Get the connection factory JNDI names.
+ *
+ * @return the jndiNames.
+ */
+ public final String[] getCfJndiNames()
+ {
+ return cfJndiNames != null ? Arrays.copyOf(cfJndiNames, cfJndiNames.length) : null;
+ }
+
+ /**
+ * Get the aos.
+ *
+ * @return the aos.
+ */
+ public final Object[] getAos()
+ {
+ return aos != null ? Arrays.copyOf(aos, aos.length) : null;
+ }
+
+ /**
+ * Get the admin object JNDI names.
+ *
+ * @return the jndiNames.
+ */
+ public final String[] getAoJndiNames()
+ {
+ return aoJndiNames != null ? Arrays.copyOf(aoJndiNames, aoJndiNames.length) : null;
+ }
+
+ /**
* Get the cl.
*
* @return the cl.
@@ -150,15 +189,4 @@
{
return log;
}
-
- /**
- * Get the jndiNames.
- *
- * @return the jndiNames.
- */
- public final String[] getJndiNames()
- {
- return jndiNames != null ? Arrays.copyOf(jndiNames, jndiNames.length) : null;
- }
-
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -157,6 +157,32 @@
}
@Override
+ public String[] bindAdminObject(URL url, String deployment, Object ao) throws Throwable
+ {
+ JndiStrategy js = ((RAConfiguration) getConfiguration()).getJndiStrategy().clone();
+
+ String[] result = js.bindAdminObjects(deployment, new Object[]{ao});
+
+ ((RAConfiguration) getConfiguration()).getMetadataRepository().registerJndiMapping(url.toExternalForm(),
+ ao.getClass().getName(), result[0]);
+
+ return result;
+ }
+
+ @Override
+ public String[] bindAdminObject(URL url, String deployment, Object ao, String jndi) throws Throwable
+ {
+ JndiStrategy js = ((RAConfiguration) getConfiguration()).getJndiStrategy().clone();
+
+ String[] result = js.bindAdminObjects(deployment, new Object[]{ao}, new String[]{jndi});
+
+ ((RAConfiguration) getConfiguration()).getMetadataRepository().registerJndiMapping(url.toExternalForm(),
+ ao.getClass().getName(), jndi);
+
+ return result;
+ }
+
+ @Override
protected File getReportDirectory()
{
return new File(SecurityActions.getSystemProperty("iron.jacamar.home"), "/log/");
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -118,7 +118,7 @@
Set<String> raDeployments = mdr.getResourceAdapters();
CommonDeployment c = createObjectsAndInjectValue(url, deploymentName, raDeployments, dataSources, parent);
- return new DsXmlDeployment(c.getURL(), c.getDeploymentName(), c.getCfs(), c.getJndiNames(), c.getCl());
+ return new DsXmlDeployment(c.getURL(), c.getDeploymentName(), c.getCfs(), c.getCfJndiNames(), c.getCl());
}
catch (DeployException de)
{
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-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -286,7 +286,8 @@
CommonDeployment c = createObjectsAndInjectValue(url, deploymentName, root, cl, cmd, ijmd);
JndiStrategy jndiStrategy = ((RAConfiguration) getConfiguration()).getJndiStrategy();
return new RAActivatorDeployment(c.getURL(), c.getDeploymentName(), c.getResourceAdapter(), jndiStrategy,
- metadataRepository, c.getCfs(), c.getJndiNames(), c.getCl(), c.getLog());
+ metadataRepository, c.getCfs(), c.getCfJndiNames(),
+ c.getAos(), c.getAoJndiNames(), c.getCl(), c.getLog());
}
catch (DeployException de)
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivatorDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivatorDeployment.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivatorDeployment.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -64,8 +64,14 @@
private Object[] cfs;
/** The JNDI names for the connection factories */
- private String[] jndis;
+ private String[] cfJndis;
+ /** The admin objects */
+ private Object[] aos;
+
+ /** The JNDI names for the admin objects */
+ private String[] aoJndis;
+
/** The classloader */
private ClassLoader cl;
@@ -77,12 +83,17 @@
* @param jndiStrategy The JNDI strategy
* @param metadataRepository The metadata repository
* @param cfs The connection factories
- * @param jndis The JNDI names for the connection factories
+ * @param cfJndis The JNDI names for the connection factories
+ * @param aos The admin objects
+ * @param aoJndis The JNDI names for the admin objects
* @param cl The classloader for the deployment
* @param log The logger
*/
public RAActivatorDeployment(URL deployment, String deploymentName, ResourceAdapter ra, JndiStrategy jndiStrategy,
- MetadataRepository metadataRepository, Object[] cfs, String[] jndis, ClassLoader cl, Logger log)
+ MetadataRepository metadataRepository,
+ Object[] cfs, String[] cfJndis,
+ Object[] aos, String[] aoJndis,
+ ClassLoader cl, Logger log)
{
this.deployment = deployment;
this.deploymentName = deploymentName;
@@ -90,7 +101,9 @@
this.jndiStrategy = jndiStrategy;
this.mdr = metadataRepository;
this.cfs = cfs;
- this.jndis = jndis;
+ this.cfJndis = cfJndis;
+ this.aos = aos;
+ this.aoJndis = aoJndis;
this.cl = cl;
this.log = log;
}
@@ -122,14 +135,14 @@
{
log.debug("Undeploying: " + deployment.toExternalForm());
- if (mdr != null && cfs != null && jndis != null)
+ if (mdr != null && cfs != null && cfJndis != null)
{
for (int i = 0; i < cfs.length; i++)
{
try
{
String cf = cfs[i].getClass().getName();
- String jndi = jndis[i];
+ String jndi = cfJndis[i];
mdr.unregisterJndiMapping(deployment.toExternalForm(), cf, jndi);
}
@@ -140,6 +153,24 @@
}
}
+ if (mdr != null && aos != null && aoJndis != null)
+ {
+ for (int i = 0; i < aos.length; i++)
+ {
+ try
+ {
+ String ao = aos[i].getClass().getName();
+ String jndi = aoJndis[i];
+
+ mdr.unregisterJndiMapping(deployment.toExternalForm(), ao, jndi);
+ }
+ catch (NotFoundException nfe)
+ {
+ log.warn("Exception during unregistering deployment", nfe);
+ }
+ }
+ }
+
if (cfs != null)
{
try
@@ -152,6 +183,18 @@
}
}
+ if (aos != null)
+ {
+ try
+ {
+ jndiStrategy.unbindAdminObjects(deploymentName, aos);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during JNDI unbinding", t);
+ }
+ }
+
if (ra != null)
{
ra.stop();
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-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -158,8 +158,8 @@
JndiStrategy jndiStrategy = ((RAConfiguration) getConfiguration()).getJndiStrategy();
MetadataRepository metadataRepository = ((RAConfiguration) getConfiguration()).getMetadataRepository();
return new RADeployment(c.getURL(), c.getDeploymentName(), c.isActivateDeployment(), c.getResourceAdapter(),
- jndiStrategy, metadataRepository, c.getCfs(), c.getJndiNames(), destination,
- c.getCl(), c.getLog());
+ jndiStrategy, metadataRepository, c.getCfs(), c.getCfJndiNames(),
+ c.getAos(), c.getAoJndiNames(), destination, c.getCl(), c.getLog());
}
catch (DeployException de)
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -69,8 +69,14 @@
private Object[] cfs;
/** The JNDI names of the connection factories */
- private String[] jndis;
+ private String[] cfJndis;
+ /** The admin objects */
+ private Object[] aos;
+
+ /** The JNDI names of the admin objects */
+ private String[] aoJndis;
+
/** The temporary directory */
private File tmpDirectory;
@@ -86,14 +92,18 @@
* @param jndiStrategy The JNDI strategy
* @param metadataRepository The metadata repository
* @param cfs The connection factories
- * @param jndis The JNDI names of the connection factories
+ * @param cfJndis The JNDI names of the connection factories
+ * @param aos The admin objects
+ * @param aoJndis The JNDI names of the admin objects
* @param tmpDirectory The temporary directory
* @param cl The classloader for the deployment
* @param log The logger
*/
public RADeployment(URL deployment, String deploymentName, boolean activator, ResourceAdapter ra,
- JndiStrategy jndiStrategy, MetadataRepository metadataRepository, Object[] cfs, String[] jndis,
- File tmpDirectory, ClassLoader cl, Logger log)
+ JndiStrategy jndiStrategy, MetadataRepository metadataRepository,
+ Object[] cfs, String[] cfJndis,
+ Object[] aos, String[] aoJndis,
+ File tmpDirectory, ClassLoader cl, Logger log)
{
this.deployment = deployment;
this.deploymentName = deploymentName;
@@ -102,7 +112,9 @@
this.jndiStrategy = jndiStrategy;
this.mdr = metadataRepository;
this.cfs = cfs;
- this.jndis = jndis;
+ this.cfJndis = cfJndis;
+ this.aos = aos;
+ this.aoJndis = aoJndis;
this.tmpDirectory = tmpDirectory;
this.cl = cl;
this.log = log;
@@ -149,14 +161,14 @@
{
log.debug("Undeploying: " + deployment.toExternalForm());
- if (mdr != null && cfs != null && jndis != null)
+ if (mdr != null && cfs != null && cfJndis != null)
{
for (int i = 0; i < cfs.length; i++)
{
try
{
String cf = cfs[i].getClass().getName();
- String jndi = jndis[i];
+ String jndi = cfJndis[i];
mdr.unregisterJndiMapping(deployment.toExternalForm(), cf, jndi);
}
@@ -167,11 +179,29 @@
}
}
- if (cfs != null && jndis != null)
+ if (mdr != null && aos != null && aoJndis != null)
{
+ for (int i = 0; i < aos.length; i++)
+ {
+ try
+ {
+ String ao = aos[i].getClass().getName();
+ String jndi = aoJndis[i];
+
+ mdr.unregisterJndiMapping(deployment.toExternalForm(), ao, jndi);
+ }
+ catch (NotFoundException nfe)
+ {
+ log.warn("Exception during unregistering deployment", nfe);
+ }
+ }
+ }
+
+ if (cfs != null && cfJndis != null)
+ {
try
{
- jndiStrategy.unbindConnectionFactories(deploymentName, cfs, jndis);
+ jndiStrategy.unbindConnectionFactories(deploymentName, cfs, cfJndis);
}
catch (Throwable t)
{
@@ -179,6 +209,18 @@
}
}
+ if (aos != null && aoJndis != null)
+ {
+ try
+ {
+ jndiStrategy.unbindAdminObjects(deploymentName, aos, aoJndis);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during JNDI unbinding", t);
+ }
+ }
+
if (ra != null)
{
ra.stop();
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-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -294,8 +294,8 @@
JndiStrategy jndiStrategy = ((RAConfiguration) getConfiguration()).getJndiStrategy();
MetadataRepository metadataRepository = ((RAConfiguration) getConfiguration()).getMetadataRepository();
return new RaXmlDeployment(c.getURL(), deployment, c.getDeploymentName(), c.getResourceAdapter(),
- jndiStrategy, metadataRepository, c.getCfs(), c.getJndiNames(),
- c.getCl(), c.getLog());
+ jndiStrategy, metadataRepository, c.getCfs(), c.getCfJndiNames(),
+ c.getAos(), c.getAoJndiNames(), c.getCl(), c.getLog());
}
catch (DeployException de)
{
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployment.java 2010-10-15 19:49:50 UTC (rev 108610)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployment.java 2010-10-15 20:13:43 UTC (rev 108611)
@@ -67,8 +67,14 @@
private Object[] cfs;
/** The JNDI names of the connection factories */
- private String[] jndis;
+ private String[] cfJndis;
+ /** The admin objects */
+ private Object[] aos;
+
+ /** The JNDI names of the admin objects */
+ private String[] aoJndis;
+
/** The classloader */
private ClassLoader cl;
@@ -81,13 +87,17 @@
* @param jndiStrategy The JNDI strategy
* @param metadataRepository The metadata repository
* @param cfs The connection factories
- * @param jndis The JNDI names of the connection factories
+ * @param cfJndis The JNDI names of the connection factories
+ * @param aos The admin objects
+ * @param aoJndis The JNDI names of the admin objects
* @param cl The classloader for the deployment
* @param log The logger
*/
public RaXmlDeployment(URL deployment, URL raDeployment, String deploymentName, ResourceAdapter ra,
- JndiStrategy jndiStrategy, MetadataRepository metadataRepository, Object[] cfs, String[] jndis, ClassLoader cl,
- Logger log)
+ JndiStrategy jndiStrategy, MetadataRepository metadataRepository,
+ Object[] cfs, String[] cfJndis,
+ Object[] aos, String[] aoJndis,
+ ClassLoader cl, Logger log)
{
this.deployment = deployment;
this.raDeployment = raDeployment;
@@ -96,7 +106,9 @@
this.jndiStrategy = jndiStrategy;
this.mdr = metadataRepository;
this.cfs = cfs;
- this.jndis = jndis;
+ this.cfJndis = cfJndis;
+ this.aos = aos;
+ this.aoJndis = aoJndis;
this.cl = cl;
this.log = log;
}
@@ -128,14 +140,14 @@
{
log.debug("Undeploying: " + deployment.toExternalForm());
- if (mdr != null && cfs != null && jndis != null)
+ if (mdr != null && cfs != null && cfJndis != null)
{
for (int i = 0; i < cfs.length; i++)
{
try
{
String cf = cfs[i].getClass().getName();
- String jndi = jndis[i];
+ String jndi = cfJndis[i];
mdr.unregisterJndiMapping(raDeployment.toExternalForm(), cf, jndi);
}
@@ -146,11 +158,29 @@
}
}
- if (cfs != null && jndis != null)
+ if (mdr != null && aos != null && aoJndis != null)
{
+ for (int i = 0; i < aos.length; i++)
+ {
+ try
+ {
+ String ao = aos[i].getClass().getName();
+ String jndi = aoJndis[i];
+
+ mdr.unregisterJndiMapping(raDeployment.toExternalForm(), ao, jndi);
+ }
+ catch (NotFoundException nfe)
+ {
+ log.warn("Exception during unregistering deployment", nfe);
+ }
+ }
+ }
+
+ if (cfs != null && cfJndis != null)
+ {
try
{
- jndiStrategy.unbindConnectionFactories(deploymentName, cfs, jndis);
+ jndiStrategy.unbindConnectionFactories(deploymentName, cfs, cfJndis);
}
catch (Throwable t)
{
@@ -158,6 +188,18 @@
}
}
+ if (aos != null && aoJndis != null)
+ {
+ try
+ {
+ jndiStrategy.unbindAdminObjects(deploymentName, aos, aoJndis);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during JNDI unbinding", t);
+ }
+ }
+
if (ra != null)
{
ra.stop();
More information about the jboss-cvs-commits
mailing list