[jboss-cvs] JBossAS SVN: r112370 - in projects/jboss-jca/branches/Branch_1_0: deployers/src/main/java/org/jboss/jca/deployers/common and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 24 12:18:01 EDT 2011
Author: jesper.pedersen
Date: 2011-10-24 12:18:01 -0400 (Mon, 24 Oct 2011)
New Revision: 112370
Modified:
projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
Log:
[JBJCA-687] AdminObject: javax.naming.Referenceable
Modified: projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java 2011-10-24 16:15:25 UTC (rev 112369)
+++ projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java 2011-10-24 16:18:01 UTC (rev 112370)
@@ -294,18 +294,21 @@
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 (ao instanceof Referenceable)
+ {
+ 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(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
+ if (objs.putIfAbsent(qualifiedName(jndiName, className), ao) != null)
+ throw new Exception(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
- Referenceable referenceable = (Referenceable)ao;
- referenceable.setReference(ref);
+ Referenceable referenceable = (Referenceable)ao;
+ referenceable.setReference(ref);
+ }
Util.bind(context, jndiName, ao);
Modified: projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java 2011-10-24 16:15:25 UTC (rev 112369)
+++ projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java 2011-10-24 16:18:01 UTC (rev 112370)
@@ -314,18 +314,21 @@
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 (ao instanceof Referenceable)
+ {
+ 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(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
+ if (objs.putIfAbsent(qualifiedName(jndiName, className), ao) != null)
+ throw new Exception(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
- Referenceable referenceable = (Referenceable)ao;
- referenceable.setReference(ref);
+ Referenceable referenceable = (Referenceable)ao;
+ referenceable.setReference(ref);
+ }
Util.bind(context, jndiName, ao);
Modified: projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-10-24 16:15:25 UTC (rev 112369)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-10-24 16:18:01 UTC (rev 112370)
@@ -95,7 +95,9 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import javax.resource.Referenceable;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.resource.ResourceException;
import javax.resource.spi.ActivationSpec;
import javax.resource.spi.BootstrapContext;
@@ -856,46 +858,54 @@
.getConfigProperties()));
beanValidationObjects.add(ao);
- if (ao != null && ao instanceof Serializable && ao instanceof Referenceable)
+ if (ao != null)
{
- try
+ boolean adminObjectBound = false;
+
+ if ((ao instanceof ResourceAdapterAssociation &&
+ ao instanceof Serializable &&
+ ao instanceof javax.resource.Referenceable) ||
+ (ao instanceof javax.naming.Referenceable))
{
- String jndiName = null;
- if (adminObject != null)
+ try
{
- jndiName = buildJndiName(adminObject.getJndiName(),
- adminObject.isUseJavaContext());
+ String jndiName = null;
+ if (adminObject != null)
+ {
+ jndiName = buildJndiName(adminObject.getJndiName(),
+ adminObject.isUseJavaContext());
- bindAdminObject(url, deploymentName, ao, jndiName);
+ bindAdminObject(url, deploymentName, ao, jndiName);
+ }
+ else
+ {
+ String[] names = bindAdminObject(url, deploymentName, ao);
+ jndiName = names[0];
+ }
+
+ aos.add(ao);
+ aoJndiNames.add(jndiName);
+ adminObjectBound = true;
+
+ org.jboss.jca.core.api.management.AdminObject mgtAo =
+ new org.jboss.jca.core.api.management.AdminObject(ao);
+
+ mgtAo.getConfigProperties().
+ addAll(createManagementView(aoMeta.getConfigProperties()));
+ mgtAo.setJndiName(jndiName);
+
+ mgtConnector.getAdminObjects().add(mgtAo);
}
- else
+ catch (Throwable t)
{
- String[] names = bindAdminObject(url, deploymentName, ao);
- jndiName = names[0];
+ throw new
+ DeployException(bundle.failedToBindAdminObject(ao.getClass().getName()), t);
}
+ }
- aos.add(ao);
- aoJndiNames.add(jndiName);
-
- org.jboss.jca.core.api.management.AdminObject mgtAo =
- new org.jboss.jca.core.api.management.AdminObject(ao);
-
- mgtAo.getConfigProperties().
- addAll(createManagementView(aoMeta.getConfigProperties()));
- mgtAo.setJndiName(jndiName);
-
- mgtConnector.getAdminObjects().add(mgtAo);
- }
- catch (Throwable t)
- {
- throw new DeployException(bundle.failedToBindAdminObject(ao.getClass().getName()),
- t);
- }
+ if (!adminObjectBound)
+ log.adminObjectNotBound(aoMeta.getAdminobjectClass().getValue());
}
- else
- {
- log.adminObjectNotBound(aoMeta.getAdminobjectClass().getValue());
- }
}
}
else
@@ -1447,7 +1457,8 @@
archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+ if (cf != null && cf instanceof Serializable &&
+ cf instanceof javax.resource.Referenceable)
{
String jndiName;
if (connectionDefinition != null)
@@ -1914,7 +1925,8 @@
archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
- if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+ if (cf != null && cf instanceof Serializable &&
+ cf instanceof javax.resource.Referenceable)
{
String jndiName;
if (connectionDefinition != null)
More information about the jboss-cvs-commits
mailing list