private FrontendModule instantiateModule(ModuleHandle handle) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoModuleJarException, InvocationTargetException { EunomiaModule module = newModuleInstance(handle.getModuleName(), handle.getModuleType()); FrontendModule mod = (FrontendModule) wrapperClass[handle.getModuleType()].newInstance(handle, module, receptor); addModuleInstance(mod, handle); return mod; }
public List getModuleHandles(String name, int type) { Object[] mods; synchronized (hashToModule) { mods = hashToModule.values().toArray(); } List list = new LinkedList(); for (int i = 0; i < mods.length; i++) { FrontendModule mod = (FrontendModule) mods[i]; ModuleHandle handle = mod.getHandle(); if (handle.getModuleType() == type && handle.getModuleName().equals(name)) { list.add(handle); } } return list; }
private FrontendModule newModuleInstantiation(ModuleHandle handle, boolean addPhantom) { try { int type = handle.getModuleType(); FrontendModule module = instantiateModule(handle); switch (type) { case ModuleHandle.TYPE_PROC: { recOut.getModuleControlData(handle); recOut.getModuleListeningList(handle); break; } case ModuleHandle.TYPE_ANLZ: { recOut.getAnalysisParameters(handle); break; } } return module; } catch (InstantiationException ie) { ie.printStackTrace(); } catch (IllegalAccessException iae) { iae.printStackTrace(); } catch (InvocationTargetException ite) { ite.printStackTrace(); } catch (ClassNotFoundException cnfe) { if (addPhantom) { logger.error("Loading module: JAR does not contain module " + handle.getModuleName()); addPhantomModule(handle); } } catch (NoModuleJarException nmj) { logger.error(nmj.getMessage()); addPhantomModule(handle); } return null; }
public void moduleFileAdded(ModuleFileAddedEvent e) { ModuleDescriptor desc = e.getModuleDescriptor(); if (desc.getType() == Descriptor.TYPE_FLOW) { loadFlowModule(desc); } String modName = desc.getName(); Object[] handles = phantomModules.toArray(); downloadSet.remove(modName); for (int i = 0; i < handles.length; i++) { ModuleHandle handle = (ModuleHandle) handles[i]; if (handle.getModuleName().equals(modName)) { if (newModuleInstantiation(handle, false) != null) { phantomModules.remove(handle); fireModuleAdded(handle); } } } }
private void addPhantomModule(ModuleHandle handle) { if (!phantomModules.contains(handle)) { phantomModules.add(handle); downloadModule(handle.getModuleName(), handle.getModuleType()); } }