Author: toad
Date: 2007-05-04 19:31:38 +0000 (Fri, 04 May 2007)
New Revision: 13151
Added:
trunk/freenet/src/freenet/client/InsertContext.java
trunk/freenet/src/freenet/client/InsertException.java
Removed:
trunk/freenet/src/freenet/client/InserterContext.java
trunk/freenet/src/freenet/client/InserterException.java
Modified:
trunk/freenet/src/freenet/client/FailureCodeTracker.java
trunk/freenet/src/freenet/client/FetchWaiter.java
trunk/freenet/src/freenet/client/HighLevelSimpleClient.java
trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
trunk/freenet/src/freenet/client/PutWaiter.java
trunk/freenet/src/freenet/client/async/ClientCallback.java
trunk/freenet/src/freenet/client/async/ClientPutState.java
trunk/freenet/src/freenet/client/async/ClientPutter.java
trunk/freenet/src/freenet/client/async/MultiPutCompletionCallback.java
trunk/freenet/src/freenet/client/async/PutCompletionCallback.java
trunk/freenet/src/freenet/client/async/SimpleHealingQueue.java
trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
trunk/freenet/src/freenet/client/async/SingleFileInserter.java
trunk/freenet/src/freenet/client/async/SplitFileInserter.java
trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
trunk/freenet/src/freenet/client/async/USKInserter.java
trunk/freenet/src/freenet/client/events/BlockInsertErrorEvent.java
trunk/freenet/src/freenet/clients/http/NinjaSpider.java
trunk/freenet/src/freenet/clients/http/Spider.java
trunk/freenet/src/freenet/clients/http/Toadlet.java
trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
trunk/freenet/src/freenet/frost/message/FrostMessage.java
trunk/freenet/src/freenet/keys/FreenetURI.java
trunk/freenet/src/freenet/node/NodeARKInserter.java
trunk/freenet/src/freenet/node/NodeClientCore.java
trunk/freenet/src/freenet/node/TextModeClientInterface.java
trunk/freenet/src/freenet/node/fcp/ClientGet.java
trunk/freenet/src/freenet/node/fcp/ClientPut.java
trunk/freenet/src/freenet/node/fcp/ClientPutBase.java
trunk/freenet/src/freenet/node/fcp/ClientPutDir.java
trunk/freenet/src/freenet/node/fcp/FCPClient.java
trunk/freenet/src/freenet/node/fcp/FCPServer.java
trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java
trunk/freenet/src/freenet/node/fcp/PutFailedMessage.java
trunk/freenet/src/freenet/node/updater/NodeUpdater.java
trunk/freenet/src/freenet/node/updater/RevocationChecker.java
Log:
Rename Inserter->Insert to be consistent with Fetch
Modified: trunk/freenet/src/freenet/client/FailureCodeTracker.java
===================================================================
--- trunk/freenet/src/freenet/client/FailureCodeTracker.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/FailureCodeTracker.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -81,7 +81,7 @@
while(i.hasNext()) {
Integer x = (Integer) i.next();
Item val = (Item) map.get(x);
- String s = insert ?
InserterException.getMessage(x.intValue()) :
FetchException.getMessage(x.intValue());
+ String s = insert ?
InsertException.getMessage(x.intValue()) :
FetchException.getMessage(x.intValue());
sb.append(val.x);
sb.append('\t');
sb.append(s);
@@ -144,7 +144,7 @@
// prefix.num.Count=<count>
if(verbose)
sfs.putSingle(Integer.toString(code)+".Description",
- insert ?
InserterException.getMessage(code) : FetchException.getMessage(code));
+ insert ?
InsertException.getMessage(code) : FetchException.getMessage(code));
sfs.put(Integer.toString(code)+".Count", item.x);
}
return sfs;
@@ -164,7 +164,7 @@
Integer code = (Integer) i.next();
if(((Item)map.get(code)).x == 0) continue;
if(insert) {
- if(InserterException.isFatal(code.intValue()))
return true;
+ if(InsertException.isFatal(code.intValue()))
return true;
} else {
if(FetchException.isFatal(code.intValue()))
return true;
}
@@ -172,7 +172,7 @@
return false;
}
- public void merge(InserterException e) {
+ public void merge(InsertException e) {
if(!insert) throw new IllegalArgumentException("This is not an
insert yet merge("+e+") called!");
if(e.errorCodes != null)
merge(e.errorCodes);
Modified: trunk/freenet/src/freenet/client/FetchWaiter.java
===================================================================
--- trunk/freenet/src/freenet/client/FetchWaiter.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/client/FetchWaiter.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -32,7 +32,7 @@
throw new UnsupportedOperationException();
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
throw new UnsupportedOperationException();
}
Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClient.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClient.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClient.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -39,28 +39,28 @@
/**
* Blocking insert.
* @param filenameHint If set, insert a single-file manifest containing
only this file, under the given filename.
- * @throws InserterException If there is an error inserting the data
+ * @throws InsertException If there is an error inserting the data
*/
- public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String
filenameHint) throws InserterException;
+ public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String
filenameHint) throws InsertException;
/**
* Blocking insert of a redirect.
*/
- public FreenetURI insertRedirect(FreenetURI insertURI, FreenetURI
target) throws InserterException;
+ public FreenetURI insertRedirect(FreenetURI insertURI, FreenetURI
target) throws InsertException;
/**
* Blocking insert of multiple files as a manifest (or zip manifest,
etc).
*/
- public FreenetURI insertManifest(FreenetURI insertURI, HashMap
bucketsByName, String defaultName) throws InserterException;
+ public FreenetURI insertManifest(FreenetURI insertURI, HashMap
bucketsByName, String defaultName) throws InsertException;
public FetchContext getFetcherContext();
/**
- * Get an InserterContext.
+ * Get an InsertContext.
* @param forceNonPersistent If true, force the request to use the
non-persistent
* bucket pool.
*/
- public InserterContext getInserterContext(boolean forceNonPersistent);
+ public InsertContext getInserterContext(boolean forceNonPersistent);
/**
* Add a ClientEventListener.
Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -129,12 +129,12 @@
return fw.waitForCompletion();
}
- public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String
filenameHint) throws InserterException {
+ public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String
filenameHint) throws InsertException {
return insert(insert, getCHKOnly, filenameHint, false);
}
- public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String
filenameHint, boolean isMetadata) throws InserterException {
- InserterContext context = getInserterContext(true);
+ public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String
filenameHint, boolean isMetadata) throws InsertException {
+ InsertContext context = getInserterContext(true);
PutWaiter pw = new PutWaiter();
ClientPutter put = new ClientPutter(pw, insert.getData(),
insert.desiredURI, insert.clientMetadata,
context, core.requestStarters.chkPutScheduler,
core.requestStarters.sskPutScheduler, priorityClass, getCHKOnly, isMetadata,
this, null, filenameHint);
@@ -142,24 +142,24 @@
return pw.waitForCompletion();
}
- public FreenetURI insertRedirect(FreenetURI insertURI, FreenetURI
targetURI) throws InserterException {
+ public FreenetURI insertRedirect(FreenetURI insertURI, FreenetURI
targetURI) throws InsertException {
Metadata m = new Metadata(Metadata.SIMPLE_REDIRECT, targetURI,
new ClientMetadata());
Bucket b;
try {
b = BucketTools.makeImmutableBucket(bucketFactory,
m.writeToByteArray());
} catch (IOException e) {
Logger.error(this, "Bucket error: "+e, e);
- throw new
InserterException(InserterException.INTERNAL_ERROR, e, null);
+ throw new
InsertException(InsertException.INTERNAL_ERROR, e, null);
} catch (MetadataUnresolvedException e) {
Logger.error(this, "Impossible error: "+e, e);
- throw new
InserterException(InserterException.INTERNAL_ERROR, e, null);
+ throw new
InsertException(InsertException.INTERNAL_ERROR, e, null);
}
InsertBlock block = new InsertBlock(b, null, insertURI);
return insert(block, false, null, true);
}
- public FreenetURI insertManifest(FreenetURI insertURI, HashMap
bucketsByName, String defaultName) throws InserterException {
+ public FreenetURI insertManifest(FreenetURI insertURI, HashMap
bucketsByName, String defaultName) throws InsertException {
PutWaiter pw = new PutWaiter();
SimpleManifestPutter putter =
new SimpleManifestPutter(pw,
core.requestStarters.chkPutScheduler, core.requestStarters.sskPutScheduler,
SimpleManifestPutter.bucketsByNameToManifestEntries(bucketsByName),
priorityClass, insertURI, defaultName, getInserterContext(true), false, this,
false);
@@ -193,8 +193,8 @@
forceDontIgnoreTooManyPathComponents ? false :
core.ignoreTooManyPathComponents);
}
- public InserterContext getInserterContext(boolean forceNonPersistent) {
- return new InserterContext(bucketFactory, forceNonPersistent ?
bucketFactory : persistentBucketFactory,
+ public InsertContext getInserterContext(boolean forceNonPersistent) {
+ return new InsertContext(bucketFactory, forceNonPersistent ?
bucketFactory : persistentBucketFactory,
forceNonPersistent ? new
NullPersistentFileTracker() : persistentFileTracker,
random, INSERT_RETRIES,
CONSECUTIVE_RNFS_ASSUME_SUCCESS,
SPLITFILE_INSERT_THREADS,
SPLITFILE_BLOCKS_PER_SEGMENT, SPLITFILE_CHECK_BLOCKS_PER_SEGMENT,
Copied: trunk/freenet/src/freenet/client/InsertContext.java (from rev 13147,
trunk/freenet/src/freenet/client/InserterContext.java)
===================================================================
--- trunk/freenet/src/freenet/client/InsertContext.java
(rev 0)
+++ trunk/freenet/src/freenet/client/InsertContext.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -0,0 +1,92 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.client;
+
+import freenet.client.async.BackgroundBlockEncoder;
+import freenet.client.async.USKManager;
+import freenet.client.events.ClientEventProducer;
+import freenet.client.events.SimpleEventProducer;
+import freenet.crypt.RandomSource;
+import freenet.support.api.BucketFactory;
+import freenet.support.io.NullPersistentFileTracker;
+import freenet.support.io.PersistentFileTracker;
+
+/** Context object for an insert operation, including both simple and
multi-file inserts */
+public class InsertContext {
+
+ public final BucketFactory bf;
+ public final BucketFactory persistentBucketFactory;
+ public final PersistentFileTracker persistentFileTracker;
+ /** If true, don't try to compress the data */
+ public boolean dontCompress;
+ public final RandomSource random;
+ public final short splitfileAlgorithm;
+ public int maxInsertRetries;
+ final int maxSplitInsertThreads;
+ public final int consecutiveRNFsCountAsSuccess;
+ public final int splitfileSegmentDataBlocks;
+ public final int splitfileSegmentCheckBlocks;
+ public final ClientEventProducer eventProducer;
+ /** Interesting tradeoff, see comments at top of Node.java. */
+ public final boolean cacheLocalRequests;
+ public final USKManager uskManager;
+ public final BackgroundBlockEncoder backgroundBlockEncoder;
+
+ public InsertContext(BucketFactory bf, BucketFactory persistentBF,
PersistentFileTracker tracker, RandomSource random,
+ int maxRetries, int rnfsToSuccess, int maxThreads, int
splitfileSegmentDataBlocks, int splitfileSegmentCheckBlocks,
+ ClientEventProducer eventProducer, boolean
cacheLocalRequests, USKManager uskManager, BackgroundBlockEncoder blockEncoder)
{
+ this.bf = bf;
+ this.persistentFileTracker = tracker;
+ this.persistentBucketFactory = persistentBF;
+ this.uskManager = uskManager;
+ this.random = random;
+ dontCompress = false;
+ splitfileAlgorithm = Metadata.SPLITFILE_ONION_STANDARD;
+ this.consecutiveRNFsCountAsSuccess = rnfsToSuccess;
+ this.maxInsertRetries = maxRetries;
+ this.maxSplitInsertThreads = maxThreads;
+ this.eventProducer = eventProducer;
+ this.splitfileSegmentDataBlocks = splitfileSegmentDataBlocks;
+ this.splitfileSegmentCheckBlocks = splitfileSegmentCheckBlocks;
+ this.cacheLocalRequests = cacheLocalRequests;
+ this.backgroundBlockEncoder = blockEncoder;
+ }
+
+ public InsertContext(InsertContext ctx, SimpleEventProducer producer,
boolean forceNonPersistent) {
+ this.persistentFileTracker = forceNonPersistent ? new
NullPersistentFileTracker() : ctx.persistentFileTracker;
+ this.uskManager = ctx.uskManager;
+ this.bf = ctx.bf;
+ this.persistentBucketFactory = forceNonPersistent ? ctx.bf :
ctx.persistentBucketFactory;
+ this.random = ctx.random;
+ this.dontCompress = ctx.dontCompress;
+ this.splitfileAlgorithm = ctx.splitfileAlgorithm;
+ this.consecutiveRNFsCountAsSuccess =
ctx.consecutiveRNFsCountAsSuccess;
+ this.maxInsertRetries = ctx.maxInsertRetries;
+ this.maxSplitInsertThreads = ctx.maxSplitInsertThreads;
+ this.eventProducer = producer;
+ this.splitfileSegmentDataBlocks =
ctx.splitfileSegmentDataBlocks;
+ this.splitfileSegmentCheckBlocks =
ctx.splitfileSegmentCheckBlocks;
+ this.cacheLocalRequests = ctx.cacheLocalRequests;
+ this.backgroundBlockEncoder = ctx.backgroundBlockEncoder;
+ }
+
+ public InsertContext(InsertContext ctx, SimpleEventProducer producer) {
+ this.persistentFileTracker = ctx.persistentFileTracker;
+ this.uskManager = ctx.uskManager;
+ this.bf = ctx.bf;
+ this.persistentBucketFactory = ctx.persistentBucketFactory;
+ this.random = ctx.random;
+ this.dontCompress = ctx.dontCompress;
+ this.splitfileAlgorithm = ctx.splitfileAlgorithm;
+ this.consecutiveRNFsCountAsSuccess =
ctx.consecutiveRNFsCountAsSuccess;
+ this.maxInsertRetries = ctx.maxInsertRetries;
+ this.maxSplitInsertThreads = ctx.maxSplitInsertThreads;
+ this.eventProducer = producer;
+ this.splitfileSegmentDataBlocks =
ctx.splitfileSegmentDataBlocks;
+ this.splitfileSegmentCheckBlocks =
ctx.splitfileSegmentCheckBlocks;
+ this.cacheLocalRequests = ctx.cacheLocalRequests;
+ this.backgroundBlockEncoder = ctx.backgroundBlockEncoder;
+ }
+
+}
Copied: trunk/freenet/src/freenet/client/InsertException.java (from rev 13147,
trunk/freenet/src/freenet/client/InserterException.java)
===================================================================
--- trunk/freenet/src/freenet/client/InsertException.java
(rev 0)
+++ trunk/freenet/src/freenet/client/InsertException.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -0,0 +1,196 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.client;
+
+import freenet.keys.FreenetURI;
+import freenet.support.Logger;
+
+public class InsertException extends Exception {
+ private static final long serialVersionUID = -1106716067841151962L;
+
+ private final int mode;
+ /** For collection errors */
+ public FailureCodeTracker errorCodes;
+ /** If a non-serious error, the URI */
+ public FreenetURI uri;
+
+ public final String extra;
+
+ /** Get the failure mode. */
+ public int getMode() {
+ return mode;
+ }
+
+ public InsertException(int m, String msg, FreenetURI expectedURI) {
+ super(getMessage(m)+": "+msg);
+ extra = msg;
+ mode = m;
+ if(Logger.shouldLog(Logger.MINOR, getClass()))
+ Logger.minor(this, "Creating InsertException:
"+getMessage(mode)+": "+msg, this);
+ errorCodes = null;
+ this.uri = expectedURI;
+ }
+
+ public InsertException(int m, FreenetURI expectedURI) {
+ super(getMessage(m));
+ extra = null;
+ mode = m;
+ if(Logger.shouldLog(Logger.MINOR, getClass()))
+ Logger.minor(this, "Creating InsertException:
"+getMessage(mode), this);
+ errorCodes = null;
+ this.uri = expectedURI;
+ }
+
+ public InsertException(int mode, Throwable e, FreenetURI expectedURI) {
+ super(getMessage(mode)+": "+e.getMessage());
+ extra = e.getMessage();
+ if(Logger.shouldLog(Logger.MINOR, getClass()))
+ Logger.minor(this, "Creating InsertException:
"+getMessage(mode)+": "+e, e);
+ this.mode = mode;
+ errorCodes = null;
+ initCause(e);
+ this.uri = expectedURI;
+ }
+
+ public InsertException(int mode, FailureCodeTracker errorCodes,
FreenetURI expectedURI) {
+ super(getMessage(mode));
+ extra = null;
+ this.mode = mode;
+ if(Logger.shouldLog(Logger.MINOR, getClass()))
+ Logger.minor(this, "Creating InsertException:
"+getMessage(mode), this);
+ this.errorCodes = errorCodes;
+ this.uri = expectedURI;
+ }
+
+ public InsertException(int mode) {
+ super(getMessage(mode));
+ extra = null;
+ this.mode = mode;
+ this.errorCodes = null;
+ this.uri = null;
+ }
+
+ /** Caller supplied a URI we cannot use */
+ public static final int INVALID_URI = 1;
+ /** Failed to read from or write to a bucket; a kind of internal error
*/
+ public static final int BUCKET_ERROR = 2;
+ /** Internal error of some sort */
+ public static final int INTERNAL_ERROR = 3;
+ /** Downstream node was overloaded */
+ public static final int REJECTED_OVERLOAD = 4;
+ /** Couldn't find enough nodes to send the data to */
+ public static final int ROUTE_NOT_FOUND = 5;
+ /** There were fatal errors in a splitfile insert. */
+ public static final int FATAL_ERRORS_IN_BLOCKS = 6;
+ /** Could not insert a splitfile because a block failed too many times
*/
+ public static final int TOO_MANY_RETRIES_IN_BLOCKS = 7;
+ /** Not able to leave the node at all */
+ public static final int ROUTE_REALLY_NOT_FOUND = 8;
+ /** Collided with pre-existing content */
+ public static final int COLLISION = 9;
+ /** Cancelled by user */
+ public static final int CANCELLED = 10;
+ /** Meta string used in the key (most probably '/') */
+ public static final int META_STRINGS_NOT_SUPPORTED = 11;
+
+ public static String getMessage(int mode) {
+ switch(mode) {
+ case INVALID_URI:
+ return "Caller supplied a URI we cannot use";
+ case BUCKET_ERROR:
+ return "Internal bucket error: out of disk
space/permissions problem?";
+ case INTERNAL_ERROR:
+ return "Internal error";
+ case REJECTED_OVERLOAD:
+ return "A downstream node timed out or was severely
overloaded";
+ case FATAL_ERRORS_IN_BLOCKS:
+ return "Fatal errors in a splitfile insert";
+ case TOO_MANY_RETRIES_IN_BLOCKS:
+ return "Could not insert splitfile: ran out of retries
(nonfatal errors)";
+ case ROUTE_NOT_FOUND:
+ return "Could not propagate the insert to enough nodes
(normal on small networks, try fetching it anyway)";
+ case ROUTE_REALLY_NOT_FOUND:
+ return "Insert could not leave the node at all";
+ case COLLISION:
+ return "Insert collided with different, pre-existing
data at the same key";
+ case META_STRINGS_NOT_SUPPORTED:
+ return "Meta string (most likely a '/') used in the
URI";
+ case CANCELLED:
+ return "Cancelled by user";
+ default:
+ return "Unknown error "+mode;
+ }
+ }
+
+ public static String getShortMessage(int mode) {
+ switch(mode) {
+ case INVALID_URI:
+ return "Invalid URI";
+ case BUCKET_ERROR:
+ return "Temp files error";
+ case INTERNAL_ERROR:
+ return "Internal error";
+ case REJECTED_OVERLOAD:
+ return "Timeout or overload";
+ case FATAL_ERRORS_IN_BLOCKS:
+ return "Some blocks failed fatally";
+ case TOO_MANY_RETRIES_IN_BLOCKS:
+ return "Some blocks ran out of retries";
+ case ROUTE_NOT_FOUND:
+ return "Route not found";
+ case ROUTE_REALLY_NOT_FOUND:
+ return "Request could not leave the node";
+ case COLLISION:
+ return "Collided with existing data";
+ case META_STRINGS_NOT_SUPPORTED:
+ return "Meta string used in the key";
+ case CANCELLED:
+ return "Cancelled";
+ default:
+ return "Unknown error "+mode;
+ }
+ }
+
+ /** Is this error fatal? Non-fatal errors are errors which are likely
to go away with
+ * more retries, or at least for which there is some point retrying.
+ */
+ public boolean isFatal() {
+ return isFatal(mode);
+ }
+
+ public static boolean isFatal(int mode) {
+ switch(mode) {
+ case INVALID_URI:
+ case FATAL_ERRORS_IN_BLOCKS:
+ case COLLISION:
+ case CANCELLED:
+ case META_STRINGS_NOT_SUPPORTED:
+ return true;
+ case BUCKET_ERROR: // maybe
+ case INTERNAL_ERROR: // maybe
+ case REJECTED_OVERLOAD:
+ case TOO_MANY_RETRIES_IN_BLOCKS:
+ case ROUTE_NOT_FOUND:
+ case ROUTE_REALLY_NOT_FOUND:
+ return false;
+ default:
+ Logger.error(InsertException.class, "Error unknown to
isFatal(): "+getMessage(mode));
+ return false;
+ }
+ }
+
+ public static InsertException construct(FailureCodeTracker errors) {
+ if(errors == null) return null;
+ if(errors.isEmpty()) return null;
+ if(errors.isOneCodeOnly()) {
+ return new InsertException(errors.getFirstCode());
+ }
+ int mode;
+ if(errors.isFatal(true))
+ mode = FATAL_ERRORS_IN_BLOCKS;
+ else
+ mode = TOO_MANY_RETRIES_IN_BLOCKS;
+ return new InsertException(mode, errors, null);
+ }
+}
Deleted: trunk/freenet/src/freenet/client/InserterContext.java
===================================================================
--- trunk/freenet/src/freenet/client/InserterContext.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/InserterContext.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -1,92 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.client;
-
-import freenet.client.async.BackgroundBlockEncoder;
-import freenet.client.async.USKManager;
-import freenet.client.events.ClientEventProducer;
-import freenet.client.events.SimpleEventProducer;
-import freenet.crypt.RandomSource;
-import freenet.support.api.BucketFactory;
-import freenet.support.io.NullPersistentFileTracker;
-import freenet.support.io.PersistentFileTracker;
-
-/** Context object for an insert operation, including both simple and
multi-file inserts */
-public class InserterContext {
-
- public final BucketFactory bf;
- public final BucketFactory persistentBucketFactory;
- public final PersistentFileTracker persistentFileTracker;
- /** If true, don't try to compress the data */
- public boolean dontCompress;
- public final RandomSource random;
- public final short splitfileAlgorithm;
- public int maxInsertRetries;
- final int maxSplitInsertThreads;
- public final int consecutiveRNFsCountAsSuccess;
- public final int splitfileSegmentDataBlocks;
- public final int splitfileSegmentCheckBlocks;
- public final ClientEventProducer eventProducer;
- /** Interesting tradeoff, see comments at top of Node.java. */
- public final boolean cacheLocalRequests;
- public final USKManager uskManager;
- public final BackgroundBlockEncoder backgroundBlockEncoder;
-
- public InserterContext(BucketFactory bf, BucketFactory persistentBF,
PersistentFileTracker tracker, RandomSource random,
- int maxRetries, int rnfsToSuccess, int maxThreads, int
splitfileSegmentDataBlocks, int splitfileSegmentCheckBlocks,
- ClientEventProducer eventProducer, boolean
cacheLocalRequests, USKManager uskManager, BackgroundBlockEncoder blockEncoder)
{
- this.bf = bf;
- this.persistentFileTracker = tracker;
- this.persistentBucketFactory = persistentBF;
- this.uskManager = uskManager;
- this.random = random;
- dontCompress = false;
- splitfileAlgorithm = Metadata.SPLITFILE_ONION_STANDARD;
- this.consecutiveRNFsCountAsSuccess = rnfsToSuccess;
- this.maxInsertRetries = maxRetries;
- this.maxSplitInsertThreads = maxThreads;
- this.eventProducer = eventProducer;
- this.splitfileSegmentDataBlocks = splitfileSegmentDataBlocks;
- this.splitfileSegmentCheckBlocks = splitfileSegmentCheckBlocks;
- this.cacheLocalRequests = cacheLocalRequests;
- this.backgroundBlockEncoder = blockEncoder;
- }
-
- public InserterContext(InserterContext ctx, SimpleEventProducer
producer, boolean forceNonPersistent) {
- this.persistentFileTracker = forceNonPersistent ? new
NullPersistentFileTracker() : ctx.persistentFileTracker;
- this.uskManager = ctx.uskManager;
- this.bf = ctx.bf;
- this.persistentBucketFactory = forceNonPersistent ? ctx.bf :
ctx.persistentBucketFactory;
- this.random = ctx.random;
- this.dontCompress = ctx.dontCompress;
- this.splitfileAlgorithm = ctx.splitfileAlgorithm;
- this.consecutiveRNFsCountAsSuccess =
ctx.consecutiveRNFsCountAsSuccess;
- this.maxInsertRetries = ctx.maxInsertRetries;
- this.maxSplitInsertThreads = ctx.maxSplitInsertThreads;
- this.eventProducer = producer;
- this.splitfileSegmentDataBlocks =
ctx.splitfileSegmentDataBlocks;
- this.splitfileSegmentCheckBlocks =
ctx.splitfileSegmentCheckBlocks;
- this.cacheLocalRequests = ctx.cacheLocalRequests;
- this.backgroundBlockEncoder = ctx.backgroundBlockEncoder;
- }
-
- public InserterContext(InserterContext ctx, SimpleEventProducer
producer) {
- this.persistentFileTracker = ctx.persistentFileTracker;
- this.uskManager = ctx.uskManager;
- this.bf = ctx.bf;
- this.persistentBucketFactory = ctx.persistentBucketFactory;
- this.random = ctx.random;
- this.dontCompress = ctx.dontCompress;
- this.splitfileAlgorithm = ctx.splitfileAlgorithm;
- this.consecutiveRNFsCountAsSuccess =
ctx.consecutiveRNFsCountAsSuccess;
- this.maxInsertRetries = ctx.maxInsertRetries;
- this.maxSplitInsertThreads = ctx.maxSplitInsertThreads;
- this.eventProducer = producer;
- this.splitfileSegmentDataBlocks =
ctx.splitfileSegmentDataBlocks;
- this.splitfileSegmentCheckBlocks =
ctx.splitfileSegmentCheckBlocks;
- this.cacheLocalRequests = ctx.cacheLocalRequests;
- this.backgroundBlockEncoder = ctx.backgroundBlockEncoder;
- }
-
-}
Deleted: trunk/freenet/src/freenet/client/InserterException.java
===================================================================
--- trunk/freenet/src/freenet/client/InserterException.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/InserterException.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -1,196 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.client;
-
-import freenet.keys.FreenetURI;
-import freenet.support.Logger;
-
-public class InserterException extends Exception {
- private static final long serialVersionUID = -1106716067841151962L;
-
- private final int mode;
- /** For collection errors */
- public FailureCodeTracker errorCodes;
- /** If a non-serious error, the URI */
- public FreenetURI uri;
-
- public final String extra;
-
- /** Get the failure mode. */
- public int getMode() {
- return mode;
- }
-
- public InserterException(int m, String msg, FreenetURI expectedURI) {
- super(getMessage(m)+": "+msg);
- extra = msg;
- mode = m;
- if(Logger.shouldLog(Logger.MINOR, getClass()))
- Logger.minor(this, "Creating InserterException:
"+getMessage(mode)+": "+msg, this);
- errorCodes = null;
- this.uri = expectedURI;
- }
-
- public InserterException(int m, FreenetURI expectedURI) {
- super(getMessage(m));
- extra = null;
- mode = m;
- if(Logger.shouldLog(Logger.MINOR, getClass()))
- Logger.minor(this, "Creating InserterException:
"+getMessage(mode), this);
- errorCodes = null;
- this.uri = expectedURI;
- }
-
- public InserterException(int mode, Throwable e, FreenetURI expectedURI)
{
- super(getMessage(mode)+": "+e.getMessage());
- extra = e.getMessage();
- if(Logger.shouldLog(Logger.MINOR, getClass()))
- Logger.minor(this, "Creating InserterException:
"+getMessage(mode)+": "+e, e);
- this.mode = mode;
- errorCodes = null;
- initCause(e);
- this.uri = expectedURI;
- }
-
- public InserterException(int mode, FailureCodeTracker errorCodes,
FreenetURI expectedURI) {
- super(getMessage(mode));
- extra = null;
- this.mode = mode;
- if(Logger.shouldLog(Logger.MINOR, getClass()))
- Logger.minor(this, "Creating InserterException:
"+getMessage(mode), this);
- this.errorCodes = errorCodes;
- this.uri = expectedURI;
- }
-
- public InserterException(int mode) {
- super(getMessage(mode));
- extra = null;
- this.mode = mode;
- this.errorCodes = null;
- this.uri = null;
- }
-
- /** Caller supplied a URI we cannot use */
- public static final int INVALID_URI = 1;
- /** Failed to read from or write to a bucket; a kind of internal error
*/
- public static final int BUCKET_ERROR = 2;
- /** Internal error of some sort */
- public static final int INTERNAL_ERROR = 3;
- /** Downstream node was overloaded */
- public static final int REJECTED_OVERLOAD = 4;
- /** Couldn't find enough nodes to send the data to */
- public static final int ROUTE_NOT_FOUND = 5;
- /** There were fatal errors in a splitfile insert. */
- public static final int FATAL_ERRORS_IN_BLOCKS = 6;
- /** Could not insert a splitfile because a block failed too many times
*/
- public static final int TOO_MANY_RETRIES_IN_BLOCKS = 7;
- /** Not able to leave the node at all */
- public static final int ROUTE_REALLY_NOT_FOUND = 8;
- /** Collided with pre-existing content */
- public static final int COLLISION = 9;
- /** Cancelled by user */
- public static final int CANCELLED = 10;
- /** Meta string used in the key (most probably '/') */
- public static final int META_STRINGS_NOT_SUPPORTED = 11;
-
- public static String getMessage(int mode) {
- switch(mode) {
- case INVALID_URI:
- return "Caller supplied a URI we cannot use";
- case BUCKET_ERROR:
- return "Internal bucket error: out of disk
space/permissions problem?";
- case INTERNAL_ERROR:
- return "Internal error";
- case REJECTED_OVERLOAD:
- return "A downstream node timed out or was severely
overloaded";
- case FATAL_ERRORS_IN_BLOCKS:
- return "Fatal errors in a splitfile insert";
- case TOO_MANY_RETRIES_IN_BLOCKS:
- return "Could not insert splitfile: ran out of retries
(nonfatal errors)";
- case ROUTE_NOT_FOUND:
- return "Could not propagate the insert to enough nodes
(normal on small networks, try fetching it anyway)";
- case ROUTE_REALLY_NOT_FOUND:
- return "Insert could not leave the node at all";
- case COLLISION:
- return "Insert collided with different, pre-existing
data at the same key";
- case META_STRINGS_NOT_SUPPORTED:
- return "Meta string (most likely a '/') used in the
URI";
- case CANCELLED:
- return "Cancelled by user";
- default:
- return "Unknown error "+mode;
- }
- }
-
- public static String getShortMessage(int mode) {
- switch(mode) {
- case INVALID_URI:
- return "Invalid URI";
- case BUCKET_ERROR:
- return "Temp files error";
- case INTERNAL_ERROR:
- return "Internal error";
- case REJECTED_OVERLOAD:
- return "Timeout or overload";
- case FATAL_ERRORS_IN_BLOCKS:
- return "Some blocks failed fatally";
- case TOO_MANY_RETRIES_IN_BLOCKS:
- return "Some blocks ran out of retries";
- case ROUTE_NOT_FOUND:
- return "Route not found";
- case ROUTE_REALLY_NOT_FOUND:
- return "Request could not leave the node";
- case COLLISION:
- return "Collided with existing data";
- case META_STRINGS_NOT_SUPPORTED:
- return "Meta string used in the key";
- case CANCELLED:
- return "Cancelled";
- default:
- return "Unknown error "+mode;
- }
- }
-
- /** Is this error fatal? Non-fatal errors are errors which are likely
to go away with
- * more retries, or at least for which there is some point retrying.
- */
- public boolean isFatal() {
- return isFatal(mode);
- }
-
- public static boolean isFatal(int mode) {
- switch(mode) {
- case INVALID_URI:
- case FATAL_ERRORS_IN_BLOCKS:
- case COLLISION:
- case CANCELLED:
- case META_STRINGS_NOT_SUPPORTED:
- return true;
- case BUCKET_ERROR: // maybe
- case INTERNAL_ERROR: // maybe
- case REJECTED_OVERLOAD:
- case TOO_MANY_RETRIES_IN_BLOCKS:
- case ROUTE_NOT_FOUND:
- case ROUTE_REALLY_NOT_FOUND:
- return false;
- default:
- Logger.error(InserterException.class, "Error unknown to
isFatal(): "+getMessage(mode));
- return false;
- }
- }
-
- public static InserterException construct(FailureCodeTracker errors) {
- if(errors == null) return null;
- if(errors.isEmpty()) return null;
- if(errors.isOneCodeOnly()) {
- return new InserterException(errors.getFirstCode());
- }
- int mode;
- if(errors.isFatal(true))
- mode = FATAL_ERRORS_IN_BLOCKS;
- else
- mode = TOO_MANY_RETRIES_IN_BLOCKS;
- return new InserterException(mode, errors, null);
- }
-}
Modified: trunk/freenet/src/freenet/client/PutWaiter.java
===================================================================
--- trunk/freenet/src/freenet/client/PutWaiter.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/client/PutWaiter.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -11,7 +11,7 @@
private boolean finished;
private boolean succeeded;
private FreenetURI uri;
- private InserterException error;
+ private InsertException error;
public void onSuccess(FetchResult result, ClientGetter state) {
// Ignore
@@ -27,7 +27,7 @@
notifyAll();
}
- public synchronized void onFailure(InserterException e,
BaseClientPutter state) {
+ public synchronized void onFailure(InsertException e, BaseClientPutter
state) {
error = e;
finished = true;
notifyAll();
@@ -42,7 +42,7 @@
Logger.error(this, "URI already set: "+this.uri+" but new URI:
"+uri, new Exception("error"));
}
- public synchronized FreenetURI waitForCompletion() throws
InserterException {
+ public synchronized FreenetURI waitForCompletion() throws
InsertException {
while(!finished) {
try {
wait();
@@ -56,7 +56,7 @@
}
if(succeeded) return uri;
Logger.error(this, "Did not succeed but no error");
- throw new InserterException(InserterException.INTERNAL_ERROR,
"Did not succeed but no error", uri);
+ throw new InsertException(InsertException.INTERNAL_ERROR, "Did
not succeed but no error", uri);
}
public void onMajorProgress() {
Modified: trunk/freenet/src/freenet/client/async/ClientCallback.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientCallback.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/ClientCallback.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -5,7 +5,7 @@
import freenet.client.FetchException;
import freenet.client.FetchResult;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.keys.FreenetURI;
/**
@@ -21,7 +21,7 @@
public void onSuccess(BaseClientPutter state);
- public void onFailure(InserterException e, BaseClientPutter state);
+ public void onFailure(InsertException e, BaseClientPutter state);
public void onGeneratedURI(FreenetURI uri, BaseClientPutter state);
Modified: trunk/freenet/src/freenet/client/async/ClientPutState.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientPutState.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/ClientPutState.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -3,7 +3,7 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.client.async;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.support.SimpleFieldSet;
/**
@@ -20,7 +20,7 @@
public abstract void cancel();
/** Schedule the request. */
- public abstract void schedule() throws InserterException;
+ public abstract void schedule() throws InsertException;
/**
* Get the token, an object which is passed around with the insert and
may be
Modified: trunk/freenet/src/freenet/client/async/ClientPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientPutter.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/ClientPutter.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -5,8 +5,8 @@
import freenet.client.ClientMetadata;
import freenet.client.InsertBlock;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.client.events.SplitfileProgressEvent;
import freenet.keys.BaseClientKey;
@@ -21,7 +21,7 @@
final Bucket data;
final FreenetURI targetURI;
final ClientMetadata cm;
- final InserterContext ctx;
+ final InsertContext ctx;
final String targetFilename;
private ClientPutState currentState;
private boolean finished;
@@ -48,7 +48,7 @@
* is an error reading this in, we will restart from scratch.
* @param targetFilename If set, create a one-file manifest containing
this filename pointing to this file.
*/
- public ClientPutter(ClientCallback client, Bucket data, FreenetURI
targetURI, ClientMetadata cm, InserterContext ctx,
+ public ClientPutter(ClientCallback client, Bucket data, FreenetURI
targetURI, ClientMetadata cm, InsertContext ctx,
ClientRequestScheduler chkScheduler,
ClientRequestScheduler sskScheduler, short priorityClass, boolean getCHKOnly,
boolean isMetadata, Object clientContext,
SimpleFieldSet stored, String targetFilename) {
super(priorityClass, chkScheduler, sskScheduler, clientContext);
@@ -65,18 +65,18 @@
this.targetFilename = targetFilename;
}
- public void start(boolean earlyEncode) throws InserterException {
+ public void start(boolean earlyEncode) throws InsertException {
start(earlyEncode, false);
}
- public boolean start(boolean earlyEncode, boolean restart) throws
InserterException {
+ public boolean start(boolean earlyEncode, boolean restart) throws
InsertException {
if(Logger.shouldLog(Logger.MINOR, this))
Logger.minor(this, "Starting "+this);
try {
this.targetURI.checkInsertURI();
if(data == null)
- throw new
InserterException(InserterException.BUCKET_ERROR, "No data to insert", null);
+ throw new
InsertException(InsertException.BUCKET_ERROR, "No data to insert", null);
boolean cancel = false;
synchronized(this) {
@@ -94,7 +94,7 @@
}
}
if(cancel) {
- onFailure(new
InserterException(InserterException.CANCELLED), null);
+ onFailure(new
InsertException(InsertException.CANCELLED), null);
oldProgress = null;
return false;
}
@@ -102,7 +102,7 @@
cancel = cancelled;
}
if(cancel) {
- onFailure(new
InserterException(InserterException.CANCELLED), null);
+ onFailure(new
InsertException(InsertException.CANCELLED), null);
oldProgress = null;
return false;
}
@@ -112,10 +112,10 @@
cancel = cancelled;
}
if(cancel) {
- onFailure(new
InserterException(InserterException.CANCELLED), null);
+ onFailure(new
InsertException(InsertException.CANCELLED), null);
return false;
}
- } catch (InserterException e) {
+ } catch (InsertException e) {
Logger.error(this, "Failed to start insert: "+e, e);
synchronized(this) {
finished = true;
@@ -146,7 +146,7 @@
client.onSuccess(this);
}
- public void onFailure(InserterException e, ClientPutState state) {
+ public void onFailure(InsertException e, ClientPutState state) {
synchronized(this) {
finished = true;
currentState = null;
@@ -178,7 +178,7 @@
startedStarting = true;
}
if(oldState != null) oldState.cancel();
- onFailure(new InserterException(InserterException.CANCELLED),
null);
+ onFailure(new InsertException(InsertException.CANCELLED), null);
}
public synchronized boolean isFinished() {
@@ -229,7 +229,7 @@
return true;
}
- public boolean restart(boolean earlyEncode) throws InserterException {
+ public boolean restart(boolean earlyEncode) throws InsertException {
return start(earlyEncode, true);
}
Modified: trunk/freenet/src/freenet/client/async/MultiPutCompletionCallback.java
===================================================================
--- trunk/freenet/src/freenet/client/async/MultiPutCompletionCallback.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/MultiPutCompletionCallback.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -2,7 +2,7 @@
import java.util.Vector;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.keys.BaseClientKey;
import freenet.support.Logger;
@@ -19,7 +19,7 @@
private final PutCompletionCallback cb;
private ClientPutState generator;
private final BaseClientPutter parent;
- private InserterException e;
+ private InsertException e;
private boolean finished;
private boolean started;
public final Object token;
@@ -46,7 +46,7 @@
complete(null);
}
- public void onFailure(InserterException e, ClientPutState state) {
+ public void onFailure(InsertException e, ClientPutState state) {
synchronized(this) {
if(finished) return;
waitingFor.remove(state);
@@ -60,7 +60,7 @@
complete(e);
}
- private void complete(InserterException e) {
+ private void complete(InsertException e) {
synchronized(this) {
if(finished) return;
finished = true;
@@ -156,7 +156,7 @@
cb.onBlockSetFinished(this);
}
- public void schedule() throws InserterException {
+ public void schedule() throws InsertException {
// Do nothing
}
Modified: trunk/freenet/src/freenet/client/async/PutCompletionCallback.java
===================================================================
--- trunk/freenet/src/freenet/client/async/PutCompletionCallback.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/PutCompletionCallback.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -1,6 +1,6 @@
package freenet.client.async;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.keys.BaseClientKey;
@@ -11,7 +11,7 @@
public void onSuccess(ClientPutState state);
- public void onFailure(InserterException e, ClientPutState state);
+ public void onFailure(InsertException e, ClientPutState state);
public void onEncode(BaseClientKey usk, ClientPutState state);
Modified: trunk/freenet/src/freenet/client/async/SimpleHealingQueue.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleHealingQueue.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/SimpleHealingQueue.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -5,8 +5,8 @@
import java.util.HashMap;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.keys.BaseClientKey;
import freenet.keys.CHKBlock;
@@ -18,10 +18,10 @@
final int maxRunning;
int counter;
- InserterContext ctx;
+ InsertContext ctx;
final HashMap runningInserters;
- public SimpleHealingQueue(ClientRequestScheduler scheduler,
InserterContext context, short prio, int maxRunning) {
+ public SimpleHealingQueue(ClientRequestScheduler scheduler,
InsertContext context, short prio, int maxRunning) {
super(prio, scheduler, null, context);
this.ctx = context;
this.runningInserters = new HashMap();
@@ -87,7 +87,7 @@
data.free();
}
- public void onFailure(InserterException e, ClientPutState state) {
+ public void onFailure(InsertException e, ClientPutState state) {
SingleBlockInserter sbi = (SingleBlockInserter)state;
Bucket data = (Bucket) sbi.getToken();
synchronized(this) {
Modified: trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -14,8 +14,8 @@
import freenet.client.ClientMetadata;
import freenet.client.DefaultMIMETypes;
import freenet.client.InsertBlock;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.client.MetadataUnresolvedException;
import freenet.client.events.SplitfileProgressEvent;
@@ -30,7 +30,7 @@
private class PutHandler extends BaseClientPutter implements
PutCompletionCallback {
- protected PutHandler(final SimpleManifestPutter smp, String
name, Bucket data, ClientMetadata cm, boolean getCHKOnly) throws
InserterException {
+ protected PutHandler(final SimpleManifestPutter smp, String
name, Bucket data, ClientMetadata cm, boolean getCHKOnly) throws
InsertException {
super(smp.priorityClass, smp.chkScheduler,
smp.sskScheduler, smp.client);
this.cm = cm;
this.data = data;
@@ -67,7 +67,7 @@
private String targetInZip;
private final Bucket data;
- public void start() throws InserterException {
+ public void start() throws InsertException {
if((origSFI == null) && (metadata != null)) return;
origSFI.start(null);
origSFI = null;
@@ -94,7 +94,7 @@
insertedAllFiles();
}
- public void onFailure(InserterException e, ClientPutState
state) {
+ public void onFailure(InsertException e, ClientPutState state) {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
if(logMINOR) Logger.minor(this, "Failed: "+this+" -
"+e, e);
fail(e);
@@ -188,7 +188,7 @@
private FreenetURI finalURI;
private FreenetURI targetURI;
private boolean finished;
- private final InserterContext ctx;
+ private final InsertContext ctx;
private final ClientCallback cb;
private final boolean getCHKOnly;
private boolean insertedAllFiles;
@@ -210,7 +210,7 @@
public SimpleManifestPutter(ClientCallback cb, ClientRequestScheduler
chkSched,
ClientRequestScheduler sskSched, HashMap
manifestElements, short prioClass, FreenetURI target,
- String defaultName, InserterContext ctx, boolean
getCHKOnly, Object clientContext, boolean earlyEncode) throws InserterException
{
+ String defaultName, InsertContext ctx, boolean
getCHKOnly, Object clientContext, boolean earlyEncode) throws InsertException {
super(prioClass, chkSched, sskSched, clientContext);
logMINOR = Logger.shouldLog(Logger.MINOR, this);
this.defaultName = defaultName;
@@ -236,7 +236,7 @@
// FIXME do something.
}
- public void start() throws InserterException {
+ public void start() throws InsertException {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
if(logMINOR) Logger.minor(this, "Starting "+this);
PutHandler[] running;
@@ -257,7 +257,7 @@
insertedAllFiles = true;
gotAllMetadata();
}
- } catch (InserterException e) {
+ } catch (InsertException e) {
cancelAndFinish();
throw e;
}
@@ -266,11 +266,11 @@
if(cancel) cancel();
}
- private void makePutHandlers(HashMap manifestElements, HashMap
putHandlersByName) throws InserterException {
+ private void makePutHandlers(HashMap manifestElements, HashMap
putHandlersByName) throws InsertException {
makePutHandlers(manifestElements, putHandlersByName, "/");
}
- private void makePutHandlers(HashMap manifestElements, HashMap
putHandlersByName, String ZipPrefix) throws InserterException {
+ private void makePutHandlers(HashMap manifestElements, HashMap
putHandlersByName, String ZipPrefix) throws InsertException {
Iterator it = manifestElements.keySet().iterator();
while(it.hasNext()) {
String name = (String) it.next();
@@ -310,7 +310,7 @@
} else {
try {
ph = new
PutHandler(this,name, data, cm, getCHKOnly);
- } catch (InserterException e) {
+ } catch (InsertException e) {
cancelAndFinish();
throw e;
}
@@ -341,7 +341,7 @@
if(defaultName != null) {
Metadata meta = (Metadata)
namesToByteArrays.get(defaultName);
if(meta == null) {
- fail(new
InserterException(InserterException.INVALID_URI, "Default name "+defaultName+"
does not exist", null));
+ fail(new
InsertException(InsertException.INVALID_URI, "Default name "+defaultName+" does
not exist", null));
return;
}
namesToByteArrays.put("", meta);
@@ -371,15 +371,15 @@
bucket =
BucketTools.makeImmutableBucket(ctx.bf, baseMetadata.writeToByteArray());
break;
} catch (IOException e) {
- fail(new
InserterException(InserterException.BUCKET_ERROR, e, null));
+ fail(new
InsertException(InsertException.BUCKET_ERROR, e, null));
return;
} catch (MetadataUnresolvedException e) {
try {
resolve(e);
} catch (IOException e1) {
- fail(new
InserterException(InserterException.BUCKET_ERROR, e, null));
+ fail(new
InsertException(InsertException.BUCKET_ERROR, e, null));
return;
- } catch (InserterException e2) {
+ } catch (InsertException e2) {
fail(e2);
}
}
@@ -435,10 +435,10 @@
isMetadata = false;
insertAsArchiveManifest = true;
} catch (ZipException e) {
- fail(new
InserterException(InserterException.INTERNAL_ERROR, e, null));
+ fail(new
InsertException(InsertException.INTERNAL_ERROR, e, null));
return;
} catch (IOException e) {
- fail(new
InserterException(InserterException.BUCKET_ERROR, e, null));
+ fail(new
InsertException(InsertException.BUCKET_ERROR, e, null));
return;
}
} else
@@ -450,12 +450,12 @@
this.metadataPuttersByMetadata.put(baseMetadata,
metadataInserter);
metadataPuttersUnfetchable.put(baseMetadata,
metadataInserter);
metadataInserter.start(null);
- } catch (InserterException e) {
+ } catch (InsertException e) {
fail(e);
}
}
- private boolean resolve(MetadataUnresolvedException e) throws
InserterException, IOException {
+ private boolean resolve(MetadataUnresolvedException e) throws
InsertException, IOException {
Metadata[] metas = e.mustResolve;
boolean mustWait = false;
for(int i=0;i<metas.length;i++) {
@@ -522,7 +522,7 @@
cb.onSuccess(this);
}
- private void fail(InserterException e) {
+ private void fail(InsertException e) {
// Cancel all, then call the callback
cancelAndFinish();
@@ -543,7 +543,7 @@
}
public void cancel() {
- fail(new InserterException(InserterException.CANCELLED));
+ fail(new InsertException(InsertException.CANCELLED));
}
public void onSuccess(ClientPutState state) {
@@ -569,7 +569,7 @@
complete();
}
- public void onFailure(InserterException e, ClientPutState state) {
+ public void onFailure(InsertException e, ClientPutState state) {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
fail(e);
}
Modified: trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -8,8 +8,8 @@
import java.net.MalformedURLException;
import freenet.client.FailureCodeTracker;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.keys.CHKEncodeException;
import freenet.keys.ClientCHKBlock;
import freenet.keys.ClientKeyBlock;
@@ -37,7 +37,7 @@
FreenetURI resultingURI;
final PutCompletionCallback cb;
final BaseClientPutter parent;
- final InserterContext ctx;
+ final InsertContext ctx;
private int retries;
private final FailureCodeTracker errors;
private boolean finished;
@@ -50,7 +50,7 @@
final int sourceLength;
private int consecutiveRNFs;
- public SingleBlockInserter(BaseClientPutter parent, Bucket data, short
compressionCodec, FreenetURI uri, InserterContext ctx, PutCompletionCallback
cb, boolean isMetadata, int sourceLength, int token, boolean getCHKOnly,
boolean addToParent, boolean dontSendEncoded, Object tokenObject) {
+ public SingleBlockInserter(BaseClientPutter parent, Bucket data, short
compressionCodec, FreenetURI uri, InsertContext ctx, PutCompletionCallback cb,
boolean isMetadata, int sourceLength, int token, boolean getCHKOnly, boolean
addToParent, boolean dontSendEncoded, Object tokenObject) {
this.consecutiveRNFs = 0;
this.tokenObject = tokenObject;
this.token = token;
@@ -76,37 +76,37 @@
logMINOR = Logger.shouldLog(Logger.MINOR, this);
}
- protected ClientKeyBlock innerEncode() throws InserterException {
+ protected ClientKeyBlock innerEncode() throws InsertException {
String uriType = uri.getKeyType().toUpperCase();
if(uriType.equals("CHK")) {
try {
return ClientCHKBlock.encode(sourceData,
isMetadata, compressionCodec == -1, compressionCodec, sourceLength);
} catch (CHKEncodeException e) {
Logger.error(this, "Caught "+e, e);
- throw new
InserterException(InserterException.INTERNAL_ERROR, e, null);
+ throw new
InsertException(InsertException.INTERNAL_ERROR, e, null);
} catch (IOException e) {
Logger.error(this, "Caught "+e+" encoding data
"+sourceData, e);
- throw new
InserterException(InserterException.BUCKET_ERROR, e, null);
+ throw new
InsertException(InsertException.BUCKET_ERROR, e, null);
}
} else if(uriType.equals("SSK") || uriType.equals("KSK")) {
try {
InsertableClientSSK ik =
InsertableClientSSK.create(uri);
return ik.encode(sourceData, isMetadata,
compressionCodec == -1, compressionCodec, sourceLength, ctx.random);
} catch (MalformedURLException e) {
- throw new
InserterException(InserterException.INVALID_URI, e, null);
+ throw new
InsertException(InsertException.INVALID_URI, e, null);
} catch (SSKEncodeException e) {
Logger.error(this, "Caught "+e, e);
- throw new
InserterException(InserterException.INTERNAL_ERROR, e, null);
+ throw new
InsertException(InsertException.INTERNAL_ERROR, e, null);
} catch (IOException e) {
Logger.error(this, "Caught "+e, e);
- throw new
InserterException(InserterException.BUCKET_ERROR, e, null);
+ throw new
InsertException(InsertException.BUCKET_ERROR, e, null);
}
} else {
- throw new
InserterException(InserterException.INVALID_URI, "Unknown keytype "+uriType,
null);
+ throw new InsertException(InsertException.INVALID_URI,
"Unknown keytype "+uriType, null);
}
}
- protected ClientKeyBlock encode() throws InserterException {
+ protected ClientKeyBlock encode() throws InsertException {
ClientKeyBlock block;
boolean shouldSend;
synchronized(this) {
@@ -139,29 +139,29 @@
public void onFailure(LowLevelPutException e) {
if(parent.isCancelled()) {
- fail(new
InserterException(InserterException.CANCELLED));
+ fail(new InsertException(InsertException.CANCELLED));
return;
}
switch(e.code) {
case LowLevelPutException.COLLISION:
- fail(new
InserterException(InserterException.COLLISION));
+ fail(new InsertException(InsertException.COLLISION));
break;
case LowLevelPutException.INTERNAL_ERROR:
- errors.inc(InserterException.INTERNAL_ERROR);
+ errors.inc(InsertException.INTERNAL_ERROR);
break;
case LowLevelPutException.REJECTED_OVERLOAD:
- errors.inc(InserterException.REJECTED_OVERLOAD);
+ errors.inc(InsertException.REJECTED_OVERLOAD);
break;
case LowLevelPutException.ROUTE_NOT_FOUND:
- errors.inc(InserterException.ROUTE_NOT_FOUND);
+ errors.inc(InsertException.ROUTE_NOT_FOUND);
break;
case LowLevelPutException.ROUTE_REALLY_NOT_FOUND:
- errors.inc(InserterException.ROUTE_REALLY_NOT_FOUND);
+ errors.inc(InsertException.ROUTE_REALLY_NOT_FOUND);
break;
default:
Logger.error(this, "Unknown LowLevelPutException code:
"+e.code);
- errors.inc(InserterException.INTERNAL_ERROR);
+ errors.inc(InsertException.INTERNAL_ERROR);
}
if(e.code == LowLevelPutException.ROUTE_NOT_FOUND) {
consecutiveRNFs++;
@@ -176,17 +176,17 @@
if(logMINOR) Logger.minor(this, "Failed: "+e);
retries++;
if((retries > ctx.maxInsertRetries) && (ctx.maxInsertRetries !=
-1)) {
- fail(InserterException.construct(errors));
+ fail(InsertException.construct(errors));
return;
}
getScheduler().register(this);
}
- private void fail(InserterException e) {
+ private void fail(InsertException e) {
fail(e, false);
}
- private void fail(InserterException e, boolean forceFatal) {
+ private void fail(InsertException e, boolean forceFatal) {
synchronized(this) {
if(finished) return;
finished = true;
@@ -204,17 +204,17 @@
if(finished) return null;
}
return encode();
- } catch (InserterException e) {
+ } catch (InsertException e) {
cb.onFailure(e, this);
return null;
} catch (Throwable t) {
Logger.error(this, "Caught "+t, t);
- cb.onFailure(new
InserterException(InserterException.INTERNAL_ERROR, t, null), this);
+ cb.onFailure(new
InsertException(InsertException.INTERNAL_ERROR, t, null), this);
return null;
}
}
- public void schedule() throws InserterException {
+ public void schedule() throws InsertException {
synchronized(this) {
if(finished) return;
}
@@ -257,7 +257,7 @@
public void onSuccess() {
if(logMINOR) Logger.minor(this, "Succeeded ("+this+"): "+token);
if(parent.isCancelled()) {
- fail(new
InserterException(InserterException.CANCELLED));
+ fail(new InsertException(InsertException.CANCELLED));
return;
}
synchronized(this) {
@@ -278,7 +278,7 @@
}
RandomGrabArray arr = getParentGrabArray();
if(arr != null) arr.remove(this);
- cb.onFailure(new
InserterException(InserterException.CANCELLED), this);
+ cb.onFailure(new InsertException(InsertException.CANCELLED),
this);
}
public synchronized boolean isCancelled() {
@@ -293,9 +293,9 @@
core.realPut(b, ctx.cacheLocalRequests);
else {
if(parent.isCancelled())
- fail(new
InserterException(InserterException.CANCELLED));
+ fail(new
InsertException(InsertException.CANCELLED));
else
- fail(new
InserterException(InserterException.BUCKET_ERROR));
+ fail(new
InsertException(InsertException.BUCKET_ERROR));
return false;
}
} catch (LowLevelPutException e) {
@@ -328,7 +328,7 @@
public void tryEncode() {
try {
encode();
- } catch (InserterException e) {
+ } catch (InsertException e) {
fail(e);
} catch (Throwable t) {
Logger.error(this, "Caught "+t, t);
Modified: trunk/freenet/src/freenet/client/async/SingleFileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileInserter.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/SingleFileInserter.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -5,8 +5,8 @@
import java.util.HashMap;
import freenet.client.InsertBlock;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.client.MetadataUnresolvedException;
import freenet.client.events.FinishedCompressionEvent;
@@ -38,7 +38,7 @@
private static boolean logMINOR;
final BaseClientPutter parent;
final InsertBlock block;
- final InserterContext ctx;
+ final InsertContext ctx;
final boolean metadata;
final PutCompletionCallback cb;
final boolean getCHKOnly;
@@ -64,12 +64,12 @@
* @param freeData If true, free the data when possible.
* @param targetFilename
* @param earlyEncode If true, try to get a URI as quickly as possible.
- * @throws InserterException
+ * @throws InsertException
*/
SingleFileInserter(BaseClientPutter parent, PutCompletionCallback cb,
InsertBlock block,
- boolean metadata, InserterContext ctx, boolean
dontCompress,
+ boolean metadata, InsertContext ctx, boolean
dontCompress,
boolean getCHKOnly, boolean reportMetadataOnly, Object
token, boolean insertAsArchiveManifest,
- boolean freeData, String targetFilename, boolean
earlyEncode) throws InserterException {
+ boolean freeData, String targetFilename, boolean
earlyEncode) throws InsertException {
this.earlyEncode = earlyEncode;
this.reportMetadataOnly = reportMetadataOnly;
this.token = token;
@@ -85,7 +85,7 @@
logMINOR = Logger.shouldLog(Logger.MINOR, this);
}
- public void start(SimpleFieldSet fs) throws InserterException {
+ public void start(SimpleFieldSet fs) throws InsertException {
if(fs != null) {
String type = fs.get("Type");
if(type.equals("SplitHandler")) {
@@ -119,24 +119,24 @@
public void run() {
try {
tryCompress();
- } catch (InserterException e) {
+ } catch (InsertException e) {
cb.onFailure(e, SingleFileInserter.this);
} catch (OutOfMemoryError e) {
OOMHandler.handleOOM(e);
System.err.println("OffThreadCompressor thread
above failed.");
// Might not be heap, so try anyway
- cb.onFailure(new
InserterException(InserterException.INTERNAL_ERROR, e, null),
SingleFileInserter.this);
+ cb.onFailure(new
InsertException(InsertException.INTERNAL_ERROR, e, null),
SingleFileInserter.this);
} catch (Throwable t) {
Logger.error(this, "Caught in OffThreadCompressor: "+t, t);
System.err.println("Caught in OffThreadCompressor: "+t);
t.printStackTrace();
// Try to fail gracefully
- cb.onFailure(new
InserterException(InserterException.INTERNAL_ERROR, t, null),
SingleFileInserter.this);
+ cb.onFailure(new
InsertException(InsertException.INTERNAL_ERROR, t, null),
SingleFileInserter.this);
}
}
}
- private void tryCompress() throws InserterException {
+ private void tryCompress() throws InsertException {
// First, determine how small it needs to be
Bucket origData = block.getData();
Bucket data = origData;
@@ -153,7 +153,7 @@
blockSize = CHKBlock.DATA_LENGTH;
oneBlockCompressedSize =
CHKBlock.MAX_COMPRESSED_DATA_LENGTH;
} else {
- throw new
InserterException(InserterException.INVALID_URI, "Unknown key type: "+type,
null);
+ throw new InsertException(InsertException.INVALID_URI,
"Unknown key type: "+type, null);
}
Compressor bestCodec = null;
@@ -193,7 +193,7 @@
}
}
} catch (IOException e) {
- throw new
InserterException(InserterException.BUCKET_ERROR, e, null);
+ throw new
InsertException(InsertException.BUCKET_ERROR, e, null);
} catch (CompressionOutputSizeException e) {
// Impossible
throw new Error(e);
@@ -215,7 +215,7 @@
boolean fitsInOneCHK = bestCodec == null ? compressedDataSize <
CHKBlock.DATA_LENGTH : compressedDataSize < CHKBlock.MAX_COMPRESSED_DATA_LENGTH;
if(block.getData().size() > Integer.MAX_VALUE)
- throw new
InserterException(InserterException.INTERNAL_ERROR, "2GB+ should not encode to
one block!", null);
+ throw new
InsertException(InsertException.INTERNAL_ERROR, "2GB+ should not encode to one
block!", null);
boolean noMetadata = ((block.clientMetadata == null) ||
block.clientMetadata.isTrivial()) && targetFilename == null;
if(noMetadata && !insertAsArchiveManifest) {
@@ -248,11 +248,11 @@
metadataBucket =
BucketTools.makeImmutableBucket(ctx.bf, meta.writeToByteArray());
} catch (IOException e) {
Logger.error(this, "Caught "+e, e);
- throw new
InserterException(InserterException.BUCKET_ERROR, e, null);
+ throw new
InsertException(InsertException.BUCKET_ERROR, e, null);
} catch (MetadataUnresolvedException e) {
// Impossible, we're not inserting a
manifest.
Logger.error(this, "Caught "+e, e);
- throw new
InserterException(InserterException.INTERNAL_ERROR, "Got
MetadataUnresolvedException in SingleFileInserter: "+e.toString(), null);
+ throw new
InsertException(InsertException.INTERNAL_ERROR, "Got
MetadataUnresolvedException in SingleFileInserter: "+e.toString(), null);
}
ClientPutState metaPutter =
createInserter(parent, metadataBucket, (short) -1, block.desiredURI, ctx, mcb,
true, (int)origSize, -1, getCHKOnly, true, false);
mcb.addURIGenerator(metaPutter);
@@ -299,8 +299,8 @@
}
private ClientPutState createInserter(BaseClientPutter parent, Bucket
data, short compressionCodec, FreenetURI uri,
- InserterContext ctx, PutCompletionCallback cb, boolean
isMetadata, int sourceLength, int token, boolean getCHKOnly,
- boolean addToParent, boolean encodeCHK) throws
InserterException {
+ InsertContext ctx, PutCompletionCallback cb, boolean
isMetadata, int sourceLength, int token, boolean getCHKOnly,
+ boolean addToParent, boolean encodeCHK) throws
InsertException {
uri.checkInsertURI(); // will throw an exception if needed
@@ -309,7 +309,7 @@
return new USKInserter(parent, data,
compressionCodec, uri, ctx, cb, isMetadata, sourceLength, token,
getCHKOnly, addToParent, this.token);
} catch (MalformedURLException e) {
- throw new
InserterException(InserterException.INVALID_URI, e, null);
+ throw new
InsertException(InsertException.INVALID_URI, e, null);
}
} else {
SingleBlockInserter sbi =
@@ -345,10 +345,10 @@
* @param forceMetadata If true, the insert is metadata,
regardless of what the
* encompassing SplitFileInserter says (i.e. it's multi-level
metadata).
* @throws ResumeException Thrown if the resume fails.
- * @throws InserterException Thrown if some other error
prevents the insert
+ * @throws InsertException Thrown if some other error prevents
the insert
* from starting.
*/
- void start(SimpleFieldSet fs, boolean forceMetadata) throws
ResumeException, InserterException {
+ void start(SimpleFieldSet fs, boolean forceMetadata) throws
ResumeException, InsertException {
boolean meta = metadata || forceMetadata;
@@ -435,7 +435,7 @@
cb.onSuccess(this);
}
- public void onFailure(InserterException e, ClientPutState
state) {
+ public void onFailure(InsertException e, ClientPutState state) {
synchronized(this) {
if(finished){
if(freeData)
@@ -447,7 +447,7 @@
}
public void onMetadata(Metadata meta, ClientPutState state) {
- InserterException e = null;
+ InsertException e = null;
synchronized(this) {
if(finished) return;
if(reportMetadataOnly) {
@@ -458,10 +458,10 @@
metaInsertSuccess = true;
} else if(state == metadataPutter) {
Logger.error(this, "Got metadata for
metadata");
- e = new
InserterException(InserterException.INTERNAL_ERROR, "Did not expect to get
metadata for metadata inserter", null);
+ e = new
InsertException(InsertException.INTERNAL_ERROR, "Did not expect to get metadata
for metadata inserter", null);
} else if(state != sfi) {
Logger.error(this, "Got metadata from
unknown state "+state);
- e = new
InserterException(InserterException.INTERNAL_ERROR, "Did not expect to get
metadata for metadata inserter", null);
+ e = new
InsertException(InsertException.INTERNAL_ERROR, "Did not expect to get metadata
for metadata inserter", null);
} else {
// Already started metadata putter ?
(in which case we've got the metadata twice)
if(metadataPutter != null) return;
@@ -481,7 +481,7 @@
metaBytes = meta.writeToByteArray();
} catch (MetadataUnresolvedException e1) {
Logger.error(this, "Impossible: "+e1, e1);
- InserterException ex = new
InserterException(InserterException.INTERNAL_ERROR,
"MetadataUnresolvedException in SingleFileInserter.SplitHandler: "+e1, null);
+ InsertException ex = new
InsertException(InsertException.INTERNAL_ERROR, "MetadataUnresolvedException in
SingleFileInserter.SplitHandler: "+e1, null);
ex.initCause(e1);
fail(ex);
return;
@@ -500,7 +500,7 @@
metaBytes =
meta.writeToByteArray();
} catch (MetadataUnresolvedException
e1) {
Logger.error(this, "Impossible
(2): "+e1, e1);
- InserterException ex = new
InserterException(InserterException.INTERNAL_ERROR,
"MetadataUnresolvedException in SingleFileInserter.SplitHandler(2): "+e1, null);
+ InsertException ex = new
InsertException(InsertException.INTERNAL_ERROR, "MetadataUnresolvedException in
SingleFileInserter.SplitHandler(2): "+e1, null);
ex.initCause(e1);
fail(ex);
return;
@@ -512,7 +512,7 @@
try {
metadataBucket =
BucketTools.makeImmutableBucket(ctx.bf, metaBytes);
} catch (IOException e1) {
- InserterException ex = new
InserterException(InserterException.BUCKET_ERROR, e1, null);
+ InsertException ex = new
InsertException(InsertException.BUCKET_ERROR, e1, null);
fail(ex);
return;
}
@@ -525,14 +525,14 @@
if(!(dataFetchable || earlyEncode))
return;
}
if(logMINOR) Logger.minor(this, "Putting
metadata on "+metadataPutter+" from "+sfi+"
("+((SplitFileInserter)sfi).getLength()+ ')');
- } catch (InserterException e1) {
+ } catch (InsertException e1) {
cb.onFailure(e1, this);
return;
}
startMetadata();
}
- private void fail(InserterException e) {
+ private void fail(InsertException e) {
if(logMINOR) Logger.minor(this, "Failing: "+e, e);
ClientPutState oldSFI = null;
ClientPutState oldMetadataPutter = null;
@@ -593,7 +593,7 @@
cb.onBlockSetFinished(this);
}
- public void schedule() throws InserterException {
+ public void schedule() throws InsertException {
sfi.schedule();
}
@@ -672,7 +672,7 @@
// Get all the URIs ASAP so we can
start to insert the metadata.
((SplitFileInserter)splitInserter).forceEncode();
}
- } catch (InserterException e1) {
+ } catch (InsertException e1) {
Logger.error(this, "Failing "+this+" : "+e1,
e1);
fail(e1);
return;
@@ -690,7 +690,7 @@
block.free();
}
- public void schedule() throws InserterException {
+ public void schedule() throws InsertException {
start(null);
}
Modified: trunk/freenet/src/freenet/client/async/SplitFileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserter.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserter.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -9,8 +9,8 @@
import freenet.client.ClientMetadata;
import freenet.client.FECCodec;
import freenet.client.FailureCodeTracker;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.keys.CHKBlock;
import freenet.keys.ClientCHK;
@@ -24,7 +24,7 @@
private static boolean logMINOR;
final BaseClientPutter parent;
- final InserterContext ctx;
+ final InsertContext ctx;
final PutCompletionCallback cb;
final long dataLength;
final short compressionCodec;
@@ -66,7 +66,7 @@
return fs;
}
- public SplitFileInserter(BaseClientPutter put, PutCompletionCallback
cb, Bucket data, Compressor bestCodec, long decompressedLength, ClientMetadata
clientMetadata, InserterContext ctx, boolean getCHKOnly, boolean isMetadata,
Object token, boolean insertAsArchiveManifest, boolean freeData) throws
InserterException {
+ public SplitFileInserter(BaseClientPutter put, PutCompletionCallback
cb, Bucket data, Compressor bestCodec, long decompressedLength, ClientMetadata
clientMetadata, InsertContext ctx, boolean getCHKOnly, boolean isMetadata,
Object token, boolean insertAsArchiveManifest, boolean freeData) throws
InsertException {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
this.parent = put;
this.insertAsArchiveManifest = insertAsArchiveManifest;
@@ -82,7 +82,7 @@
try {
dataBuckets = BucketTools.split(data,
CHKBlock.DATA_LENGTH, ctx.persistentBucketFactory);
} catch (IOException e) {
- throw new
InserterException(InserterException.BUCKET_ERROR, e, null);
+ throw new InsertException(InsertException.BUCKET_ERROR,
e, null);
}
if(freeData) data.free();
countDataBlocks = dataBuckets.length;
@@ -104,7 +104,7 @@
countCheckBlocks = count;
}
- public SplitFileInserter(BaseClientPutter parent, PutCompletionCallback
cb, ClientMetadata clientMetadata, InserterContext ctx, boolean getCHKOnly,
boolean metadata, Object token, boolean insertAsArchiveManifest, SimpleFieldSet
fs) throws ResumeException {
+ public SplitFileInserter(BaseClientPutter parent, PutCompletionCallback
cb, ClientMetadata clientMetadata, InsertContext ctx, boolean getCHKOnly,
boolean metadata, Object token, boolean insertAsArchiveManifest, SimpleFieldSet
fs) throws ResumeException {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
this.parent = parent;
this.insertAsArchiveManifest = insertAsArchiveManifest;
@@ -230,7 +230,7 @@
return (SplitFileInserterSegment[]) segs.toArray(new
SplitFileInserterSegment[segs.size()]);
}
- public void start() throws InserterException {
+ public void start() throws InsertException {
for(int i=0;i<segments.length;i++)
segments[i].start();
@@ -300,13 +300,13 @@
if(missingURIs) {
if(logMINOR) Logger.minor(this, "Missing URIs");
// Error
- fail(new
InserterException(InserterException.INTERNAL_ERROR, "Missing URIs after
encoding", null));
+ fail(new
InsertException(InsertException.INTERNAL_ERROR, "Missing URIs after encoding",
null));
return;
} else
cb.onMetadata(m, this);
}
- private void fail(InserterException e) {
+ private void fail(InsertException e) {
synchronized(this) {
if(finished) return;
finished = true;
@@ -379,7 +379,7 @@
}
}
- InserterException e = segment.getException();
+ InsertException e = segment.getException();
if((e != null) && e.isFatal()) {
cancel();
} else {
@@ -413,7 +413,7 @@
FailureCodeTracker tracker = new
FailureCodeTracker(true);
boolean allSucceeded = true;
for(int i=0;i<segments.length;i++) {
- InserterException e =
segments[i].getException();
+ InsertException e = segments[i].getException();
if(e == null) continue;
if(logMINOR) Logger.minor(this, "Failure on
segment "+i+" : "+segments[i]+" : "+e, e);
allSucceeded = false;
@@ -424,12 +424,12 @@
if(allSucceeded)
cb.onSuccess(this);
else {
-
cb.onFailure(InserterException.construct(tracker), this);
+
cb.onFailure(InsertException.construct(tracker), this);
}
} catch (Throwable t) {
// We MUST tell the parent *something*!
Logger.error(this, "Caught "+t, t);
- cb.onFailure(new
InserterException(InserterException.INTERNAL_ERROR), this);
+ cb.onFailure(new
InsertException(InsertException.INTERNAL_ERROR), this);
}
}
@@ -442,7 +442,7 @@
segments[i].cancel();
}
- public void schedule() throws InserterException {
+ public void schedule() throws InsertException {
start();
}
Modified: trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -5,8 +5,8 @@
import freenet.client.FECCodec;
import freenet.client.FECJob;
import freenet.client.FailureCodeTracker;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.client.FECCodec.StandardOnionFECCodecEncoderCallback;
import freenet.keys.BaseClientKey;
@@ -42,7 +42,7 @@
final SingleBlockInserter[] checkBlockInserters;
- final InserterContext blockInsertContext;
+ final InsertContext blockInsertContext;
final int segNo;
@@ -54,7 +54,7 @@
private boolean hasURIs;
- private InserterException toThrow;
+ private InsertException toThrow;
private final FailureCodeTracker errors;
@@ -66,7 +66,7 @@
public SplitFileInserterSegment(SplitFileInserter parent,
FECCodec splitfileAlgo, Bucket[] origDataBlocks,
- InserterContext blockInsertContext, boolean getCHKOnly,
int segNo) {
+ InsertContext blockInsertContext, boolean getCHKOnly,
int segNo) {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
this.parent = parent;
this.getCHKOnly = getCHKOnly;
@@ -92,7 +92,7 @@
* @throws ResumeException
*/
public SplitFileInserterSegment(SplitFileInserter parent,
- SimpleFieldSet fs, short splitfileAlgorithm,
InserterContext ctx,
+ SimpleFieldSet fs, short splitfileAlgorithm,
InsertContext ctx,
boolean getCHKOnly, int segNo) throws ResumeException {
this.parent = parent;
this.getCHKOnly = getCHKOnly;
@@ -109,7 +109,7 @@
else
this.errors = new FailureCodeTracker(true);
if (finished && !errors.isEmpty())
- toThrow = InserterException.construct(errors);
+ toThrow = InsertException.construct(errors);
blocksGotURI = 0;
blocksCompleted = 0;
SimpleFieldSet dataFS = fs.subset("DataBlocks");
@@ -387,7 +387,7 @@
return fs;
}
- public void start() throws InserterException {
+ public void start() throws InsertException {
if (logMINOR)
Logger.minor(this, "Starting segment " + segNo + " of "
+ parent
+ " (" + parent.dataLength + "): " +
this + " ( finished="
@@ -473,8 +473,8 @@
}
} catch (Throwable t) {
Logger.error(this, "Caught " + t + " while encoding " +
this, t);
- InserterException ex = new InserterException(
- InserterException.INTERNAL_ERROR, t,
null);
+ InsertException ex = new InsertException(
+ InsertException.INTERNAL_ERROR, t,
null);
finish(ex);
return;
}
@@ -497,7 +497,7 @@
}
}
- private void finish(InserterException ex) {
+ private void finish(InsertException ex) {
if (logMINOR)
Logger.minor(this, "Finishing " + this + " with " + ex,
ex);
synchronized (this) {
@@ -514,7 +514,7 @@
if (finished)
return;
finished = true;
- toThrow = InserterException.construct(errors);
+ toThrow = InsertException.construct(errors);
}
parent.segmentFinished(this);
}
@@ -568,7 +568,7 @@
completed(x);
}
- public void onFailure(InserterException e, ClientPutState state) {
+ public void onFailure(InsertException e, ClientPutState state) {
if (parent.parent.isCancelled()) {
parent.cancel();
return;
@@ -657,7 +657,7 @@
return dataURIs;
}
- InserterException getException() {
+ InsertException getException() {
synchronized (this) {
return toThrow;
}
@@ -669,7 +669,7 @@
return;
finished = true;
if (toThrow != null)
- toThrow = new
InserterException(InserterException.CANCELLED);
+ toThrow = new
InsertException(InsertException.CANCELLED);
}
for (int i = 0; i < dataBlockInserters.length; i++) {
SingleBlockInserter sbi = dataBlockInserters[i];
Modified: trunk/freenet/src/freenet/client/async/USKInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKInserter.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/async/USKInserter.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -7,8 +7,8 @@
import java.net.MalformedURLException;
import java.util.Arrays;
-import freenet.client.InserterContext;
-import freenet.client.InserterException;
+import freenet.client.InsertContext;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.keys.BaseClientKey;
import freenet.keys.FreenetURI;
@@ -30,7 +30,7 @@
final BaseClientPutter parent;
final Bucket data;
final short compressionCodec;
- final InserterContext ctx;
+ final InsertContext ctx;
final PutCompletionCallback cb;
final boolean isMetadata;
final int sourceLength;
@@ -51,7 +51,7 @@
/** After attempting inserts on this many slots, go back to the Fetcher
*/
private static final long MAX_TRIED_SLOTS = 10;
- public void schedule() throws InserterException {
+ public void schedule() throws InsertException {
// Caller calls schedule()
// schedule() calls scheduleFetcher()
// scheduleFetcher() creates a Fetcher (set up to tell us about
author-errors as well as valid inserts)
@@ -114,7 +114,7 @@
}
try {
sbi.schedule();
- } catch (InserterException e) {
+ } catch (InsertException e) {
cb.onFailure(e, this);
}
}
@@ -136,9 +136,9 @@
// FINISHED!!!! Yay!!!
}
- public synchronized void onFailure(InserterException e, ClientPutState
state) {
+ public synchronized void onFailure(InsertException e, ClientPutState
state) {
sbi = null;
- if(e.getMode() == InserterException.COLLISION) {
+ if(e.getMode() == InsertException.COLLISION) {
// Try the next slot
edition++;
if(consecutiveCollisions++ > MAX_TRIED_SLOTS)
@@ -151,7 +151,7 @@
}
public USKInserter(BaseClientPutter parent, Bucket data, short
compressionCodec, FreenetURI uri,
- InserterContext ctx, PutCompletionCallback cb, boolean
isMetadata, int sourceLength, int token,
+ InsertContext ctx, PutCompletionCallback cb, boolean
isMetadata, int sourceLength, int token,
boolean getCHKOnly, boolean addToParent, Object
tokenObject) throws MalformedURLException {
this.tokenObject = tokenObject;
this.parent = parent;
@@ -185,7 +185,7 @@
synchronized(this) {
finished = true;
}
- cb.onFailure(new
InserterException(InserterException.CANCELLED), this);
+ cb.onFailure(new InsertException(InsertException.CANCELLED),
this);
}
public void onFailure() {
Modified: trunk/freenet/src/freenet/client/events/BlockInsertErrorEvent.java
===================================================================
--- trunk/freenet/src/freenet/client/events/BlockInsertErrorEvent.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/client/events/BlockInsertErrorEvent.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -3,17 +3,17 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.client.events;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.keys.FreenetURI;
public class BlockInsertErrorEvent implements ClientEvent {
public static final int code = 0x05;
- public final InserterException e;
+ public final InsertException e;
public final FreenetURI key;
public final int retryNumber;
- public BlockInsertErrorEvent(InserterException e, FreenetURI key, int
retryNumber) {
+ public BlockInsertErrorEvent(InsertException e, FreenetURI key, int
retryNumber) {
this.e = e;
this.key = key;
this.retryNumber = retryNumber;
Modified: trunk/freenet/src/freenet/clients/http/NinjaSpider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/NinjaSpider.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/clients/http/NinjaSpider.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -36,7 +36,7 @@
import freenet.client.FetchException;
import freenet.client.FetchResult;
import freenet.client.FetchContext;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.async.BaseClientPutter;
import freenet.client.async.ClientCallback;
import freenet.client.async.ClientGetter;
@@ -221,7 +221,7 @@
// Ignore
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
// Ignore
}
Modified: trunk/freenet/src/freenet/clients/http/Spider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Spider.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/clients/http/Spider.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -26,7 +26,7 @@
import freenet.client.FetchException;
import freenet.client.FetchResult;
import freenet.client.FetchContext;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.async.BaseClientPutter;
import freenet.client.async.ClientCallback;
import freenet.client.async.ClientGetter;
@@ -165,7 +165,7 @@
// Ignore
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
// Ignore
}
Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -13,7 +13,7 @@
import freenet.client.FetchResult;
import freenet.client.HighLevelSimpleClient;
import freenet.client.InsertBlock;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.keys.FreenetURI;
import freenet.l10n.L10n;
import freenet.support.HTMLEncoder;
@@ -117,7 +117,7 @@
return client.fetch(uri, maxSize, clientContext);
}
- FreenetURI insert(InsertBlock insert, String filenameHint, boolean
getCHKOnly) throws InserterException {
+ FreenetURI insert(InsertBlock insert, String filenameHint, boolean
getCHKOnly) throws InsertException {
// For now, just run it blocking.
insert.desiredURI.checkInsertURI();
return client.insert(insert, getCHKOnly, filenameHint);
Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -16,7 +16,7 @@
import freenet.client.ClientMetadata;
import freenet.client.HighLevelSimpleClient;
import freenet.client.InsertBlock;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.clients.http.filter.GenericReadFilterCallback;
import freenet.clients.http.bookmark.BookmarkItems;
import freenet.clients.http.bookmark.BookmarkCategory;
@@ -264,7 +264,7 @@
HTMLNode infobox =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-success",
l10n("insertSucceededTitle")));
content =
ctx.getPageMaker().getContentNode(infobox);
content.addChild("#",
l10n("finInsertSuccessWithKey", "key", finalKey.toString()));
- } catch (InserterException e) {
+ } catch (InsertException e) {
HTMLNode infobox =
ctx.getPageMaker().getInfobox("infobox-error", l10n("insertFailedTitle"));
content =
ctx.getPageMaker().getContentNode(infobox);
content.addChild("#",
l10n("insertFailedWithMessage", "message", e.getMessage()));
@@ -273,7 +273,7 @@
content.addChild("#",
l10n("uriWouldHaveBeen", "uri", e.uri.toString()));
}
int mode = e.getMode();
- if((mode ==
InserterException.FATAL_ERRORS_IN_BLOCKS) || (mode ==
InserterException.TOO_MANY_RETRIES_IN_BLOCKS)) {
+ if((mode ==
InsertException.FATAL_ERRORS_IN_BLOCKS) || (mode ==
InsertException.TOO_MANY_RETRIES_IN_BLOCKS)) {
content.addChild("br"); /* TODO */
content.addChild("#",
l10n("splitfileErrorLabel"));
content.addChild("pre",
e.errorCodes.toVerboseString());
@@ -316,7 +316,7 @@
L10n.addL10nSubstitution(content,
"keyInsertedSuccessfullyWithKeyAndName",
new String[] { "link", "/link",
"name" },
new String[] { "<a
href=\"/"+u+"\">", "</a>", u });
- } catch (InserterException e) {
+ } catch (InsertException e) {
HTMLNode infobox =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-error",
l10n("insertFailedTitle")));
content =
ctx.getPageMaker().getContentNode(infobox);
content.addChild("#",
l10n("insertFailedWithMessage", "message", e.getMessage()));
@@ -325,7 +325,7 @@
content.addChild("#",
l10n("uriWouldHaveBeen", "uri", e.uri.toString()));
}
int mode = e.getMode();
- if((mode ==
InserterException.FATAL_ERRORS_IN_BLOCKS) || (mode ==
InserterException.TOO_MANY_RETRIES_IN_BLOCKS)) {
+ if((mode ==
InsertException.FATAL_ERRORS_IN_BLOCKS) || (mode ==
InsertException.TOO_MANY_RETRIES_IN_BLOCKS)) {
content.addChild("br"); /* TODO */
content.addChild("#",
l10n("splitfileErrorLabel"));
content.addChild("pre",
e.errorCodes.toVerboseString());
Modified: trunk/freenet/src/freenet/frost/message/FrostMessage.java
===================================================================
--- trunk/freenet/src/freenet/frost/message/FrostMessage.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/frost/message/FrostMessage.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -8,7 +8,7 @@
import freenet.keys.FreenetURI;
import freenet.support.io.ArrayBucket;
import java.net.MalformedURLException;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
public final class FrostMessage {
@@ -270,7 +270,7 @@
return key;
}
- public final FreenetURI insertMessage(HighLevelSimpleClient client, int
innitialIndex) throws InserterException, MalformedURLException
+ public final FreenetURI insertMessage(HighLevelSimpleClient client, int
innitialIndex) throws InsertException, MalformedURLException
{
boolean keepgoing;
FreenetURI key = null;
@@ -293,7 +293,7 @@
try {
returnKey = client.insert(block, false, null); // I don't know
what that 'false' is
}
- catch (InserterException e)
+ catch (InsertException e)
{
System.err.println("FIN -> insert failed with the message" +
e.getMessage());
if(moreTries--==0) throw e;
Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -24,7 +24,7 @@
import freenet.support.URLDecoder;
import freenet.support.URLEncodedFormatException;
import freenet.support.URLEncoder;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
/**
* Note that the metadata pairs below are not presently supported. They are
supported
@@ -799,12 +799,12 @@
suggestedEdition);
}
- public void checkInsertURI() throws InserterException {
+ public void checkInsertURI() throws InsertException {
if(metaStr != null && metaStr.length > 0)
- throw new
InserterException(InserterException.META_STRINGS_NOT_SUPPORTED,this);
+ throw new
InsertException(InsertException.META_STRINGS_NOT_SUPPORTED,this);
}
- public static void checkInsertURI(FreenetURI uri) throws
InserterException { uri.checkInsertURI(); }
+ public static void checkInsertURI(FreenetURI uri) throws
InsertException { uri.checkInsertURI(); }
public URI toRelativeURI() throws URISyntaxException {
// Single-argument constructor used because it preserves
encoded /'es in path.
Modified: trunk/freenet/src/freenet/node/NodeARKInserter.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeARKInserter.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/node/NodeARKInserter.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -9,7 +9,7 @@
import freenet.client.ClientMetadata;
import freenet.client.FetchException;
import freenet.client.FetchResult;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.async.BaseClientPutter;
import freenet.client.async.ClientCallback;
import freenet.client.async.ClientGetter;
@@ -163,7 +163,7 @@
}
}
}
- } catch (InserterException e) {
+ } catch (InsertException e) {
onFailure(e, inserter);
}
}
@@ -192,7 +192,7 @@
}
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
if(logMINOR) Logger.minor(this, "ARK insert failed: "+e);
synchronized(this) {
lastInsertedPeers = null;
Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -7,7 +7,7 @@
import freenet.client.ArchiveManager;
import freenet.client.HighLevelSimpleClient;
import freenet.client.HighLevelSimpleClientImpl;
-import freenet.client.InserterContext;
+import freenet.client.InsertContext;
import freenet.client.async.BackgroundBlockEncoder;
import freenet.client.async.HealingQueue;
import freenet.client.async.SimpleHealingQueue;
@@ -266,7 +266,7 @@
uskManager = new USKManager(this);
healingQueue = new
SimpleHealingQueue(requestStarters.chkPutScheduler,
- new InserterContext(tempBucketFactory,
tempBucketFactory, persistentTempBucketFactory,
+ new InsertContext(tempBucketFactory,
tempBucketFactory, persistentTempBucketFactory,
random, 0, 2, 1, 0, 0, new
SimpleEventProducer(),
!Node.DONT_CACHE_LOCAL_REQUESTS, uskManager, backgroundBlockEncoder),
RequestStarter.PREFETCH_PRIORITY_CLASS, 512 /* FIXME make configurable */);
Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -29,7 +29,7 @@
import freenet.client.FetchResult;
import freenet.client.HighLevelSimpleClient;
import freenet.client.InsertBlock;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.events.EventDumper;
import freenet.clients.http.filter.ContentFilter;
import freenet.clients.http.filter.ContentFilter.FilterOutput;
@@ -455,12 +455,12 @@
FreenetURI uri;
try {
uri = client.insert(block, getCHKOnly, null);
- } catch (InserterException e) {
+ } catch (InsertException e) {
outsb.append("Error: ").append(e.getMessage());
if(e.uri != null)
outsb.append("URI would have been: ").append(e.uri);
int mode = e.getMode();
- if((mode == InserterException.FATAL_ERRORS_IN_BLOCKS) || (mode
== InserterException.TOO_MANY_RETRIES_IN_BLOCKS)) {
+ if((mode == InsertException.FATAL_ERRORS_IN_BLOCKS) || (mode ==
InsertException.TOO_MANY_RETRIES_IN_BLOCKS)) {
outsb.append("Splitfile-specific
error:\n").append(e.errorCodes.toVerboseString());
}
outsb.append("\r\n");
@@ -535,7 +535,7 @@
outsb.append("=======================================================");
outsb.append("URI: ").append(uri);
outsb.append("=======================================================");
- } catch (InserterException e) {
+ } catch (InsertException e) {
outsb.append("Finished insert but: ").append(e.getMessage());
if(e.uri != null) {
uri = e.uri;
@@ -591,7 +591,7 @@
outsb.append("Upload rate: ").append(rate).append(" bytes /
second\r\n");
} catch (FileNotFoundException e1) {
outsb.append("File not found");
- } catch (InserterException e) {
+ } catch (InsertException e) {
outsb.append("Finished insert but: ").append(e.getMessage());
if(e.uri != null) {
outsb.append("URI would have been: ").append(e.uri);
@@ -638,7 +638,7 @@
try {
FreenetURI result =
client.insertRedirect(insert, target);
outsb.append("Successfully inserted to fetch URI:
").append(result);
- } catch (InserterException e) {
+ } catch (InsertException e) {
outsb.append("Finished insert but: ").append(e.getMessage());
Logger.normal(this, "Error: "+e, e);
if(e.uri != null) {
Modified: trunk/freenet/src/freenet/node/fcp/ClientGet.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGet.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/ClientGet.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -10,7 +10,7 @@
import freenet.client.FetchContext;
import freenet.client.FetchException;
import freenet.client.FetchResult;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.async.BaseClientPutter;
import freenet.client.async.ClientCallback;
import freenet.client.async.ClientGetter;
@@ -454,7 +454,7 @@
// Ignore
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
// Ignore
}
Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPut.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/ClientPut.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -13,7 +13,7 @@
import freenet.client.DefaultMIMETypes;
import freenet.client.FetchException;
import freenet.client.FetchResult;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.Metadata;
import freenet.client.MetadataUnresolvedException;
import freenet.client.async.ClientGetter;
@@ -125,7 +125,7 @@
} catch (MetadataUnresolvedException e) {
// Impossible
Logger.error(this, "Impossible: "+e, e);
- onFailure(new
InserterException(InserterException.INTERNAL_ERROR, "Impossible: "+e+" in
ClientPut", null), null);
+ onFailure(new
InsertException(InsertException.INTERNAL_ERROR, "Impossible: "+e+" in
ClientPut", null), null);
this.data = null;
clientMetadata = cm;
putter = null;
@@ -199,7 +199,7 @@
} catch (MetadataUnresolvedException e) {
// Impossible
Logger.error(this, "Impossible: "+e, e);
- onFailure(new
InserterException(InserterException.INTERNAL_ERROR, "Impossible: "+e+" in
ClientPut", null), null);
+ onFailure(new
InsertException(InsertException.INTERNAL_ERROR, "Impossible: "+e+" in
ClientPut", null), null);
this.data = null;
clientMetadata = cm;
putter = null;
@@ -318,7 +318,7 @@
} catch (MetadataUnresolvedException e) {
// Impossible
Logger.error(this, "Impossible: "+e, e);
- onFailure(new
InserterException(InserterException.INTERNAL_ERROR, "Impossible: "+e+" in
ClientPut", null), null);
+ onFailure(new
InsertException(InsertException.INTERNAL_ERROR, "Impossible: "+e+" in
ClientPut", null), null);
this.data = null;
clientMetadata = cm;
origFilename = null;
@@ -359,7 +359,7 @@
synchronized(this) {
started = true;
}
- } catch (InserterException e) {
+ } catch (InsertException e) {
synchronized(this) {
started = true;
}
@@ -368,7 +368,7 @@
synchronized(this) {
started = true;
}
- onFailure(new
InserterException(InserterException.INTERNAL_ERROR, t, null), null);
+ onFailure(new
InsertException(InsertException.INTERNAL_ERROR, t, null), null);
}
}
@@ -471,7 +471,7 @@
}
}
return true;
- } catch (InserterException e) {
+ } catch (InsertException e) {
onFailure(e, null);
return false;
}
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutBase.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutBase.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutBase.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -22,7 +22,7 @@
*/
public abstract class ClientPutBase extends ClientRequest implements
ClientCallback, ClientEventListener {
- final InserterContext ctx;
+ final InsertContext ctx;
final boolean getCHKOnly;
// Verbosity bitmasks
@@ -34,7 +34,7 @@
/** Has the request succeeded? */
protected boolean succeeded;
/** If the request failed, how did it fail? PutFailedMessage is the most
- * convenient way to store this (InserterException has a stack trace!).
+ * convenient way to store this (InsertException has a stack trace!).
*/
private PutFailedMessage putFailedMessage;
/** URI generated for the insert. */
@@ -56,7 +56,7 @@
boolean dontCompress, int maxRetries, boolean
earlyEncode) {
super(uri, identifier, verbosity, handler, priorityClass,
persistenceType, clientToken, global);
this.getCHKOnly = getCHKOnly;
- ctx = new InserterContext(client.defaultInsertContext, new
SimpleEventProducer(), persistenceType == ClientRequest.PERSIST_CONNECTION);
+ ctx = new InsertContext(client.defaultInsertContext, new
SimpleEventProducer(), persistenceType == ClientRequest.PERSIST_CONNECTION);
ctx.dontCompress = dontCompress;
ctx.eventProducer.addEventListener(this);
ctx.maxInsertRetries = maxRetries;
@@ -68,7 +68,7 @@
boolean getCHKOnly, boolean dontCompress, int
maxRetries, boolean earlyEncode) {
super(uri, identifier, verbosity, handler, client,
priorityClass, persistenceType, clientToken, global);
this.getCHKOnly = getCHKOnly;
- ctx = new InserterContext(client.defaultInsertContext, new
SimpleEventProducer(), persistenceType == ClientRequest.PERSIST_CONNECTION);
+ ctx = new InsertContext(client.defaultInsertContext, new
SimpleEventProducer(), persistenceType == ClientRequest.PERSIST_CONNECTION);
ctx.dontCompress = dontCompress;
ctx.eventProducer.addEventListener(this);
ctx.maxInsertRetries = maxRetries;
@@ -84,7 +84,7 @@
finished = Fields.stringToBool(fs.get("Finished"), false);
//finished = false;
succeeded = Fields.stringToBool(fs.get("Succeeded"), false);
- ctx = new InserterContext(client.defaultInsertContext, new
SimpleEventProducer());
+ ctx = new InsertContext(client.defaultInsertContext, new
SimpleEventProducer());
ctx.dontCompress = dontCompress;
ctx.eventProducer.addEventListener(this);
ctx.maxInsertRetries = maxRetries;
@@ -116,7 +116,7 @@
client.server.forceStorePersistentRequests();
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
if(finished) return;
synchronized(this) {
finished = true;
@@ -143,7 +143,7 @@
if( !finished ) {
synchronized(this) {
finished = true;
- InserterException cancelled = new
InserterException(InserterException.CANCELLED);
+ InsertException cancelled = new
InsertException(InsertException.CANCELLED);
putFailedMessage = new PutFailedMessage(cancelled, identifier,
global);
}
trySendFinalMessage(null);
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutDir.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutDir.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutDir.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -11,7 +11,7 @@
import freenet.client.FetchException;
import freenet.client.FetchResult;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.async.ClientGetter;
import freenet.client.async.ClientRequester;
import freenet.client.async.ManifestElement;
@@ -65,7 +65,7 @@
try {
p = new SimpleManifestPutter(this,
client.core.requestStarters.chkPutScheduler,
client.core.requestStarters.sskPutScheduler,
manifestElements, priorityClass, uri,
defaultName, ctx, getCHKOnly, client.lowLevelClient, earlyEncode);
- } catch (InserterException e) {
+ } catch (InsertException e) {
onFailure(e, null);
p = null;
}
@@ -137,7 +137,7 @@
if(!finished)
p = new SimpleManifestPutter(this,
client.core.requestStarters.chkPutScheduler,
client.core.requestStarters.sskPutScheduler,
manifestElements,
priorityClass, uri, defaultName, ctx, getCHKOnly, client, earlyEncode);
- } catch (InserterException e) {
+ } catch (InsertException e) {
onFailure(e, null);
p = null;
}
@@ -162,7 +162,7 @@
FCPMessage msg = persistentTagMessage();
client.queueClientRequestMessage(msg, 0);
}
- } catch (InserterException e) {
+ } catch (InsertException e) {
started = true;
onFailure(e, null);
}
Modified: trunk/freenet/src/freenet/node/fcp/FCPClient.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPClient.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/FCPClient.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -8,7 +8,7 @@
import freenet.client.FetchContext;
import freenet.client.HighLevelSimpleClient;
-import freenet.client.InserterContext;
+import freenet.client.InsertContext;
import freenet.node.NodeClientCore;
import freenet.support.LRUQueue;
import freenet.support.Logger;
@@ -64,7 +64,7 @@
/** Client (one FCPClient = one HighLevelSimpleClient = one round-robin
slot) */
private final HighLevelSimpleClient client;
public final FetchContext defaultFetchContext;
- public final InserterContext defaultInsertContext;
+ public final InsertContext defaultInsertContext;
public final NodeClientCore core;
/** Are we the global queue? */
public final boolean isGlobalQueue;
Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java 2007-05-04 19:30:30 UTC
(rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java 2007-05-04 19:31:38 UTC
(rev 13151)
@@ -27,7 +27,7 @@
import freenet.client.DefaultMIMETypes;
import freenet.client.FetchContext;
import freenet.client.HighLevelSimpleClient;
-import freenet.client.InserterContext;
+import freenet.client.InsertContext;
import freenet.config.Config;
import freenet.config.InvalidConfigValueException;
import freenet.config.SubConfig;
@@ -73,7 +73,7 @@
private boolean haveLoadedPersistentRequests;
private long persistenceInterval;
final FetchContext defaultFetchContext;
- public InserterContext defaultInsertContext;
+ public InsertContext defaultInsertContext;
public static final int QUEUE_MAX_RETRIES = -1;
public static final long QUEUE_MAX_DATA_SIZE = Long.MAX_VALUE;
private boolean canStartPersister = false;
Modified: trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -96,7 +96,7 @@
/**
* Write to a SimpleFieldSet for storage or transmission.
* @param verbose If true, include fields which derive directly from
static
- * stuff on InserterException (and therefore can be omitted if talking
to self
+ * stuff on InsertException (and therefore can be omitted if talking to
self
* or another node).
*/
public SimpleFieldSet getFieldSet(boolean verbose) {
Modified: trunk/freenet/src/freenet/node/fcp/PutFailedMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/PutFailedMessage.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/node/fcp/PutFailedMessage.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -6,7 +6,7 @@
import java.net.MalformedURLException;
import freenet.client.FailureCodeTracker;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.keys.FreenetURI;
import freenet.node.Node;
import freenet.support.Fields;
@@ -24,16 +24,16 @@
final boolean global;
final boolean isFatal;
- public PutFailedMessage(InserterException e, String identifier, boolean
global) {
+ public PutFailedMessage(InsertException e, String identifier, boolean
global) {
this.code = e.getMode();
- this.codeDescription = InserterException.getMessage(code);
- this.shortCodeDescription =
InserterException.getShortMessage(code);
+ this.codeDescription = InsertException.getMessage(code);
+ this.shortCodeDescription =
InsertException.getShortMessage(code);
this.extraDescription = e.extra;
this.tracker = e.errorCodes;
this.expectedURI = e.uri;
this.identifier = identifier;
this.global = global;
- this.isFatal = InserterException.isFatal(code);
+ this.isFatal = InsertException.isFatal(code);
}
/**
@@ -55,9 +55,9 @@
isFatal = Fields.stringToBool(fs.get("Fatal"), false);
shortCodeDescription = fs.get("ShortCodeDescription");
} else {
- codeDescription = InserterException.getMessage(code);
- isFatal = InserterException.isFatal(code);
- shortCodeDescription =
InserterException.getShortMessage(code);
+ codeDescription = InsertException.getMessage(code);
+ isFatal = InsertException.isFatal(code);
+ shortCodeDescription =
InsertException.getShortMessage(code);
}
extraDescription = fs.get("ExtraDescription");
Modified: trunk/freenet/src/freenet/node/updater/NodeUpdater.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdater.java 2007-05-04
19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdater.java 2007-05-04
19:31:38 UTC (rev 13151)
@@ -8,7 +8,7 @@
import freenet.client.FetchException;
import freenet.client.FetchResult;
import freenet.client.FetchContext;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.async.BaseClientPutter;
import freenet.client.async.ClientCallback;
import freenet.client.async.ClientGetter;
@@ -227,7 +227,7 @@
// Impossible
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
// Impossible
}
Modified: trunk/freenet/src/freenet/node/updater/RevocationChecker.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/RevocationChecker.java
2007-05-04 19:30:30 UTC (rev 13150)
+++ trunk/freenet/src/freenet/node/updater/RevocationChecker.java
2007-05-04 19:31:38 UTC (rev 13151)
@@ -3,7 +3,7 @@
import freenet.client.FetchException;
import freenet.client.FetchResult;
import freenet.client.FetchContext;
-import freenet.client.InserterException;
+import freenet.client.InsertException;
import freenet.client.async.BaseClientPutter;
import freenet.client.async.ClientCallback;
import freenet.client.async.ClientGetter;
@@ -168,7 +168,7 @@
}
- public void onFailure(InserterException e, BaseClientPutter state) {
+ public void onFailure(InsertException e, BaseClientPutter state) {
// TODO Auto-generated method stub
}