* @return
*/
private static ConnectionFactory setupConnectionFactory(JdbcConnectionDescriptor jcd)
{
ConnectionFactory cf = null;
ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();
if (cpd != null && cpd.getConnectionFactory() != null)
{
cf = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
if ( cf == null )
{
try
{
if (Boolean.valueOf(jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(ConnectionManagerImpl.class.getClassLoader());
cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
connectionFactories.put(cpd.getConnectionFactory(), cf);
}
finally
{
Thread.currentThread().setContextClassLoader(cl);
cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
connectionFactories.put(cpd.getConnectionFactory(), cf);
}
}
else
{
cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
}
}
catch (InstantiationException e)
{
String err = "Can't instantiate class " + cpd.getConnectionFactory();
throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
}
catch (IllegalAccessException e)
{
String err = "Can't instantiate class " + cpd.getConnectionFactory();
throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
}
}
}
else