public PluginSystem(PluginInfo pluginInfo) throws IOException {
pluginPath = pluginInfo.getJar().getParentFile().getCanonicalPath()
+ "/global";
kryo = new MyKryoInit();
pluginDocument = new PluginList<DocumentPlugin>();
pluginElements = new PluginList<MapElementPlugin>();
try {
for (File dep : pluginInfo.getDependencies()) {
ClassLoaderUtil.addFile(dep);
}
ClassLoaderUtil.addFile(pluginInfo.getJar());
core = (ICorePlugin) ClassLoader.getSystemClassLoader()
.loadClass(pluginInfo.getCorePlugin()).newInstance();
plugin = (IPlugin) ClassLoader.getSystemClassLoader()
.loadClass(pluginInfo.getDocumentPlugin()).newInstance();
for (DocumentPlugin plug : plugin.getDocuments()) {
this.pluginDocument.addPlugin(plug);
}
for (MapElementPlugin plug : plugin.getMapElements()) {
pluginElements.addPlugin(plug);
}
MyKryoInit kryo = new MyKryoInit();
kryo.addPluginClasses(plugin.getClasses());
} catch (Exception e) {
Logger.getLogger(getClass()).error("enable to load plugin ", e);
ExceptionTool.showError(e);
}