Package freenet.client

Examples of freenet.client.ClientMetadata


     * @param mimeOverride Optional MIME type override.
     * @param isDefaultDoc If true, make this the default document.
     */
    public final void addExternal(String name, RandomAccessBucket data, String mimeOverride, boolean isDefaultDoc) {
      assert(data != null);
      ClientMetadata cm = makeClientMetadata(mimeOverride);
      addExternal(name, data, cm, isDefaultDoc);
    }
View Full Code Here


      ClientMetadata cm = makeClientMetadata(mimeOverride);
      addExternal(name, data, cm, isDefaultDoc);
    }

    public final void addRedirect(String name, FreenetURI targetUri, String mimeOverride, boolean isDefaultDoc) {
      ClientMetadata cm = makeClientMetadata(mimeOverride);
      addRedirect(name, targetUri, cm, isDefaultDoc);
    }
View Full Code Here

      HighLevelSimpleClient client = node.clientCore.makeClient((short) 0, false, false);
      FreenetURI uri = new FreenetURI("KSK@" + uid + "-" + dateFormat.format(today.getTime()));
      System.out.println("PUSHING " + uri);
     
      try {
        InsertBlock block = new InsertBlock(data, new ClientMetadata(), uri);
        t1 = System.currentTimeMillis();
        client.insert(block, false, null);
        t2 = System.currentTimeMillis();
       
        System.out.println("PUSH-TIME-" + ":" + (t2 - t1));
View Full Code Here

     
      client = node.clientCore.makeClient((short) 0, false, false);

      System.err.println("Inserting single block 3 times");
     
      InsertBlock block = new InsertBlock(single, new ClientMetadata(), FreenetURI.EMPTY_CHK_URI);
     
      FreenetURI uri = null;
     
      int successes = 0;
     
      for(int i=0;i<3;i++) {
        System.err.println("Inserting single block, try #"+i);
        try {
          t1 = System.currentTimeMillis();
          FreenetURI thisURI = client.insert(block, false, null);
          if(uri != null && !thisURI.equals(uri)) {
            System.err.println("URI "+i+" is "+thisURI+" but previous is "+uri);
            System.exit(EXIT_DIFFERENT_URI);
          }
          uri = thisURI;
          t2 = System.currentTimeMillis();
         
          System.out.println("PUSH-TIME-" + i + ":" + (t2 - t1)+" for "+uri+" for single block");
          csvLine.add(String.valueOf(t2 - t1));
          csvLine.add(uri.toASCIIString());
          successes++;
        } catch (InsertException e) {
          e.printStackTrace();
          csvLine.add(InsertException.getShortMessage(e.getMode()));
          csvLine.add("N/A");
          System.out.println("INSERT FAILED: "+e+" for insert "+i+" for single block");
        }
      }
     
      if(successes == 3)
        System.err.println("All inserts succeeded for single block: "+successes);
      else if(successes != 0)
        System.err.println("Some inserts succeeded for single block: "+successes);
      else
        System.err.println("NO INSERTS SUCCEEDED FOR SINGLE BLOCK: "+successes);
     
      uri = null;
     
      // Insert 3 blocks
     
      for(int i=0;i<3;i++) {
        System.err.println("Inserting MHK #"+i);
        uri = null;
        block = new InsertBlock(mhks[i], new ClientMetadata(), FreenetURI.EMPTY_CHK_URI);
        try {
          t1 = System.currentTimeMillis();
          FreenetURI thisURI = client.insert(block, false, null);
          uri = thisURI;
          t2 = System.currentTimeMillis();
View Full Code Here

  protected final ClientMetadata guessMime(String name, String mimetype) {
    String mimeType = mimetype;
    if((mimeType == null) && (name != null))
      mimeType = DefaultMIMETypes.guessMIMEType(name, true);
    ClientMetadata cm;
    if(mimeType == null || mimeType.equals(DefaultMIMETypes.DEFAULT_MIME_TYPE))
      cm = null;
    else
      cm = new ClientMetadata(mimeType);
    return cm;
  }
View Full Code Here

          }
         
        });

        try {
          InsertBlock block = new InsertBlock(data, new ClientMetadata(), uri);
          t1 = System.currentTimeMillis();
          client.insert(block, false, null);
          t2 = System.currentTimeMillis();

          System.out.println("PUSH-TIME-" + i + ":" + (t2 - t1));
View Full Code Here

      } catch (IOException e1) {
        InsertException ex = new InsertException(InsertExceptionMode.BUCKET_ERROR, e1, null);
        fail(ex, context);
        return;
      }
      ClientMetadata m = meta.getClientMetadata();
      CompatibilityMode cmode = ctx.getCompatibilityMode();
      if(!(cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1255.ordinal()))
        m = null;
      if(metadataThreshold > 0 && metaBytes.length < metadataThreshold) {
        // FIXME what to do about m ???
View Full Code Here

      // Now we have to insert the Archive we have generated.
     
      // Can we just insert it, and not bother with a redirect to it?
      // Thereby exploiting implicit manifest support, which will pick up on .metadata??
      // We ought to be able to !!
      block = new InsertBlock(outputBucket, new ClientMetadata(mimeType), targetURI);
    } catch (IOException e) {
      fail(new InsertException(InsertExceptionMode.BUCKET_ERROR, e, null), context);
      return;
    } finally {
      Closer.close(os);
View Full Code Here

        //System.out.println("Decompose: "+name+" (Metadata)");
        smc.addItem(name, (Metadata)o);
      } else {
        ManifestElement element = (ManifestElement) o;
        String mimeType = element.mimeOverride;
        ClientMetadata cm;
        if(mimeType == null || mimeType.equals(DefaultMIMETypes.DEFAULT_MIME_TYPE))
          cm = null;
        else
          cm = new ClientMetadata(mimeType);
        Metadata m;
        if(element.targetURI != null) {
          //System.out.println("Decompose: "+name+" (ManifestElement, Redirect)");
          m = new Metadata(DocumentType.SIMPLE_REDIRECT, null, null, element.targetURI, cm);
        } else {
View Full Code Here

    } finally {
        os.close();
    }
        System.err.println("Inserting test data.");
        HighLevelSimpleClient client = node.clientCore.makeClient((short)0, false, false);
        InsertBlock block = new InsertBlock(data, new ClientMetadata(), FreenetURI.EMPTY_CHK_URI);
        long startInsertTime = System.currentTimeMillis();
        FreenetURI uri;
        try {
      uri = client.insert(block, false, null);
    } catch (InsertException e) {
View Full Code Here

TOP

Related Classes of freenet.client.ClientMetadata

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.