if (factoryConfig.getClasspathId() == null) {
factoryConfig.setClasspathId(SimpleClassLoaderManager.SYSTEM_LOADER);
}
final DefaultComboBoxModel classLoaderModel = new DefaultComboBoxModel();
final ClassLoaderManager classLoaderManager = (ClassLoaderManager) SingletonManager.get(ClassLoaderManager.class);
for (Iterator iter = classLoaderManager.getIds().iterator(); iter.hasNext();) {
classLoaderModel.addElement(iter.next());
}
classLoaderModel.addElement(SimpleClassLoaderManager.SYSTEM_LOADER);
classLoaderComboBox.setModel(classLoaderModel);
classLoaderComboBox.setSelectedItem(factoryConfig.getClasspathId());
updateConectionFactories();
classLoaderModel.addListDataListener(new ListDataListener() {
@Override
public void contentsChanged(ListDataEvent e) {
try {
updateConectionFactories();
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
}
@Override
public void intervalAdded(ListDataEvent e) {
// NOP
}
@Override
public void intervalRemoved(ListDataEvent e) {
// NOP
}
});
ConnectionFactory bean = null;
ClassLoader classLoader = getClass().getClassLoader();
try {
Class clazz = classLoaderManager.getClassLoader(factoryConfig.getClasspathId()).loadClass(factoryConfig.getProvider().getClassName());
bean = ReflectUtils.createConnectionFactory(clazz);
} catch (Throwable e) {
log.error(e.getMessage(), e);
HermesBrowser.getBrowser().showErrorDialog("Cannot find class " + factoryConfig.getProvider().getClassName() + " in loader " + factoryConfig.getClasspathId());
}