Package freenet.support

Examples of freenet.support.SimpleFieldSet


    ignoreUSKDatehints = fs.getBoolean("IgnoreUSKDatehints", false);
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet sfs = new SimpleFieldSet(true);
    sfs.putSingle("URI", uri.toString());
    sfs.putSingle("Identifier", identifier);
    sfs.put("Verbosity", verbosity);
    sfs.put("MaxRetries", maxRetries);
    sfs.putSingle("Metadata.ContentType", contentType);
    sfs.putSingle("ClientToken", clientToken);
    switch(uploadFromType) {
    case DIRECT:
            sfs.putSingle("UploadFrom", "direct");
            sfs.put("DataLength", dataLength);
        break;
    case DISK:
            sfs.putSingle("UploadFrom", "disk");
            sfs.putSingle("Filename", origFilename.getAbsolutePath());
            sfs.put("DataLength", dataLength);
            break;
    case REDIRECT:
            sfs.putSingle("UploadFrom", "redirect");
            sfs.putSingle("TargetURI", redirectTarget.toString());
            break;
    }
    sfs.put("GetCHKOnly", getCHKOnly);
    sfs.put("PriorityClass", priorityClass);
    sfs.putSingle("Persistence", persistence.toString().toLowerCase());
    sfs.put("DontCompress", dontCompress);
    if (compressorDescriptor != null)
      sfs.putSingle("Codecs", compressorDescriptor);
    sfs.put("Global", global);
    sfs.put("BinaryBlob", binaryBlob);
    return sfs;
  }
View Full Code Here


    String euri = fs.get("ExpectedURI");
    if(euri != null && euri.length() > 0)
      expectedURI = new FreenetURI(euri);
    else
      expectedURI = null;
    SimpleFieldSet trackerSubset = fs.subset("Errors");
    if(trackerSubset != null) {
      tracker = new FailureCodeTracker(true, trackerSubset);
    } else {
      tracker = null;
    }
View Full Code Here

  public SimpleFieldSet getFieldSet() {
    return getFieldSet(true);
  }
 
  public SimpleFieldSet getFieldSet(boolean verbose) {
    SimpleFieldSet fs = new SimpleFieldSet(true);
    if(identifier == null)
      throw new NullPointerException();
    fs.putSingle("Identifier", identifier);
    fs.put("Global", global);
    fs.put("Code", code.code);
    if(verbose)
      fs.putSingle("CodeDescription", codeDescription);
    if(extraDescription != null)
      fs.putSingle("ExtraDescription", extraDescription);
    if(tracker != null) {
      fs.tput("Errors", tracker.toFieldSet(verbose));
    }
    if(verbose)
      fs.put("Fatal", isFatal);
    if(verbose)
      fs.putSingle("ShortCodeDescription", shortCodeDescription);
    if(expectedURI != null)
      fs.putSingle("ExpectedURI", expectedURI.toString());
    return fs;
  }
View Full Code Here

    this.identifier = identifier;
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet sfs = new SimpleFieldSet(true);
    sfs.putSingle("NodeIdentifier", nodeIdentifier);
    if(identifier != null)
      sfs.putSingle("Identifier", identifier);
    return sfs;
  }
View Full Code Here

    buckets.put("Description", descriptionBucket);
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet fs = super.getFieldSet();
    fs.putSingle("URI", URI.toString());
    return fs;
  }
View Full Code Here

  }
 
  @Override
  public SimpleFieldSet getFieldSet() {
    int dataLength = 0;
    SimpleFieldSet fs = new SimpleFieldSet(true);
    for(Map.Entry<String, Bucket> entry : buckets.entrySet()) {
      String field = entry.getKey();
      Bucket bucket = entry.getValue();
      fs.put(field + "Length", bucket.size());
      dataLength += bucket.size();
    }
    fs.put("DataLength", dataLength);
    return fs;
  }
View Full Code Here

        this.clientToken = clientToken;
    }

    @Override
  public SimpleFieldSet getFieldSet() {
        final SimpleFieldSet fs = new SimpleFieldSet(true);
        fs.putSingle("Identifier", ident);
        fs.put("Global", global);
        if(priorityClass >= 0)   fs.put("PriorityClass", priorityClass);
        if(clientToken != null ) fs.putSingle("ClientToken", clientToken);
        return fs;
    }
View Full Code Here

    this.global = global;
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet sfs = new SimpleFieldSet(true);
    sfs.putSingle("Identifier", identifier);
    sfs.put("Global", global);
    return sfs;
  }
View Full Code Here

    this.handler = handler;
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet sfs = new SimpleFieldSet(true);
   
    sfs.putSingle(TestDDARequestMessage.DIRECTORY, checkJob.directory.toString());
   
    boolean isReadAllowed = false;
    boolean isWriteAllowed = false;
   
    if(checkJob.readFilename != null) {
      isReadAllowed = (readContentFromClient != null) &&  (checkJob.readContent.equals(readContentFromClient));
      // cleanup in any case : we created it!... let's hope the client will do the same on its side.
      checkJob.readFilename.delete();
      sfs.putSingle(READ_ALLOWED, String.valueOf(isReadAllowed));
    }
   
    if(checkJob.writeFilename != null) {
      File maybeWrittenFile = checkJob.writeFilename;
      if (maybeWrittenFile.exists() && maybeWrittenFile.isFile() && maybeWrittenFile.canRead()) {
        try {
            String existingContent = FileUtil.readUTF(maybeWrittenFile).toString().trim();
          isWriteAllowed = checkJob.writeContent.equals(existingContent);
        } catch (IOException e) {
          Logger.error(this, "Caught an IOE trying to read the file (" + maybeWrittenFile + ")! " + e.getMessage());
        }
      }
      sfs.putSingle(WRITE_ALLOWED, String.valueOf(isWriteAllowed));
    }
   
    // FIXME this really shouldn't be a side-effect!
    handler.registerTestDDAResult(checkJob.directory.toString(), isReadAllowed, isWriteAllowed);
   
View Full Code Here

   
    filesByName = new HashMap<String, Object>();
    filesToRead = new LinkedList<DirPutFile>();
    long totalBytes = 0;
    // Now parse the meat
    SimpleFieldSet files = fs.subset("Files");
    if(files == null)
      throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "Missing Files section", identifier, global);
    boolean logMINOR = Logger.shouldLog(LogLevel.MINOR, this);
    for(int i=0;;i++) {
      SimpleFieldSet subset = files.subset(Integer.toString(i));
      if(subset == null) break;
      DirPutFile f = DirPutFile.create(subset, identifier, global, (persistence == Persistence.FOREVER) ? bfPersistent : bfTemp);
      addFile(f);
      if(logMINOR) Logger.minor(this, "Adding "+f);
      if(f instanceof DirectDirPutFile) {
View Full Code Here

TOP

Related Classes of freenet.support.SimpleFieldSet

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.