[jboss-cvs] JBossAS SVN: r106518 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/spi/naming and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 8 21:55:54 EDT 2010
Author: jesper.pedersen
Date: 2010-07-08 21:55:53 -0400 (Thu, 08 Jul 2010)
New Revision: 106518
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/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/fungal/RADeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java
Log:
[JBJCA-370] Change the naming SPI for unbind
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-07-09 00:05:38 UTC (rev 106517)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java 2010-07-09 01:55:53 UTC (rev 106518)
@@ -72,10 +72,10 @@
/**
* Unbind connection factories for a deployment
* @param deployment The deployment name
- * @param jndiNames The JNDI names for the connection factories
+ * @param cfs The connection factories
* @exception Throwable Thrown if an error occurs
*/
- public void unbindConnectionFactories(String deployment, String[] jndiNames) throws Throwable
+ public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable
{
}
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-07-09 00:05:38 UTC (rev 106517)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java 2010-07-09 01:55:53 UTC (rev 106518)
@@ -121,6 +121,9 @@
referenceable.setReference(ref);
Util.bind(context, jndiName, cf);
+
+ if (log.isDebugEnabled())
+ log.debug("Bound " + cf.getClass().getName() + " under " + jndiName);
}
finally
{
@@ -133,36 +136,38 @@
/**
* Unbind connection factories for a deployment
* @param deployment The deployment name
- * @param jndiNames The JNDI names for the connection factories
+ * @param cfs The connection factories
* @exception Throwable Thrown if an error occurs
*/
- public void unbindConnectionFactories(String deployment, String[] jndiNames) throws Throwable
+ public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable
{
- if (jndiNames == null)
- throw new IllegalArgumentException("JndiNames is null");
+ if (cfs == null)
+ throw new IllegalArgumentException("CFS is null");
+ if (cfs.length == 0)
+ throw new IllegalArgumentException("CFS is empty");
+
+ if (cfs.length > 1)
+ throw new IllegalArgumentException("SimpleJndiStrategy only support " +
+ "a single connection factory per deployment");
+
+ String jndiName = JNDI_PREFIX + deployment;
+
+ Object cf = cfs[0];
+ String className = cf.getClass().getName();
+
Context context = null;
try
{
context = new InitialContext();
- for (String jndiName : jndiNames)
- {
- connectionFactories.remove(jndiName);
+ Util.unbind(context, jndiName);
- try
- {
- Util.unbind(context, jndiName);
- }
- catch (Throwable it)
- {
- log.warn("Exception during JNDI unbind for: " + jndiName, it);
- }
- }
+ connectionFactories.remove(qualifiedName(jndiName, className));
}
catch (Throwable t)
{
- log.warn("Exception during JNDI initialization", t);
+ log.warn("Exception during unbind", t);
}
finally
{
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-07-09 00:05:38 UTC (rev 106517)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java 2010-07-09 01:55:53 UTC (rev 106518)
@@ -43,10 +43,10 @@
/**
* Unbind connection factories for a deployment
* @param deployment The deployment name
- * @param jndiNames The JNDI names for the connection factories
+ * @param cfs The connection factories
* @exception Throwable Thrown if an error occurs
*/
- public void unbindConnectionFactories(String deployment, String[] jndiNames) throws Throwable;
+ public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable;
/**
* Clone the JNDI strategy implementation
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-07-09 00:05:38 UTC (rev 106517)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-07-09 01:55:53 UTC (rev 106518)
@@ -397,7 +397,8 @@
List<Failure> partialFailures = null;
List<Object> beanValidationObjects = new ArrayList<Object>();
- String[] jndiNames = null;
+ String deploymentName = null;
+ Object[] cfs = null;
// Create objects and inject values
if (cmd != null)
@@ -563,11 +564,9 @@
{
if (cdMetas.size() == 1)
{
- String deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
- String[] jns = bindConnectionFactory(deploymentName, cf);
-
- if (jns != null)
- jndiNames = jns;
+ deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+ bindConnectionFactory(deploymentName, cf);
+ cfs = new Object[] {cf};
}
else
{
@@ -736,7 +735,7 @@
log.info("Deployed: " + url.toExternalForm());
- return new RADeployment(url, resourceAdapter, jndiStrategy, jndiNames, destination, cl);
+ return new RADeployment(url, deploymentName, resourceAdapter, jndiStrategy, cfs, destination, cl);
}
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-07-09 00:05:38 UTC (rev 106517)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java 2010-07-09 01:55:53 UTC (rev 106518)
@@ -47,14 +47,17 @@
/** The deployment */
private URL deployment;
+ /** The deployment name */
+ private String deploymentName;
+
/** The resource adapter instance */
private ResourceAdapter ra;
/** The JNDI strategy */
private JndiStrategy jndiStrategy;
- /** JNDI names for connection factories */
- private String[] jndiNames;
+ /** The connection factories */
+ private Object[] cfs;
/** The temporary directory */
private File tmpDirectory;
@@ -65,23 +68,26 @@
/**
* Constructor
* @param deployment The deployment
+ * @param deploymentName The deployment name
* @param ra The resource adapter instance if present
* @param jndiStrategy The JNDI strategy
- * @param jndiNames The JNDI names for connection factories
+ * @param cfs The connection factories
* @param tmpDirectory The temporary directory
* @param cl The classloader for the deployment
*/
public RADeployment(URL deployment,
+ String deploymentName,
ResourceAdapter ra,
JndiStrategy jndiStrategy,
- String[] jndiNames,
+ Object[] cfs,
File tmpDirectory,
ClassLoader cl)
{
this.deployment = deployment;
+ this.deploymentName = deploymentName;
this.ra = ra;
this.jndiStrategy = jndiStrategy;
- this.jndiNames = jndiNames;
+ this.cfs = cfs;
this.tmpDirectory = tmpDirectory;
this.cl = cl;
}
@@ -111,11 +117,11 @@
{
log.debug("Undeploying: " + deployment.toExternalForm());
- if (jndiNames != null)
+ if (cfs != null)
{
try
{
- jndiStrategy.unbindConnectionFactories(null, jndiNames);
+ jndiStrategy.unbindConnectionFactories(deploymentName, cfs);
}
catch (Throwable t)
{
More information about the jboss-cvs-commits
mailing list