Add DOM entity ownership interfaces 64/27664/10
authorTom Pantelis <tpanteli@brocade.com>
Mon, 28 Sep 2015 14:34:16 +0000 (10:34 -0400)
committerRobert Varga <robert.varga@pantheon.sk>
Tue, 24 Nov 2015 22:19:21 +0000 (23:19 +0100)
Change-Id: I7416d28efdfd10cad6468087f96765baa412ca13
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntity.java [new file with mode: 0644]
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipCandidateRegistration.java [new file with mode: 0644]
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipChange.java [new file with mode: 0644]
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipListener.java [new file with mode: 0644]
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipListenerRegistration.java [new file with mode: 0644]
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipService.java [new file with mode: 0644]

diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntity.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntity.java
new file mode 100644 (file)
index 0000000..b9180e5
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.dom.api.clustering;
+
+import com.google.common.annotations.Beta;
+import javax.annotation.Nonnull;
+import org.opendaylight.mdsal.common.api.clustering.GenericEntity;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+/**
+ * Binding version of {@link GenericEntity}.
+ *
+ * @author Thomas Pantelis
+ */
+@Beta
+public class DOMEntity extends GenericEntity<YangInstanceIdentifier> {
+    private static final long serialVersionUID = 1L;
+
+    // FIXME: needs update once the model is in
+//    private static final QName ENTITY_QNAME =
+//            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.core.general.entity.rev150820.Entity.QNAME;
+//    private static final QName ENTITY_NAME = QName.create(ENTITY_QNAME, "name");
+
+
+    /** Constructs an instance.
+     *
+     * @param type the entity type
+     * @param id the entity id.
+     */
+    public DOMEntity(@Nonnull final String type, @Nonnull final YangInstanceIdentifier id) {
+        super(type, id);
+    }
+
+    /**
+     * Construct an Entity with an with a name. The general-entity schema is used to construct the
+     * YangInstanceIdentifier.
+     *
+     * @param type the type of the entity
+     * @param entityName the name of the entity used to construct a general-entity YangInstanceIdentifier
+     */
+    // FIXME: needs update once the model is in
+//    public DOMEntity(@Nonnull String type, @Nonnull String entityName) {
+//        super(type, YangInstanceIdentifier.builder().node(ENTITY_QNAME).nodeWithKey(ENTITY_QNAME, ENTITY_NAME,
+//                Preconditions.checkNotNull(entityName, "entityName should not be null")).build());
+//    }
+}
diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipCandidateRegistration.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipCandidateRegistration.java
new file mode 100644 (file)
index 0000000..6bcce77
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.dom.api.clustering;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.mdsal.common.api.clustering.GenericEntityOwnershipCandidateRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+/**
+ * DOM version of {@link GenericEntityOwnershipCandidateRegistration}.
+ *
+ * @author Thomas Pantelis
+ */
+@Beta
+public interface DOMEntityOwnershipCandidateRegistration extends
+        GenericEntityOwnershipCandidateRegistration<YangInstanceIdentifier, DOMEntity> {
+}
diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipChange.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipChange.java
new file mode 100644 (file)
index 0000000..e25f6f2
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.dom.api.clustering;
+
+import com.google.common.annotations.Beta;
+import javax.annotation.Nonnull;
+import org.opendaylight.mdsal.common.api.clustering.EntityOwnershipChangeState;
+import org.opendaylight.mdsal.common.api.clustering.GenericEntityOwnershipChange;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+/**
+ * DOM version of {@link GenericEntityOwnershipChange}.
+ *
+ * @author Thomas Pantelis
+ */
+@Beta
+public class DOMEntityOwnershipChange extends GenericEntityOwnershipChange<YangInstanceIdentifier, DOMEntity> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public DOMEntityOwnershipChange(@Nonnull final DOMEntity entity, @Nonnull final EntityOwnershipChangeState state) {
+        super(entity, state);
+    }
+}
diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipListener.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipListener.java
new file mode 100644 (file)
index 0000000..17a3044
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.dom.api.clustering;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.mdsal.common.api.clustering.GenericEntityOwnershipListener;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+/**
+ * DOM interface for GenericEntityOwnershipListener.
+ *
+ * @author Thomas Pantelis
+ */
+@Beta
+public interface DOMEntityOwnershipListener extends
+        GenericEntityOwnershipListener<YangInstanceIdentifier, DOMEntityOwnershipChange> {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    void ownershipChanged(DOMEntityOwnershipChange ownershipChange);
+}
diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipListenerRegistration.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipListenerRegistration.java
new file mode 100644 (file)
index 0000000..312a136
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.dom.api.clustering;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.mdsal.common.api.clustering.GenericEntityOwnershipListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+/**
+ * DOM interface for GenericEntityOwnershipCandidateRegistration.
+ *
+ * @author Thomas Pantelis
+ */
+@Beta
+public interface DOMEntityOwnershipListenerRegistration extends
+        GenericEntityOwnershipListenerRegistration<YangInstanceIdentifier, DOMEntityOwnershipListener> {
+}
diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/clustering/DOMEntityOwnershipService.java
new file mode 100644 (file)
index 0000000..0cf99cc
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.dom.api.clustering;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Optional;
+import javax.annotation.Nonnull;
+import org.opendaylight.mdsal.common.api.clustering.CandidateAlreadyRegisteredException;
+import org.opendaylight.mdsal.common.api.clustering.EntityOwnershipState;
+import org.opendaylight.mdsal.common.api.clustering.GenericEntityOwnershipService;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+/**
+ * DOM version of {@link GenericEntityOwnershipService}.
+ *
+ * @author Thomas Pantelis
+ */
+@Beta
+public interface DOMEntityOwnershipService extends
+        GenericEntityOwnershipService<YangInstanceIdentifier, DOMEntity, DOMEntityOwnershipListener> {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    DOMEntityOwnershipCandidateRegistration registerCandidate(@Nonnull DOMEntity entity)
+            throws CandidateAlreadyRegisteredException;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    DOMEntityOwnershipListenerRegistration registerListener(@Nonnull String entityType,
+            @Nonnull DOMEntityOwnershipListener listener);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    Optional<EntityOwnershipState> getOwnershipState(@Nonnull DOMEntity forEntity);
+}