@Override public ClientGetter fetch(FreenetURI uri, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException { if(uri == null) throw new NullPointerException(); ClientGetter get = new ClientGetter(callback, uri, fctx, prio, null, null, null); try { core.clientContext.start(get); } catch (PersistenceDisabledException e) { // Impossible } return get; }
@Override public ClientGetter fetchFromMetadata(Bucket initialMetadata, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException { if(initialMetadata == null) throw new NullPointerException(); ClientGetter get = new ClientGetter(callback, FreenetURI.EMPTY_CHK_URI, fctx, prio, null, null, initialMetadata); try { core.clientContext.start(get); } catch (PersistenceDisabledException e) { // Impossible } return get; }
@Override public ClientPutter insert(InsertBlock insert, String filenameHint, boolean isMetadata, InsertContext ctx, ClientPutCallback cb, short priority) throws InsertException { ClientPutter put = new ClientPutter(cb, insert.getData(), insert.desiredURI, insert.clientMetadata, ctx, priority, isMetadata, filenameHint, false, core.clientContext, null, -1); try { core.clientContext.start(put); } catch (PersistenceDisabledException e) { // Impossible } return put; }
@Override public FetchResult fetch(FreenetURI uri, long overrideMaxSize, RequestClient clientContext) throws FetchException { if(uri == null) throw new NullPointerException(); FetchWaiter fw = new FetchWaiter(clientContext); FetchContext context = getFetchContext(overrideMaxSize); ClientGetter get = new ClientGetter(fw, uri, context, priorityClass, null, null, null); try { core.clientContext.start(get); } catch (PersistenceDisabledException e) { // Impossible } return fw.waitForCompletion(); }
/** * Fetch a key. Either returns the data, or throws an exception. */ @Override public FetchResult fetchFromMetadata(Bucket initialMetadata) throws FetchException { if(initialMetadata == null) throw new NullPointerException(); FetchContext context = getFetchContext(); FetchWaiter fw = new FetchWaiter(this); ClientGetter get = new ClientGetter(fw, FreenetURI.EMPTY_CHK_URI, context, priorityClass, null, null, initialMetadata); try { core.clientContext.start(get); } catch (PersistenceDisabledException e) { // Impossible } return fw.waitForCompletion(); }
/** * Fetch a key. Either returns the data, or throws an exception. */ @Override public FetchResult fetch(FreenetURI uri) throws FetchException { if(uri == null) throw new NullPointerException(); FetchContext context = getFetchContext(); FetchWaiter fw = new FetchWaiter(this); ClientGetter get = new ClientGetter(fw, uri, context, priorityClass, null, null, null); try { core.clientContext.start(get); } catch (PersistenceDisabledException e) { // Impossible } return fw.waitForCompletion(); }
public FreenetURI insert(InsertBlock insert, String filenameHint, boolean isMetadata, short priority, InsertContext ctx, byte[] forceCryptoKey) throws InsertException { PutWaiter pw = new PutWaiter(this); ClientPutter put = new ClientPutter(pw, insert.getData(), insert.desiredURI, insert.clientMetadata, ctx, priority, isMetadata, filenameHint, false, core.clientContext, forceCryptoKey, -1); try { core.clientContext.start(put); } catch (PersistenceDisabledException e) { // Impossible } return pw.waitForCompletion(); }
public void start(ClientContext context) throws FetchException { try { if(!checkCache(context)) context.start(getter); } catch (FetchException e) { synchronized(this) { this.failed = e; this.finished = true; } } catch (PersistenceDisabledException e) { // Impossible Logger.error(this, "Failed to start: "+e); synchronized(this) { this.failed = new FetchException(FetchExceptionMode.INTERNAL_ERROR, e); this.finished = true; } } }
public void start(short priority, long maxSize) { HighLevelSimpleClient hlsc = node.clientCore.makeClient(priority, false, false); FetchContext context = hlsc.getFetchContext(); context.maxNonSplitfileRetries = -1; context.maxSplitfileBlockRetries = -1; context.maxTempLength = maxSize; context.maxOutputLength = maxSize; ClientGetter get = new ClientGetter(this, freenetURI, context, priority, null, null, null); try { node.clientCore.clientContext.start(get); } catch (PersistenceDisabledException e) { // Impossible } catch (FetchException e) { onFailure(e, null); } }
@Override public FreenetURI insertManifest(FreenetURI insertURI, HashMap<String, Object> bucketsByName, String defaultName, short priorityClass, byte[] forceCryptoKey) throws InsertException { PutWaiter pw = new PutWaiter(this); DefaultManifestPutter putter; try { putter = new DefaultManifestPutter(pw, BaseManifestPutter.bucketsByNameToManifestEntries(bucketsByName), priorityClass, insertURI, defaultName, getInsertContext(true), false, forceCryptoKey, core.clientContext); } catch (TooManyFilesInsertException e1) { throw new InsertException(InsertExceptionMode.TOO_MANY_FILES); } try { core.clientContext.start(putter); } catch (PersistenceDisabledException e) { // Impossible } return pw.waitForCompletion(); }
updateManager.node.clientCore.clientContext.start(cg); } catch(FetchException e1) { myCallback.onFailure(e1, cg);
priority, false, null, true, updateManager.node.clientCore.clientContext, null, -1); try { updateManager.node.clientCore.clientContext.start(putter); } catch(InsertException e1) { Logger.error(this, "Failed to start insert of "+type+" binary blob: " + e1, e1);
@Override public void prefetch(FreenetURI uri, long timeout, long maxSize, Set<String> allowedTypes, short prio) { FetchContext ctx = getFetchContext(maxSize); ctx.allowedMIMETypes = allowedTypes; final ClientGetter get = new ClientGetter(nullCallback, uri, ctx, prio, new NullBucket(), null, null); core.getTicker().queueTimedJob(new Runnable() { @Override public void run() { get.cancel(core.clientContext); } }, timeout); try { core.clientContext.start(get); } catch (FetchException e) { // Ignore } catch (PersistenceDisabledException e) { // Impossible } }
updateManager.node.clientCore.clientContext.start(cg); } catch(FetchException e1) { System.err.println("Failed to decode UOM blob: " + e1);
node.clientCore.clientContext.start(toStart); } catch(FetchException e) { Logger.error(this, "Error while starting the fetching: " + e, e);
node.clientCore.clientContext.start(get); } catch (PersistenceDisabledException e) {
node.clientCore.clientContext.start(inserter);
toCancel.cancel(core.clientContext); if(cg != null) { core.clientContext.start(cg); if(logMINOR) Logger.minor(this, "Started revocation fetcher");