Adds abstract distributed primitive builder + Refactored AtomicCounter and AtomicValue builder to make use of it.

Change-Id: I56cef62673fabc54ca29634c27e4ff1f41ba6a88
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicValueBuilder.java b/core/api/src/main/java/org/onosproject/store/service/AtomicValueBuilder.java
index d0ba25e..81c484f 100644
--- a/core/api/src/main/java/org/onosproject/store/service/AtomicValueBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicValueBuilder.java
@@ -15,65 +15,16 @@
  */
 package org.onosproject.store.service;
 
+import org.onosproject.store.primitives.DistributedPrimitiveBuilder;
+
 /**
  * Builder for constructing new AtomicValue instances.
  *
  * @param <V> atomic value type
  */
-public interface AtomicValueBuilder<V> {
-    /**
-     * Sets the name for the atomic value.
-     * <p>
-     * Each atomic value is identified by a unique name.
-     * </p>
-     * <p>
-     * Note: This is a mandatory parameter.
-     * </p>
-     *
-     * @param name name of the atomic value
-     * @return this AtomicValueBuilder for method chaining
-     */
-    AtomicValueBuilder<V> withName(String name);
+public abstract class AtomicValueBuilder<V> extends DistributedPrimitiveBuilder<AsyncAtomicValue<V>> {
 
-    /**
-     * Sets a serializer that can be used to serialize the value.
-     * <p>
-     * Note: This is a mandatory parameter.
-     * </p>
-     *
-     * @param serializer serializer
-     * @return this AtomicValueBuilder for method chaining
-     */
-    AtomicValueBuilder<V> withSerializer(Serializer serializer);
-
-    /**
-     * Creates this atomic value on the partition that spans the entire cluster.
-     * <p>
-     * When partitioning is disabled, the value state will be
-     * ephemeral and does not survive a full cluster restart.
-     * </p>
-     * <p>
-     * Note: By default partitions are enabled.
-     * </p>
-     * @return this AtomicValueBuilder for method chaining
-     */
-    AtomicValueBuilder<V> withPartitionsDisabled();
-
-    /**
-     * Builds a AsyncAtomicValue based on the configuration options
-     * supplied to this builder.
-     *
-     * @return new AsyncAtomicValue
-     * @throws java.lang.RuntimeException if a mandatory parameter is missing
-     */
-    AsyncAtomicValue<V> buildAsyncValue();
-
-    /**
-     * Builds a AtomicValue based on the configuration options
-     * supplied to this builder.
-     *
-     * @return new AtomicValue
-     * @throws java.lang.RuntimeException if a mandatory parameter is missing
-     */
-    AtomicValue<V> build();
+    public AtomicValueBuilder() {
+        super(DistributedPrimitive.Type.VALUE);
+    }
 }