* net.pterodactylus.fcp.URIGenerated)
*/
public void receivedURIGenerated(FcpConnection fcpConnection, URIGenerated uriGenerated) {
- /* TODO */
+ if (fcpConnection != HighLevelClient.this.fcpConnection) {
+ return;
+ }
+ String identifier = uriGenerated.getIdentifier();
+ /* TODO - check inserts */
+ HighLevelProgress highLevelProgress = new HighLevelProgress(identifier, uriGenerated.getURI());
+ fireProgressReceived(identifier, highLevelProgress);
}
/**
* request has failed or succeeded. Other fields are not set. If the request is
* not yet finished, {@link #isFetchable()} will tell you whether the request
* has progressed to a state that allows other clients to fetch the inserted
- * data. This is of course only valid for Put and PutDir requests. If none of
- * those methods return <code>true</code>, you can use the block count
- * methods to get detailed progress statistics. When progress you received is a
- * {@link DownloadResult} you do not need to check
+ * data. This is of course only valid for Put and PutDir requests. Alternatively
+ * {@link #getURI()} can return a non-<code>null</code> value which signals
+ * that the request generated a URI. If none of those methods return
+ * <code>true</code>, you can use the block count methods to get detailed
+ * progress statistics. When progress you received is a {@link DownloadResult}
+ * you do not need to check
*
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
* @version $Id$
/** Whether a Put request should be fetchable now. */
private boolean fetchable;
+ /** The generated URI, in case of a Put request. */
+ private String uri;
+
/** The number of total blocks. */
private int totalBlocks;
}
/**
+ * Creates a new high-level progress for a Put or PutDir request that
+ * generated a URI.
+ *
+ * @param identifier
+ * The identifier of the request
+ * @param uri
+ * The URI of the request
+ */
+ public HighLevelProgress(String identifier, String uri) {
+ this(identifier);
+ this.uri = uri;
+ }
+
+ /**
* Creates a new high-level progress with the given values.
*
* @param identifier
}
/**
+ * Returns the URI that was generated by the request. Of course only Put and
+ * PutDir requests will generated URIs.
+ *
+ * @return The generated URI
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * Sets the URI generated by the request.
+ *
+ * @param uri
+ * The generated URI
+ */
+ void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ /**
* Returns the number of total blocks.
*
* @return The number of total blocks