[jboss-cvs] JBossAS SVN: r112138 - in projects/jboss-jca/branches/Branch_1_0: core/src/main/java/org/jboss/jca/core/util and 10 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 26 10:46:01 EDT 2011
Author: jesper.pedersen
Date: 2011-08-26 10:46:01 -0400 (Fri, 26 Aug 2011)
New Revision: 112138
Added:
projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/
projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/Injection.java
projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/SecurityActions.java
projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/package.html
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyRaXmlTestCase.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyTestCase.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectImpl.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectInterface.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnection.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactory.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactoryImpl.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionImpl.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnection.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionFactory.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionMetaData.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyResourceAdapter.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/package.html
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ironjacamar.xml
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ra.xml
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/configproperty-ra.xml
Modified:
projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java
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/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject1Impl.java
projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject2Impl.java
projects/jboss-jca/branches/Branch_1_0/doc/userguide/en-US/modules/logging.xml
Log:
[JBJCA-658] config-property not applied in all cases
Added: projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/Injection.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/Injection.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/Injection.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,381 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.util;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.util.Locale;
+
+/**
+ * Injection utility which can inject values into objects. This file is a copy
+ * of the <code>com.github.fungal.api.util.Injection</code> class.
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class Injection
+{
+ /**
+ * Constructor
+ */
+ public Injection()
+ {
+ }
+
+ /**
+ * Inject a value into an object property
+ * @param object The object
+ * @param propertyName The property name
+ * @param propertyValue The property value
+ * @exception NoSuchMethodException If the property method cannot be found
+ * @exception IllegalAccessException If the property method cannot be accessed
+ * @exception InvocationTargetException If the property method cannot be executed
+ */
+ @SuppressWarnings("unchecked")
+ public void inject(Object object, String propertyName, Object propertyValue)
+ throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
+ {
+ inject(object, propertyName, propertyValue, null, false);
+ }
+
+ /**
+ * Inject a value into an object property
+ * @param object The object
+ * @param propertyName The property name
+ * @param propertyValue The property value
+ * @param propertyType The property type as a fully quilified class name
+ * @exception NoSuchMethodException If the property method cannot be found
+ * @exception IllegalAccessException If the property method cannot be accessed
+ * @exception InvocationTargetException If the property method cannot be executed
+ */
+ @SuppressWarnings("unchecked")
+ public void inject(Object object, String propertyName, Object propertyValue, String propertyType)
+ throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
+ {
+ inject(object, propertyName, propertyValue, propertyType, false);
+ }
+
+ /**
+ * Inject a value into an object property
+ * @param object The object
+ * @param propertyName The property name
+ * @param propertyValue The property value
+ * @param propertyType The property type as a fully quilified class name
+ * @param includeFields Should fields be included for injection if a method can't be found
+ * @exception NoSuchMethodException If the property method cannot be found
+ * @exception IllegalAccessException If the property method cannot be accessed
+ * @exception InvocationTargetException If the property method cannot be executed
+ */
+ @SuppressWarnings("unchecked")
+ public void inject(Object object,
+ String propertyName, Object propertyValue, String propertyType,
+ boolean includeFields)
+ throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
+ {
+ if (object == null)
+ throw new IllegalArgumentException("Object is null");
+
+ if (propertyName == null || propertyName.trim().equals(""))
+ throw new IllegalArgumentException("PropertyName is undefined");
+
+ String methodName = "set" + propertyName.substring(0, 1).toUpperCase(Locale.US);
+ if (propertyName.length() > 1)
+ {
+ methodName += propertyName.substring(1);
+ }
+
+ Method method = findMethod(object.getClass(), methodName, propertyType);
+
+ if (method != null)
+ {
+ Class<?> parameterClass = method.getParameterTypes()[0];
+ Object parameterValue = null;
+ try
+ {
+ parameterValue = getValue(propertyName, parameterClass, propertyValue,
+ object.getClass().getClassLoader());
+ }
+ catch (Throwable t)
+ {
+ throw new InvocationTargetException(t, t.getMessage());
+ }
+
+ if (!parameterClass.isPrimitive() || parameterValue != null)
+ method.invoke(object, new Object[] {parameterValue});
+ }
+ else
+ {
+ if (!includeFields)
+ throw new NoSuchMethodException("Method " + methodName + " not found");
+
+ // Ok, we didn't find a method - assume field
+ Field field = findField(object.getClass(), propertyName, propertyType);
+
+ if (field != null)
+ {
+ Class<?> fieldClass = field.getType();
+ Object fieldValue = null;
+ try
+ {
+ fieldValue = getValue(propertyName, fieldClass, propertyValue,
+ object.getClass().getClassLoader());
+ }
+ catch (Throwable t)
+ {
+ throw new InvocationTargetException(t, t.getMessage());
+ }
+
+ field.set(object, fieldValue);
+ }
+ else
+ {
+ throw new NoSuchMethodException("Field " + propertyName + " not found");
+ }
+ }
+ }
+
+ /**
+ * Find a method
+ * @param clz The class
+ * @param methodName The method name
+ * @param propertyType The property type; can be <code>null</code>
+ * @return The method; <code>null</code> if not found
+ */
+ protected Method findMethod(Class<?> clz, String methodName, String propertyType)
+ {
+ while (!clz.equals(Object.class))
+ {
+ Method[] methods = clz.getDeclaredMethods();
+ for (int i = 0; i < methods.length; i++)
+ {
+ Method method = methods[i];
+ if (methodName.equals(method.getName()) && method.getParameterTypes().length == 1)
+ {
+ if (propertyType == null || propertyType.equals(method.getParameterTypes()[0].getName()))
+ return method;
+ }
+ }
+
+ clz = clz.getSuperclass();
+ }
+
+ return null;
+ }
+
+ /**
+ * Find a field
+ * @param clz The class
+ * @param fieldName The field name
+ * @param fieldType The field type; can be <code>null</code>
+ * @return The field; <code>null</code> if not found
+ */
+ protected Field findField(Class<?> clz, String fieldName, String fieldType)
+ {
+ while (!clz.equals(Object.class))
+ {
+ Field[] fields = clz.getDeclaredFields();
+ for (int i = 0; i < fields.length; i++)
+ {
+ Field field = fields[i];
+ if (fieldName.equals(field.getName()))
+ {
+ if (fieldType == null || fieldType.equals(field.getType().getName()))
+ return field;
+ }
+ }
+
+ clz = clz.getSuperclass();
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the value
+ * @param name The value name
+ * @param clz The value class
+ * @param v The value
+ * @param cl The class loader
+ * @return The substituted value
+ * @exception Exception Thrown in case of an error
+ */
+ protected Object getValue(String name, Class<?> clz, Object v, ClassLoader cl) throws Exception
+ {
+ if (v instanceof String)
+ {
+ String substituredValue = getSubstitutionValue((String)v);
+
+ if (clz.equals(String.class))
+ {
+ v = substituredValue;
+ }
+ else if (clz.equals(byte.class) || clz.equals(Byte.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Byte.valueOf(substituredValue);
+ }
+ else if (clz.equals(short.class) || clz.equals(Short.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Short.valueOf(substituredValue);
+ }
+ else if (clz.equals(int.class) || clz.equals(Integer.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Integer.valueOf(substituredValue);
+ }
+ else if (clz.equals(long.class) || clz.equals(Long.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Long.valueOf(substituredValue);
+ }
+ else if (clz.equals(float.class) || clz.equals(Float.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Float.valueOf(substituredValue);
+ }
+ else if (clz.equals(double.class) || clz.equals(Double.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Double.valueOf(substituredValue);
+ }
+ else if (clz.equals(boolean.class) || clz.equals(Boolean.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Boolean.valueOf(substituredValue);
+ }
+ else if (clz.equals(char.class) || clz.equals(Character.class))
+ {
+ if (substituredValue != null && !substituredValue.trim().equals(""))
+ v = Character.valueOf(substituredValue.charAt(0));
+ }
+ else if (clz.equals(InetAddress.class))
+ {
+ v = InetAddress.getByName(substituredValue);
+ }
+ else if (clz.equals(Class.class))
+ {
+ v = Class.forName(substituredValue, true, cl);
+ }
+ else
+ {
+ try
+ {
+ Constructor<?> constructor = clz.getConstructor(String.class);
+ v = constructor.newInstance(substituredValue);
+ }
+ catch (Throwable t)
+ {
+ // Try static String valueOf method
+ try
+ {
+ Method valueOf = clz.getMethod("valueOf", String.class);
+ v = valueOf.invoke((Object)null, substituredValue);
+ }
+ catch (Throwable inner)
+ {
+ throw new IllegalArgumentException("Unknown property resolution for property " + name);
+ }
+ }
+ }
+ }
+
+ return v;
+ }
+
+ /**
+ * System property substitution
+ * @param input The input string
+ * @return The output
+ */
+ protected String getSubstitutionValue(String input)
+ {
+ if (input == null || input.trim().equals(""))
+ return input;
+
+ while (input.indexOf("${") != -1)
+ {
+ int from = input.indexOf("${");
+ int to = input.indexOf("}");
+ int dv = input.indexOf(":", from + 2);
+
+ if (dv != -1)
+ {
+ if (dv > to)
+ dv = -1;
+ }
+
+ String systemProperty = "";
+ String defaultValue = "";
+ if (dv == -1)
+ {
+ String s = input.substring(from + 2, to);
+ if ("/".equals(s))
+ {
+ systemProperty = File.separator;
+ }
+ else if (":".equals(s))
+ {
+ systemProperty = File.pathSeparator;
+ }
+ else
+ {
+ systemProperty = SecurityActions.getSystemProperty(s);
+ }
+ }
+ else
+ {
+ systemProperty = SecurityActions.getSystemProperty(input.substring(from + 2, dv));
+ defaultValue = input.substring(dv + 1, to);
+ }
+ String prefix = "";
+ String postfix = "";
+
+ if (from != 0)
+ {
+ prefix = input.substring(0, from);
+ }
+
+ if (to + 1 < input.length() - 1)
+ {
+ postfix = input.substring(to + 1);
+ }
+
+ if (systemProperty != null && !systemProperty.trim().equals(""))
+ {
+ input = prefix + systemProperty + postfix;
+ }
+ else if (defaultValue != null && !defaultValue.trim().equals(""))
+ {
+ input = prefix + defaultValue + postfix;
+ }
+ else
+ {
+ input = prefix + postfix;
+ }
+ }
+ return input;
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/SecurityActions.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/SecurityActions.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/SecurityActions.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+class SecurityActions
+{
+ /**
+ * Constructor
+ */
+ private SecurityActions()
+ {
+ }
+
+ /**
+ * Get a system property
+ * @param name The property name
+ * @return The property value
+ */
+ static String getSystemProperty(final String name)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ return System.getProperty(name);
+ }
+ else
+ {
+ return (String)AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ return System.getProperty(name);
+ }
+ });
+ }
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/package.html
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/package.html (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/core/src/main/java/org/jboss/jca/core/util/package.html 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,3 @@
+<body>
+Utility classes
+</body>
Modified: projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java 2011-08-26 14:39:15 UTC (rev 112137)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -102,4 +102,14 @@
*/
@Message(id = 20059, value = "Invalid ResourceAdapter class: %s")
public String invalidResourceAdapter(String clz);
+
+ /**
+ * Unable to inject
+ * @param clz The class name
+ * @param name The name
+ * @param value
+ * @return The value
+ */
+ @Message(id = 20060, value = "Unable to inject: %s property: %s value: %s")
+ public String unableToInject(String clz, String name, String value);
}
Modified: projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-08-26 14:39:15 UTC (rev 112137)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -58,6 +58,7 @@
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
import org.jboss.jca.core.spi.transaction.TransactionIntegration;
import org.jboss.jca.core.spi.transaction.recovery.XAResourceRecovery;
+import org.jboss.jca.core.util.Injection;
import org.jboss.jca.deployers.DeployersBundle;
import org.jboss.jca.deployers.DeployersLogger;
import org.jboss.jca.validator.Failure;
@@ -85,8 +86,9 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
-import java.util.Map.Entry;
+import java.util.Map;
import java.util.Set;
import javax.resource.Referenceable;
@@ -750,11 +752,37 @@
if (activateDeployment && adminObjects != null)
{
+ Injection injector = new Injection();
+
for (CommonAdminObject adminObject : adminObjects)
{
Object ao = initAndInject(aoMeta.getAdminobjectClass().getValue(),
aoMeta.getConfigProperties(), cl);
+ if (adminObject != null &&
+ adminObject.getConfigProperties() != null &&
+ adminObject.getConfigProperties().size() > 0)
+ {
+ Iterator<Map.Entry<String, String>> it =
+ adminObject.getConfigProperties().entrySet().iterator();
+
+ while (it.hasNext())
+ {
+ Map.Entry<String, String> entry = it.next();
+
+ try
+ {
+ injector.inject(ao, entry.getKey(), entry.getValue());
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException(bundle.unableToInject(ao.getClass().getName(),
+ entry.getKey(),
+ entry.getValue()));
+ }
+ }
+ }
+
if (trace)
{
log.trace("AdminObject: " + ao.getClass().getName());
@@ -929,6 +957,36 @@
resourceAdapter = (ResourceAdapter)or;
+ Map<String, String> raConfigProperties = null;
+
+ if (raxml != null)
+ raConfigProperties = raxml.getConfigProperties();
+
+ if (raConfigProperties == null && ijmd != null)
+ raConfigProperties = ijmd.getConfigProperties();
+
+ if (raConfigProperties != null)
+ {
+ Injection injector = new Injection();
+ Iterator<Map.Entry<String, String>> it = raConfigProperties.entrySet().iterator();
+
+ while (it.hasNext())
+ {
+ Map.Entry<String, String> entry = it.next();
+
+ try
+ {
+ injector.inject(resourceAdapter, entry.getKey(), entry.getValue());
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException(bundle.unableToInject(resourceAdapter.getClass().getName(),
+ entry.getKey(),
+ entry.getValue()));
+ }
+ }
+ }
+
if (trace)
{
log.trace("ResourceAdapter: " + resourceAdapter.getClass().getName());
@@ -1004,6 +1062,30 @@
ManagedConnectionFactory mcf = (ManagedConnectionFactory)om;
+ if (connectionDefinition != null &&
+ connectionDefinition.getConfigProperties() != null)
+ {
+ Injection injector = new Injection();
+ Iterator<Map.Entry<String, String>> it =
+ connectionDefinition.getConfigProperties().entrySet().iterator();
+
+ while (it.hasNext())
+ {
+ Map.Entry<String, String> entry = it.next();
+
+ try
+ {
+ injector.inject(mcf, entry.getKey(), entry.getValue());
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException(bundle.unableToInject(mcf.getClass().getName(),
+ entry.getKey(),
+ entry.getValue()));
+ }
+ }
+ }
+
if (trace)
{
log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
@@ -1347,6 +1429,30 @@
ManagedConnectionFactory mcf = (ManagedConnectionFactory)om;
+ if (connectionDefinition != null &&
+ connectionDefinition.getConfigProperties() != null)
+ {
+ Injection injector = new Injection();
+ Iterator<Map.Entry<String, String>> it =
+ connectionDefinition.getConfigProperties().entrySet().iterator();
+
+ while (it.hasNext())
+ {
+ Map.Entry<String, String> entry = it.next();
+
+ try
+ {
+ injector.inject(mcf, entry.getKey(), entry.getValue());
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException(bundle.unableToInject(mcf.getClass().getName(),
+ entry.getKey(),
+ entry.getValue()));
+ }
+ }
+ }
+
if (trace)
{
log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
@@ -1570,8 +1676,9 @@
.getRecoverPlugin()
.getConfigPropertiesMap().size());
- for (Entry<String, String> property : recoveryMD.getRecoverPlugin()
- .getConfigPropertiesMap().entrySet())
+ for (Map.Entry<String, String> property :
+ recoveryMD.getRecoverPlugin().
+ getConfigPropertiesMap().entrySet())
{
ConfigProperty c =
new ConfigPropertyImpl(null,
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyRaXmlTestCase.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyRaXmlTestCase.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyRaXmlTestCase.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec;
+
+import org.jboss.jca.embedded.dsl.InputStreamDescriptor;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectImpl;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectInterface;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnection;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionFactory;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionFactoryImpl;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionImpl;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnection;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnectionFactory;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnectionMetaData;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyResourceAdapter;
+
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptor;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.junit.Assert.*;
+
+/**
+ * ConnectorTestCase
+ *
+ * @version $Revision: $
+ */
+ at RunWith(Arquillian.class)
+public class ConfigPropertyRaXmlTestCase
+{
+ private static Logger log = Logger.getLogger(ConfigPropertyTestCase.class);
+
+ /**
+ * Define the deployment
+ *
+ * @return The deployment archive
+ */
+ @Deployment(order = 1)
+ public static ResourceAdapterArchive createDeployment()
+ {
+ String deploymentName = "config-property.rar";
+
+ ResourceAdapterArchive raa =
+ ShrinkWrap.create(ResourceAdapterArchive.class, deploymentName);
+ JavaArchive ja = ShrinkWrap.create(JavaArchive.class, UUID.randomUUID().toString() + ".jar");
+ ja.addClasses(ConfigPropertyResourceAdapter.class, ConfigPropertyManagedConnectionFactory.class,
+ ConfigPropertyManagedConnection.class, ConfigPropertyConnectionFactory.class,
+ ConfigPropertyManagedConnectionMetaData.class,
+ ConfigPropertyConnectionFactoryImpl.class, ConfigPropertyConnection.class,
+ ConfigPropertyConnectionImpl.class);
+ raa.addAsLibrary(ja);
+
+ raa.addAsManifestResource(deploymentName + "/META-INF/ra.xml", "ra.xml");
+
+ return raa;
+ }
+
+ /**
+ * Define the deployment
+ * @return The deployment archive
+ * @throws Exception in case of errors
+ */
+ @Deployment(order = 2)
+ public static Descriptor createDescriptor() throws Exception
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStreamDescriptor isd = new InputStreamDescriptor("configproperty-ra.xml",
+ cl.getResourceAsStream("configproperty-ra.xml"));
+ return isd;
+ }
+
+ /** CF */
+ @Resource(mappedName = "java:/eis/ConfigPropertyConnectionFactory1")
+ private ConfigPropertyConnectionFactory connectionFactory;
+
+ /** AO */
+ @Resource(mappedName = "java:/eis/ao/ConfigPropertyAdminObjectInterface1")
+ private ConfigPropertyAdminObjectInterface adminObject;
+
+ /**
+ * Test config properties
+ *
+ * @exception Throwable Thrown if case of an error
+ */
+ @Test
+ public void testConfigProperties() throws Throwable
+ {
+ assertNotNull(connectionFactory);
+ assertNotNull(adminObject);
+
+ ConfigPropertyConnection connection = connectionFactory.getConnection();
+ assertNotNull(connection);
+
+ assertEquals("A", connection.getResourceAdapterProperty());
+ assertEquals("B", connection.getManagedConnectionFactoryProperty());
+
+ assertEquals("C", adminObject.getProperty());
+
+ connection.close();
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyTestCase.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyTestCase.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/ConfigPropertyTestCase.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec;
+
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectImpl;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectInterface;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnection;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionFactory;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionFactoryImpl;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionImpl;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnection;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnectionFactory;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnectionMetaData;
+import org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyResourceAdapter;
+
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.junit.Assert.*;
+
+/**
+ * ConnectorTestCase
+ *
+ * @version $Revision: $
+ */
+ at RunWith(Arquillian.class)
+public class ConfigPropertyTestCase
+{
+ private static Logger log = Logger.getLogger(ConfigPropertyTestCase.class);
+
+ /**
+ * Define the deployment
+ *
+ * @return The deployment archive
+ */
+ @Deployment
+ public static ResourceAdapterArchive createDeployment()
+ {
+ String deploymentName = "config-property.rar";
+
+ ResourceAdapterArchive raa =
+ ShrinkWrap.create(ResourceAdapterArchive.class, deploymentName);
+ JavaArchive ja = ShrinkWrap.create(JavaArchive.class, UUID.randomUUID().toString() + ".jar");
+ ja.addClasses(ConfigPropertyResourceAdapter.class, ConfigPropertyManagedConnectionFactory.class,
+ ConfigPropertyManagedConnection.class, ConfigPropertyConnectionFactory.class,
+ ConfigPropertyManagedConnectionMetaData.class,
+ ConfigPropertyConnectionFactoryImpl.class, ConfigPropertyConnection.class,
+ ConfigPropertyConnectionImpl.class);
+ raa.addAsLibrary(ja);
+
+ raa.addAsManifestResource(deploymentName + "/META-INF/ra.xml", "ra.xml");
+ raa.addAsManifestResource(deploymentName + "/META-INF/ironjacamar.xml", "ironjacamar.xml");
+
+ return raa;
+ }
+
+ /** CF */
+ @Resource(mappedName = "java:/eis/ConfigPropertyConnectionFactory")
+ private ConfigPropertyConnectionFactory connectionFactory;
+
+ /** AO */
+ @Resource(mappedName = "java:/eis/ao/ConfigPropertyAdminObjectInterface")
+ private ConfigPropertyAdminObjectInterface adminObject;
+
+ /**
+ * Test config properties
+ *
+ * @exception Throwable Thrown if case of an error
+ */
+ @Test
+ public void testConfigProperties() throws Throwable
+ {
+ assertNotNull(connectionFactory);
+ assertNotNull(adminObject);
+
+ ConfigPropertyConnection connection = connectionFactory.getConnection();
+ assertNotNull(connection);
+
+ assertEquals("A", connection.getResourceAdapterProperty());
+ assertEquals("B", connection.getManagedConnectionFactoryProperty());
+
+ assertEquals("C", adminObject.getProperty());
+
+ connection.close();
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectImpl.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectImpl.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectImpl.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import java.io.Serializable;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+import javax.resource.Referenceable;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+
+/**
+ * ConfigPropertyAdminObjectImpl
+ *
+ * @version $Revision: $
+ */
+public class ConfigPropertyAdminObjectImpl implements ConfigPropertyAdminObjectInterface,
+ ResourceAdapterAssociation, Referenceable, Serializable
+{
+ /** Serial version uid */
+ private static final long serialVersionUID = 1L;
+
+ /** The resource adapter */
+ private ResourceAdapter ra;
+
+ /** Reference */
+ private Reference reference;
+
+ /** property */
+ private String property;
+
+ /**
+ * Default constructor
+ */
+ public ConfigPropertyAdminObjectImpl()
+ {
+
+ }
+
+ /**
+ * Set property
+ * @param property The value
+ */
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ /**
+ * Get property
+ * @return The value
+ */
+ public String getProperty()
+ {
+ return property;
+ }
+
+ /**
+ * Get the resource adapter
+ *
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter
+ *
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ this.ra = ra;
+ }
+
+ /**
+ * Get the Reference instance.
+ *
+ * @return Reference instance
+ * @exception NamingException Thrown if a reference can't be obtained
+ */
+ @Override
+ public Reference getReference() throws NamingException
+ {
+ return reference;
+ }
+
+ /**
+ * Set the Reference instance.
+ *
+ * @param reference A Reference instance
+ */
+ @Override
+ public void setReference(Reference reference)
+ {
+ this.reference = reference;
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ * @return A hash code value for this object.
+ */
+ @Override
+ public int hashCode()
+ {
+ int result = 17;
+ if (property != null)
+ result += 31 * result + 7 * property.hashCode();
+ else
+ result += 31 * result + 7;
+ return result;
+ }
+
+ /**
+ * Indicates whether some other object is equal to this one.
+ * @param other The reference object with which to compare.
+ * @return true if this object is the same as the obj argument, false otherwise.
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+ if (other == this)
+ return true;
+ if (!(other instanceof ConfigPropertyAdminObjectImpl))
+ return false;
+ ConfigPropertyAdminObjectImpl obj = (ConfigPropertyAdminObjectImpl)other;
+ boolean result = true;
+ if (result)
+ {
+ if (property == null)
+ result = obj.getProperty() == null;
+ else
+ result = property.equals(obj.getProperty());
+ }
+ return result;
+ }
+
+
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectInterface.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectInterface.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyAdminObjectInterface.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import java.io.Serializable;
+
+import javax.resource.Referenceable;
+
+/**
+ * ConfigPropertyAdminObjectInterface
+ *
+ * @version $Revision: $
+ */
+public interface ConfigPropertyAdminObjectInterface extends Referenceable, Serializable
+{
+ /**
+ * Set property
+ * @param property The value
+ */
+ public void setProperty(String property);
+
+ /**
+ * Get property
+ * @return The value
+ */
+ public String getProperty();
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnection.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnection.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnection.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+/**
+ * ConfigPropertyConnection
+ *
+ * @version $Revision: $
+ */
+public interface ConfigPropertyConnection
+{
+ /**
+ * getResourceAdapterProperty
+ * @return String
+ */
+ public String getResourceAdapterProperty();
+ /**
+ * getManagedConnectionFactoryProperty
+ * @return String
+ */
+ public String getManagedConnectionFactoryProperty();
+
+ /**
+ * Close
+ */
+ public void close();
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactory.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactory.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactory.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import java.io.Serializable;
+
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
+
+/**
+ * ConfigPropertyConnectionFactory
+ *
+ * @version $Revision: $
+ */
+public interface ConfigPropertyConnectionFactory extends Serializable, Referenceable
+{
+ /**
+ * Get connection from factory
+ *
+ * @return ConfigPropertyConnection instance
+ * @exception ResourceException Thrown if a connection can't be obtained
+ */
+ public ConfigPropertyConnection getConnection() throws ResourceException;
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactoryImpl.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactoryImpl.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionFactoryImpl.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+
+/**
+ * ConfigPropertyConnectionFactoryImpl
+ *
+ * @version $Revision: $
+ */
+public class ConfigPropertyConnectionFactoryImpl implements ConfigPropertyConnectionFactory
+{
+ /** The serial version UID */
+ private static final long serialVersionUID = 1L;
+
+ /** Reference */
+ private Reference reference;
+
+ /** ManagedConnectionFactory */
+ private ConfigPropertyManagedConnectionFactory mcf;
+
+ /** ConnectionManager */
+ private ConnectionManager connectionManager;
+
+ /**
+ * Default constructor
+ */
+ public ConfigPropertyConnectionFactoryImpl()
+ {
+
+ }
+
+ /**
+ * Constructor
+ * @param mcf ManagedConnectionFactory
+ * @param cxManager ConnectionManager
+ */
+ public ConfigPropertyConnectionFactoryImpl(ConfigPropertyManagedConnectionFactory mcf, ConnectionManager cxManager)
+ {
+ this.mcf = mcf;
+ this.connectionManager = cxManager;
+ }
+
+ /**
+ * Get connection from factory
+ *
+ * @return ConfigPropertyConnection instance
+ * @exception ResourceException Thrown if a connection can't be obtained
+ */
+ @Override
+ public ConfigPropertyConnection getConnection() throws ResourceException
+ {
+ return (ConfigPropertyConnection)connectionManager.allocateConnection(mcf, null);
+ }
+
+ /**
+ * Get the Reference instance.
+ *
+ * @return Reference instance
+ * @exception NamingException Thrown if a reference can't be obtained
+ */
+ @Override
+ public Reference getReference() throws NamingException
+ {
+ return reference;
+ }
+
+ /**
+ * Set the Reference instance.
+ *
+ * @param reference A Reference instance
+ */
+ @Override
+ public void setReference(Reference reference)
+ {
+ this.reference = reference;
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionImpl.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionImpl.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyConnectionImpl.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+/**
+ * ConfigPropertyConnectionImpl
+ *
+ * @version $Revision: $
+ */
+public class ConfigPropertyConnectionImpl implements ConfigPropertyConnection
+{
+ /** ManagedConnection */
+ private ConfigPropertyManagedConnection mc;
+
+ /** ManagedConnectionFactory */
+ private ConfigPropertyManagedConnectionFactory mcf;
+
+ /**
+ * Default constructor
+ * @param mc ConfigPropertyManagedConnection
+ * @param mcf ConfigPropertyManagedConnectionFactory
+ */
+ public ConfigPropertyConnectionImpl(ConfigPropertyManagedConnection mc, ConfigPropertyManagedConnectionFactory mcf)
+ {
+ this.mc = mc;
+ this.mcf = mcf;
+ }
+
+ /**
+ * Call getResourceAdapterProperty
+ * @return String
+ */
+ public String getResourceAdapterProperty()
+ {
+ return ((ConfigPropertyResourceAdapter)mcf.getResourceAdapter()).getProperty();
+ }
+
+ /**
+ * Call getManagedConnectionFactoryProperty
+ * @return String
+ */
+ public String getManagedConnectionFactoryProperty()
+ {
+ return mcf.getProperty();
+ }
+
+ /**
+ * Close
+ */
+ public void close()
+ {
+ mc.closeHandle(this);
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnection.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnection.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnection.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import java.io.PrintWriter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.resource.NotSupportedException;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+/**
+ * ConfigPropertyManagedConnection
+ *
+ * @version $Revision: $
+ */
+public class ConfigPropertyManagedConnection implements ManagedConnection
+{
+ /** The logwriter */
+ private PrintWriter logwriter;
+
+ /** ManagedConnectionFactory */
+ private ConfigPropertyManagedConnectionFactory mcf;
+
+ /** Listeners */
+ private List<ConnectionEventListener> listeners;
+
+ /** Connection */
+ private Object connection;
+
+ /**
+ * Default constructor
+ * @param mcf mcf
+ */
+ public ConfigPropertyManagedConnection(ConfigPropertyManagedConnectionFactory mcf)
+ {
+ this.mcf = mcf;
+ this.logwriter = null;
+ this.listeners = new ArrayList<ConnectionEventListener>(1);
+ this.connection = null;
+ }
+
+ /**
+ * Creates a new connection handle for the underlying physical connection
+ * represented by the ManagedConnection instance.
+ *
+ * @param subject Security context as JAAS subject
+ * @param cxRequestInfo ConnectionRequestInfo instance
+ * @return generic Object instance representing the connection handle.
+ * @throws ResourceException generic exception if operation fails
+ */
+ public Object getConnection(Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ connection = new ConfigPropertyConnectionImpl(this, mcf);
+ return connection;
+ }
+
+ /**
+ * Used by the container to change the association of an
+ * application-level connection handle with a ManagedConneciton instance.
+ *
+ * @param connection Application-level connection handle
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void associateConnection(Object connection) throws ResourceException
+ {
+ }
+
+ /**
+ * Application server calls this method to force any cleanup on the ManagedConnection instance.
+ *
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void cleanup() throws ResourceException
+ {
+ }
+
+ /**
+ * Destroys the physical connection to the underlying resource manager.
+ *
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void destroy() throws ResourceException
+ {
+ }
+
+ /**
+ * Adds a connection event listener to the ManagedConnection instance.
+ *
+ * @param listener A new ConnectionEventListener to be registered
+ */
+ public void addConnectionEventListener(ConnectionEventListener listener)
+ {
+ if (listener == null)
+ throw new IllegalArgumentException("Listener is null");
+ listeners.add(listener);
+ }
+
+ /**
+ * Removes an already registered connection event listener from the ManagedConnection instance.
+ *
+ * @param listener already registered connection event listener to be removed
+ */
+ public void removeConnectionEventListener(ConnectionEventListener listener)
+ {
+ if (listener == null)
+ throw new IllegalArgumentException("Listener is null");
+ listeners.remove(listener);
+ }
+
+ /**
+ * Close handle
+ *
+ * @param handle The handle
+ */
+ public void closeHandle(ConfigPropertyConnection handle)
+ {
+ ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+ event.setConnectionHandle(handle);
+ for (ConnectionEventListener cel : listeners)
+ {
+ cel.connectionClosed(event);
+ }
+ }
+
+ /**
+ * Gets the log writer for this ManagedConnection instance.
+ *
+ * @return Character ourput stream associated with this Managed-Connection instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ return logwriter;
+ }
+
+ /**
+ * Sets the log writer for this ManagedConnection instance.
+ *
+ * @param out Character Output stream to be associated
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ logwriter = out;
+ }
+
+ /**
+ * Returns an <code>javax.resource.spi.LocalTransaction</code> instance.
+ *
+ * @return LocalTransaction instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public LocalTransaction getLocalTransaction() throws ResourceException
+ {
+ throw new NotSupportedException("LocalTransaction not supported");
+ }
+
+ /**
+ * Returns an <code>javax.transaction.xa.XAresource</code> instance.
+ *
+ * @return XAResource instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public XAResource getXAResource() throws ResourceException
+ {
+ throw new NotSupportedException("GetXAResource not supported not supported");
+ }
+
+ /**
+ * Gets the metadata information for this connection's underlying EIS resource manager instance.
+ *
+ * @return ManagedConnectionMetaData instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public ManagedConnectionMetaData getMetaData() throws ResourceException
+ {
+ return new ConfigPropertyManagedConnectionMetaData();
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionFactory.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionFactory.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,230 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+
+import javax.security.auth.Subject;
+
+/**
+ * ConfigPropertyManagedConnectionFactory
+ *
+ * @version $Revision: $
+ */
+public class ConfigPropertyManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation
+{
+ /** The serial version UID */
+ private static final long serialVersionUID = 1L;
+
+ /** The resource adapter */
+ private ResourceAdapter ra;
+
+ /** The logwriter */
+ private PrintWriter logwriter;
+
+ /** property */
+ private String property;
+
+ /**
+ * Default constructor
+ */
+ public ConfigPropertyManagedConnectionFactory()
+ {
+
+ }
+
+ /**
+ * Set property
+ * @param property The value
+ */
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ /**
+ * Get property
+ * @return The value
+ */
+ public String getProperty()
+ {
+ return property;
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @param cxManager ConnectionManager to be associated with created EIS connection factory instance
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+ {
+ return new ConfigPropertyConnectionFactoryImpl(this, cxManager);
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory() throws ResourceException
+ {
+ throw new ResourceException("This resource adapter doesn't support non-managed environments");
+ }
+
+ /**
+ * Creates a new physical connection to the underlying EIS resource manager.
+ *
+ * @param subject Caller's security information
+ * @param cxRequestInfo Additional resource adapter specific connection request information
+ * @throws ResourceException generic exception
+ * @return ManagedConnection instance
+ */
+ public ManagedConnection createManagedConnection(Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ return new ConfigPropertyManagedConnection(this);
+ }
+
+ /**
+ * Returns a matched connection from the candidate set of connections.
+ *
+ * @param connectionSet Candidate connection set
+ * @param subject Caller's security information
+ * @param cxRequestInfo Additional resource adapter specific connection request information
+ * @throws ResourceException generic exception
+ * @return ManagedConnection if resource adapter finds an acceptable match otherwise null
+ */
+ public ManagedConnection matchManagedConnections(Set connectionSet,
+ Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ ManagedConnection result = null;
+ Iterator it = connectionSet.iterator();
+ while (result == null && it.hasNext())
+ {
+ ManagedConnection mc = (ManagedConnection)it.next();
+ if (mc instanceof ConfigPropertyManagedConnection)
+ {
+ result = mc;
+ }
+
+ }
+ return result;
+ }
+
+ /**
+ * Get the log writer for this ManagedConnectionFactory instance.
+ *
+ * @return PrintWriter
+ * @throws ResourceException generic exception
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ return logwriter;
+ }
+
+ /**
+ * Set the log writer for this ManagedConnectionFactory instance.
+ *
+ * @param out PrintWriter - an out stream for error logging and tracing
+ * @throws ResourceException generic exception
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ logwriter = out;
+ }
+
+ /**
+ * Get the resource adapter
+ *
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter
+ *
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ this.ra = ra;
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ * @return A hash code value for this object.
+ */
+ @Override
+ public int hashCode()
+ {
+ int result = 17;
+ if (property != null)
+ result += 31 * result + 7 * property.hashCode();
+ else
+ result += 31 * result + 7;
+ return result;
+ }
+
+ /**
+ * Indicates whether some other object is equal to this one.
+ * @param other The reference object with which to compare.
+ * @return true if this object is the same as the obj argument, false otherwise.
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+ if (other == this)
+ return true;
+ if (!(other instanceof ConfigPropertyManagedConnectionFactory))
+ return false;
+ ConfigPropertyManagedConnectionFactory obj = (ConfigPropertyManagedConnectionFactory)other;
+ boolean result = true;
+ if (result)
+ {
+ if (property == null)
+ result = obj.getProperty() == null;
+ else
+ result = property.equals(obj.getProperty());
+ }
+ return result;
+ }
+
+
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionMetaData.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionMetaData.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyManagedConnectionMetaData.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import javax.resource.ResourceException;
+
+import javax.resource.spi.ManagedConnectionMetaData;
+
+/**
+ * ConfigPropertyManagedConnectionMetaData
+ *
+ * @version $Revision: $
+ */
+public class ConfigPropertyManagedConnectionMetaData implements ManagedConnectionMetaData
+{
+ /**
+ * Default constructor
+ */
+ public ConfigPropertyManagedConnectionMetaData()
+ {
+ }
+
+ /**
+ * Returns Product name of the underlying EIS instance connected through the ManagedConnection.
+ *
+ * @return Product name of the EIS instance
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public String getEISProductName() throws ResourceException
+ {
+ return null;
+ }
+
+ /**
+ * Returns Product version of the underlying EIS instance connected through the ManagedConnection.
+ *
+ * @return Product version of the EIS instance
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public String getEISProductVersion() throws ResourceException
+ {
+ return null;
+ }
+
+ /**
+ * Returns maximum limit on number of active concurrent connections
+ *
+ * @return Maximum limit for number of active concurrent connections
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public int getMaxConnections() throws ResourceException
+ {
+ return 0;
+ }
+
+ /**
+ * Returns name of the user associated with the ManagedConnection instance
+ *
+ * @return Name of the user
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public String getUserName() throws ResourceException
+ {
+ return null;
+ }
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyResourceAdapter.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyResourceAdapter.java (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/ConfigPropertyResourceAdapter.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.deployers.spec.rars.configproperty;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+
+import javax.transaction.xa.XAResource;
+
+/**
+ * ConfigPropertyResourceAdapter
+ *
+ * @version $Revision: $
+ */
+public class ConfigPropertyResourceAdapter implements ResourceAdapter
+{
+ /** property */
+ private String property;
+
+ /**
+ * Default constructor
+ */
+ public ConfigPropertyResourceAdapter()
+ {
+ }
+
+ /**
+ * Set property
+ * @param property The value
+ */
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ /**
+ * Get property
+ * @return The value
+ */
+ public String getProperty()
+ {
+ return property;
+ }
+
+ /**
+ * This is called during the activation of a message endpoint.
+ *
+ * @param endpointFactory A message endpoint factory instance.
+ * @param spec An activation spec JavaBean instance.
+ * @throws ResourceException generic exception
+ */
+ public void endpointActivation(MessageEndpointFactory endpointFactory,
+ ActivationSpec spec) throws ResourceException
+ {
+ }
+
+ /**
+ * This is called when a message endpoint is deactivated.
+ *
+ * @param endpointFactory A message endpoint factory instance.
+ * @param spec An activation spec JavaBean instance.
+ */
+ public void endpointDeactivation(MessageEndpointFactory endpointFactory,
+ ActivationSpec spec)
+ {
+ }
+
+ /**
+ * This is called when a resource adapter instance is bootstrapped.
+ *
+ * @param ctx A bootstrap context containing references
+ * @throws ResourceAdapterInternalException indicates bootstrap failure.
+ */
+ public void start(BootstrapContext ctx)
+ throws ResourceAdapterInternalException
+ {
+ }
+
+ /**
+ * This is called when a resource adapter instance is undeployed or
+ * during application server shutdown.
+ */
+ public void stop()
+ {
+ }
+
+ /**
+ * This method is called by the application server during crash recovery.
+ *
+ * @param specs An array of ActivationSpec JavaBeans
+ * @throws ResourceException generic exception
+ * @return An array of XAResource objects
+ */
+ public XAResource[] getXAResources(ActivationSpec[] specs)
+ throws ResourceException
+ {
+ return null;
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ * @return A hash code value for this object.
+ */
+ @Override
+ public int hashCode()
+ {
+ int result = 17;
+ if (property != null)
+ result += 31 * result + 7 * property.hashCode();
+ else
+ result += 31 * result + 7;
+ return result;
+ }
+
+ /**
+ * Indicates whether some other object is equal to this one.
+ * @param other The reference object with which to compare.
+ * @return true if this object is the same as the obj argument, false otherwise.
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+ if (other == this)
+ return true;
+ if (!(other instanceof ConfigPropertyResourceAdapter))
+ return false;
+ ConfigPropertyResourceAdapter obj = (ConfigPropertyResourceAdapter)other;
+ boolean result = true;
+ if (result)
+ {
+ if (property == null)
+ result = obj.getProperty() == null;
+ else
+ result = property.equals(obj.getProperty());
+ }
+ return result;
+ }
+
+
+}
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/package.html
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/package.html (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/configproperty/package.html 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,3 @@
+<body>
+Resource adapter for testing config-property's
+</body>
Modified: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject1Impl.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject1Impl.java 2011-08-26 14:39:15 UTC (rev 112137)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject1Impl.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -38,6 +38,9 @@
public class MultipleAdminObject1Impl implements MultipleAdminObject1,
ResourceAdapterAssociation, Referenceable, Serializable
{
+ /** Serial version uid */
+ private static final long serialVersionUID = 1L;
+
/** The resource adapter */
private ResourceAdapter ra;
Modified: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject2Impl.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject2Impl.java 2011-08-26 14:39:15 UTC (rev 112137)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/multiple/MultipleAdminObject2Impl.java 2011-08-26 14:46:01 UTC (rev 112138)
@@ -38,6 +38,9 @@
public class MultipleAdminObject2Impl implements MultipleAdminObject2,
ResourceAdapterAssociation, Referenceable, Serializable
{
+ /** Serial version uid */
+ private static final long serialVersionUID = 1L;
+
/** The resource adapter */
private ResourceAdapter ra;
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ironjacamar.xml
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ironjacamar.xml (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ironjacamar.xml 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,49 @@
+<!--
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+-->
+
+<ironjacamar xmlns="http://www.jboss.org/ironjacamar/schema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema
+ http://www.jboss.org/ironjacamar/schema/ironjacamar_1_0.xsd">
+
+ <config-property name="Property">A</config-property>
+
+ <transaction-support>NoTransaction</transaction-support>
+
+ <connection-definitions>
+ <connection-definition class-name="org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnectionFactory"
+ jndi-name="java:/eis/ConfigPropertyConnectionFactory"
+ pool-name="ConfigPropertyConnectionFactory">
+ <config-property name="Property">B</config-property>
+ </connection-definition>
+ </connection-definitions>
+
+ <admin-objects>
+ <admin-object class-name="org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectImpl"
+ jndi-name="java:/eis/ao/ConfigPropertyAdminObjectInterface">
+ <config-property name="Property">C</config-property>
+ </admin-object>
+ </admin-objects>
+
+</ironjacamar>
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/config-property.rar/META-INF/ra.xml 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+-->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyResourceAdapter</resourceadapter-class>
+ <config-property>
+ <config-property-name>property</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>default</config-property-value>
+ </config-property>
+
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnectionFactory</managedconnectionfactory-class>
+ <config-property>
+ <config-property-name>property</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>default</config-property-value>
+ </config-property>
+
+ <connectionfactory-interface>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionFactory</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionFactoryImpl</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnection</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyConnectionImpl</connection-impl-class>
+ </connection-definition>
+ <transaction-support>NoTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ <adminobject>
+ <adminobject-interface>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectInterface</adminobject-interface>
+ <adminobject-class>org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectImpl</adminobject-class>
+ <config-property>
+ <config-property-name>property</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>default</config-property-value>
+ </config-property>
+
+ </adminobject>
+ </resourceadapter>
+</connector>
Added: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/configproperty-ra.xml
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/configproperty-ra.xml (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/resources/configproperty-ra.xml 2011-08-26 14:46:01 UTC (rev 112138)
@@ -0,0 +1,49 @@
+<!--
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+-->
+
+<resource-adapters>
+ <resource-adapter>
+ <archive>config-property.rar</archive>
+
+ <config-property name="Property">A</config-property>
+
+ <transaction-support>NoTransaction</transaction-support>
+
+ <connection-definitions>
+ <connection-definition class-name="org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyManagedConnectionFactory"
+ jndi-name="java:/eis/ConfigPropertyConnectionFactory1"
+ pool-name="ConfigPropertyConnectionFactory">
+ <config-property name="Property">B</config-property>
+ </connection-definition>
+ </connection-definitions>
+
+ <admin-objects>
+ <admin-object class-name="org.jboss.jca.test.deployers.spec.rars.configproperty.ConfigPropertyAdminObjectImpl"
+ jndi-name="java:/eis/ao/ConfigPropertyAdminObjectInterface1">
+ <config-property name="Property">C</config-property>
+ </admin-object>
+ </admin-objects>
+
+ </resource-adapter>
+</resource-adapters>
Modified: projects/jboss-jca/branches/Branch_1_0/doc/userguide/en-US/modules/logging.xml
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/doc/userguide/en-US/modules/logging.xml 2011-08-26 14:39:15 UTC (rev 112137)
+++ projects/jboss-jca/branches/Branch_1_0/doc/userguide/en-US/modules/logging.xml 2011-08-26 14:46:01 UTC (rev 112138)
@@ -799,6 +799,11 @@
<entry><code>EXCEPTION</code></entry>
<entry>Invalid ResourceAdapter class</entry>
</row>
+ <row>
+ <entry>20060</entry>
+ <entry><code>EXCEPTION</code></entry>
+ <entry>Unable to inject</entry>
+ </row>
</tbody>
</tgroup>
</table>
More information about the jboss-cvs-commits
mailing list