Пример #1
0
  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;
  }
Пример #2
0
  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;
  }
Пример #3
0
  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;
  }
Пример #4
0
 private void addPhantomModule(ModuleHandle handle) {
   if (!phantomModules.contains(handle)) {
     phantomModules.add(handle);
     downloadModule(handle.getModuleName(), handle.getModuleType());
   }
 }