final Collection<File> list = HelperIO.getFiles(data.getDirectoryModule(), filter);
for (final File file : list) {
try {
final ModuleConfig cm = HelperXml.deserialize(file, ModuleConfigImpl.class);
try {
final URL[] urls = new URL[cm.getJars().size()];
for (int ii = 0; ii < cm.getJars().size(); ii++) {
urls[ii] = new URL("file:" + file.getParent() + '/' + cm.getJars().get(ii)); //$NON-NLS-1$
}
final JarLoader jl = new JarLoader(urls);
try {
if (null != cm.getProperties()) {
// cm.setProperty(new PropertyImpl(jl.getResourceAsStream(cm.getProperties())));
cm.setProperty(new PropertyImpl(new File(file.getParent(), cm.getProperties())));
}
cm.setLocalizer(new LocalizerFile(cm.getLocalizerBase(), jl, new EncodingControl()));
cm.getLocalizer().setLocale(data.getLanguage().getLocale());
// read data for the module
final File tmd = new File(data.getDirectoryData(), cm.getUUID() + FileType.DATA.getExtension());
try {
ModuleData md = new ModuleDataImpl();
if (tmd.exists()) {
md = HelperXml.deserialize(tmd, ModuleDataImpl.class);
}
final ModuleAbstract module = (ModuleAbstract) jl.createInstance(cm.getModuleClass(), HelperArray
.getArray(ModuleConfig.class, ModuleData.class, Callback.class, ScalableIcon.class,
File.class), HelperArray.getArray(cm, md, controller,
new ScalableIconImpl(cm.getLogo(), cm.getLogoLarge(), jl), data.getDirectoryDB())); // TODO
// add
// large
// icon
modules.add(module);
} catch (JAXBException ex) {
log.error("Could not process module data file " + HelperString.quote(tmd.getAbsolutePath()), ex); //$NON-NLS-1$
}
} catch (Exception ex) {
log.error(
"Could not create instantiate class " + HelperString.quote(cm.getModuleClass()) + " from module configuration file " + HelperString.quote(file.getAbsolutePath()), ex); //$NON-NLS-1$//$NON-NLS-2$
}
} catch (MalformedURLException ex) {
log.error("Invalid JAR destination in module configuration file " + HelperString.quote(file.getAbsolutePath()), ex); //$NON-NLS-1$
}
} catch (JAXBException ex) {