Fix @author tags
diff --git a/src/main/java/com/intel/jndn/utils/Client.java b/src/main/java/com/intel/jndn/utils/Client.java
index 711d24c..e38d38d 100644
--- a/src/main/java/com/intel/jndn/utils/Client.java
+++ b/src/main/java/com/intel/jndn/utils/Client.java
@@ -13,17 +13,18 @@
*/
package com.intel.jndn.utils;
-import java.io.IOException;
-import java.util.concurrent.CompletableFuture;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+
/**
* Base functionality provided by all NDN clients in this package.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface Client {
@@ -38,7 +39,7 @@
* @param interest the {@link Interest} to send over the network
* @return a future {@link Data} packet
*/
- public CompletableFuture<Data> getAsync(Face face, Interest interest);
+ CompletableFuture<Data> getAsync(Face face, Interest interest);
/**
* Convenience method for calling
@@ -50,7 +51,7 @@
* @param name the {@link Name} to wrap inside a default {@link Interest}
* @return a future {@link Data} packet
*/
- public CompletableFuture<Data> getAsync(Face face, Name name);
+ CompletableFuture<Data> getAsync(Face face, Name name);
/**
* Synchronously retrieve the {@link Data} for an {@link Interest}; this will
@@ -64,7 +65,7 @@
* @return a {@link Data} packet
* @throws java.io.IOException if the request fails
*/
- public Data getSync(Face face, Interest interest) throws IOException;
+ Data getSync(Face face, Interest interest) throws IOException;
/**
* Convenience method for calling
@@ -77,5 +78,5 @@
* @return a {@link Data} packet
* @throws java.io.IOException if the request fails
*/
- public Data getSync(Face face, Name name) throws IOException;
+ Data getSync(Face face, Name name) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/ProcessingStage.java b/src/main/java/com/intel/jndn/utils/ProcessingStage.java
index 68b2649..d665c84 100644
--- a/src/main/java/com/intel/jndn/utils/ProcessingStage.java
+++ b/src/main/java/com/intel/jndn/utils/ProcessingStage.java
@@ -18,7 +18,7 @@
* processing stage may convert a data packet with unencrypted content to one
* with encrypted content.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface ProcessingStage<T, Y> {
@@ -30,5 +30,5 @@
* may be a new object)
* @throws Exception if the processing fails
*/
- public Y process(T input) throws Exception;
+ Y process(T input) throws Exception;
}
diff --git a/src/main/java/com/intel/jndn/utils/Server.java b/src/main/java/com/intel/jndn/utils/Server.java
index 197a52a..422074c 100644
--- a/src/main/java/com/intel/jndn/utils/Server.java
+++ b/src/main/java/com/intel/jndn/utils/Server.java
@@ -13,12 +13,13 @@
*/
package com.intel.jndn.utils;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Name;
import net.named_data.jndn.OnInterestCallback;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+
/**
* Base interface for defining a server; see descendant interfaces for different
* modes of serving packets. This class extends {@link Runnable} expecting
@@ -26,20 +27,20 @@
* {@link Runnable#run()} block, thus allowing different ways to manage servers
* (e.g. single-thread vs {@link ScheduledThreadPoolExecutor}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface Server extends Runnable, OnInterestCallback {
/**
* @return the {@link Name} prefix this server is serving on.
*/
- public Name getPrefix();
+ Name getPrefix();
/**
* @return the registered prefix ID of the server on the {@link Face} or -1 if
* unregistered
*/
- public long getRegisteredPrefixId();
+ long getRegisteredPrefixId();
/**
* Add a stage to the server pipeline. Each stage should be processed once the
@@ -49,5 +50,5 @@
*
* @param stage a Data-to-Data processing stage
*/
- public void addPostProcessingStage(ProcessingStage<Data, Data> stage);
+ void addPostProcessingStage(ProcessingStage<Data, Data> stage);
}
diff --git a/src/main/java/com/intel/jndn/utils/client/DataStream.java b/src/main/java/com/intel/jndn/utils/client/DataStream.java
index 3f517a3..f558ab4 100644
--- a/src/main/java/com/intel/jndn/utils/client/DataStream.java
+++ b/src/main/java/com/intel/jndn/utils/client/DataStream.java
@@ -24,7 +24,7 @@
*
* TODO merge with Observable
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface DataStream extends OnData, OnTimeout, OnComplete, OnException {
diff --git a/src/main/java/com/intel/jndn/utils/client/OnComplete.java b/src/main/java/com/intel/jndn/utils/client/OnComplete.java
index 6cbbe86..5bd6811 100644
--- a/src/main/java/com/intel/jndn/utils/client/OnComplete.java
+++ b/src/main/java/com/intel/jndn/utils/client/OnComplete.java
@@ -16,12 +16,12 @@
/**
* Callback fired when an activity is finished.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface OnComplete {
/**
* Called when an activity is finished
*/
- public void onComplete();
+ void onComplete();
}
diff --git a/src/main/java/com/intel/jndn/utils/client/OnException.java b/src/main/java/com/intel/jndn/utils/client/OnException.java
index d4c440d..976a874 100644
--- a/src/main/java/com/intel/jndn/utils/client/OnException.java
+++ b/src/main/java/com/intel/jndn/utils/client/OnException.java
@@ -17,7 +17,7 @@
* Callback fired when an activity throws an exception; this is necessary because
* some actions are performed asynchronously (e.g. in a thread pool) and exceptions
* could otherwise be lost.
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface OnException {
@@ -25,5 +25,5 @@
* Called when an activity throws an exception
* @param exception the exception thrown
*/
- public void onException(Exception exception);
+ void onException(Exception exception);
}
diff --git a/src/main/java/com/intel/jndn/utils/client/SegmentationType.java b/src/main/java/com/intel/jndn/utils/client/SegmentationType.java
index 166d81f..d0b6c6e 100644
--- a/src/main/java/com/intel/jndn/utils/client/SegmentationType.java
+++ b/src/main/java/com/intel/jndn/utils/client/SegmentationType.java
@@ -17,7 +17,7 @@
* Documents known partition types from
* http://named-data.net/doc/tech-memos/naming-conventions.pdf
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public enum SegmentationType {
diff --git a/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java b/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java
index d866675..6155398 100644
--- a/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java
@@ -13,15 +13,16 @@
*/
package com.intel.jndn.utils.client;
-import java.io.IOException;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
+import java.io.IOException;
+
/**
* Define a client that can retrieve segmented packets into a
* {@link DataStream}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface SegmentedClient {
@@ -35,5 +36,5 @@
* @return a data stream of packets returned
* @throws IOException if the initial request fails
*/
- public DataStream getSegmentsAsync(Face face, Interest interest) throws IOException;
+ DataStream getSegmentsAsync(Face face, Interest interest) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/client/StreamingClient.java b/src/main/java/com/intel/jndn/utils/client/StreamingClient.java
index 3ab5fb6..9e75840 100644
--- a/src/main/java/com/intel/jndn/utils/client/StreamingClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/StreamingClient.java
@@ -13,16 +13,17 @@
*/
package com.intel.jndn.utils.client;
-import java.io.IOException;
-import java.io.InputStream;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
+import java.io.IOException;
+import java.io.InputStream;
+
/**
* Define a client that can stream content bytes that are partitioned over
* multiple packets.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface StreamingClient {
@@ -39,5 +40,5 @@
* @return a stream of content bytes
* @throws IOException if the stream setup fails
*/
- public InputStream getStreamAsync(Face face, Interest interest, SegmentationType partitionMarker) throws IOException;
+ InputStream getStreamAsync(Face face, Interest interest, SegmentationType partitionMarker) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java b/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java
index 2659656..d1cdd51 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java
@@ -13,51 +13,40 @@
*/
package com.intel.jndn.utils.client.impl;
+import com.intel.jndn.utils.client.DataStream;
import com.intel.jndn.utils.client.OnComplete;
import com.intel.jndn.utils.client.OnException;
import com.intel.jndn.utils.client.RetryClient;
-import com.intel.jndn.utils.client.SegmentedClient;
-import com.intel.jndn.utils.client.DataStream;
import com.intel.jndn.utils.client.SegmentationType;
+import com.intel.jndn.utils.client.SegmentedClient;
import com.intel.jndn.utils.client.StreamingClient;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.OnTimeout;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Logger;
+
/**
* Implementation of a client that can handle segmented data, retries after
* failed requests, and streaming of data packets.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class AdvancedClient extends SimpleClient implements SegmentedClient, StreamingClient {
- private static final Logger logger = Logger.getLogger(AdvancedClient.class.getName());
public static final int DEFAULT_MAX_RETRIES = 3;
+ private static final Logger logger = Logger.getLogger(AdvancedClient.class.getName());
private static AdvancedClient defaultInstance;
private final SegmentedClient segmentedClient;
private final RetryClient retryClient;
private final StreamingClient streamingClient;
/**
- * Singleton access for simpler client use
- *
- * @return a default client
- */
- public static AdvancedClient getDefault() {
- if (defaultInstance == null) {
- defaultInstance = new AdvancedClient();
- }
- return defaultInstance;
- }
-
- /**
* Build an advanced client
*
* @param sleepTime for synchronous processing, the time to sleep the thread
@@ -90,6 +79,18 @@
}
/**
+ * Singleton access for simpler client use
+ *
+ * @return a default client
+ */
+ public static AdvancedClient getDefault() {
+ if (defaultInstance == null) {
+ defaultInstance = new AdvancedClient();
+ }
+ return defaultInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java b/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
index c1ca4fe..d06795a 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
@@ -13,18 +13,18 @@
*/
package com.intel.jndn.utils.client.impl;
-import com.intel.jndn.utils.client.SegmentedClient;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import net.named_data.jndn.Data;
import net.named_data.jndn.util.Blob;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
/**
* Internal class for assembling a list of {@link Data} packets into one large
* data packet; this implementation will use all properties of the first packet
* in the list and concatenate the content bytes of all packets in order.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
class DataAssembler {
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java b/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java
index 21f1c0e..de85eb6 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java
@@ -14,19 +14,20 @@
package com.intel.jndn.utils.client.impl;
import com.intel.jndn.utils.client.RetryClient;
-import java.io.IOException;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.OnData;
import net.named_data.jndn.OnTimeout;
+import java.io.IOException;
+import java.util.logging.Logger;
+
/**
* Default implementation of {@link RetryClient}; on request failure, this class
* immediately retries the request until a maximum number of retries is reached.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DefaultRetryClient implements RetryClient {
@@ -80,11 +81,11 @@
*/
private class RetryContext implements OnData, OnTimeout {
- public int numFailures = 0;
public final Face face;
public final Interest interest;
public final OnData applicationOnData;
public final OnTimeout applicationOnTimeout;
+ public int numFailures = 0;
public RetryContext(Face face, Interest interest, OnData applicationOnData, OnTimeout applicationOnTimeout) {
this.face = face;
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java b/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
index 83e0baa..302645c 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
@@ -13,10 +13,8 @@
*/
package com.intel.jndn.utils.client.impl;
-import com.intel.jndn.utils.client.SegmentedClient;
import com.intel.jndn.utils.client.DataStream;
-import java.io.IOException;
-import java.util.logging.Logger;
+import com.intel.jndn.utils.client.SegmentedClient;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -24,12 +22,15 @@
import net.named_data.jndn.Name.Component;
import net.named_data.jndn.OnData;
+import java.io.IOException;
+import java.util.logging.Logger;
+
/**
* Retrieve segments one by one until the FinalBlockId indicates an end segment;
* then request remaining packets. This class currently only handles segmented
* data (not yet byte-offset segmented data).
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DefaultSegmentedClient implements SegmentedClient {
@@ -67,6 +68,26 @@
}
/**
+ * Replace the final component of an interest name with a segmented component;
+ * if the interest name does not have a segmented component, this will add
+ * one.
+ *
+ * @param interest the request
+ * @param segmentNumber a segment number
+ * @param marker a marker to use for segmenting the packet
+ * @return a segmented interest (a copy of the passed interest)
+ */
+ protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) {
+ Interest copied = new Interest(interest);
+ Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker);
+ Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker))
+ ? copied.getName().getPrefix(-1)
+ : new Name(copied.getName());
+ copied.setName(newName.append(lastComponent));
+ return copied;
+ }
+
+ /**
* Helper class to track the last requested segment for a given request
* context and request follow-on packets
*/
@@ -126,24 +147,4 @@
}
}
- /**
- * Replace the final component of an interest name with a segmented component;
- * if the interest name does not have a segmented component, this will add
- * one.
- *
- * @param interest the request
- * @param segmentNumber a segment number
- * @param marker a marker to use for segmenting the packet
- * @return a segmented interest (a copy of the passed interest)
- */
- protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) {
- Interest copied = new Interest(interest);
- Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker);
- Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker))
- ? copied.getName().getPrefix(-1)
- : new Name(copied.getName());
- copied.setName(newName.append(lastComponent));
- return copied;
- }
-
}
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java b/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java
index 55fa0f0..29e7c76 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java
@@ -18,23 +18,24 @@
import com.intel.jndn.utils.client.SegmentationType;
import com.intel.jndn.utils.client.SegmentedClient;
import com.intel.jndn.utils.client.StreamingClient;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Interest;
+import net.named_data.jndn.OnData;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.OnData;
/**
* Default implementation of {@link StreamingClient}; uses a segmented client to
* retrieve packets asynchronously and pipes them to a stream as they are
* received.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DefaultStreamingClient implements StreamingClient {
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java b/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
index 7a051ee..27d4187 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
@@ -20,7 +20,7 @@
* Helper methods for dealing with segmented packets (see
* http://named-data.net/doc/tech-memos/naming-conventions.pdf).
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentationHelper {
@@ -33,7 +33,7 @@
* @return true if the name is segmented
*/
public static boolean isSegmented(Name name, byte marker) {
- return name.size() > 0 ? name.get(-1).getValue().buf().get(0) == marker : false;
+ return name.size() > 0 && name.get(-1).getValue().buf().get(0) == marker;
}
/**
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java b/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
index 41fd86a..2d0f691 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
@@ -13,9 +13,16 @@
*/
package com.intel.jndn.utils.client.impl;
+import com.intel.jndn.utils.client.DataStream;
import com.intel.jndn.utils.client.OnComplete;
import com.intel.jndn.utils.client.OnException;
-import com.intel.jndn.utils.client.DataStream;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Interest;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.OnData;
+import net.named_data.jndn.OnTimeout;
+import net.named_data.jndn.encoding.EncodingException;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
@@ -23,12 +30,6 @@
import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Collectors;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.OnData;
-import net.named_data.jndn.OnTimeout;
-import net.named_data.jndn.encoding.EncodingException;
/**
* As packets are received, they are mapped by their last component's segment
@@ -40,7 +41,7 @@
* data is received; if data is received out of order, the callbacks will not be
* fired until adjoining packets are received.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedDataStream implements DataStream {
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java b/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java
index 9e2e594..00e224f 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java
@@ -14,24 +14,25 @@
package com.intel.jndn.utils.client.impl;
import com.intel.jndn.utils.Client;
-import java.io.IOException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Level;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
import net.named_data.jndn.OnData;
import net.named_data.jndn.OnTimeout;
-import java.util.logging.Logger;
import net.named_data.jndn.encoding.EncodingException;
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Provide a client to simplify information retrieval over the NDN network.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SimpleClient implements Client {
@@ -43,18 +44,6 @@
private final long interestLifetime;
/**
- * Singleton access for simpler client use
- *
- * @return a default client
- */
- public static SimpleClient getDefault() {
- if (defaultInstance == null) {
- defaultInstance = new SimpleClient();
- }
- return defaultInstance;
- }
-
- /**
* Build a simple client
*
* @param sleepTime for synchronous processing, the time to sleep the thread
@@ -76,6 +65,18 @@
}
/**
+ * Singleton access for simpler client use
+ *
+ * @return a default client
+ */
+ public static SimpleClient getDefault() {
+ if (defaultInstance == null) {
+ defaultInstance = new SimpleClient();
+ }
+ return defaultInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java b/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java
index 59ad55a..7cf5c6f 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java
@@ -15,7 +15,7 @@
/**
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class StreamException extends Exception {
diff --git a/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java b/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java
index 21862fa..5befb6d 100644
--- a/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java
+++ b/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java
@@ -14,15 +14,16 @@
package com.intel.jndn.utils.processing.impl;
import com.intel.jndn.utils.ProcessingStage;
-import java.io.ByteArrayOutputStream;
-import java.util.zip.GZIPOutputStream;
import net.named_data.jndn.Data;
import net.named_data.jndn.util.Blob;
+import java.io.ByteArrayOutputStream;
+import java.util.zip.GZIPOutputStream;
+
/**
* Sample stage for compressing {@link Data} content using GZIP
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class CompressionStage implements ProcessingStage<Data, Data> {
diff --git a/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java b/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java
index 3125db8..74df0b0 100644
--- a/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java
+++ b/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java
@@ -23,7 +23,7 @@
* As a part of a {@link com.intel.jndn.utils.ServerIn} pipeline, this stage
* will sign a {@link Data} packet.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SigningStage implements ProcessingStage<Data, Data> {
diff --git a/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java b/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java
index 34818a4..4ab03aa 100644
--- a/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java
+++ b/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java
@@ -19,7 +19,7 @@
/**
* @author Andrew Brown, andrew.brown@intel.com
*/
-public interface AnnouncementService {
+interface AnnouncementService {
void announceEntrance(long id) throws IOException;
void announceExit(long id) throws IOException;
Cancellation discoverExistingAnnouncements(On<Long> onFound, On<Void> onComplete, On<Exception> onError);
diff --git a/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java b/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java
index 556b91f..83e3f28 100644
--- a/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java
+++ b/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java
@@ -74,9 +74,11 @@
if (newAnnouncementCancellation != null) {
newAnnouncementCancellation.cancel();
}
+
if (existingAnnouncementsCancellation != null) {
existingAnnouncementsCancellation.cancel();
}
+
for (Context c : known) {
c.cancel();
}
diff --git a/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java b/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java
index eba700a..af64f15 100644
--- a/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java
+++ b/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java
@@ -16,7 +16,7 @@
/**
* Thrown when a {@link Repository} cannot retrieve a stored packet.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DataNotFoundException extends Exception {
diff --git a/src/main/java/com/intel/jndn/utils/server/DynamicServer.java b/src/main/java/com/intel/jndn/utils/server/DynamicServer.java
index 60caf35..1859897 100644
--- a/src/main/java/com/intel/jndn/utils/server/DynamicServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/DynamicServer.java
@@ -14,7 +14,7 @@
package com.intel.jndn.utils.server;
import com.intel.jndn.utils.Server;
-import com.intel.jndn.utils.server.RespondWithData;
+
import java.io.IOException;
/**
@@ -23,7 +23,7 @@
* will run a callback to determine what packet to send back. As good practice,
* keep callback methods as short as possible.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface DynamicServer extends Server {
@@ -36,5 +36,5 @@
* @param callback the callback instance
* @throws java.io.IOException if the server fails to register a prefix
*/
- public void respondUsing(RespondWithData callback) throws IOException;
+ void respondUsing(RespondWithData callback) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java b/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java
index 09ebc23..a0db7e9 100644
--- a/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java
@@ -14,15 +14,16 @@
package com.intel.jndn.utils.server;
import com.intel.jndn.utils.Server;
-import java.io.IOException;
import net.named_data.jndn.Data;
+import java.io.IOException;
+
/**
* Defines the API for a {@link Server} producing {@link Data} packets and
* storing them until they are requested; this server corresponds closely to use
* cases such as: cache, file system, web server.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface RepositoryServer extends Server {
@@ -32,10 +33,10 @@
* @param data the {@link Data} packet to store and serve
* @throws IOException if the underlying server fails to store the packet
*/
- public void serve(Data data) throws IOException;
+ void serve(Data data) throws IOException;
/**
* Clean up stale {@link Data} packets from the underlying content store.
*/
- public void cleanup();
+ void cleanup();
}
diff --git a/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java b/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
index fe7f74a..d83e1d6 100644
--- a/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
+++ b/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
@@ -20,9 +20,9 @@
/**
* Functional interface for serving data from Server.on()
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface RespondWithBlob {
- public Blob onInterest(Name prefix, Interest interest) throws Exception;
+ Blob onInterest(Name prefix, Interest interest) throws Exception;
}
diff --git a/src/main/java/com/intel/jndn/utils/server/RespondWithData.java b/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
index 95d0e6a..556d1d6 100644
--- a/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
+++ b/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
@@ -20,9 +20,9 @@
/**
* Functional interface for serving data from Server.on()
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface RespondWithData {
- public Data onInterest(Name prefix, Interest interest) throws Exception;
+ Data onInterest(Name prefix, Interest interest) throws Exception;
}
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
index 6be4280..faade78 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
@@ -13,17 +13,9 @@
*/
package com.intel.jndn.utils.server.impl;
-import com.intel.jndn.utils.server.RepositoryServer;
-import com.intel.jndn.utils.repository.impl.ForLoopRepository;
import com.intel.jndn.utils.Repository;
-import com.intel.jndn.utils.server.impl.SegmentedServerHelper;
-import com.intel.jndn.utils.server.impl.ServerBaseImpl;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import com.intel.jndn.utils.repository.impl.ForLoopRepository;
+import com.intel.jndn.utils.server.RepositoryServer;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -31,11 +23,18 @@
import net.named_data.jndn.Name;
import net.named_data.jndn.encoding.EncodingException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Implementation of a {@link RepositoryServer} that segments packets stored in
* its repository.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedServer extends ServerBaseImpl implements RepositoryServer {
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java
index 78e3c27..68ab3eb 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java
@@ -13,15 +13,16 @@
*/
package com.intel.jndn.utils.server.impl;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.util.Blob;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.util.Blob;
/**
* Helper for segmenting an input stream into a list of Data packets. Current
@@ -30,7 +31,7 @@
* several assumptions: NDN packet size was limited to 8000 at the time this was
* written and signature size is unknown.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedServerHelper {
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java b/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java
index 6110005..64130bd 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java
@@ -15,11 +15,6 @@
import com.intel.jndn.utils.ProcessingStage;
import com.intel.jndn.utils.Server;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.ForwardingFlags;
@@ -27,10 +22,16 @@
import net.named_data.jndn.OnRegisterFailed;
import net.named_data.jndn.encoding.EncodingException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Base implementation for a {@link Server}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public abstract class ServerBaseImpl implements Server {
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java b/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java
index cee7d7f..1c1a643 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java
@@ -14,14 +14,8 @@
package com.intel.jndn.utils.server.impl;
import com.intel.jndn.utils.server.DynamicServer;
-import com.intel.jndn.utils.server.RespondWithData;
-import com.intel.jndn.utils.server.RespondWithBlob;
import com.intel.jndn.utils.server.RespondWithBlob;
import com.intel.jndn.utils.server.RespondWithData;
-import com.intel.jndn.utils.server.impl.ServerBaseImpl;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -30,11 +24,15 @@
import net.named_data.jndn.OnInterest;
import net.named_data.jndn.util.Blob;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Implementation of a {@link DynamicServer} that wraps the {@link OnInterest}
* callback with some encoding and pipeline support.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SimpleServer extends ServerBaseImpl implements DynamicServer {