[jboss-cvs] JBossAS SVN: r110903 - in projects/jboss-jca/trunk/rhq/src/main: resources/META-INF and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 14 02:34:05 EDT 2011
Author: gaol
Date: 2011-03-14 02:34:05 -0400 (Mon, 14 Mar 2011)
New Revision: 110903
Modified:
projects/jboss-jca/trunk/rhq/src/main/java/org/jboss/jca/rhq/ra/McfResourceComponent.java
projects/jboss-jca/trunk/rhq/src/main/resources/META-INF/rhq-plugin.xml
Log:
[JBJCA-518] gets mcf-class-name, conn_pool configurations of McfResourceComponent using management model api
Modified: projects/jboss-jca/trunk/rhq/src/main/java/org/jboss/jca/rhq/ra/McfResourceComponent.java
===================================================================
--- projects/jboss-jca/trunk/rhq/src/main/java/org/jboss/jca/rhq/ra/McfResourceComponent.java 2011-03-13 09:23:59 UTC (rev 110902)
+++ projects/jboss-jca/trunk/rhq/src/main/java/org/jboss/jca/rhq/ra/McfResourceComponent.java 2011-03-14 06:34:05 UTC (rev 110903)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.rhq.ra;
+import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
import org.jboss.jca.core.api.management.ConfigProperty;
import org.jboss.jca.core.api.management.Connector;
import org.jboss.jca.core.api.management.ManagedConnectionFactory;
@@ -32,10 +33,13 @@
import java.util.List;
+import javax.resource.spi.ResourceAdapterAssociation;
+
import org.jboss.logging.Logger;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertySimple;
/**
* McfResourceComponent represent the ManagedConnectionFactory in JCA container.
@@ -64,20 +68,84 @@
Connector connector = ManagementRepositoryHelper.getConnectorByUniqueId(mr, getRarUniqueId());
String jcaClsName = getJCAClassName();
-
- for (ManagedConnectionFactory mcf : connector.getManagedConnectionFactories())
+ ManagedConnectionFactory mcf = null;
+ for (ManagedConnectionFactory connectorMcf : connector.getManagedConnectionFactories())
{
- javax.resource.spi.ManagedConnectionFactory jcaMcf = mcf.getManagedConnectionFactory();
- Class<?> mcfCls = jcaMcf.getClass();
+ Class<?> mcfCls = connectorMcf.getManagedConnectionFactory().getClass();
if (mcfCls.getName().equals(jcaClsName))
{
logger.debug("Class Name is: " + jcaClsName);
- List<ConfigProperty> mcfConfProps = mcf.getConfigProperties();
- PropertyList configList = getConfigPropertiesList(jcaMcf, mcfConfProps);
- config.put(configList);
+ mcf = connectorMcf;
break;
}
}
+ if (null == mcf)
+ {
+ throw new IllegalStateException("Can not find the associated ManagedConnectionFactory in the Connector.");
+ }
+
+ javax.resource.spi.ManagedConnectionFactory jcaMcf = mcf.getManagedConnectionFactory();
+ // jndi name
+
+ // mcf-class-name
+ PropertySimple clsNameProp = new PropertySimple("mcf-class-name", jcaClsName);
+ config.put(clsNameProp);
+
+ // cf-interface-name
+
+ // cf-impl-name
+
+ // connection-interface-name
+
+ // connection-impl-name
+
+ // use-ra-association
+ boolean useRaAsso = ResourceAdapterAssociation.class.isAssignableFrom(jcaMcf.getClass());
+ PropertySimple useRaAssoProp = new PropertySimple("use-ra-association", Boolean.valueOf(useRaAsso));
+ config.put(useRaAssoProp);
+
+ // conn_pool
+ PoolConfiguration poolConfig = mcf.getPoolConfiguration();
+ PropertySimple minSizeProp = new PropertySimple("min-pool-size", Integer.valueOf(poolConfig.getMinSize()));
+ config.put(minSizeProp);
+
+ PropertySimple maxSizeProp = new PropertySimple("max-pool-size", Integer.valueOf(poolConfig.getMaxSize()));
+ config.put(maxSizeProp);
+
+ Boolean doBackGroundValidation = Boolean.valueOf(poolConfig.isBackgroundValidation());
+ PropertySimple isBackGroundValidateProp = new PropertySimple("background-validation", doBackGroundValidation);
+ config.put(isBackGroundValidateProp);
+
+ Long bvInterval = Long.valueOf(poolConfig.getBackgroundValidationInterval());
+ PropertySimple backGroundValidateIntervalProp = new PropertySimple("background-validation-millis", bvInterval);
+ config.put(backGroundValidateIntervalProp);
+
+ Integer bvMinutes = Integer.valueOf(poolConfig.getBackgroundValidationMinutes());
+ PropertySimple backGroundValidateMintuesProp = new PropertySimple("background-validation-minutes", bvMinutes);
+ config.put(backGroundValidateMintuesProp);
+
+ Integer blTimeout = Integer.valueOf((int)poolConfig.getBlockingTimeout());
+ PropertySimple blockingTimeoutProp = new PropertySimple("blocking-timeout-millis", blTimeout);
+ config.put(blockingTimeoutProp);
+
+ Integer idleTimeout = Integer.valueOf((int)poolConfig.getIdleTimeout());
+ PropertySimple idleTimeoutProp = new PropertySimple("idle-timeout-minutes", idleTimeout);
+ config.put(idleTimeoutProp);
+
+ PropertySimple prefillProp = new PropertySimple("prefill", Boolean.valueOf(poolConfig.isPrefill()));
+ config.put(prefillProp);
+
+ PropertySimple useStictMinProp = new PropertySimple("use-strict-min", Boolean.valueOf(poolConfig.isStrictMin()));
+ config.put(useStictMinProp);
+
+ PropertySimple useFasFailProp = new PropertySimple("use-fast-fail", Boolean.valueOf(poolConfig.isUseFastFail()));
+ config.put(useFasFailProp);
+
+ // config properties
+ List<ConfigProperty> mcfConfProps = mcf.getConfigProperties();
+ PropertyList configList = getConfigPropertiesList(jcaMcf, mcfConfProps);
+ config.put(configList);
+
return config;
}
}
Modified: projects/jboss-jca/trunk/rhq/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- projects/jboss-jca/trunk/rhq/src/main/resources/META-INF/rhq-plugin.xml 2011-03-13 09:23:59 UTC (rev 110902)
+++ projects/jboss-jca/trunk/rhq/src/main/resources/META-INF/rhq-plugin.xml 2011-03-14 06:34:05 UTC (rev 110903)
@@ -88,6 +88,13 @@
</c:description>
</c:simple-property>
+ <c:simple-property name="background-validation-minutes" type="integer" required="false" units="minutes"
+ defaultValue="0">
+ <c:description>
+ The background-validation-minutes element specifies the amount of time, in minutes, that background validation will run. The default is 0.
+ </c:description>
+ </c:simple-property>
+
<c:simple-property name="blocking-timeout-millis" displayName="Blocking Timeout in Milliseconds"
units="milliseconds" defaultValue="30000"
type="integer" required="false">
@@ -264,6 +271,12 @@
</c:description>
</c:simple-property>
+ <c:simple-property name="use-fast-fail" type="boolean" required="false" defaultValue="false">
+ <c:description>
+ Whether fail a connection allocation on the first connection if it is invalid (true) or keep trying until the pool is exhausted of all potential connections (false), default false.
+ </c:description>
+ </c:simple-property>
+
<c:simple-property name="validate-on-match" type="boolean" required="false" defaultValue="true">
<c:description>
The validate-on-match element indicates whether or not connection level validation should be done when a
@@ -420,20 +433,20 @@
<!-- Managed Connection Factories. Includes No Tx / Tx connection factories -->
<service name="Managed Connection Factory" discovery="org.jboss.jca.rhq.ra.McfResourceDiscoveryComponent"
- class="org.jboss.jca.rhq.ra.McfResourceComponent" supportsManualAdd="true">
+ class="org.jboss.jca.rhq.ra.McfResourceComponent">
&datasourceAndConnectionFactoryOperations;
<resource-configuration>
<c:group name="general" displayName="General">
<c:simple-property name="jndi-name" displayName="JNDI Name"/>
- <c:simple-property name="mcf-class-name" displayName="ManagedConnectionFactory class name"/>
- <c:simple-property name="cf-interface-name" displayName="ConnectionFactory interface class name"/>
- <c:simple-property name="cf-impl-name" displayName="ConnectionFactory implement class name"/>
- <c:simple-property name="connection-interface-name" displayName="Connection interface class name"/>
- <c:simple-property name="connection-impl-name" displayName="Connection implement class name"/>
-
- <c:simple-property name="use-ra-association" displayName="Use ResourceAdapterAssociation" type="boolean" readOnly="true" required="false"/>
+ <c:simple-property name="mcf-class-name" displayName="ManagedConnectionFactory class name" readOnly="true" />
+ <c:simple-property name="cf-interface-name" displayName="ConnectionFactory interface class name" readOnly="true"/>
+ <c:simple-property name="cf-impl-name" displayName="ConnectionFactory implement class name" readOnly="true"/>
+ <c:simple-property name="connection-interface-name" displayName="Connection interface class name" readOnly="true"/>
+ <c:simple-property name="connection-impl-name" displayName="Connection implement class name" readOnly="true"/>
+
+ <c:simple-property name="use-ra-association" displayName="Use ResourceAdapterAssociation" type="boolean" readOnly="true"/>
</c:group>
<c:group name="conn_pool" displayName="Connection Pool">
More information about the jboss-cvs-commits
mailing list