User: d_jencks
Date: 02/04/09 18:08:24
Modified: src/main/org/jboss/resource/connectionmanager
JBossManagedConnectionPool.java RARDeployment.java
Log:
added support for setting individual ManagedConnectionFactory properties
programatically
Revision Changes Path
1.3 +1 -1
jbosscx/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
Index: JBossManagedConnectionPool.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JBossManagedConnectionPool.java 6 Apr 2002 04:34:28 -0000 1.2
+++ JBossManagedConnectionPool.java 10 Apr 2002 01:08:23 -0000 1.3
@@ -41,7 +41,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
* @version
* @jmx:mbean name="jboss.jca:service=JBossManagedConnectionPool"
- * extends="org.jboss.system.Service"
+ * extends="org.jboss.system.ServiceMBean"
*/
public class JBossManagedConnectionPool
1.3 +50 -0
jbosscx/src/main/org/jboss/resource/connectionmanager/RARDeployment.java
Index: RARDeployment.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/connectionmanager/RARDeployment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RARDeployment.java 6 Apr 2002 04:34:28 -0000 1.2
+++ RARDeployment.java 10 Apr 2002 01:08:24 -0000 1.3
@@ -628,6 +628,48 @@
mcf = null;
mcfClass = null;
}
+
+ /**
+ * The setManagedConnectionFactoryAttribute method can be used to set
+ * attributes on the ManagedConnectionFactory from code, without using the
+ * xml configuration.
+ *
+ * @param name a <code>String</code> value
+ * @param clazz a <code>Class</code> value
+ * @param value an <code>Object</code> value
+ *
+ * @jmx:managed-operation
+ */
+ public void setManagedConnectionFactoryAttribute(String name, Class clazz,
Object value)
+ {
+ Method setter;
+
+ try
+ {
+ setter = mcfClass.getMethod("set" + name, new Class[]{clazz});
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ log.warn("The class '" + mcfClass.toString() + "' has no " +
+ "setter for config property '" + name + "'");
+ throw new IllegalArgumentException("The class '" + mcfClass.toString() +
"' has no " +
+ "setter for config property '" + name + "'");
+ }
+ try
+ {
+ setter.invoke(mcf, new Object[]{value});
+ log.debug("set property " + name + " to value " + value);
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to invoke setter method '" + setter + "' " +
+ "on object '" + mcf + "'", e);
+ throw new IllegalArgumentException("Unable to invoke setter method '" +
setter + "' " +
+ "on object '" + mcf + "'");
+ }
+ }
+
+
//ObjectFactory implementation
/**
* Describe <code>getObjectInstance</code> method here.
@@ -659,6 +701,11 @@
protected void setMcfProperties() throws DeploymentException
{
+ if (managedConnectionFactoryProperties == null)
+ {
+ return;
+ } // end of if ()
+
// the properties that the deployment descriptor says we need to
// set
NodeList props = managedConnectionFactoryProperties.getChildNodes();
@@ -713,6 +760,8 @@
continue;
}
Object v = pe.getValue();
+ setManagedConnectionFactoryAttribute(name, clazz, v);
+ /*
try
{
setter = mcfClass.getMethod("set" + name, new Class[]{clazz});
@@ -734,6 +783,7 @@
log.warn("Unable to invoke setter method '" + setter + "' " +
"on object '" + mcf + "'", e);
}
+ */
} // end of if ()
} // end of if ()
} //end of for
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development