public void generate(IndentWriter writer) {
   writer.println("# of SubViews: " + tabViews.size());
   writer.indent();
   try {
     for (Iterator<UISWTViewCore> iter = tabViews.iterator(); iter.hasNext(); ) {
       UISWTViewCore view = iter.next();
       writer.println(view.getTitleID() + ": " + view.getFullTitle());
     }
   } finally {
     writer.exdent();
   }
 }
Exemplo n.º 2
0
  protected static void generateEvidence(IndentWriter writer) {
    writer.println(file_map.size() + " FMFile Reservations");

    try {
      writer.indent();

      try {
        file_map_mon.enter();

        Iterator it = file_map.keySet().iterator();

        while (it.hasNext()) {

          String key = (String) it.next();

          List owners = (List) file_map.get(key);

          Iterator it2 = owners.iterator();

          String str = "";

          while (it2.hasNext()) {

            Object[] entry = (Object[]) it2.next();

            FMFileOwner owner = (FMFileOwner) entry[0];
            Boolean write = (Boolean) entry[1];
            String reason = (String) entry[2];

            str +=
                (str.length() == 0 ? "" : ", ")
                    + owner.getName()
                    + "["
                    + (write.booleanValue() ? "write" : "read")
                    + "/"
                    + reason
                    + "]";
          }

          writer.println(Debug.secretFileName(key) + " -> " + str);
        }
      } finally {

        file_map_mon.exit();
      }

      FMFileManagerImpl.generateEvidence(writer);

    } finally {

      writer.exdent();
    }
  }
Exemplo n.º 3
0
  public void generate(IndentWriter writer) {
    writer.println("SpeedManager: enabled=" + enabled + ",provider=" + provider);

    try {
      writer.indent();

      ping_mapper.generateEvidence(writer);

    } finally {

      writer.exdent();
    }
  }
Exemplo n.º 4
0
  public void generate(IndentWriter writer) {
    super.generate(writer);

    try {
      writer.indent();

      writer.println("tico_machine=" + getMachineName());

    } finally {

      writer.exdent();
    }
  }
Exemplo n.º 5
0
  public void generate(IndentWriter writer) {
    writer.println(getName() + "/" + getID() + "/" + type);

    try {
      writer.indent();

      writer.println(
          "hidden="
              + hidden
              + ", last_seen="
              + new SimpleDateFormat().format(new Date(last_seen))
              + ", online="
              + online
              + ", transcoding="
              + transcoding);

      writer.println("p_props=" + persistent_properties);
      writer.println("t_props=" + transient_properties);

      writer.println("errors=" + errors);
      writer.println("infos=" + infos);
    } finally {

      writer.exdent();
    }
  }
  protected void generateEvidence(IndentWriter writer) {
    writer.println("DownloadManagerStats");

    try {
      writer.indent();

      writer.println(
          "recv_d="
              + getTotalDataBytesReceived()
              + ",recv_p="
              + getTotalProtocolBytesReceived()
              + ",recv_g="
              + getTotalGoodDataBytesReceived()
              + ",sent_d="
              + getTotalDataBytesSent()
              + ",sent_p="
              + getTotalProtocolBytesSent()
              + ",discard="
              + getDiscarded()
              + ",hash_fails="
              + getHashFailCount()
              + "/"
              + getHashFailBytes()
              + ",comp="
              + getCompleted()
              + "[live:"
              + getDownloadCompleted(true)
              + "/"
              + getDownloadCompleted(false)
              + "],dl_comp="
              + downloadCompleted
              + ",remaining="
              + getRemaining());

      writer.println(
          "down_lim="
              + getDownloadRateLimitBytesPerSecond()
              + ",up_lim="
              + getUploadRateLimitBytesPerSecond());
    } finally {

      writer.exdent();
    }
  }
  public void generate(IndentWriter writer) {
    writer.println("Content Networks");

    try {
      writer.indent();

      synchronized (this) {
        Iterator<ContentNetworkImpl> it = networks.iterator();

        while (it.hasNext()) {

          ContentNetworkImpl network = it.next();

          writer.println(network.getString());
        }
      }
    } finally {

      writer.exdent();
    }
  }
Exemplo n.º 8
0
  public void generate(IndentWriter writer) {
    List<UPnPMapping> mappings_copy;
    List<UPnPPluginService> services_copy;

    try {
      this_mon.enter();

      mappings_copy = new ArrayList<UPnPMapping>(mappings);

      services_copy = new ArrayList<UPnPPluginService>(services);

    } finally {

      this_mon.exit();
    }

    writer.println("Mappings");

    try {
      writer.indent();

      for (UPnPMapping mapping : mappings_copy) {

        if (mapping.isEnabled()) {

          writer.println(mapping.getString());
        }
      }
    } finally {

      writer.exdent();
    }

    writer.println("Services");

    try {
      writer.indent();

      for (UPnPPluginService service : services_copy) {

        writer.println(service.getString());
      }
    } finally {

      writer.exdent();
    }
  }
Exemplo n.º 9
0
  public void generateTT(IndentWriter writer) {
    TranscodeFileImpl[] files = getFiles();

    int complete = 0;
    int copied = 0;
    int deleted = 0;
    int template = 0;

    for (TranscodeFileImpl f : files) {

      if (f.isComplete()) {

        complete++;
      }

      if (f.isCopiedToDevice()) {

        copied++;
      }

      if (f.isDeleted()) {

        deleted++;
      }

      if (f.isTemplate()) {

        template++;
      }
    }

    writer.println(
        "files="
            + files.length
            + ", comp="
            + complete
            + ", copied="
            + copied
            + ", deleted="
            + deleted
            + ", template="
            + template);
  }
  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();
    }
  }
Exemplo n.º 11
0
  protected void generateEvidence(IndentWriter writer) {
    writer.println("Tunnel Handler");

    writer.indent();

    writer.println("started=" + started + ", active=" + active);

    if (init_fail != null) {

      writer.println("Init fail: " + init_fail);
    }

    long now = SystemTime.getMonotonousTime();

    writer.println("total local=" + total_local_servers);
    writer.println(
        "last local create="
            + (last_local_server_create_time == 0
                ? "<never>"
                : String.valueOf(now - last_local_server_create_time)));
    writer.println(
        "last local agree="
            + (last_local_server_agree_time == 0
                ? "<never>"
                : String.valueOf(now - last_local_server_agree_time)));

    writer.println("total remote=" + total_servers);
    writer.println(
        "last remote create="
            + (last_server_create_time == 0
                ? "<never>"
                : String.valueOf(now - last_server_create_time)));
    writer.println(
        "last remote agree="
            + (last_server_agree_time == 0
                ? "<never>"
                : String.valueOf(now - last_server_agree_time)));

    synchronized (tunnels) {
      writer.println("tunnels=" + tunnels.size());

      for (PairManagerTunnel tunnel : tunnels.values()) {

        writer.println("    " + tunnel.getString());
      }
    }

    try {
      writer.println("IPv4 punchers: " + nat_punchers_ipv4.size());

      for (DHTNATPuncher p : nat_punchers_ipv4) {

        writer.println("    " + p.getStats());
      }

      writer.println("IPv6 punchers: " + nat_punchers_ipv6.size());

      for (DHTNATPuncher p : nat_punchers_ipv6) {

        writer.println("    " + p.getStats());
      }
    } finally {

      writer.exdent();
    }
  }
  public void dumpConfigChanges(IndentWriter writer) {
    ConfigurationDefaults defaults = ConfigurationDefaults.getInstance();

    Set<String> keys =
        new TreeSet<String>(
            new Comparator<String>() {
              public int compare(String o1, String o2) {
                return (o1.compareToIgnoreCase(o2));
              }
            });

    keys.addAll(propertiesMap.keySet());

    Iterator<String> it = keys.iterator();

    while (it.hasNext()) {

      String key = it.next();

      // don't dump crypto stuff

      if (ignoreKeyForDump(key)) {

        continue;
      }

      Object value = propertiesMap.get(key);

      boolean bParamExists = defaults.doesParameterDefaultExist(key.toString());

      if (bParamExists) {

        Object def = defaults.getParameter(key);

        if (def != null && value != null) {

          if (!BEncoder.objectsAreIdentical(def, value)) {

            if (value instanceof Long) {

              writer.println(key + "=" + value);

            } else if (value instanceof List) {

              writer.println(
                  key + "=" + BDecoder.decodeStrings((List) BEncoder.clone(value)) + "[list]");

            } else if (value instanceof Map) {

              writer.println(
                  key + "=" + BDecoder.decodeStrings((Map) BEncoder.clone(value)) + "[map]");

            } else if (value instanceof byte[]) {

              byte[] b = (byte[]) value;

              boolean hex = false;

              for (int i = 0; i < b.length; i++) {

                char c = (char) b[i];

                if (!(Character.isLetterOrDigit(c)
                    || "\\ `¬\"£$%^&*()-_=+[{]};:'@#~,<.>/?'".indexOf(c) != -1)) {

                  hex = true;

                  break;
                }
              }
              writer.println(
                  key + "=" + (hex ? ByteFormatter.nicePrint(b) : bytesToString((byte[]) value)));

            } else {

              writer.println(key + "=" + value + "[unknown]");
            }
          }
        }
      }
    }
  }
  public void generate(IndentWriter writer) {
    writer.println("Configuration Details");

    try {
      writer.indent();

      writer.println(
          "version=" + Constants.AZUREUS_VERSION + ", subver=" + Constants.AZUREUS_SUBVER);

      writer.println("System Properties");

      try {
        writer.indent();

        Properties props = System.getProperties();

        Iterator it = new TreeSet(props.keySet()).iterator();

        while (it.hasNext()) {

          String key = (String) it.next();

          writer.println(key + "=" + props.get(key));
        }
      } finally {

        writer.exdent();
      }

      writer.println("Environment");

      try {
        writer.indent();

        Map<String, String> env = System.getenv();

        if (env == null) {

          writer.println("Not supported");

        } else {

          Iterator it = new TreeSet(env.keySet()).iterator();

          while (it.hasNext()) {

            String key = (String) it.next();

            writer.println(key + "=" + env.get(key));
          }
        }
      } finally {

        writer.exdent();
      }

      writer.println("Azureus Config");

      ConfigurationDefaults defaults = ConfigurationDefaults.getInstance();

      try {
        writer.indent();

        Set<String> keys =
            new TreeSet<String>(
                new Comparator<String>() {
                  public int compare(String o1, String o2) {
                    return (o1.compareToIgnoreCase(o2));
                  }
                });

        keys.addAll(propertiesMap.keySet());

        Iterator<String> it = keys.iterator();

        while (it.hasNext()) {

          String key = it.next();

          // don't dump crypto stuff

          if (ignoreKeyForDump(key)) {

            continue;
          }

          Object value = propertiesMap.get(key);

          boolean bParamExists = defaults.doesParameterDefaultExist(key.toString());

          if (!bParamExists) {

            key = "[NoDef] " + key;
          } else {

            Object def = defaults.getParameter(key);

            if (def != null && value != null) {

              if (!BEncoder.objectsAreIdentical(def, value)) {

                key = "-> " + key;
              }
            }
          }

          if (value instanceof Long) {

            writer.println(key + "=" + value);

          } else if (value instanceof List) {

            writer.println(
                key + "=" + BDecoder.decodeStrings((List) BEncoder.clone(value)) + "[list]");

          } else if (value instanceof Map) {

            writer.println(
                key + "=" + BDecoder.decodeStrings((Map) BEncoder.clone(value)) + "[map]");

          } else if (value instanceof byte[]) {

            byte[] b = (byte[]) value;

            boolean hex = false;

            for (int i = 0; i < b.length; i++) {

              char c = (char) b[i];

              if (!(Character.isLetterOrDigit(c)
                  || "\\ `¬\"£$%^&*()-_=+[{]};:'@#~,<.>/?'".indexOf(c) != -1)) {

                hex = true;

                break;
              }
            }
            writer.println(
                key + "=" + (hex ? ByteFormatter.nicePrint(b) : bytesToString((byte[]) value)));

          } else {

            writer.println(key + "=" + value + "[unknown]");
          }
        }
      } finally {

        writer.exdent();
      }
    } finally {

      writer.exdent();
    }
  }