[jboss-cvs] JBossAS SVN: r111198 - in projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers: fungal and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 18 12:16:28 EDT 2011
Author: maeste
Date: 2011-04-18 12:16:27 -0400 (Mon, 18 Apr 2011)
New Revision: 111198
Modified:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
Log:
moving mcf creation out of AbstractDsDeployer
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-04-18 15:10:51 UTC (rev 111197)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-04-18 16:16:27 UTC (rev 111198)
@@ -32,9 +32,7 @@
import org.jboss.jca.common.api.metadata.ds.DataSources;
import org.jboss.jca.common.api.metadata.ds.XaDataSource;
import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
-import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.ra.Connector;
-import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
import org.jboss.jca.common.api.metadata.ra.XsdString;
import org.jboss.jca.common.metadata.ra.common.ConfigPropertyImpl;
import org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager;
@@ -346,17 +344,8 @@
{
log.debug("DataSource=" + ds);
- Connector md = getMergedMetaData(ds, uniqueId);
+ ManagedConnectionFactory mcf = createMcf(ds, uniqueId, cl);
- // Get the first connection definition as there is only one
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516) md.getResourceadapter();
- List<ConnectionDefinition> cds = ra1516.getOutboundResourceadapter().getConnectionDefinitions();
- ConnectionDefinition cd = cds.get(0);
-
- // ManagedConnectionFactory
- ManagedConnectionFactory mcf = (ManagedConnectionFactory) initAndInject(cd.getManagedConnectionFactoryClass()
- .getValue(), cd.getConfigProperties(), cl);
-
initAndInjectClassLoaderPlugin(mcf, ds);
// Create the pool
PoolConfiguration pc = createPoolConfiguration(ds.getPool(), ds.getTimeOut(), ds.getValidation());
@@ -484,28 +473,8 @@
return mcf.createConnectionFactory(cm);
}
- /**
- * getMerged metadata for ds and give uniqueID
- *
- * @param ds the ds
- * @param uniqueId the uniqueId
- * @return merged MD
- * @throws NotFoundException in case uniqueId is not found
- * @throws Exception in case of other errors
- */
- protected abstract Connector getMergedMetaData(DataSource ds, String uniqueId) throws NotFoundException, Exception;
- /**
- * getMerged metadata for xa-ds and give uniqueID
- *
- * @param ds the xa-ds
- * @param uniqueId the uniqueId
- * @return merged MD
- * @throws NotFoundException in case uniqueId is not found
- * @throws Exception in case of other errors
- */
- protected abstract Connector getMergedMetaData(XaDataSource ds, String uniqueId) throws NotFoundException,
- Exception;
+
/**
* Deploy an XA datasource
@@ -525,17 +494,7 @@
{
log.debug("XaDataSource=" + ds);
- Connector md = getMergedMetaData(ds, uniqueId);
-
- // Get the first connection definition as there is only one
- ResourceAdapter1516 ra1516 = (ResourceAdapter1516) md.getResourceadapter();
- List<ConnectionDefinition> cds = ra1516.getOutboundResourceadapter().getConnectionDefinitions();
- ConnectionDefinition cd = cds.get(0);
-
- // ManagedConnectionFactory
- ManagedConnectionFactory mcf = (ManagedConnectionFactory) initAndInject(cd.getManagedConnectionFactoryClass()
- .getValue(), cd.getConfigProperties(), cl);
- initAndInjectClassLoaderPlugin(mcf, ds);
+ ManagedConnectionFactory mcf = createMcf(ds, uniqueId, cl);
// Create the pool
PoolConfiguration pc = createPoolConfiguration(ds.getXaPool(), ds.getTimeOut(), ds.getValidation());
@@ -777,7 +736,33 @@
return mcf.createConnectionFactory(cm);
}
+ /**
+ * Create Mcf for xads
+ *
+ * @param ds the xsds
+ * @param uniqueId the uniqueId
+ * @param cl the classloader
+ * @return the mcf
+ * @throws NotFoundException in case it's not found in cl
+ * @throws Exception in case of other errro
+ * @throws DeployException in case of deoloy error
+ */
+ protected abstract ManagedConnectionFactory createMcf(XaDataSource ds, String uniqueId, ClassLoader cl)
+ throws NotFoundException, Exception, DeployException;
+ /**
+ * Create Mcf for ds
+ *
+ * @param ds the xsds
+ * @param uniqueId the uniqueId
+ * @param cl the classloader
+ * @return the mcf
+ * @throws NotFoundException in case it's not found in cl
+ * @throws Exception in case of other errro
+ * @throws DeployException in case of deoloy error
+ */
+ protected abstract ManagedConnectionFactory createMcf(DataSource ds, String uniqueId, ClassLoader cl)
+ throws NotFoundException, Exception, DeployException;
/**
* Create an instance of the pool configuration based on the input
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java 2011-04-18 15:10:51 UTC (rev 111197)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java 2011-04-18 16:16:27 UTC (rev 111198)
@@ -26,7 +26,9 @@
import org.jboss.jca.common.api.metadata.ds.DataSources;
import org.jboss.jca.common.api.metadata.ds.XaDataSource;
import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
import org.jboss.jca.common.metadata.ds.DsParser;
import org.jboss.jca.common.metadata.merge.Merger;
import org.jboss.jca.core.naming.ExplicitJndiStrategy;
@@ -50,6 +52,7 @@
import javax.management.JMException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import javax.resource.spi.ManagedConnectionFactory;
import org.jboss.logging.Logger;
import org.jboss.security.SubjectFactory;
@@ -400,7 +403,7 @@
if (mgtDs.getPool().getStatistics() != null)
{
String dsPSName = baseName + ",type=PoolStatistics";
-
+
Set<String> writeAttributes = new HashSet<String>();
writeAttributes.add("Enabled");
Set<String> excludeAttributes = new HashSet<String>();
@@ -427,7 +430,7 @@
excludeAttributes.add("Names");
Set<String> excludeOperations = new HashSet<String>();
excludeOperations.add("delta(.)*");
-
+
DynamicMBean dsSDMB = JMX.createMBean(mgtDs.getStatistics(), "Statistics",
writeAttributes, null, excludeAttributes, excludeOperations);
ObjectName dsSON = new ObjectName(dsSName);
@@ -442,24 +445,46 @@
return ons;
}
+
@Override
- protected Connector getMergedMetaData(DataSource ds, String uniqueId) throws NotFoundException, Exception
+ protected ManagedConnectionFactory createMcf(XaDataSource ds, String uniqueId, ClassLoader cl)
+ throws NotFoundException, Exception, DeployException
{
Merger merger = new Merger();
Connector md = mdr.getResourceAdapter(uniqueId);
md = merger.mergeConnectorAndDs(ds, md);
- return md;
+ // Get the first connection definition as there is only one
+ ResourceAdapter1516 ra1516 = (ResourceAdapter1516) md.getResourceadapter();
+ List<ConnectionDefinition> cds = ra1516.getOutboundResourceadapter().getConnectionDefinitions();
+ ConnectionDefinition cd = cds.get(0);
+
+ // ManagedConnectionFactory
+ ManagedConnectionFactory mcf = (ManagedConnectionFactory) initAndInject(cd.getManagedConnectionFactoryClass()
+ .getValue(), cd.getConfigProperties(), cl);
+ initAndInjectClassLoaderPlugin(mcf, ds);
+ return mcf;
}
@Override
- protected Connector getMergedMetaData(XaDataSource ds, String uniqueId) throws NotFoundException,
- Exception {
+ protected ManagedConnectionFactory createMcf(DataSource ds, String uniqueId, ClassLoader cl)
+ throws NotFoundException, Exception, DeployException
+ {
Merger merger = new Merger();
Connector md = mdr.getResourceAdapter(uniqueId);
md = merger.mergeConnectorAndDs(ds, md);
- return md;
+
+ // Get the first connection definition as there is only one
+ ResourceAdapter1516 ra1516 = (ResourceAdapter1516) md.getResourceadapter();
+ List<ConnectionDefinition> cds = ra1516.getOutboundResourceadapter().getConnectionDefinitions();
+ ConnectionDefinition cd = cds.get(0);
+
+ // ManagedConnectionFactory
+ ManagedConnectionFactory mcf = (ManagedConnectionFactory) initAndInject(cd.getManagedConnectionFactoryClass()
+ .getValue(), cd.getConfigProperties(), cl);
+ initAndInjectClassLoaderPlugin(mcf, ds);
+ return mcf;
}
/**
More information about the jboss-cvs-commits
mailing list