Whitespace and formatting fixes.
[jFCPlib.git] / src / net / pterodactylus / fcp / highlevel / HighLevelProgress.java
index 403ac30..6a71de6 100644 (file)
@@ -30,13 +30,14 @@ package net.pterodactylus.fcp.highlevel;
  * 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 &lt;bombe@freenetproject.org&gt;
- * @version $Id$
  */
 public class HighLevelProgress extends HighLevelResult {
 
@@ -46,6 +47,9 @@ public class HighLevelProgress extends HighLevelResult {
        /** 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;
 
@@ -90,6 +94,20 @@ public class HighLevelProgress extends HighLevelResult {
        }
 
        /**
+        * 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
@@ -164,6 +182,26 @@ public class HighLevelProgress extends HighLevelResult {
        }
 
        /**
+        * 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