[ONOS-7551] Support primitive revisions for upgrades

Change-Id: Ib56e10f06ab9abedd176cdd84add6cbf4e3d4c50
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicCounterBuilder.java b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterBuilder.java
index e0f8efd..0fdd778 100644
--- a/core/api/src/main/java/org/onosproject/store/service/AtomicCounterBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterBuilder.java
@@ -21,8 +21,6 @@
  * Builder for AtomicCounter.
  */
 public abstract class AtomicCounterBuilder
-    extends DistributedPrimitiveBuilder<AtomicCounterBuilder, AsyncAtomicCounter> {
-    public AtomicCounterBuilder() {
-        super(DistributedPrimitive.Type.COUNTER);
-    }
+    extends AtomicCounterOptions<AtomicCounterBuilder>
+    implements DistributedPrimitiveBuilder<AsyncAtomicCounter> {
 }
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicCounterMapBuilder.java b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterMapBuilder.java
index 96c8e91..9598e34 100644
--- a/core/api/src/main/java/org/onosproject/store/service/AtomicCounterMapBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterMapBuilder.java
@@ -21,10 +21,8 @@
  * Builder for AtomicCounterMap.
  */
 public abstract class AtomicCounterMapBuilder<K>
-        extends DistributedPrimitiveBuilder<AtomicCounterMapBuilder<K>, AtomicCounterMap<K>> {
-    public AtomicCounterMapBuilder() {
-        super(DistributedPrimitive.Type.COUNTER_MAP);
-    }
+    extends AtomicCounterMapOptions<AtomicCounterMapBuilder<K>, K>
+    implements DistributedPrimitiveBuilder<AtomicCounterMap<K>> {
 
     /**
      * Builds an async atomic counter map based on the configuration options
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicCounterMapOptions.java b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterMapOptions.java
new file mode 100644
index 0000000..f9c5d3e
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterMapOptions.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for AtomicCounterMap.
+ */
+public abstract class AtomicCounterMapOptions<O extends AtomicCounterMapOptions<O, K>, K>
+        extends DistributedPrimitiveOptions<O> {
+    public AtomicCounterMapOptions() {
+        super(DistributedPrimitive.Type.COUNTER_MAP);
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicCounterOptions.java b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterOptions.java
new file mode 100644
index 0000000..1a0bd9b
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicCounterOptions.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Options for AtomicCounter.
+ */
+public abstract class AtomicCounterOptions<O extends AtomicCounterOptions<O>>
+    extends DistributedPrimitiveOptions<O> {
+    public AtomicCounterOptions() {
+        super(DistributedPrimitive.Type.COUNTER);
+    }
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicIdGeneratorBuilder.java b/core/api/src/main/java/org/onosproject/store/service/AtomicIdGeneratorBuilder.java
index ef90642..b7d8e88 100644
--- a/core/api/src/main/java/org/onosproject/store/service/AtomicIdGeneratorBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicIdGeneratorBuilder.java
@@ -21,8 +21,6 @@
  * Builder for AtomicIdGenerator.
  */
 public abstract class AtomicIdGeneratorBuilder
-    extends DistributedPrimitiveBuilder<AtomicIdGeneratorBuilder, AsyncAtomicIdGenerator> {
-    public AtomicIdGeneratorBuilder() {
-        super(DistributedPrimitive.Type.ID_GENERATOR);
-    }
+    extends AtomicIdGeneratorOptions<AtomicIdGeneratorBuilder>
+    implements DistributedPrimitiveBuilder<AsyncAtomicIdGenerator> {
 }
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicIdGeneratorOptions.java b/core/api/src/main/java/org/onosproject/store/service/AtomicIdGeneratorOptions.java
new file mode 100644
index 0000000..44e2649
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicIdGeneratorOptions.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Options for AtomicIdGenerator.
+ */
+public abstract class AtomicIdGeneratorOptions<O extends AtomicIdGeneratorOptions<O>>
+    extends DistributedPrimitiveOptions<O> {
+    public AtomicIdGeneratorOptions() {
+        super(DistributedPrimitive.Type.ID_GENERATOR);
+    }
+}
\ No newline at end of file
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 10b26d3..4c08707 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
@@ -23,9 +23,6 @@
  * @param <V> atomic value type
  */
 public abstract class AtomicValueBuilder<V>
-    extends DistributedPrimitiveBuilder<AtomicValueBuilder<V>, AsyncAtomicValue<V>> {
-
-    public AtomicValueBuilder() {
-        super(DistributedPrimitive.Type.VALUE);
-    }
+    extends AtomicValueOptions<AtomicValueBuilder<V>, V>
+    implements DistributedPrimitiveBuilder<AsyncAtomicValue<V>> {
 }
diff --git a/core/api/src/main/java/org/onosproject/store/service/AtomicValueOptions.java b/core/api/src/main/java/org/onosproject/store/service/AtomicValueOptions.java
new file mode 100644
index 0000000..b00a7af
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/AtomicValueOptions.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for constructing new AtomicValue instances.
+ *
+ * @param <V> atomic value type
+ */
+public abstract class AtomicValueOptions<O extends AtomicValueOptions<O, V>, V> extends DistributedPrimitiveOptions<O> {
+    public AtomicValueOptions() {
+        super(DistributedPrimitive.Type.VALUE);
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
index d991072..4773035 100644
--- a/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
@@ -24,51 +24,8 @@
  * @param <V> type for map value
  */
 public abstract class ConsistentMapBuilder<K, V>
-    extends DistributedPrimitiveBuilder<ConsistentMapBuilder<K, V>, ConsistentMap<K, V>> {
-
-    private boolean nullValues = false;
-    private boolean purgeOnUninstall = false;
-
-    public ConsistentMapBuilder() {
-        super(DistributedPrimitive.Type.CONSISTENT_MAP);
-    }
-
-    /**
-     * Enables null values in the map.
-     *
-     * @return this builder
-     */
-    public ConsistentMapBuilder<K, V> withNullValues() {
-        nullValues = true;
-        return this;
-    }
-
-    /**
-     * Clears map contents when the owning application is uninstalled.
-     *
-     * @return this builder
-     */
-    public ConsistentMapBuilder<K, V> withPurgeOnUninstall() {
-        purgeOnUninstall = true;
-        return this;
-    }
-
-    /**
-     * Returns whether null values are supported by the map.
-     *
-     * @return {@code true} if null values are supported; {@code false} otherwise
-     */
-    public boolean nullValues() {
-        return nullValues;
-    }
-
-    /**
-     * Returns if map entries need to be cleared when owning application is uninstalled.
-     * @return {@code true} if yes; {@code false} otherwise.
-     */
-    public boolean purgeOnUninstall() {
-        return purgeOnUninstall;
-    }
+    extends ConsistentMapOptions<ConsistentMapBuilder<K, V>, K, V>
+    implements DistributedPrimitiveBuilder<ConsistentMap<K, V>> {
 
     /**
      * Builds an async consistent map based on the configuration options
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentMapOptions.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapOptions.java
new file mode 100644
index 0000000..587789d
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapOptions.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for {@link ConsistentMap} instances.
+ *
+ * @param <K> type for map key
+ * @param <V> type for map value
+ */
+public abstract class ConsistentMapOptions<O extends ConsistentMapOptions<O, K, V>, K, V>
+    extends DistributedPrimitiveOptions<O> {
+
+    private boolean nullValues = false;
+    private boolean purgeOnUninstall = false;
+
+    public ConsistentMapOptions() {
+        super(DistributedPrimitive.Type.CONSISTENT_MAP);
+    }
+
+    /**
+     * Enables null values in the map.
+     *
+     * @return this builder
+     */
+    public O withNullValues() {
+        nullValues = true;
+        return (O) this;
+    }
+
+    /**
+     * Clears map contents when the owning application is uninstalled.
+     *
+     * @return this builder
+     */
+    public O withPurgeOnUninstall() {
+        purgeOnUninstall = true;
+        return (O) this;
+    }
+
+    /**
+     * Returns whether null values are supported by the map.
+     *
+     * @return {@code true} if null values are supported; {@code false} otherwise
+     */
+    public boolean nullValues() {
+        return nullValues;
+    }
+
+    /**
+     * Returns if map entries need to be cleared when owning application is uninstalled.
+     * @return {@code true} if yes; {@code false} otherwise.
+     */
+    public boolean purgeOnUninstall() {
+        return purgeOnUninstall;
+    }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentMultimapBuilder.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentMultimapBuilder.java
index 15f4606..3af5e65 100644
--- a/core/api/src/main/java/org/onosproject/store/service/ConsistentMultimapBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentMultimapBuilder.java
@@ -22,34 +22,8 @@
  * A builder class for {@code AsyncConsistentMultimap}.
  */
 public abstract class ConsistentMultimapBuilder<K, V>
-        extends DistributedPrimitiveBuilder<ConsistentMultimapBuilder<K, V>,
-        ConsistentMultimap<K, V>> {
-
-    private boolean purgeOnUninstall = false;
-
-    public ConsistentMultimapBuilder() {
-        super(DistributedPrimitive.Type.CONSISTENT_MULTIMAP);
-    }
-
-    /**
-     * Clears multimap contents when the owning application is uninstalled.
-     *
-     * @return this builder
-     */
-    public ConsistentMultimapBuilder<K, V> withPurgeOnUninstall() {
-        purgeOnUninstall = true;
-        return this;
-    }
-
-    /**
-     * Returns if multimap entries need to be cleared when owning application
-     * is uninstalled.
-     *
-     * @return true if items are to be cleared on uninstall
-     */
-    public boolean purgeOnUninstall() {
-        return purgeOnUninstall;
-    }
+    extends ConsistentMultimapOptions<ConsistentMultimapBuilder<K, V>, K, V>
+    implements DistributedPrimitiveBuilder<ConsistentMultimap<K, V>> {
 
     /**
      * Builds the distributed multimap based on the configuration options
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentMultimapOptions.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentMultimapOptions.java
new file mode 100644
index 0000000..84fe6bb
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentMultimapOptions.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * A builder class for {@code AsyncConsistentMultimap}.
+ */
+public abstract class ConsistentMultimapOptions<O extends ConsistentMultimapOptions<O, K, V>, K, V>
+        extends DistributedPrimitiveOptions<O> {
+
+    private boolean purgeOnUninstall = false;
+
+    public ConsistentMultimapOptions() {
+        super(DistributedPrimitive.Type.CONSISTENT_MULTIMAP);
+    }
+
+    /**
+     * Clears multimap contents when the owning application is uninstalled.
+     *
+     * @return this builder
+     */
+    public O withPurgeOnUninstall() {
+        purgeOnUninstall = true;
+        return (O) this;
+    }
+
+    /**
+     * Returns if multimap entries need to be cleared when owning application
+     * is uninstalled.
+     *
+     * @return true if items are to be cleared on uninstall
+     */
+    public boolean purgeOnUninstall() {
+        return purgeOnUninstall;
+    }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMapBuilder.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMapBuilder.java
index 6c8d3b0..fc7c2f9 100644
--- a/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMapBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMapBuilder.java
@@ -22,32 +22,8 @@
  * Builder for {@link ConsistentTreeMap}.
  */
 public abstract class ConsistentTreeMapBuilder<V>
-        extends DistributedPrimitiveBuilder<ConsistentTreeMapBuilder<V>, ConsistentTreeMap<V>> {
-
-    private boolean purgeOnUninstall = false;
-
-    public ConsistentTreeMapBuilder() {
-        super(DistributedPrimitive.Type.CONSISTENT_TREEMAP);
-    }
-
-    /**
-     * Clears map contents when the owning application is uninstalled.
-     *
-     * @return this builder
-     */
-    public ConsistentTreeMapBuilder<V> withPurgeOnUninstall() {
-        purgeOnUninstall = true;
-        return this;
-    }
-
-    /**
-     * Return if map entries need to be cleared when owning application is uninstalled.
-     *
-     * @return true if items are to be cleared on uninstall
-     */
-    public boolean purgeOnUninstall() {
-        return purgeOnUninstall;
-    }
+    extends ConsistentTreeMapOptions<ConsistentTreeMapBuilder<V>, V>
+    implements DistributedPrimitiveBuilder<ConsistentTreeMap<V>> {
 
     /**
      * Builds the distributed tree map based on the configuration options supplied
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMapOptions.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMapOptions.java
new file mode 100644
index 0000000..5725683
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMapOptions.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for {@link ConsistentTreeMap}.
+ */
+public abstract class ConsistentTreeMapOptions<O extends ConsistentTreeMapOptions<O, V>, V>
+    extends DistributedPrimitiveOptions<O> {
+
+    private boolean purgeOnUninstall = false;
+
+    public ConsistentTreeMapOptions() {
+        super(DistributedPrimitive.Type.CONSISTENT_TREEMAP);
+    }
+
+    /**
+     * Clears map contents when the owning application is uninstalled.
+     *
+     * @return this builder
+     */
+    public O withPurgeOnUninstall() {
+        purgeOnUninstall = true;
+        return (O) this;
+    }
+
+    /**
+     * Return if map entries need to be cleared when owning application is uninstalled.
+     *
+     * @return true if items are to be cleared on uninstall
+     */
+    public boolean purgeOnUninstall() {
+        return purgeOnUninstall;
+    }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedLockBuilder.java b/core/api/src/main/java/org/onosproject/store/service/DistributedLockBuilder.java
index 7e61c6a..32e77e3 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DistributedLockBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DistributedLockBuilder.java
@@ -21,8 +21,6 @@
  * Builder for DistributedLock.
  */
 public abstract class DistributedLockBuilder
-    extends DistributedPrimitiveBuilder<DistributedLockBuilder, AsyncDistributedLock> {
-    public DistributedLockBuilder() {
-        super(DistributedPrimitive.Type.LOCK);
-    }
+    extends DistributedLockOptions<DistributedLockBuilder>
+    implements DistributedPrimitiveBuilder<AsyncDistributedLock> {
 }
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedLockOptions.java b/core/api/src/main/java/org/onosproject/store/service/DistributedLockOptions.java
new file mode 100644
index 0000000..21a8c6f
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/DistributedLockOptions.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for DistributedLock.
+ */
+public abstract class DistributedLockOptions<O extends DistributedLockOptions<O>>
+    extends DistributedPrimitiveOptions<O> {
+    public DistributedLockOptions() {
+        super(DistributedPrimitive.Type.LOCK);
+    }
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java b/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java
index c80bd0e..1420e4b 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DistributedSetBuilder.java
@@ -22,30 +22,7 @@
  *
  * @param <E> type set elements.
  */
-public abstract class DistributedSetBuilder<E> extends DistributedPrimitiveBuilder<DistributedSetBuilder<E>,
-                                                                                   AsyncDistributedSet<E>> {
-
-    private boolean purgeOnUninstall = false;
-
-    public DistributedSetBuilder() {
-        super(DistributedPrimitive.Type.SET);
-    }
-
-    /**
-     * Enables clearing set contents when the owning application is uninstalled.
-     *
-     * @return this builder
-     */
-    public DistributedSetBuilder<E> withPurgeOnUninstall() {
-        purgeOnUninstall = true;
-        return this;
-    }
-
-    /**
-     * Returns if set contents need to be cleared when owning application is uninstalled.
-     * @return {@code true} if yes; {@code false} otherwise.
-     */
-    public boolean purgeOnUninstall() {
-        return purgeOnUninstall;
-    }
+public abstract class DistributedSetBuilder<E>
+    extends DistributedSetOptions<DistributedSetBuilder<E>, E>
+    implements DistributedPrimitiveBuilder<AsyncDistributedSet<E>> {
 }
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedSetOptions.java b/core/api/src/main/java/org/onosproject/store/service/DistributedSetOptions.java
new file mode 100644
index 0000000..2c6efd0
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/DistributedSetOptions.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for distributed set.
+ *
+ * @param <E> type set elements.
+ */
+public abstract class DistributedSetOptions<O extends DistributedSetOptions<O, E>, E>
+    extends DistributedPrimitiveOptions<O> {
+
+    private boolean purgeOnUninstall = false;
+
+    public DistributedSetOptions() {
+        super(DistributedPrimitive.Type.SET);
+    }
+
+    /**
+     * Enables clearing set contents when the owning application is uninstalled.
+     *
+     * @return this builder
+     */
+    public O withPurgeOnUninstall() {
+        purgeOnUninstall = true;
+        return (O) this;
+    }
+
+    /**
+     * Returns if set contents need to be cleared when owning application is uninstalled.
+     * @return {@code true} if yes; {@code false} otherwise.
+     */
+    public boolean purgeOnUninstall() {
+        return purgeOnUninstall;
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentTreeBuilder.java b/core/api/src/main/java/org/onosproject/store/service/DocumentTreeBuilder.java
index 14ecd5c..fb012db 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DocumentTreeBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentTreeBuilder.java
@@ -22,59 +22,8 @@
  * Builder for {@link DocumentTree}.
  */
 public abstract class DocumentTreeBuilder<V>
-        extends DistributedPrimitiveBuilder<DocumentTreeBuilder<V>, AsyncDocumentTree<V>> {
-
-    private boolean purgeOnUninstall = false;
-    private Ordering ordering = Ordering.NATURAL;
-
-    public DocumentTreeBuilder() {
-        super(DistributedPrimitive.Type.DOCUMENT_TREE);
-    }
-
-    /**
-     * Clears document tree contents when the owning application is uninstalled.
-     *
-     * @return this builder
-     */
-    public DocumentTreeBuilder<V> withPurgeOnUninstall() {
-        purgeOnUninstall = true;
-        return this;
-    }
-
-    /**
-     * Return if document tree entries need to be cleared when owning application is uninstalled.
-     *
-     * @return true if items are to be cleared on uninstall
-     */
-    public boolean purgeOnUninstall() {
-        return purgeOnUninstall;
-    }
-
-    /**
-     * Sets the ordering of the tree nodes.
-     * <p>
-     * When {@link AsyncDocumentTree#getChildren(DocumentPath)} is called, children will be returned according to
-     * the specified sort order.
-     *
-     * @param ordering ordering of the tree nodes
-     * @return this builder
-     */
-    public DocumentTreeBuilder<V> withOrdering(Ordering ordering) {
-        this.ordering = ordering;
-        return this;
-    }
-
-    /**
-     * Returns the ordering of tree nodes.
-     * <p>
-     * When {@link AsyncDocumentTree#getChildren(DocumentPath)} is called, children will be returned according to
-     * the specified sort order.
-     *
-     * @return the ordering of tree nodes
-     */
-    public Ordering ordering() {
-        return ordering;
-    }
+    extends DocumentTreeOptions<DocumentTreeBuilder<V>, V>
+    implements DistributedPrimitiveBuilder<AsyncDocumentTree<V>> {
 
     /**
      * Builds the distributed Document tree based on the configuration options supplied
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentTreeOptions.java b/core/api/src/main/java/org/onosproject/store/service/DocumentTreeOptions.java
new file mode 100644
index 0000000..d93b9c3
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentTreeOptions.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for {@link DocumentTree}.
+ */
+public abstract class DocumentTreeOptions<O extends DocumentTreeOptions<O, V>, V>
+        extends DistributedPrimitiveOptions<O> {
+
+    private boolean purgeOnUninstall = false;
+    private Ordering ordering = Ordering.NATURAL;
+
+    public DocumentTreeOptions() {
+        super(DistributedPrimitive.Type.DOCUMENT_TREE);
+    }
+
+    /**
+     * Clears document tree contents when the owning application is uninstalled.
+     *
+     * @return this builder
+     */
+    public O withPurgeOnUninstall() {
+        purgeOnUninstall = true;
+        return (O) this;
+    }
+
+    /**
+     * Return if document tree entries need to be cleared when owning application is uninstalled.
+     *
+     * @return true if items are to be cleared on uninstall
+     */
+    public boolean purgeOnUninstall() {
+        return purgeOnUninstall;
+    }
+
+    /**
+     * Sets the ordering of the tree nodes.
+     * <p>
+     * When {@link AsyncDocumentTree#getChildren(DocumentPath)} is called, children will be returned according to
+     * the specified sort order.
+     *
+     * @param ordering ordering of the tree nodes
+     * @return this builder
+     */
+    public O withOrdering(Ordering ordering) {
+        this.ordering = ordering;
+        return (O) this;
+    }
+
+    /**
+     * Returns the ordering of tree nodes.
+     * <p>
+     * When {@link AsyncDocumentTree#getChildren(DocumentPath)} is called, children will be returned according to
+     * the specified sort order.
+     *
+     * @return the ordering of tree nodes
+     */
+    public Ordering ordering() {
+        return ordering;
+    }
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/LeaderElectorBuilder.java b/core/api/src/main/java/org/onosproject/store/service/LeaderElectorBuilder.java
index d3d6951..aef492d 100644
--- a/core/api/src/main/java/org/onosproject/store/service/LeaderElectorBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/LeaderElectorBuilder.java
@@ -15,50 +15,12 @@
  */
 package org.onosproject.store.service;
 
-import java.util.concurrent.TimeUnit;
-
 import org.onosproject.store.primitives.DistributedPrimitiveBuilder;
 
 /**
  * Builder for constructing new {@link AsyncLeaderElector} instances.
  */
 public abstract class LeaderElectorBuilder
-    extends DistributedPrimitiveBuilder<LeaderElectorBuilder, AsyncLeaderElector> {
-
-    private long electionTimeoutMillis = DistributedPrimitive.DEFAULT_OPERATION_TIMEOUT_MILLIS;
-
-    public LeaderElectorBuilder() {
-        super(DistributedPrimitive.Type.LEADER_ELECTOR);
-    }
-
-    /**
-     * Sets the election timeout in milliseconds.
-     *
-     * @param electionTimeoutMillis the election timeout in milliseconds
-     * @return leader elector builder
-     */
-    public LeaderElectorBuilder withElectionTimeout(long electionTimeoutMillis) {
-        this.electionTimeoutMillis = electionTimeoutMillis;
-        return this;
-    }
-
-    /**
-     * Sets the election timeout.
-     *
-     * @param electionTimeout the election timeout
-     * @param timeUnit the timeout time unit
-     * @return leader elector builder
-     */
-    public LeaderElectorBuilder withElectionTimeout(long electionTimeout, TimeUnit timeUnit) {
-        return withElectionTimeout(timeUnit.toMillis(electionTimeout));
-    }
-
-    /**
-     * Returns the election timeout in milliseconds.
-     *
-     * @return the election timeout in milliseconds
-     */
-    public final long electionTimeoutMillis() {
-        return electionTimeoutMillis;
-    }
+    extends LeaderElectorOptions<LeaderElectorBuilder>
+    implements DistributedPrimitiveBuilder<AsyncLeaderElector> {
 }
diff --git a/core/api/src/main/java/org/onosproject/store/service/LeaderElectorOptions.java b/core/api/src/main/java/org/onosproject/store/service/LeaderElectorOptions.java
new file mode 100644
index 0000000..ff879b5
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/LeaderElectorOptions.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import java.util.concurrent.TimeUnit;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for constructing new {@link AsyncLeaderElector} instances.
+ */
+public abstract class LeaderElectorOptions<O extends LeaderElectorOptions<O>>
+    extends DistributedPrimitiveOptions<O> {
+
+    private long electionTimeoutMillis = DistributedPrimitive.DEFAULT_OPERATION_TIMEOUT_MILLIS;
+
+    public LeaderElectorOptions() {
+        super(DistributedPrimitive.Type.LEADER_ELECTOR);
+    }
+
+    /**
+     * Sets the election timeout in milliseconds.
+     *
+     * @param electionTimeoutMillis the election timeout in milliseconds
+     * @return leader elector builder
+     */
+    public O withElectionTimeout(long electionTimeoutMillis) {
+        this.electionTimeoutMillis = electionTimeoutMillis;
+        return (O) this;
+    }
+
+    /**
+     * Sets the election timeout.
+     *
+     * @param electionTimeout the election timeout
+     * @param timeUnit the timeout time unit
+     * @return leader elector builder
+     */
+    public O withElectionTimeout(long electionTimeout, TimeUnit timeUnit) {
+        return withElectionTimeout(timeUnit.toMillis(electionTimeout));
+    }
+
+    /**
+     * Returns the election timeout in milliseconds.
+     *
+     * @return the election timeout in milliseconds
+     */
+    public final long electionTimeoutMillis() {
+        return electionTimeoutMillis;
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/RevisionType.java b/core/api/src/main/java/org/onosproject/store/service/RevisionType.java
new file mode 100644
index 0000000..77152aa
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/RevisionType.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+/**
+ * Distributed primitive revision types.
+ * <p>
+ * Revision types dictate the semantics of new revisions of a distributed primitive. They indicate how the new
+ * revision is initialized and how it relates to prior revisions.
+ */
+public enum RevisionType {
+
+    /**
+     * A distributed primitive that is initialized with an empty state.
+     */
+    NONE,
+
+    /**
+     * A distributed primitive that is initialized from the previous revision and sets the previous revision to
+     * read-only mode.
+     */
+    VERSION,
+
+    /**
+     * A distributed primitive that is initialized from the state of the previous revision and to which changes to
+     * the previous revision are propagated.
+     */
+    PROPAGATE,
+
+    /**
+     * A distributed primitive that is initialized from the state of the previous revision and thereafter diverges.
+     */
+    ISOLATE,
+
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/TransactionContextBuilder.java b/core/api/src/main/java/org/onosproject/store/service/TransactionContextBuilder.java
index c9af8e9..d456d1c7 100644
--- a/core/api/src/main/java/org/onosproject/store/service/TransactionContextBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/TransactionContextBuilder.java
@@ -21,9 +21,6 @@
  * Abstract base class for a transaction context builder.
  */
 public abstract class TransactionContextBuilder
-    extends DistributedPrimitiveBuilder<TransactionContextBuilder, TransactionContext> {
-
-    public TransactionContextBuilder() {
-        super(DistributedPrimitive.Type.TRANSACTION_CONTEXT);
-    }
+    extends TransactionContextOptions<TransactionContextBuilder>
+    implements DistributedPrimitiveBuilder<TransactionContext> {
 }
diff --git a/core/api/src/main/java/org/onosproject/store/service/TransactionContextOptions.java b/core/api/src/main/java/org/onosproject/store/service/TransactionContextOptions.java
new file mode 100644
index 0000000..7336f2f
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/TransactionContextOptions.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Abstract base class for a transaction context builder.
+ */
+public abstract class TransactionContextOptions<O extends TransactionContextOptions<O>>
+    extends DistributedPrimitiveOptions<O> {
+    public TransactionContextOptions() {
+        super(DistributedPrimitive.Type.TRANSACTION_CONTEXT);
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/WorkQueueBuilder.java b/core/api/src/main/java/org/onosproject/store/service/WorkQueueBuilder.java
new file mode 100644
index 0000000..52bf3ae
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/WorkQueueBuilder.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveBuilder;
+
+/**
+ * Builder for WorkQueue.
+ */
+public abstract class WorkQueueBuilder<E>
+    extends WorkQueueOptions<WorkQueueBuilder<E>, E>
+    implements DistributedPrimitiveBuilder<WorkQueue<E>> {
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/WorkQueueOptions.java b/core/api/src/main/java/org/onosproject/store/service/WorkQueueOptions.java
new file mode 100644
index 0000000..8d5e23a
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/WorkQueueOptions.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import org.onosproject.store.primitives.DistributedPrimitiveOptions;
+
+/**
+ * Builder for WorkQueue.
+ */
+public abstract class WorkQueueOptions<O extends WorkQueueOptions<O, E>, E>
+    extends DistributedPrimitiveOptions<O> {
+    public WorkQueueOptions() {
+        super(DistributedPrimitive.Type.LOCK);
+    }
+}
\ No newline at end of file