Package freenet.client.async

Examples of freenet.client.async.ClientContext


        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        erab.storeTo(dos);
        dos.close();
        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ClientContext context = new ClientContext(0, null, null, null, null, null, null, null, null,
                null, r, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null, null);
        context.setPersistentMasterSecret(secret);
        EncryptedRandomAccessBucket restored = (EncryptedRandomAccessBucket) BucketTools.restoreFrom(dis, context.persistentFG, context.persistentFileTracker, secret);
        assertEquals(buf.length, restored.size());
        assertEquals(erab, restored);
        tmp = new byte[buf.length];
        is = erab.getInputStream();
View Full Code Here


        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(erab);
        oos.close();
        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ClientContext context = new ClientContext(0, null, null, null, null, null, null, null, null,
                null, r, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null, null);
        context.setPersistentMasterSecret(secret);
        ObjectInputStream ois = new ObjectInputStream(dis);
        EncryptedRandomAccessBucket restored = (EncryptedRandomAccessBucket) ois.readObject();
        restored.onResume(context);
        assertEquals(buf.length, restored.size());
        assertEquals(erab, restored);
View Full Code Here

            memoryLimitedJobRunner.waitForShutdown();
            System.out.println("FEC decoding threads finished.");
        }
       
    });
    clientContext = new ClientContext(node.bootID, clientLayerPersister, node.executor,
            archiveManager, persistentTempBucketFactory, tempBucketFactory,
            persistentTempBucketFactory, healingQueue, uskManager, random, node.fastWeakRandom,
            node.getTicker(), memoryLimitedJobRunner, tempFilenameGenerator, persistentFilenameGenerator, tempBucketFactory,
            persistentRAFFactory, tempBucketFactory.getUnderlyingRAFFactory(), persistentDiskChecker,
            compressor, storeChecker, fcpPersistentRoot, cryptoSecretTransient, toadlets, defaultFetchContext, defaultInsertContext);
View Full Code Here

        DataOutputStream dos = new DataOutputStream(baos);
        eraf.storeTo(dos);
        dos.close();
        eraf.close();
        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ClientContext context = new ClientContext(0, null, null, null, null, null, null, null, null,
                null, r, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null, null);
        context.setPersistentMasterSecret(secret);
        EncryptedRandomAccessBuffer restored = (EncryptedRandomAccessBuffer) BucketTools.restoreRAFFrom(dis, context.persistentFG, context.persistentFileTracker, secret);
        assertEquals(buf.length, restored.size());
        //assertEquals(rafw, restored);
        tmp = new byte[buf.length];
        restored.pread(0, tmp, 0, buf.length);
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(eraf);
        oos.close();
        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ClientContext context = new ClientContext(0, null, null, null, null, null, null, null, null,
                null, r, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null, null);
        context.setPersistentMasterSecret(secret);
        ObjectInputStream ois = new ObjectInputStream(dis);
        EncryptedRandomAccessBuffer restored = (EncryptedRandomAccessBuffer) ois.readObject();
        restored.onResume(context);
        assertEquals(buf.length, restored.size());
        assertEquals(eraf, restored);
View Full Code Here

    @Override
    public ClientRequest migrate(PersistentRequestClient newClient, ObjectContainer container,
            NodeClientCore core) throws IdentifierCollisionException, NotAllowedException,
            IOException, MetadataUnresolvedException, ResumeFailedException {
        ClientContext context = core.clientContext;
        if(targetURI != null)
            container.activate(targetURI, Integer.MAX_VALUE);
        if(uri != null)
            container.activate(uri, Integer.MAX_VALUE);
        container.activate(ctx, Integer.MAX_VALUE);
        ctx.onResume();
        File f = origFilename;
        if(f != null) {
            container.activate(f, Integer.MAX_VALUE);
            f = new File(f.toString());
            if(!f.exists()) {
                Logger.error(this, "Not migrating insert as data has been deleted");
                return null;
            }
        }
        container.activate(clientMetadata, Integer.MAX_VALUE);
        RandomAccessBucket data;
        if(this.data != null) {
            container.activate(this.data, Integer.MAX_VALUE);
            if(this.data.size() == 0) {
                Logger.error(this, "No data migrating insert: "+this.data);
                return null;
            }
            this.data.onResume(context);
            data = BucketTools.toRandomAccessBucket(this.data, context.getBucketFactory(true));
        } else {
            Logger.error(this, "Not migrating insert as data has been deleted (or very old download?)");
            return null;
        }
        byte[] overrideSplitfileKey = null;
View Full Code Here

            new freenet.clients.fcp.ClientGet(newClient, uri, fctx.localRequestOnly, fctx.ignoreStore,
                fctx.filterData, fctx.maxSplitfileBlockRetries, fctx.maxNonSplitfileRetries,
                fctx.maxOutputLength, ReturnType.getByCode(returnType), false, identifier, verbosity, priorityClass,
                f, charset, fctx.canWriteClientCache, realTime, binaryBlob, core);
        if(finished) {
            ClientContext context = core.clientContext;
            if(getFailedMessage != null) {
                container.activate(getFailedMessage, Integer.MAX_VALUE);
                if(getFailedMessage.expectedMimeType != null)
                    this.foundDataMimeType = getFailedMessage.expectedMimeType;
            }
View Full Code Here

 
    @Override
    public ClientRequest migrate(PersistentRequestClient newClient, ObjectContainer container,
            NodeClientCore core) throws IdentifierCollisionException, NotAllowedException,
            IOException, ResumeFailedException, TooManyFilesInsertException {
        ClientContext context = core.clientContext;
        container.activate(manifestElements, Integer.MAX_VALUE);
        migrateManifestElements(manifestElements, context.getBucketFactory(true), context);
        container.activate(uri, Integer.MAX_VALUE);
        container.activate(ctx, Integer.MAX_VALUE);
        freenet.clients.fcp.ClientPutDir put =
            new freenet.clients.fcp.ClientPutDir(newClient, uri, identifier, verbosity,
                priorityClass, Persistence.FOREVER, clientToken, ctx.getCHKOnly, ctx.dontCompress,
View Full Code Here

TOP

Related Classes of freenet.client.async.ClientContext

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.