[jboss-cvs] JBossAS SVN: r64245 - in trunk/connector/src/main/org/jboss/resource: adapter/jdbc/local and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 24 04:48:33 EDT 2007
Author: wolfc
Date: 2007-07-24 04:48:33 -0400 (Tue, 24 Jul 2007)
New Revision: 64245
Added:
trunk/connector/src/main/org/jboss/resource/metadata/mcf/NonXADataSourceDeploymentMetaData.java
Modified:
trunk/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java
trunk/connector/src/main/org/jboss/resource/adapter/jdbc/local/LocalManagedConnectionFactory.java
trunk/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java
trunk/connector/src/main/org/jboss/resource/metadata/mcf/LocalDataSourceDeploymentMetaData.java
trunk/connector/src/main/org/jboss/resource/metadata/mcf/NoTxDataSourceDeploymentMetaData.java
Log:
JBAS-4577: no-tx-datasource ignores driver-class and connection-url
Modified: trunk/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java 2007-07-24 05:25:39 UTC (rev 64244)
+++ trunk/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java 2007-07-24 08:48:33 UTC (rev 64245)
@@ -53,7 +53,7 @@
private Reference reference;
- public WrapperDataSource (final BaseWrapperManagedConnectionFactory mcf, final ConnectionManager cm)
+ protected WrapperDataSource (final BaseWrapperManagedConnectionFactory mcf, final ConnectionManager cm)
{
this.mcf = mcf;
this.cm = cm;
Modified: trunk/connector/src/main/org/jboss/resource/adapter/jdbc/local/LocalManagedConnectionFactory.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/adapter/jdbc/local/LocalManagedConnectionFactory.java 2007-07-24 05:25:39 UTC (rev 64244)
+++ trunk/connector/src/main/org/jboss/resource/adapter/jdbc/local/LocalManagedConnectionFactory.java 2007-07-24 08:48:33 UTC (rev 64245)
@@ -36,6 +36,7 @@
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.security.auth.Subject;
@@ -70,6 +71,18 @@
}
+ @Override
+ public Object createConnectionFactory(ConnectionManager cm) throws ResourceException
+ {
+ // check some invariants before they come back to haunt us
+ if(driverClass == null)
+ throw new JBossResourceException("driverClass is null");
+ if(connectionURL == null)
+ throw new JBossResourceException("connectionURL is null");
+
+ return super.createConnectionFactory(cm);
+ }
+
/**
* Get the value of ConnectionURL.
*
@@ -423,7 +436,7 @@
if (driverClass == null)
{
- throw new JBossResourceException("No Driver class specified!");
+ throw new JBossResourceException("No Driver class specified (url = " + url + ")!");
}
// Check if the driver is already loaded, if not then try to load it
Modified: trunk/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java 2007-07-24 05:25:39 UTC (rev 64244)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java 2007-07-24 08:48:33 UTC (rev 64245)
@@ -130,7 +130,7 @@
}
catch (ResourceException re)
{
- throw new DeploymentException("Could not create ConnectionFactory for adapter: " + cm);
+ throw new DeploymentException("Could not create ConnectionFactory for adapter: " + cm, re);
}
}
Modified: trunk/connector/src/main/org/jboss/resource/metadata/mcf/LocalDataSourceDeploymentMetaData.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/metadata/mcf/LocalDataSourceDeploymentMetaData.java 2007-07-24 05:25:39 UTC (rev 64244)
+++ trunk/connector/src/main/org/jboss/resource/metadata/mcf/LocalDataSourceDeploymentMetaData.java 2007-07-24 08:48:33 UTC (rev 64245)
@@ -21,11 +21,8 @@
*/
package org.jboss.resource.metadata.mcf;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@@ -37,83 +34,15 @@
*/
@XmlType(name="local-tx-datasource")
@XmlAccessorType(XmlAccessType.FIELD)
-public class LocalDataSourceDeploymentMetaData extends DataSourceDeploymentMetaData
+public class LocalDataSourceDeploymentMetaData extends NonXADataSourceDeploymentMetaData
{
-
/** The serialVersionUID */
private static final long serialVersionUID = -1513179292986405426L;
- @XmlElement(name="driver-class", required=true)
- private String driverClass;
-
- @XmlElement(name="connection-url", required=true)
- private String connectionUrl;
-
public LocalDataSourceDeploymentMetaData()
{
setTrackConnectionByTransaction(true);
setLocalTransactions(true);
setTransactionSupportMetaData(ManagedConnectionFactoryTransactionSupportMetaData.LOCAL);
}
-
- public String getConnectionUrl()
- {
- return connectionUrl;
- }
-
- public void setConnectionUrl(String connectionUrl)
- {
- this.connectionUrl = connectionUrl;
- }
-
- public String getDriverClass()
- {
- return driverClass;
- }
-
- public void setDriverClass(String driverClass)
- {
- this.driverClass = driverClass;
- }
-
- @Override
- public List<ManagedConnectionFactoryPropertyMetaData> getManagedConnectionFactoryProperties()
- {
-
- List<ManagedConnectionFactoryPropertyMetaData> properties = super.getManagedConnectionFactoryProperties();
- ManagedConnectionFactoryPropertyMetaData property = null;
-
- if(getConnectionUrl() != null)
- {
- property = new ManagedConnectionFactoryPropertyMetaData();
- property.setName("ConnectionURL");
- property.setValue(getConnectionUrl());
- properties.add(property);
-
- }
-
- if(getDriverClass() != null)
- {
- property = new ManagedConnectionFactoryPropertyMetaData();
- property.setName("DriverClass");
- property.setValue(getDriverClass());
- properties.add(property);
- }
-
- StringBuffer propBuff = new StringBuffer();
- List<DataSourceConnectionPropertyMetaData> dsProps = getDataSourceConnectionProperties();
-
- for (DataSourceConnectionPropertyMetaData prop : dsProps)
- {
- propBuff.append(prop.getName() + "=" + prop.getValue() + "\n");
- }
-
- property = new ManagedConnectionFactoryPropertyMetaData();
- property.setName("ConnectionProperties");
- property.setValue(propBuff.toString());
- properties.add(property);
-
- return properties;
-
- }
}
Modified: trunk/connector/src/main/org/jboss/resource/metadata/mcf/NoTxDataSourceDeploymentMetaData.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/metadata/mcf/NoTxDataSourceDeploymentMetaData.java 2007-07-24 05:25:39 UTC (rev 64244)
+++ trunk/connector/src/main/org/jboss/resource/metadata/mcf/NoTxDataSourceDeploymentMetaData.java 2007-07-24 08:48:33 UTC (rev 64245)
@@ -31,7 +31,7 @@
* @version $Revision: 1.1 $
*/
@XmlType(name="no-tx-datasource")
-public class NoTxDataSourceDeploymentMetaData extends DataSourceDeploymentMetaData
+public class NoTxDataSourceDeploymentMetaData extends NonXADataSourceDeploymentMetaData
{
/** The serialVersionUID */
private static final long serialVersionUID = -5354506847562754007L;
Added: trunk/connector/src/main/org/jboss/resource/metadata/mcf/NonXADataSourceDeploymentMetaData.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/metadata/mcf/NonXADataSourceDeploymentMetaData.java (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/metadata/mcf/NonXADataSourceDeploymentMetaData.java 2007-07-24 08:48:33 UTC (rev 64245)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.resource.metadata.mcf;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Provide a common base for non xa data source deployment meta data.
+ *
+ * TODO: update to AS 5
+ * See also http://docs.jboss.org/jbossas/jboss4guide/r2/html/ch7.chapt.html#ch7.jdbc.sect
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+public abstract class NonXADataSourceDeploymentMetaData extends DataSourceDeploymentMetaData
+{
+ @XmlElement(name="driver-class", required=true)
+ private String driverClass;
+
+ @XmlElement(name="connection-url", required=true)
+ private String connectionUrl;
+
+ public String getConnectionUrl()
+ {
+ return connectionUrl;
+ }
+
+ public void setConnectionUrl(String connectionUrl)
+ {
+ this.connectionUrl = connectionUrl;
+ }
+
+ public String getDriverClass()
+ {
+ return driverClass;
+ }
+
+ public void setDriverClass(String driverClass)
+ {
+ this.driverClass = driverClass;
+ }
+
+ @Override
+ public List<ManagedConnectionFactoryPropertyMetaData> getManagedConnectionFactoryProperties()
+ {
+
+ List<ManagedConnectionFactoryPropertyMetaData> properties = super.getManagedConnectionFactoryProperties();
+ ManagedConnectionFactoryPropertyMetaData property = null;
+
+ if(getConnectionUrl() != null)
+ {
+ property = new ManagedConnectionFactoryPropertyMetaData();
+ property.setName("ConnectionURL");
+ property.setValue(getConnectionUrl());
+ properties.add(property);
+
+ }
+
+ if(getDriverClass() != null)
+ {
+ property = new ManagedConnectionFactoryPropertyMetaData();
+ property.setName("DriverClass");
+ property.setValue(getDriverClass());
+ properties.add(property);
+ }
+
+ StringBuffer propBuff = new StringBuffer();
+ List<DataSourceConnectionPropertyMetaData> dsProps = getDataSourceConnectionProperties();
+
+ for (DataSourceConnectionPropertyMetaData prop : dsProps)
+ {
+ propBuff.append(prop.getName() + "=" + prop.getValue() + "\n");
+ }
+
+ property = new ManagedConnectionFactoryPropertyMetaData();
+ property.setName("ConnectionProperties");
+ property.setValue(propBuff.toString());
+ properties.add(property);
+
+ return properties;
+
+ }
+}
Property changes on: trunk/connector/src/main/org/jboss/resource/metadata/mcf/NonXADataSourceDeploymentMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list