Fixed checkstyle issues
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/BatchReadRequest.java b/core/api/src/main/java/org/onlab/onos/store/service/BatchReadRequest.java
index 1cf422c..ecd9168 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/BatchReadRequest.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/BatchReadRequest.java
@@ -8,63 +8,63 @@
/**
* Collection of read requests to be submitted as one batch.
*/
-public class BatchReadRequest {
+public final class BatchReadRequest {
- private final List<ReadRequest> readRequests;
+ private final List<ReadRequest> readRequests;
- /**
- * Creates a new BatchReadRequest object from the specified list of read requests.
- * @param readRequests read requests.
- * @return BatchReadRequest object.
- */
- public static BatchReadRequest create(List<ReadRequest> readRequests) {
- return new BatchReadRequest(readRequests);
- }
+ /**
+ * Creates a new BatchReadRequest object from the specified list of read requests.
+ * @param readRequests read requests.
+ * @return BatchReadRequest object.
+ */
+ public static BatchReadRequest create(List<ReadRequest> readRequests) {
+ return new BatchReadRequest(readRequests);
+ }
- private BatchReadRequest(List<ReadRequest> readRequests) {
- this.readRequests = Collections.unmodifiableList(readRequests);
- }
+ private BatchReadRequest(List<ReadRequest> readRequests) {
+ this.readRequests = Collections.unmodifiableList(readRequests);
+ }
- /**
- * Returns the number of requests in this batch.
- * @return size of request batch.
- */
- public int batchSize() {
- return readRequests.size();
- }
+ /**
+ * Returns the number of requests in this batch.
+ * @return size of request batch.
+ */
+ public int batchSize() {
+ return readRequests.size();
+ }
- /**
- * Returns the requests in this batch as a list.
- * @return list of read requests
- */
- public List<ReadRequest> getAsList() {
- return readRequests;
- }
+ /**
+ * Returns the requests in this batch as a list.
+ * @return list of read requests
+ */
+ public List<ReadRequest> getAsList() {
+ return readRequests;
+ }
- /**
- * Builder for BatchReadRequest.
- */
- public static class Builder {
+ /**
+ * Builder for BatchReadRequest.
+ */
+ public static class Builder {
- private final List<ReadRequest> readRequests = Lists.newLinkedList();
+ private final List<ReadRequest> readRequests = Lists.newLinkedList();
- /**
- * Append a get request.
- * @param tableName table name
- * @param key key to fetch.
- * @return this Builder
- */
- public Builder get(String tableName, String key) {
- readRequests.add(new ReadRequest(tableName, key));
- return this;
- }
+ /**
+ * Append a get request.
+ * @param tableName table name
+ * @param key key to fetch.
+ * @return this Builder
+ */
+ public Builder get(String tableName, String key) {
+ readRequests.add(new ReadRequest(tableName, key));
+ return this;
+ }
- /**
- * Builds a BatchReadRequest
- * @return BatchReadRequest
- */
- public BatchReadRequest build() {
- return new BatchReadRequest(readRequests);
- }
- }
-}
\ No newline at end of file
+ /**
+ * Builds a BatchReadRequest.
+ * @return BatchReadRequest
+ */
+ public BatchReadRequest build() {
+ return new BatchReadRequest(readRequests);
+ }
+ }
+}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/BatchReadResult.java b/core/api/src/main/java/org/onlab/onos/store/service/BatchReadResult.java
index 7281eff..525e77f 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/BatchReadResult.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/BatchReadResult.java
@@ -3,19 +3,30 @@
import java.util.Collections;
import java.util.List;
+/**
+ * Result of a batch read operation.
+ */
public class BatchReadResult {
-
- private final List<ReadResult> readResults;
-
- public BatchReadResult(List<ReadResult> readResults) {
- this.readResults = Collections.unmodifiableList(readResults);
- }
-
- public List<ReadResult> getAsList() {
- return readResults;
- }
-
- public int batchSize() {
- return readResults.size();
- }
-}
\ No newline at end of file
+
+ private final List<ReadResult> readResults;
+
+ public BatchReadResult(List<ReadResult> readResults) {
+ this.readResults = Collections.unmodifiableList(readResults);
+ }
+
+ /**
+ * Returns the results as a list.
+ * @return list of results
+ */
+ public List<ReadResult> getAsList() {
+ return readResults;
+ }
+
+ /**
+ * Returns the batch size.
+ * @return batch size
+ */
+ public int batchSize() {
+ return readResults.size();
+ }
+}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteRequest.java b/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteRequest.java
index 9ce14a1..ae1fa21 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteRequest.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteRequest.java
@@ -8,83 +8,83 @@
/**
* Collection of write requests to be submitted as one batch.
*/
-public class BatchWriteRequest {
+public final class BatchWriteRequest {
- private final List<WriteRequest> writeRequests;
+ private final List<WriteRequest> writeRequests;
- /**
- * Creates a new BatchWriteRequest object from the specified list of write requests.
- * @param writeRequests write requests.
- * @return BatchWriteRequest object.
- */
- public static BatchWriteRequest create(List<WriteRequest> writeRequests) {
- return new BatchWriteRequest(writeRequests);
- }
+ /**
+ * Creates a new BatchWriteRequest object from the specified list of write requests.
+ * @param writeRequests write requests.
+ * @return BatchWriteRequest object.
+ */
+ public static BatchWriteRequest create(List<WriteRequest> writeRequests) {
+ return new BatchWriteRequest(writeRequests);
+ }
- private BatchWriteRequest(List<WriteRequest> writeRequests) {
- this.writeRequests = Collections.unmodifiableList(writeRequests);
- }
+ private BatchWriteRequest(List<WriteRequest> writeRequests) {
+ this.writeRequests = Collections.unmodifiableList(writeRequests);
+ }
- /**
- * Returns the requests in this batch as a list.
- * @return list of write requests
- */
- public List<WriteRequest> getAsList() {
- return writeRequests;
- }
+ /**
+ * Returns the requests in this batch as a list.
+ * @return list of write requests
+ */
+ public List<WriteRequest> getAsList() {
+ return writeRequests;
+ }
- /**
- * Returns the number of requests in this batch.
- * @return size of request batch.
- */
- public int batchSize() {
- return writeRequests.size();
- }
+ /**
+ * Returns the number of requests in this batch.
+ * @return size of request batch.
+ */
+ public int batchSize() {
+ return writeRequests.size();
+ }
- /**
- * Builder for BatchWriteRequest.
- */
- public static class Builder {
+ /**
+ * Builder for BatchWriteRequest.
+ */
+ public static class Builder {
- private final List<WriteRequest> writeRequests = Lists.newLinkedList();
+ private final List<WriteRequest> writeRequests = Lists.newLinkedList();
- public Builder put(String tableName, String key, byte[] value) {
- writeRequests.add(WriteRequest.put(tableName, key, value));
- return this;
- }
+ public Builder put(String tableName, String key, byte[] value) {
+ writeRequests.add(WriteRequest.put(tableName, key, value));
+ return this;
+ }
- public Builder putIfAbsent(String tableName, String key, byte[] value) {
- writeRequests.add(WriteRequest.putIfAbsent(tableName, key, value));
- return this;
- }
+ public Builder putIfAbsent(String tableName, String key, byte[] value) {
+ writeRequests.add(WriteRequest.putIfAbsent(tableName, key, value));
+ return this;
+ }
- public Builder putIfValueMatches(String tableName, String key, byte[] oldValue, byte[] newValue) {
- writeRequests.add(WriteRequest.putIfValueMatches(tableName, key, oldValue, newValue));
- return this;
- }
+ public Builder putIfValueMatches(String tableName, String key, byte[] oldValue, byte[] newValue) {
+ writeRequests.add(WriteRequest.putIfValueMatches(tableName, key, oldValue, newValue));
+ return this;
+ }
- public Builder putIfVersionMatches(String tableName, String key, byte[] value, long version) {
- writeRequests.add(WriteRequest.putIfVersionMatches(tableName, key, value, version));
- return this;
- }
+ public Builder putIfVersionMatches(String tableName, String key, byte[] value, long version) {
+ writeRequests.add(WriteRequest.putIfVersionMatches(tableName, key, value, version));
+ return this;
+ }
- public Builder remove(String tableName, String key) {
- writeRequests.add(WriteRequest.remove(tableName, key));
- return this;
- }
+ public Builder remove(String tableName, String key) {
+ writeRequests.add(WriteRequest.remove(tableName, key));
+ return this;
+ }
- public Builder removeIfVersionMatches(String tableName, String key, long version) {
- writeRequests.add(WriteRequest.removeIfVersionMatches(tableName, key, version));
- return this;
- }
+ public Builder removeIfVersionMatches(String tableName, String key, long version) {
+ writeRequests.add(WriteRequest.removeIfVersionMatches(tableName, key, version));
+ return this;
+ }
- public Builder removeIfValueMatches(String tableName, String key, byte[] value) {
- writeRequests.add(WriteRequest.removeIfValueMatches(tableName, key, value));
- return this;
- }
+ public Builder removeIfValueMatches(String tableName, String key, byte[] value) {
+ writeRequests.add(WriteRequest.removeIfValueMatches(tableName, key, value));
+ return this;
+ }
- public BatchWriteRequest build() {
- return new BatchWriteRequest(writeRequests);
- }
- }
-}
\ No newline at end of file
+ public BatchWriteRequest build() {
+ return new BatchWriteRequest(writeRequests);
+ }
+ }
+}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteResult.java b/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteResult.java
index 22c653c..4e1848b 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteResult.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/BatchWriteResult.java
@@ -3,28 +3,43 @@
import java.util.Collections;
import java.util.List;
+/**
+ * Result of a batch write operation.
+ */
public class BatchWriteResult {
-
- private final List<WriteResult> writeResults;
-
- public BatchWriteResult(List<WriteResult> writeResults) {
- this.writeResults = Collections.unmodifiableList(writeResults);
- }
-
- public boolean isSuccessful() {
- for (WriteResult result : writeResults) {
- if (result.status() != WriteStatus.OK) {
- return false;
- }
- }
- return true;
- }
-
- public List<WriteResult> getAsList() {
- return this.writeResults;
- }
-
- public int batchSize() {
- return writeResults.size();
- }
-}
\ No newline at end of file
+
+ private final List<WriteResult> writeResults;
+
+ public BatchWriteResult(List<WriteResult> writeResults) {
+ this.writeResults = Collections.unmodifiableList(writeResults);
+ }
+
+ /**
+ * Returns true if this batch write operation was successful.
+ * @return true if successful, false otherwise.
+ */
+ public boolean isSuccessful() {
+ for (WriteResult result : writeResults) {
+ if (result.status() != WriteStatus.OK) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns the results as a List.
+ * @return list of batch results.
+ */
+ public List<WriteResult> getAsList() {
+ return this.writeResults;
+ }
+
+ /**
+ * Returns the size of this batch.
+ * @return batch size.
+ */
+ public int batchSize() {
+ return writeResults.size();
+ }
+}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/DatabaseService.java b/core/api/src/main/java/org/onlab/onos/store/service/DatabaseService.java
index 57d81f2..2779fe6 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/DatabaseService.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/DatabaseService.java
@@ -13,7 +13,7 @@
* @returns value (and version) associated with this key. This calls returns null if the key does not exist.
*/
VersionedValue get(String tableName, String key);
-
+
/**
* Associate the key with a value.
* @param tableName table name in which this key/value resides.
@@ -22,7 +22,7 @@
* @return the previous value associated with the specified key, or null if there was no mapping for the key.
*/
VersionedValue put(String tableName, String key, byte[] value);
-
+
/**
* If the specified key is not already associated with a value, associate it with the given value.
* @param tableName table name in which this key/value resides.
@@ -31,7 +31,7 @@
* @return true if put was successful, false if there is already a value associated with this key
*/
boolean putIfAbsent(String tableName, String key, byte[] value);
-
+
/**
* Sets the key to the specified value if the version in the database (for that key)
* matches the specified version.
@@ -42,7 +42,7 @@
* @return true if put was successful, false if there version in database is different from what is specified.
*/
boolean putIfVersionMatches(String tableName, String key, byte[] value, long version);
-
+
/**
* Replaces the entry for a key only if currently mapped to a given value.
* @param tableName name of table associated with this operation.
@@ -52,7 +52,7 @@
* @return true if put was successful, false if there version in database is different from what is specified.
*/
boolean putIfValueMatches(String tableName, String key, byte[] oldValue, byte[] newValue);
-
+
/**
* Removes the key (and associated value).
* @param tableName name of table associated with this operation.
@@ -60,7 +60,7 @@
* @return value previously associated with the key. This call returns null if the key does not exist.
*/
VersionedValue remove(String tableName, String key);
-
+
/**
* Removes the key (and associated value) if the version in the database matches specified version.
* @param tableName name of table associated with this operation.
@@ -69,7 +69,7 @@
* @return true if remove was successful, false if there version in database is different from what is specified.
*/
boolean removeIfVersionMatches(String tableName, String key, long version);
-
+
/**
* Removes the key (and associated value) if the value in the database matches specified value.
* @param tableName name of table associated with this operation.
@@ -78,14 +78,14 @@
* @return true if remove was successful, false if there value in database is different from what is specified.
*/
boolean removeIfValueMatches(String tableName, String key, byte[] value);
-
+
/**
* Performs a batch read operation and returns the results.
* @param batchRequest batch request.
* @return result of the batch operation.
*/
BatchReadResult batchRead(BatchReadRequest batchRequest);
-
+
/**
* Performs a batch write operation and returns the results.
* This method provides transactional semantics. Either all writes succeed or none do.
@@ -96,4 +96,4 @@
* @return result of the batch operation.
*/
BatchWriteResult batchWrite(BatchWriteRequest batchRequest);
-}
\ No newline at end of file
+}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/Lock.java b/core/api/src/main/java/org/onlab/onos/store/service/Lock.java
index 510df82..dfd4742 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/Lock.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/Lock.java
@@ -9,11 +9,11 @@
*/
public interface Lock {
- /**
- * Returns the path this lock will be used to guard from concurrent access.
- * @return path.
- */
- String path();
+ /**
+ * Returns the path this lock will be used to guard from concurrent access.
+ * @return path.
+ */
+ String path();
/**
* Acquires the lock.
@@ -79,4 +79,4 @@
* extend expiration fails or if the path is currently not locked by this instance.
*/
boolean extendExpiration(int leaseDurationMillis);
-}
\ No newline at end of file
+}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/ReadResult.java b/core/api/src/main/java/org/onlab/onos/store/service/ReadResult.java
index 3f253f2..943bc63 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/ReadResult.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/ReadResult.java
@@ -14,17 +14,17 @@
private final ReadStatus status;
public ReadResult(ReadStatus status, String tableName, String key, VersionedValue value) {
- this.status = status;
+ this.status = status;
this.tableName = tableName;
this.key = key;
this.value = value;
}
-
+
/**
* Returns the status of the read operation.
*/
public ReadStatus status() {
- return status;
+ return status;
}
/**
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/ReadStatus.java b/core/api/src/main/java/org/onlab/onos/store/service/ReadStatus.java
index 2039a1c..72ed356 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/ReadStatus.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/ReadStatus.java
@@ -1,6 +1,6 @@
package org.onlab.onos.store.service;
public enum ReadStatus {
- OK,
- NO_SUCH_TABLE
+ OK,
+ NO_SUCH_TABLE
}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/WriteResult.java b/core/api/src/main/java/org/onlab/onos/store/service/WriteResult.java
index 3cc11b0..3f61061 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/WriteResult.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/WriteResult.java
@@ -7,27 +7,27 @@
* Database write result.
*/
public class WriteResult {
-
+
private final WriteStatus status;
private final VersionedValue previousValue;
-
+
public WriteResult(WriteStatus status, VersionedValue previousValue) {
- this.status = status;
+ this.status = status;
this.previousValue = previousValue;
}
public VersionedValue previousValue() {
return previousValue;
}
-
+
public WriteStatus status() {
- return status;
+ return status;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
- .add("status", status)
+ .add("status", status)
.add("previousValue", previousValue)
.toString();
}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/WriteStatus.java b/core/api/src/main/java/org/onlab/onos/store/service/WriteStatus.java
index ebb4f6d..8c9990a 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/WriteStatus.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/WriteStatus.java
@@ -1,8 +1,8 @@
package org.onlab.onos.store.service;
public enum WriteStatus {
- OK,
- ABORTED,
- PRECONDITION_VIOLATION,
- NO_SUCH_TABLE,
+ OK,
+ ABORTED,
+ PRECONDITION_VIOLATION,
+ NO_SUCH_TABLE,
}