[jboss-cvs] JBossAS SVN: r62219 - trunk/connector/src/main/org/jboss/resource/adapter/jdbc.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 10 12:13:54 EDT 2007
Author: vicky.kak at jboss.com
Date: 2007-04-10 12:13:54 -0400 (Tue, 10 Apr 2007)
New Revision: 62219
Modified:
trunk/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnectionFactory.java
Log:
[JBAS-3707] Changes
Modified: trunk/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnectionFactory.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnectionFactory.java 2007-04-10 16:09:38 UTC (rev 62218)
+++ trunk/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnectionFactory.java 2007-04-10 16:13:54 UTC (rev 62219)
@@ -23,12 +23,16 @@
import java.io.PrintWriter;
import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -126,7 +130,17 @@
protected boolean isTransactionQueryTimeout = false;
protected int queryTimeout = 0;
+
+ /**
+ * The variable <code>urlDelimiter</code> holds the url delimiter
+ * information to be used for HA DS configuration .
+ */
+ protected String urlDelimiter;
+
+ protected String urlSelectorStrategyClassName;
+ private URLSelectorStrategy urlSelectorStrategy;
+
private boolean validateOnMatch = true;
public BaseWrapperManagedConnectionFactory ()
@@ -342,7 +356,71 @@
{
queryTimeout = timeout;
}
-
+
+ public void setURLDelimiter(String urlDelimiter)
+ throws ResourceException
+ {
+ this.urlDelimiter = urlDelimiter;
+ }
+
+ public void setUrlSelectorStrategyClassName(String urlSelectorStrategyClassName)
+ {
+ this.urlSelectorStrategyClassName = urlSelectorStrategyClassName;
+ }
+
+ public String getUrlSelectorStrategyClassName()
+ {
+ return urlSelectorStrategyClassName;
+ }
+
+ public URLSelectorStrategy getUrlSelectorStrategy()
+ {
+ return urlSelectorStrategy;
+ }
+
+ //This load the URLSelectStrategy class.
+ public Object loadClass(String className,Object constructorParameter)
+ throws JBossResourceException
+ {
+ Object result = null;
+ try
+ {
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+ Class param[] = {java.util.List.class};
+ Constructor cnstructor = clazz.getDeclaredConstructor(param);
+ Object consParameter[] = {constructorParameter};
+ result = cnstructor.newInstance(consParameter);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ log.error("Class not found for URLSelectStrategy :"+className);
+ throw new JBossResourceException("Class not found for URLSelectStrategy: " + className, cnfe);
+ }
+ catch (InstantiationException ie)
+ {
+ log.error("Could not instantiate URLSelectorStrategy type :"+className);
+ throw new JBossResourceException("Could not instantiate an URLSelectStrategy: ", ie);
+ }
+ catch (IllegalAccessException iae)
+ {
+ log.error("Check for the constructor with List parameter for URLSelectStrategy class as "+className);
+ throw new JBossResourceException("Constructor object enforces Java language access control and the underlying constructor is inaccessible: ", iae);
+
+ }
+ catch (InvocationTargetException ite)
+ {
+ log.error("Constructor Invocation failing for URLSelectorStrategy "+className);
+ throw new JBossResourceException("The underlying constructor of URLSelecStrategy throws an exception: ", ite);
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ log.error("Constructor or Method mismatch in URLSelectorStrategy :"+className);
+ throw new JBossResourceException("Could not a matching method for URLSelecStrategy: ", nsme);
+ }
+
+ return result;
+ }
+
public Set getInvalidConnections(final Set connectionSet) throws ResourceException
{
final Set invalid = new HashSet();
More information about the jboss-cvs-commits
mailing list