[jboss-cvs] JBossAS SVN: r61563 - trunk/connector/src/main/org/jboss/resource/connectionmanager.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 22 01:31:20 EDT 2007
Author: weston.price at jboss.com
Date: 2007-03-22 01:31:20 -0400 (Thu, 22 Mar 2007)
New Revision: 61563
Modified:
trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
trunk/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
Log:
[JBAS-1425] Programmatic deployment improvements and cleanup.
Modified: trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java 2007-03-22 05:29:03 UTC (rev 61562)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java 2007-03-22 05:31:20 UTC (rev 61563)
@@ -37,7 +37,7 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import org.jboss.deployment.DeploymentException;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.logging.Logger;
import org.jboss.mx.util.JMXExceptionDecoder;
import org.jboss.resource.JBossResourceException;
@@ -372,9 +372,12 @@
{
ManagedConnectionFactory mcf = null;
- if (managedConnectionFactoryName == null)
- throw new DeploymentException("ManagedConnectionFactory not set!");
-
+ if(managedConnectionFactoryName == null)
+ {
+ throw new org.jboss.deployers.spi.DeploymentException("ManagedConnectionFactory is not set.");
+
+ }
+
try
{
//We are getting the actual mcf instance itself. This will require
@@ -412,20 +415,25 @@
else if ("ByNothing".equals(criteria))
poolingStrategy = new OnePool(mcf, poolParams, noTxSeparatePools, log);
else
- throw new DeploymentException("Unknown pooling criteria: " + criteria);
+ throw new DeploymentException("Unknown pooling criteria: " + criteria);
+
}
protected void stopService() throws Exception
{
if (poolingStrategy != null)
+ {
poolingStrategy.shutdown();
+
+ }
+
getServer().removeNotificationListener(managedConnectionFactoryName, this);
poolingStrategy = null;
}
- public void handleNotification(Notification notification,
- Object handback)
+ public void handleNotification(Notification notification, Object handback)
{
+ log.trace("Flushing pool due to notification from ManagedConnectionFactory" + notification);
flush();
}
Modified: trunk/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java 2007-03-22 05:29:03 UTC (rev 61562)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java 2007-03-22 05:31:20 UTC (rev 61563)
@@ -36,6 +36,7 @@
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanException;
import javax.management.MBeanOperationInfo;
+import javax.management.MBeanParameterInfo;
import javax.management.Notification;
import javax.management.ObjectName;
import javax.management.ReflectionException;
@@ -514,87 +515,6 @@
setManagedConnectionFactoryAttribute(name, clazz, v, mustExist);
}
}
-
- protected void setMcfProperties(Element mcfProps) throws DeploymentException
- {
- if (mcfProps == null)
- return;
- // the properties that the deployment descriptor says we need to set
- NodeList props = mcfProps.getChildNodes();
- for (int i = 0; i < props.getLength(); i++)
- {
- if (props.item(i).getNodeType() == Node.ELEMENT_NODE)
- {
- Element prop = (Element) props.item(i);
- if (prop.getTagName().equals("config-property"))
- {
- String name = null;
- String type = null;
- String value = null;
- //Support for more friendly config style
- //<config-property name="" type=""></config-property>
- if (prop.hasAttribute("name"))
- {
- name = prop.getAttribute("name");
- type = prop.getAttribute("type");
- value = MetaData.getElementContent(prop, null, false);
- }
- else
- {
- name = MetaData.getElementContent(MetaData.getUniqueChild(prop, "config-property-name"));
- type = MetaData.getElementContent(MetaData.getUniqueChild(prop, "config-property-type"));
- value = MetaData.getElementContent(MetaData.getOptionalChild(prop, "config-property-value"), null, false);
- }
- if (name == null || name.length() == 0 || value == null || value.length() == 0)
- {
- log.debug("Not setting config property '" + name + "'");
- continue;
- }
- if (type == null || type.length() == 0)
- {
- // Default to String for convenience.
- type = "java.lang.String";
- }
- // see if it is a primitive type first
- Class clazz = Classes.getPrimitiveTypeForName(type);
- if (clazz == null)
- {
- //not primitive, look for it.
- try
- {
- clazz = Thread.currentThread().getContextClassLoader().loadClass(type);
- }
- catch (ClassNotFoundException cnfe)
- {
- log.warn("Unable to find class '" + type + "' for " + "property '" + name
- + "' - skipping property.");
- continue;
- }
- }
- PropertyEditor pe = PropertyEditorManager.findEditor(clazz);
- if (pe == null)
- {
- log.warn("Unable to find a PropertyEditor for class '" + clazz + "' of property '" + name + "' - "
- + "skipping property");
- continue;
- }
- log.debug("setting property: " + name + " to value " + value);
- try
- {
- pe.setAsText(value);
- }
- catch (IllegalArgumentException iae)
- {
- log.warn("Value '" + value + "' is not valid for property '" + name + "' of class '" + clazz
- + "' - skipping " + "property");
- continue;
- }
- Object v = pe.getValue();
- setManagedConnectionFactoryAttribute(name, clazz, v);
- }
- }
- }
- }
protected void setManagedConnectionFactoryProperties(List<ManagedConnectionFactoryPropertyMetaData> properties)
{
@@ -720,7 +640,6 @@
attributes.add(new MBeanAttributeInfo("EisType", String.class.getName(), "The Enterprise Information System type.", true, false, false));
attributes.add(new MBeanAttributeInfo("Version", String.class.getName(), "The ResourceAdapter version.", true, false, false));
attributes.add(new MBeanAttributeInfo("ManagedConnectionFactoryClass", String.class.getName(), "The ManagedConnectionFactory class", true, false, false));
- attributes.add(new MBeanAttributeInfo("ConnectionInterface", String.class.getName(), "The Connection interface", true, false, false));
attributes.add(new MBeanAttributeInfo("ConnectionFactoryImpl", String.class.getName(), "The Connection Factory implementation", true, false, false));
attributes.add(new MBeanAttributeInfo("ConnectionInterface", String.class.getName(), "The Connection Inteface", true, false, false));
attributes.add(new MBeanAttributeInfo("ConnectionImplClass", String.class.getName(), "The Connection Implementation class", true, false, false));
@@ -757,11 +676,30 @@
@Override
protected MBeanOperationInfo[] getInternalOperationInfo()
{
- // TODO Auto-generated method stub
- return super.getInternalOperationInfo();
+ MBeanOperationInfo[] operations = new MBeanOperationInfo[1];
+ MBeanParameterInfo[] getMCFAttributeParamInfo = new MBeanParameterInfo[]{ new MBeanParameterInfo("ManagedConnectionFactoryAttributeName", String.class.getName(), "The ManagedConnectionFactoryAttribute name")};
+ operations[0] = new MBeanOperationInfo("getManagedConnectionFactoryAttribute", "Inspect the value of a ManagedConnectionFactory attribute", getMCFAttributeParamInfo, Object.class.getName(), MBeanOperationInfo.INFO);
+ return operations;
+
}
@Override
+ protected Object internalInvoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
+ {
+ if(actionName.equals("getManagedConnectionFactoryAttribute"))
+ {
+ String param = (String)params[0];
+ return getManagedConnectionFactoryAttribute(param);
+
+ }
+ else
+ {
+ return super.internalInvoke(actionName, params, signature);
+ }
+
+ }
+
+ @Override
protected Object getInternalAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
{
ConnectionDefinitionMetaData cdmd = cmd.getConnectionDefinition(dmd.getConnectionDefinition());
More information about the jboss-cvs-commits
mailing list