コード例 #1
0
    protected propertyWrapper(Properties _props) {
      Iterator it = _props.keySet().iterator();

      while (it.hasNext()) {

        Object key = it.next();

        put(key, _props.get(key));
      }

      initialising = false;
    }
コード例 #2
0
  public String getPluginID() {
    String id = (String) props.get("plugin.id");

    // hack alert - azupdater needs to change its plugin id due to general hackage

    if (id != null && id.equals("azupdater")) {

      plugin_id_to_use = id;
    }

    if (plugin_id_to_use != null) {
      return plugin_id_to_use;
    }

    // Calculate what plugin ID value to use - look at the properties file
    // first, and if that isn't correct, base it on the given plugin ID
    // value we were given.

    if (id == null) {
      id = given_plugin_id;
    }
    if (id == null) {
      id = "<none>";
    }

    plugin_id_to_use = id;
    return plugin_id_to_use;
  }
コード例 #3
0
  public String getPluginName() {
    String name = null;

    if (props != null) {

      name = (String) props.get("plugin.name");
    }

    if (name == null) {

      try {

        name = new File(pluginDir).getName();

      } catch (Throwable e) {

      }
    }

    if (name == null || name.length() == 0) {

      name = plugin.getClass().getName();
    }

    return (name);
  }
コード例 #4
0
  public PluginInterface getLocalPluginInterface(Class plugin_class, String id)
      throws PluginException {
    try {
      Plugin p = (Plugin) plugin_class.newInstance();

      // Discard plugin.id from the properties, we want the
      // plugin ID we create to take priority - not a value
      // from the original plugin ID properties file.
      Properties local_props = new Properties(props);
      local_props.remove("plugin.id");

      if (id.endsWith("_v")) {

        throw (new Exception("Verified plugins must be loaded from a jar"));
      }

      PluginInterfaceImpl pi =
          new PluginInterfaceImpl(
              p,
              initialiser,
              initialiser_key,
              class_loader,
              null,
              key + "." + id,
              local_props,
              pluginDir,
              getPluginID() + "." + id,
              plugin_version);

      initialiser.fireCreated(pi);

      p.initialize(pi);

      children.add(pi);

      return (pi);

    } catch (Throwable e) {

      if (e instanceof PluginException) {

        throw ((PluginException) e);
      }

      throw (new PluginException("Local initialisation fails", e));
    }
  }
コード例 #5
0
  public String getPluginVersion() {
    String version = (String) props.get("plugin.version");

    if (version == null) {

      version = plugin_version;
    }

    return (version);
  }
コード例 #6
0
 public void setPluginVersion(String version) {
   props.put("plugin.version", version);
 }
コード例 #7
0
 public void setPluginName(String name) {
   props.put("plugin.name", name);
 }