Package net.pterodactylus.sone.core.FreenetInterface

Examples of net.pterodactylus.sone.core.FreenetInterface.Fetched


  public Sone fetchSone(Sone sone, FreenetURI soneUri, boolean fetchOnly) {
    logger.log(Level.FINE, String.format("Starting fetch for Sone “%s” from %s…", sone, soneUri));
    FreenetURI requestUri = soneUri.setMetaString(new String[] { "sone.xml" });
    sone.setStatus(SoneStatus.downloading);
    try {
      Fetched fetchResults = freenetInterface.fetchUri(requestUri);
      if (fetchResults == null) {
        /* TODO - mark Sone as bad. */
        return null;
      }
      logger.log(Level.FINEST, String.format("Got %d bytes back.", fetchResults.getFetchResult().size()));
      Sone parsedSone = parseSone(sone, fetchResults.getFetchResult(), fetchResults.getFreenetUri());
      if (parsedSone != null) {
        if (!fetchOnly) {
          parsedSone.setStatus((parsedSone.getTime() == 0) ? SoneStatus.unknown : SoneStatus.idle);
          core.updateSone(parsedSone);
          addSone(parsedSone);
View Full Code Here


      @Override
      @SuppressWarnings("synthetic-access")
      public void editionFound(FreenetURI uri, long edition, boolean newKnownGood, boolean newSlot) {
        logger.log(Level.FINEST, String.format("Found update for %s: %d, %s, %s", uri, edition, newKnownGood, newSlot));
        if (newKnownGood || newSlot) {
          Fetched uriResult = freenetInterface.fetchUri(uri.setMetaString(new String[] { "sone.properties" }));
          if (uriResult == null) {
            logger.log(Level.WARNING, String.format("Could not fetch properties of latest homepage: %s", uri));
            return;
          }
          Bucket resultBucket = uriResult.getFetchResult().asBucket();
          try {
            parseProperties(resultBucket.getInputStream(), edition);
            latestEdition = edition;
          } catch (IOException ioe1) {
            logger.log(Level.WARNING, String.format("Could not parse sone.properties of %s!", uri), ioe1);
View Full Code Here

TOP

Related Classes of net.pterodactylus.sone.core.FreenetInterface.Fetched

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.