コード例 #1
0
  public long getSize() throws ResourceDownloaderException {

    if (delegates.length == 0) {

      ResourceDownloaderException error =
          new ResourceDownloaderException(this, "Alternate download fails - 0 alteratives");

      informFailed(error);

      throw (error);
    }

    if (size != -2) {

      return (size);
    }

    try {
      for (int i = 0; i < max_to_try; i++) {

        try {
          ResourceDownloaderBaseImpl c = ((ResourceDownloaderBaseImpl) delegates[i]).getClone(this);

          addReportListener(c);

          size = c.getSize();

          setProperties(c);

          break;

        } catch (ResourceDownloaderException e) {

          if (i == delegates.length - 1) {

            throw (e);
          }
        }
      }
    } finally {

      if (size == -2) {

        size = -1;
      }

      setSize(size);
    }

    return (size);
  }
コード例 #2
0
  protected String getLogIndent() {
    String indent = "";

    ResourceDownloaderBaseImpl pos = parent;

    while (pos != null) {

      indent += "  ";

      pos = pos.getParent();
    }

    return (indent);
  }
コード例 #3
0
  protected void setParent(ResourceDownloader _parent) {
    ResourceDownloaderBaseImpl old_parent = parent;

    parent = (ResourceDownloaderBaseImpl) _parent;

    if (old_parent != null) {

      old_parent.removeChild(this);
    }

    if (parent != null) {

      parent.addChild(this);
    }
  }
コード例 #4
0
  protected ResourceDownloaderBaseImpl(ResourceDownloaderBaseImpl _parent) {
    parent = _parent;

    if (parent != null) {

      parent.addChild(this);
    }
  }