Пример #1
0
  /**
   * Return a TitleConfig for the AU. Returns matching entry from the title db if found, else
   * creates one
   */
  TitleConfig titleConfigFromAu(InactiveAuProxy au) {
    PluginProxy plugin = au.getPlugin();
    String auname = au.getName();
    Configuration auConfig = au.getConfiguration();
    TitleConfig tc = AuUtil.findTitleConfig(auConfig, plugin.getPlugin());
    if (tc != null) {
      return tc;
    }

    tc = new TitleConfig(auname, plugin.getPluginId());
    ArrayList<ConfigParamAssignment> params = new ArrayList();
    for (Iterator iter = auConfig.keyIterator(); iter.hasNext(); ) {
      String key = (String) iter.next();
      if (!ConfigParamDescr.isReservedParam(key)) {
        String val = auConfig.get(key);
        ConfigParamDescr descr = plugin.findAuConfigDescr(key);
        if (descr != null) {
          ConfigParamAssignment cpa = new ConfigParamAssignment(descr, val);
          params.add(cpa);
        } else {
          log.warning("Unknown parameter key: " + key + " in au: " + auname);
        }
      }
    }
    params.trimToSize();
    tc.setParams(params);
    return tc;
  }
Пример #2
0
 /**
  * Return the titles in the set.
  *
  * @return a collection of TitleConfig
  */
 public Collection<TitleConfig> getTitles() {
   Collection aus = daemon.getRemoteApi().getInactiveAus();
   ArrayList<TitleConfig> res = new ArrayList<TitleConfig>(aus.size());
   for (Iterator iter = aus.iterator(); iter.hasNext(); ) {
     InactiveAuProxy aup = (InactiveAuProxy) iter.next();
     res.add(titleConfigFromAu(aup));
   }
   res.trimToSize();
   return res;
 }
Пример #3
0
  public static ArrayList makeEntries(int firstEntry, int lastEntry) {
    int numEntries = lastEntry - firstEntry + 1;
    ArrayList ret_arry = new ArrayList(numEntries);

    for (int i = 0; i < numEntries; i++) {
      String name = "/testentry" + (firstEntry + i) + ".html";
      ret_arry.add(new PollTally.NameListEntry(i % 2 == 1, name));
    }

    return ret_arry;
  }