예제 #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;
 }