Package freenet.keys

Examples of freenet.keys.USK


  }

  void start() {
    try {
      // because of UoM, this version is actually worth having as well
      USK myUsk = USK.create(URI.setSuggestedEdition(currentVersion));
      core.uskManager.subscribe(myUsk, this, true, getRequestClient());
    } catch(MalformedURLException e) {
      Logger.error(this, "The auto-update URI isn't valid and can't be used");
      manager.blow("The auto-update URI isn't valid and can't be used", true);
    }
View Full Code Here


  void kill() {
    try {
      ClientGetter c;
      synchronized(this) {
        isRunning = false;
        USK myUsk = USK.create(URI.setSuggestedEdition(currentVersion));
        core.uskManager.unsubscribe(myUsk, this);
        c = cg;
        cg = null;
      }
      c.cancel(core.clientContext);
View Full Code Here

    }
  }

  @Override
  public synchronized void onSuccess(ClientPutState state, ClientContext context) {
    USK newEdition = pubUSK.copy(edition);
    finished = true;
    sbi = null;
    FreenetURI targetURI = pubUSK.getSSK(edition).getURI();
    FreenetURI realURI = ((SingleBlockInserter)state).getURI(context);
    if(!targetURI.equals(realURI))
View Full Code Here

  private boolean bogusUSK(ClientContext context) {
    if(!uri.isUSK()) return false;
    long edition = uri.getSuggestedEdition();
    if(edition < 0)
      return true; // Need to do the fetch.
    USK usk;
    try {
      usk = USK.create(uri);
    } catch (MalformedURLException e) {
      return false; // Will fail later.
    }
View Full Code Here

        removeBookmark(path + cat.get(i).getName() + ((cat.get(i) instanceof BookmarkCategory) ? "/"
          : ""));
    } else {
      if(((BookmarkItem) bookmark).getKeyType().equals("USK")) {
        try {
          USK u = ((BookmarkItem) bookmark).getUSK();
          if(!wantUSK(u, (BookmarkItem)bookmark)) {
            this.node.uskManager.unsubscribe(u, this.uskCB);
          }
        } catch(MalformedURLException mue) {
        }
View Full Code Here

      if(!"USK".equals(item.getKeyType()))
        continue;

      try {
        FreenetURI furi = new FreenetURI(item.getKey());
        USK usk = USK.create(furi);

        if(usk.equals(u, false)) return true;
      } catch(MalformedURLException mue) {
      }
    }
    return false;
  }
View Full Code Here

  static final short PRIORITY_PROGRESS = RequestStarter.UPDATE_PRIORITY_CLASS;

  private void subscribeToUSK(BookmarkItem item) {
    if("USK".equals(item.getKeyType()))
      try {
        USK u = item.getUSK();
        this.node.uskManager.subscribe(u, this.uskCB, true, this);
      } catch(MalformedURLException mue) {}
  }
View Full Code Here

        if(!"USK".equals(items.get(i).getKeyType()))
          continue;

        try {
          FreenetURI furi = new FreenetURI(items.get(i).getKey());
          USK usk = USK.create(furi);

          if(usk.equals(key, false)) {
            if(logMINOR) Logger.minor(this, "Updating bookmark for "+furi+" to edition "+edition);
            matched = true;
            BookmarkItem item = items.get(i);
            updated |= item.setEdition(edition, node);
            // We may have bookmarked the same site twice, so continue the search.
View Full Code Here

  abstract boolean dontKeepFullFieldSet();

  protected abstract void maybeClearPeerAddedTimeOnRestart(long now);

  private boolean parseARK(SimpleFieldSet fs, boolean onStartup, boolean forDiffNodeRef) {
    USK ark = null;
    long arkNo = 0;
    try {
      String arkPubKey = fs.get("ark.pubURI");
      arkNo = fs.getLong("ark.number", -1);
      if(arkPubKey == null && arkNo <= -1) {
        // ark.pubURI and ark.number are always optional as a pair
        return false;
      } else if(arkPubKey != null && arkNo > -1) {
        if(onStartup) arkNo++;
        // this is the number of the ref we are parsing.
        // we want the number of the next edition.
        // on startup we want to fetch the old edition in case there's been a corruption.
        FreenetURI uri = new FreenetURI(arkPubKey);
        ClientSSK ssk = new ClientSSK(uri);
        ark = new USK(ssk, arkNo);
      } else if(forDiffNodeRef && arkPubKey == null && myARK != null && arkNo > -1) {
        // get the ARK URI from the previous ARK and the edition from the SFS
        ark = myARK.copy(arkNo);
      } else if(forDiffNodeRef && arkPubKey != null && myARK != null && arkNo <= -1) {
        // the SFS must contain an edition if it contains a arkPubKey
View Full Code Here

        cb.failed(origURI, token, e);
    }
  }

  public void startTemporaryBackgroundFetcher(USK usk, ClientContext context, final FetchContext fctx, boolean prefetchContent, boolean realTimeFlag) {
    final USK clear = usk.clearCopy();
    USKFetcher sched = null;
    ArrayList<USKFetcher> toCancel = null;
    synchronized(this) {
//      int x = 0;
//      for(USK key: backgroundFetchersByClearUSK.keySet()) {
View Full Code Here

TOP

Related Classes of freenet.keys.USK

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.