protected void generateEvidence(IndentWriter writer) {
    writer.println(getPluginName());

    try {
      writer.indent();

      writer.println("id:" + getPluginID() + ",version:" + getPluginVersion());

      String user_dir = FileUtil.getUserFile("plugins").toString();
      String shared_dir = FileUtil.getApplicationFile("plugins").toString();

      String plugin_dir = getPluginDirectoryName();

      String type;
      boolean built_in = false;

      if (plugin_dir.startsWith(shared_dir)) {

        type = "shared";

      } else if (plugin_dir.startsWith(user_dir)) {

        type = "per-user";

      } else {

        built_in = true;

        type = "built-in";
      }

      PluginState ps = getPluginState();

      String info = getPluginconfig().getPluginStringParameter("plugin.info");

      writer.println(
          "type:"
              + type
              + ",enabled="
              + !ps.isDisabled()
              + ",load_at_start="
              + ps.isLoadedAtStartup()
              + ",operational="
              + ps.isOperational()
              + (info == null || info.length() == 0 ? "" : (",info=" + info)));

      if (ps.isOperational()) {

        Plugin plugin = getPlugin();

        if (plugin instanceof AEDiagnosticsEvidenceGenerator) {

          try {
            writer.indent();

            ((AEDiagnosticsEvidenceGenerator) plugin).generate(writer);

          } catch (Throwable e) {

            writer.println(
                "Failed to generate plugin-specific info: " + Debug.getNestedExceptionMessage(e));

          } finally {

            writer.exdent();
          }
        }
      } else {
        if (!built_in) {

          File dir = new File(plugin_dir);

          if (dir.exists()) {

            String[] files = dir.list();

            if (files != null) {

              String files_str = "";

              for (String f : files) {

                files_str += (files_str.length() == 0 ? "" : ", ") + f;
              }

              writer.println("    files: " + files_str);
            }
          }
        }
      }
    } finally {

      writer.exdent();
    }
  }
  protected PluginInterfaceImpl(
      Plugin _plugin,
      PluginInitializer _initialiser,
      Object _initialiser_key,
      ClassLoader _class_loader,
      List<File> _verified_files,
      String _key,
      Properties _props,
      String _pluginDir,
      String _plugin_id,
      String _plugin_version)
      throws PluginException {
    // check we're being created by the core

    StackTraceElement[] stack = Thread.currentThread().getStackTrace();

    int pos = 0;

    while (!stack[pos].getClassName().equals(PluginInterfaceImpl.class.getName())) {

      pos++;
    }

    String caller_class = stack[pos + 1].getClassName();

    if (!(caller_class.equals("org.gudy.azureus2.pluginsimpl.local.PluginInitializer")
        || caller_class.equals("org.gudy.azureus2.pluginsimpl.local.PluginInterfaceImpl"))) {

      throw (new PluginException("Invalid caller"));
    }

    // check we haven't been subclassed

    String class_name = getClass().getCanonicalName();

    if (class_name == null
        || !class_name.equals("org.gudy.azureus2.pluginsimpl.local.PluginInterfaceImpl")) {

      throw (new PluginException("Subclassing not permitted"));
    }

    plugin = _plugin;
    initialiser = _initialiser;
    initialiser_key = _initialiser_key;
    class_loader = _class_loader;
    key = _key;
    pluginConfigKey = "Plugin." + _key;
    props = new propertyWrapper(_props);
    pluginDir = _pluginDir;
    config = new PluginConfigImpl(this, pluginConfigKey);
    given_plugin_id = _plugin_id;
    plugin_version = _plugin_version;
    ipc_interface = new IPCInterfaceImpl(initialiser, plugin);
    state = new PluginStateImpl(this, initialiser);

    boolean verified = false;
    boolean bad = false;

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

      if (plugin.getClass() == FailedPlugin.class) {

        verified = true;

      } else {
        if (_verified_files != null) {

          File jar = FileUtil.getJarFileFromClass(plugin.getClass());

          if (jar != null) {

            for (File file : _verified_files) {

              if (file.equals(jar)) {

                verified = true;
              }
            }
          }
        }
      }

      if (!verified) {

        bad = true;
      }
    }

    PluginInitializer.setVerified(this, plugin, verified, bad);
  }