Ejemplo n.º 1
0
  protected void addPlugins() {
    ContainerBase container = new ContainerBase("Plugins");
    container.initProperties();
    addChild(container);

    ComponentDescription[] desc = ComponentConnector.parseFile(filename);
    if (desc == null) {
      if (log.isWarnEnabled()) {
        log.warn("No data found in file " + filename);
      }
      return;
    }
    for (int i = 0; i < desc.length; i++) {
      StringBuffer name = new StringBuffer(desc[i].getName());
      StringBuffer className = new StringBuffer(desc[i].getClassname());
      String insertionPoint = desc[i].getInsertionPoint();
      String priority = desc[i].priorityToString(desc[i].getPriority());
      //       if(log.isDebugEnabled()) {
      //         log.debug("Insertion Point: " + insertionPoint);
      //       }

      if (insertionPoint.endsWith("Plugin")) {
        int start = 0;
        if ((start = name.indexOf("OrgRTData")) != -1) {
          name.delete(start, start + 2);
          start = className.indexOf("RT");
          className.delete(start, start + 2);
        }

        // HACK!
        // When dumping INIs we add an extra parameter to the GLSInitServlet,
        // so strip it off here
        boolean isGLS = false;
        if (className.indexOf("GLSInitServlet") != -1) {
          isGLS = true;
        }

        int index = name.lastIndexOf(".");
        if (index != -1) name.delete(0, index + 1);
        PluginBase plugin = new PluginBase(name.substring(0), className.substring(0), priority);
        plugin.initProperties();
        Iterator iter = ComponentConnector.getPluginProps(desc[i]);
        while (iter.hasNext()) {
          if (isGLS) {
            String param = (String) iter.next();
            if (param.startsWith("exptid=")) continue;
            else plugin.addParameter(param);
          } else plugin.addParameter((String) iter.next());
        }
        container.addChild(plugin);
      }
    }
  }
Ejemplo n.º 2
0
  protected void addComponents() {
    ContainerBase container = new ContainerBase("Other Components");
    container.initProperties();
    addChild(container);

    ComponentDescription[] desc = ComponentConnector.parseFile(filename);
    if (desc == null) {
      if (log.isWarnEnabled()) {
        log.warn("No data found in file " + filename);
      }
      return;
    }
    for (int i = 0; i < desc.length; i++) {
      String name = desc[i].getName();
      String insertionPoint = desc[i].getInsertionPoint();
      //       if(log.isDebugEnabled()) {
      //         log.debug("Insertion Point: " + insertionPoint);
      //       }

      if (!insertionPoint.endsWith(".Binder") && !insertionPoint.endsWith(".Plugin")) {
        if (log.isDebugEnabled()) {
          log.debug("Create Component: " + name);
        }
        int index = name.lastIndexOf('.');
        if (index != -1) name = name.substring(index + 1);
        ComponentBase binder =
            new ComponentBase(
                name,
                desc[i].getClassname(),
                desc[i].priorityToString(desc[i].getPriority()),
                insertionPoint);
        binder.initProperties();

        // FIXME: Must I change ComponentConnector in some way here?
        Iterator iter = ComponentConnector.getPluginProps(desc[i]);
        while (iter.hasNext()) binder.addParameter((String) iter.next());
        container.addChild(binder);
      }
    }
  }