DistributedAtomicLong

- DistributedAtomicLong required for SharedLog sequencer.

Change-Id: I8b85970e67fcf18ea6938312c62eb84999c45105
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZDistributedAtomicLong.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZDistributedAtomicLong.java
new file mode 100644
index 0000000..5df8fc3
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZDistributedAtomicLong.java
@@ -0,0 +1,54 @@
+package net.onrc.onos.core.datastore.hazelcast;
+
+import com.hazelcast.core.HazelcastInstance;
+import com.hazelcast.core.IAtomicLong;
+
+import net.onrc.onos.core.util.distributed.DistributedAtomicLong;
+
+/**
+ * Hazelcast implementation of DistributedAtomicLong.
+ */
+public class HZDistributedAtomicLong implements DistributedAtomicLong {
+    private final IAtomicLong hzAtomicLong;
+
+    // TODO remove dependency HZClient if possible
+    /**
+     * Creates or Gets the DistributedAtomicLong instance.
+     *
+     * @param client client to use
+     * @param name the name of the DistributedAtomicLong instance
+     */
+    public HZDistributedAtomicLong(HZClient client, String name) {
+        this(client.getHZInstance(), name);
+    }
+
+    /**
+     * Creates or Gets the DistributedAtomicLong instance.
+     *
+     * @param instance HazelcastInstance to use
+     * @param name the name of the DistributedAtomicLong instance.
+     */
+    public HZDistributedAtomicLong(HazelcastInstance instance, String name) {
+        hzAtomicLong = instance.getAtomicLong(name);
+    }
+
+    @Override
+    public long get() {
+        return hzAtomicLong.get();
+    }
+
+    @Override
+    public long addAndGet(long delta) {
+        return hzAtomicLong.addAndGet(delta);
+    }
+
+    @Override
+    public void set(long newValue) {
+        hzAtomicLong.set(newValue);
+    }
+
+    @Override
+    public long incrementAndGet() {
+        return hzAtomicLong.incrementAndGet();
+    }
+}