public ConnectionManagerImpl(PersistenceBroker broker)
{
this.broker = broker;
this.pbKey = broker.getPBKey();
this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);
ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();
if (cpd != null && cpd.getConnectionFactory() != null)
{
connectionFactory = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
if ( connectionFactory == null )
{
try
{
if (Boolean.valueOf(this.jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
connectionFactory = (ConnectionFactory)
ClassHelper.newInstance (cpd.getConnectionFactory(), true);
connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
}
finally
{
Thread.currentThread().setContextClassLoader(cl);
connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
}
}
else
{
connectionFactory = (ConnectionFactory)
ClassHelper.newInstance (cpd.getConnectionFactory(), true);
}
}
catch (InstantiationException e)
{
String err = "Can't instantiate class " + cpd.getConnectionFactory();
log.error(err, e);
throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
}
catch (IllegalAccessException e)
{
String err = "Can't instantiate class " + cpd.getConnectionFactory();
log.error(err, e);
throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
}
}
}