fos.write(res);
fos.close();
}
} catch (Exception e) {
LogManager.getInstance().logMessage(
new LogMessage(LogMessage.ERROR, e,
"File error transferring xml file "
+ newRes.getAbsolutePath(),
"Adapter may be corrupt?"));
}
}
if (!jarFile.getParent().equals(
Config.getInstance().getJarBaseURL())) {
File newJarFile = new File(
Config.getInstance().getJarBaseURL(), jarFile.getName());
FileUtil.copy(jarFile.getAbsolutePath(), newJarFile
.getAbsolutePath());
jarFile = newJarFile;
}
Loader.loadJar(jarFile.getAbsolutePath());
try {
DataAdapter adapterImpl = (DataAdapter) ClassLoader
.getSystemClassLoader().loadClass(adapter)
.newInstance();
AdapterFactory.getInstance().addAdapter(adapterImpl);
ArrayList profiles = Config.getInstance()
.getAvailableProfiles();
Iterator itp = profiles.iterator();
while (itp.hasNext()) {
Profile p = (Profile) itp.next();
p.setAdapter(adapterImpl.getClass().getName(), true);
}
ArrayList editprofiles = Config.getEditInstance()
.getAvailableProfiles();
Iterator itp2 = editprofiles.iterator();
while (itp2.hasNext()) {
Profile p = (Profile) itp2.next();
p.setAdapter(adapterImpl.getClass().getName(), true);
}
Config.getEditInstance().setJarForAdapter(adapterImpl,
jarFile.getName());
Config.getInstance().setJarForAdapter(adapterImpl,
jarFile.getName());
refresh();
} catch (Exception e) {
LogManager.getInstance().logMessage(
new LogMessage(LogMessage.ERROR, e,
"Problem loading adapter class",
"Adapter may be corrupt?"));
}
}
}