<properties>
<config.configfile.directory>etc/opendaylight/karaf</config.configfile.directory>
<config.clustering.configfile>05-clustering.xml</config.clustering.configfile>
- <config.clustered-entity-ownership.configfile>06-clustered-entity-ownership.xml</config.clustered-entity-ownership.configfile>
</properties>
<dependencies>
<type>xml</type>
<classifier>config</classifier>
</dependency>
- <dependency>
- <!-- finalname="${config.configfile.directory}/${config.clustered-entity-ownership.configfile}" -->
- <groupId>${project.groupId}</groupId>
- <artifactId>sal-clustering-config</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>entityownershipconfig</classifier>
- </dependency>
<dependency>
<!-- finalname="configuration/initial/akka.conf" -->
<groupId>${project.groupId}</groupId>
<configfile finalname="${config.configfile.directory}/${config.clustering.configfile}" override="true">
mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/config
</configfile>
- <configfile finalname="${config.configfile.directory}/${config.clustered-entity-ownership.configfile}">
- mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/entityownershipconfig
- </configfile>
<configfile finalname="configuration/initial/akka.conf">
mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/akkaconf
</configfile>
<type>xml</type>
<classifier>config</classifier>
</artifact>
- <artifact>
- <file>${project.build.directory}/classes/initial/06-clustered-entity-ownership.xml.conf</file>
- <type>xml</type>
- <classifier>entityownershipconfig</classifier>
- </artifact>
<artifact>
<file>${project.build.directory}/classes/initial/akka.conf</file>
<type>xml</type>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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
--->
-<snapshot>
- <configuration>
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <type xmlns:legacy-eos="urn:opendaylight:params:xml:ns:yang:controller:config:legacy-entity-ownership-service-provider">legacy-eos:legacy-entity-ownership-service-provider</type>
- <name>legacy-entity-ownership-service-provider</name>
- </module>
- <module>
- <type xmlns:singleton="urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service">singleton:cluster-singleton-service-impl</type>
- <name>cluster-singleton-service-impl</name>
- </module>
- </modules>
-
- <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <service>
- <type xmlns:legacy-eos="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service">legacy-eos:entity-ownership-service</type>
- <instance>
- <name>entity-ownership-service</name>
- <provider>/modules/module[type='legacy-entity-ownership-service-provider'][name='legacy-entity-ownership-service-provider']</provider>
- </instance>
- </service>
- <service>
- <type xmlns:singleton="urn:opendaylight:params:xml:ns:yang:md:sal:config:spi:cluster-singleton-service">singleton:cluster-singleton-service</type>
- <instance>
- <name>cluster-singleton-service</name>
- <provider>/modules/module[type='cluster-singleton-service-impl'][name='cluster-singleton-service-impl']</provider>
- </instance>
- </service>
- </services>
-
- </data>
- </configuration>
- <required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:config:legacy-entity-ownership-service-provider?module=opendaylight-legacy-entity-ownership-service-provider&revision=2016-02-26</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service?module=cluster-singleton-service-impl&revision=2016-07-18</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:md:sal:config:spi:cluster-singleton-service?module=cluster-singleton-service-spi&revision=2016-07-18</capability>
- </required-capabilities>
-</snapshot>
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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.controller.md.sal.common.api.clustering;
-
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-
-/**
- * Thrown when a Candidate has already been registered for a given Entity. This could be due to a component doing a
- * duplicate registration or two different components within the same process trying to register a Candidate.
- *
- * @deprecated Use org.opendaylight.mdsal.common.api.clustering.CandidateAlreadyRegisteredException instead
- */
-@Deprecated
-public class CandidateAlreadyRegisteredException extends Exception {
- private static final long serialVersionUID = 1L;
-
- private final Entity entity;
-
- public CandidateAlreadyRegisteredException(@Nonnull Entity entity) {
- super(String.format("Candidate has already been registered for %s",
- Preconditions.checkNotNull(entity, "entity should not be null")));
- this.entity = entity;
- }
-
- /**
- * Returns the entity for which a Candidate has already been registered in the current process.
- *
- * @return the entity for which a Candidate has already been registered in the current process
- */
- @Nonnull
- public Entity getEntity() {
- return entity;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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.controller.md.sal.common.api.clustering;
-
-import com.google.common.base.Preconditions;
-import java.io.Serializable;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
-/**
- * A clustered Entity is something which is shared by multiple applications across a cluster. An Entity has a type
- * and an identifier.
- *
- * <p>
- * The type describes the type of the Entity where examples of a type maybe "openflow" or "netconf"
- * etc. An Entity type could be tied to how exactly an application shares and "owns" an entity. For example we may want
- * an application which deals with the openflow entity to be assigned ownership of that entity based on a first come
- * first served basis. On the other hand for netconf entity types we may want applications to gain ownership based on
- * a load balancing approach. While this mechanism of assigning a ownership acquisition strategy is not finalized the
- * intention is that the entity type will play a role in determining the strategy and thus should be put in place.
- *
- * <p>
- * The identifier is a YangInstanceIdentifier. The reason for the choice of YangInstanceIdentifier is because it
- * can easily be used to represent a data node. For example an inventory node represents a shared entity and it is best
- * referenced by the YangInstanceIdentifier if the inventory node is stored in the data store.
- *
- * <p>
- * Note that an entity identifier must conform to a valid yang schema. If there is no existing yang schema to
- * represent an entity, the general-entity yang model can be used.
- *
- * @deprecated Use org.opendaylight.mdsal.binding.api.clustering.Entity or
- * org.opendaylight.mdsal.eos.dom.api.DOMEntity instead
- */
-@Deprecated
-public final class Entity implements Serializable {
- private static final long serialVersionUID = 1L;
-
- 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");
-
- private final String type;
- private final YangInstanceIdentifier id;
-
- /**
- * Construct an Entity with a YangInstanceIdentifier.
- *
- * @param type the type of the entity
- * @param id the identifier of the entity
- */
- public Entity(@Nonnull String type, @Nonnull YangInstanceIdentifier id) {
- this.type = Preconditions.checkNotNull(type, "type should not be null");
- this.id = Preconditions.checkNotNull(id, "id should not be null");
- }
-
- /**
- * 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
- */
- public Entity(@Nonnull String type, @Nonnull String entityName) {
- this.type = Preconditions.checkNotNull(type, "type should not be null");
- this.id = YangInstanceIdentifier.builder().node(ENTITY_QNAME).nodeWithKey(ENTITY_QNAME, ENTITY_NAME,
- Preconditions.checkNotNull(entityName, "entityName should not be null")).build();
- }
-
- /**
- * Returns the id of entity.
- */
- @Nonnull
- public YangInstanceIdentifier getId() {
- return id;
- }
-
- /**
- * Returns the type of entity.
- */
- @Nonnull
- public String getType() {
- return type;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
-
- Entity entity = (Entity) obj;
-
- if (!id.equals(entity.id)) {
- return false;
- }
-
- if (!type.equals(entity.type)) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 31 * type.hashCode() + id.hashCode();
- }
-
- @Override
- public String toString() {
- return "Entity{" + "type='" + type + '\'' + ", id=" + id + '}';
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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.controller.md.sal.common.api.clustering;
-
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
-
-/**
- * An EntityOwnershipCandidateRegistration records a request to register a Candidate for a given Entity. Calling
- * close on the EntityOwnershipCandidateRegistration will remove the Candidate from any future ownership considerations
- * for that Entity.
- *
- * @deprecated Use org.opendaylight.mdsal.binding.api.clustering.EntityOwnershipCandidateRegistration
- * or org.opendaylight.mdsal.dom.api.clustering.DOMEntityOwnershipCandidateRegistration instead
- */
-@Deprecated
-public interface EntityOwnershipCandidateRegistration extends ObjectRegistration<Entity> {
-
- /**
- * Unregister the candidate.
- */
- @Override
- void close();
-}
+++ /dev/null
-/*
- * 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.controller.md.sal.common.api.clustering;
-
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-
-/**
- * A DTO that encapsulates an ownership change for an entity.
- *
- * @author Thomas Pantelis
- *
- * @deprecated Use org.opendaylight.mdsal.binding.api.clustering.EntityOwnershipChange or
- * org.opendaylight.mdsal.dom.api.clustering.DOMEntityOwnershipChange instead
- */
-@Deprecated
-public class EntityOwnershipChange {
- private final Entity entity;
- private final boolean wasOwner;
- private final boolean isOwner;
- private final boolean hasOwner;
- private final boolean inJeopardy;
-
- public EntityOwnershipChange(@Nonnull Entity entity, boolean wasOwner, boolean isOwner, boolean hasOwner) {
- this(entity, wasOwner, isOwner, hasOwner, false);
- }
-
- public EntityOwnershipChange(@Nonnull Entity entity, boolean wasOwner, boolean isOwner, boolean hasOwner,
- boolean inJeopardy) {
- this.entity = Preconditions.checkNotNull(entity, "entity can't be null");
- this.wasOwner = wasOwner;
- this.isOwner = isOwner;
- this.hasOwner = hasOwner;
- this.inJeopardy = inJeopardy;
- }
-
- /**
- * Returns the entity whose ownership status changed.
- * @return the entity
- */
- @Nonnull public Entity getEntity() {
- return entity;
- }
-
- /**
- * Returns the previous ownership status of the entity for this process instance.
- * @return true if this process was the owner of the entity at the time this notification was generated
- */
- public boolean wasOwner() {
- return wasOwner;
- }
-
- /**
- * Returns the current ownership status of the entity for this process instance.
- * @return true if this process is now the owner of the entity
- */
- public boolean isOwner() {
- return isOwner;
- }
-
- /**
- * Returns the current ownership status of the entity across all process instances.
- * @return true if the entity has an owner which may or may not be this process. If false, then
- * the entity has no candidates and thus no owner.
- */
- public boolean hasOwner() {
- return hasOwner;
- }
-
- /**
- * Returns the current jeopardy state. When in a jeopardy state, the values from other methods may potentially
- * be out of date.
- *
- * @return true if the local node is in a jeopardy state. If false, the reported information is accurate.
- */
- public boolean inJeopardy() {
- return inJeopardy;
- }
-
- @Override
- public String toString() {
- return "EntityOwnershipChanged [entity=" + entity + ", wasOwner=" + wasOwner + ", isOwner=" + isOwner
- + ", hasOwner=" + hasOwner + ", inJeopardy=" + inJeopardy + "]";
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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.controller.md.sal.common.api.clustering;
-
-/**
- * An EntityOwnershipListener is a component that represents a listener for entity ownership changes.
- *
- * @deprecated Use org.opendaylight.mdsal.binding.api.clustering.EntityOwnershipListener or
- * org.opendaylight.mdsal.dom.api.clustering.DOMEntityOwnershipListener instead
- */
-@Deprecated
-public interface EntityOwnershipListener {
-
- /**
- * A notification that is generated when the ownership status of an entity changes.
- *
- * <p>
- * The following outlines valid combinations of the ownership status flags in the EntityOwnershipChange
- * parameter and their meanings:
- * <ul>
- * <li><b>wasOwner = false, isOwner = true, hasOwner = true</b> - this process has been granted ownership</li>
- * <li><b>wasOwner = true, isOwner = false, hasOwner = true</b> - this process was the owner but ownership
- * transitioned to another process</li>
- * <li><b>wasOwner = false, isOwner = false, hasOwner = true</b> - ownership transitioned to another process
- * and this process was not the previous owner</li>
- * <li><b>wasOwner = false, isOwner = false, hasOwner = false</b> - the entity no longer has any candidates and
- * thus no owner and this process was not the previous owner</li>
- * <li><b>wasOwner = true, isOwner = false, hasOwner = false</b> - the entity no longer has any candidates and
- * thus no owner and this process was the previous owner</li>
- * </ul>
- * @param ownershipChange contains the entity and its ownership status flags
- */
- void ownershipChanged(EntityOwnershipChange ownershipChange);
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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.controller.md.sal.common.api.clustering;
-
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
-
-/**
- * An EntityOwnershipListenerRegistration records a request to register a ownership status change listener for a
- * given Entity. Calling close on the registration will unregister listeners and future ownership changes will not
- * be delivered to the listener.
- *
- * @deprecated Use org.opendaylight.mdsal.binding.api.clustering.EntityOwnershipListenerRegistration or
- * org.opendaylight.mdsal.dom.api.clustering.DOMEntityOwnershipListenerRegistration instead
- */
-@Deprecated
-public interface EntityOwnershipListenerRegistration extends ObjectRegistration<EntityOwnershipListener> {
-
- /**
- * Return the entity type that the listener was registered for.
- */
- @Nonnull String getEntityType();
-
- /**
- * Unregister the listener.
- */
- @Override
- void close();
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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.controller.md.sal.common.api.clustering;
-
-import com.google.common.base.Optional;
-import javax.annotation.Nonnull;
-
-/**
- * <p>
- * The EntityOwnershipService provides the means for a component/application to request ownership for a given
- * Entity on the current cluster member. Entity ownership is always tied to a process and two components on the same
- * process cannot register a candidate for a given Entity.
- * </p>
- * <p>
- * A component/application may also register interest in the ownership status of an Entity. The listener would be
- * notified whenever the ownership status changes.
- * </p>
- *
- * @deprecated Use org.opendaylight.mdsal.binding.api.clustering.EntityOwnershipService or
- * org.opendaylight.mdsal.dom.api.clustering.DOMEntityOwnershipService instead
- */
-@Deprecated
-public interface EntityOwnershipService {
-
- /**
- * Registers a candidate for ownership of the given entity. Only one such request can be made per entity
- * per process. If multiple requests for registering a candidate for a given entity are received in the
- * current process a CandidateAlreadyRegisteredException will be thrown.
- *
- * <p>
- * The registration is performed asynchronously and any registered {@link EntityOwnershipListener} is
- * notified of ownership status changes for the entity.
- *
- * @param entity the entity which the Candidate wants to own
- * @return a registration object that can be used to unregister the Candidate
- * @throws CandidateAlreadyRegisteredException if the candidate is already registered
- */
- EntityOwnershipCandidateRegistration registerCandidate(@Nonnull Entity entity)
- throws CandidateAlreadyRegisteredException;
-
- /**
- * Registers a listener that is interested in ownership changes for entities of the given entity type. The
- * listener is notified whenever its process instance is granted ownership of the entity and also whenever
- * it loses ownership. On registration the listener will be notified of all entities its process instance
- * currently owns at the time of registration.
- *
- * @param entityType the type of entities whose ownership status the Listener is interested in
- * @param listener the listener that is interested in the entities
- * @return a registration object that can be used to unregister the Listener
- */
- EntityOwnershipListenerRegistration registerListener(@Nonnull String entityType,
- @Nonnull EntityOwnershipListener listener);
-
- /**
- * Gets the current ownership state information for an entity.
- *
- * @param forEntity the entity to query.
- * @return an Optional EntityOwnershipState whose instance is present if the entity is found
- */
- Optional<EntityOwnershipState> getOwnershipState(@Nonnull Entity forEntity);
-
- /**
- * Check if a local candidate is registered for the given entity.
- *
- * @param entity the entity
- * @return true if a candidate was registered locally, false otherwise
- */
- boolean isCandidateRegistered(@Nonnull Entity entity);
-}
+++ /dev/null
-/*
- * 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.controller.md.sal.common.api.clustering;
-
-/**
- * A DTO that encapsulates ownership state for an entity.
- *
- * @author Thomas Pantelis
- *
- * @deprecated Use org.opendaylight.mdsal.common.api.clustering.EntityOwnershipState instead
- */
-@Deprecated
-public class EntityOwnershipState {
- private final boolean isOwner;
- private final boolean hasOwner;
-
- public EntityOwnershipState(boolean isOwner, boolean hasOwner) {
- this.isOwner = isOwner;
- this.hasOwner = hasOwner;
- }
-
- /**
- * Returns the current ownership status of the entity for this process instance.
- * @return true if this process is the owner of the entity
- */
- public boolean isOwner() {
- return isOwner;
- }
-
- /**
- * Returns the current ownership status of the entity across all process instances.
- * @return true if the entity has an owner which may or may not be this process. If false, then
- * the entity has no candidates and thus no owner.
- */
- public boolean hasOwner() {
- return hasOwner;
- }
-
- @Override
- public String toString() {
- return "EntityOwnershipState [isOwner=" + isOwner + ", hasOwner=" + hasOwner + "]";
- }
-}
package org.opendaylight.controller.md.sal.common.api.data;
import com.google.common.base.Preconditions;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.opendaylight.yangtools.concepts.Path;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
private static final long serialVersionUID = 1L;
+ @SuppressFBWarnings("SE_BAD_FIELD")
private final Path<?> path;
private final Class<? extends Path<?>> pathType;
+++ /dev/null
-module general-entity {
- namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:general-entity";
- prefix "general-entity";
-
- description "Defines a model to describe a general entity whose path can be used as an ID for an entity that isn't otherwise modelled";
-
- revision 2015-08-20 {
- description "Initial revision";
- }
-
- list entity {
- key name;
- leaf name {
- type string;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-module opendaylight-entity-ownership-service {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service";
- prefix "entity-ownership-service";
-
- import config { prefix config; revision-date 2013-04-05; }
-
- description "EntityOwnershipService interface definition";
-
- revision "2015-08-10" {
- description "Initial revision";
- }
-
- identity entity-ownership-service {
- base "config:service-type";
- config:java-class "org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService";
- config:disable-osgi-service-registration;
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * 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.controller.md.sal.common.api.clustering;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-import org.apache.commons.lang3.SerializationUtils;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
-/**
- * Unit tests for Entity.
- *
- * @author Thomas Pantelis
- */
-public class EntityTest {
- static String ENTITY_TYPE1 = "type1";
- static String ENTITY_TYPE2 = "type2";
- static final QName QNAME1 = QName.create("test", "2015-08-14", "1");
- static final QName QNAME2 = QName.create("test", "2015-08-14", "2");
- static final YangInstanceIdentifier YANGID1 = YangInstanceIdentifier.of(QNAME1);
- static final YangInstanceIdentifier YANGID2 = YangInstanceIdentifier.of(QNAME2);
-
- @Test
- public void testHashCode() {
- Entity entity1 = new Entity(ENTITY_TYPE1, YANGID1);
-
- assertEquals("hashCode", entity1.hashCode(), new Entity(ENTITY_TYPE1, YANGID1).hashCode());
- assertNotEquals("hashCode", entity1.hashCode(), new Entity(ENTITY_TYPE2, YANGID2).hashCode());
- }
-
- @Test
- public void testEquals() {
- Entity entity1 = new Entity(ENTITY_TYPE1, YANGID1);
-
- assertEquals("Same", true, entity1.equals(entity1));
- assertEquals("Same", true, entity1.equals(new Entity(ENTITY_TYPE1, YANGID1)));
- assertEquals("Different entity type", false, entity1.equals(new Entity(ENTITY_TYPE2, YANGID1)));
- assertEquals("Different yang ID", false, entity1.equals(new Entity(ENTITY_TYPE1, YANGID2)));
- assertEquals("Different Object", false, entity1.equals(new Object()));
- assertEquals("Equals null", false, entity1.equals(null));
- }
-
- @Test
- public void testSerialization() {
- Entity entity = new Entity(ENTITY_TYPE1, YANGID1);
-
- Entity clone = SerializationUtils.clone(entity);
-
- assertEquals("getType", entity.getType(), clone.getType());
- assertEquals("getId", entity.getId(), clone.getId());
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.controller.md.sal.dom.clustering.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
-import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipChange;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListenerRegistration;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipCandidateRegistration;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipChange;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListenerRegistration;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-
-/**
- * Adapter that bridges between the legacy pre-Boron EntityOwnershipService and DOMEntityOwnershipService interfaces.
- *
- * @author Thomas Pantelis
- */
-@Deprecated
-public class LegacyEntityOwnershipServiceAdapter implements EntityOwnershipService, AutoCloseable {
- private final DOMEntityOwnershipService domService;
-
- public LegacyEntityOwnershipServiceAdapter(@Nonnull final DOMEntityOwnershipService domService) {
- this.domService = Preconditions.checkNotNull(domService);
- }
-
- @Override
- @SuppressWarnings("checkstyle:avoidHidingCauseException")
- public EntityOwnershipCandidateRegistration registerCandidate(
- final Entity entity) throws CandidateAlreadyRegisteredException {
- try {
- return new EntityOwnershipCandidateRegistrationAdapter(domService.registerCandidate(toDOMEntity(entity)),
- entity);
- } catch (org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException e) {
- throw new CandidateAlreadyRegisteredException(entity);
- }
- }
-
- @Override
- public EntityOwnershipListenerRegistration registerListener(final String entityType,
- final EntityOwnershipListener listener) {
- return new EntityOwnershipListenerRegistrationAdapter(entityType, listener, domService
- .registerListener(entityType, new DOMEntityOwnershipListenerAdapter(listener)));
- }
-
- @Override
- public Optional<EntityOwnershipState> getOwnershipState(final Entity forEntity) {
- return toEntityOwnershipState(domService.getOwnershipState(toDOMEntity(forEntity)));
- }
-
- @Override
- public boolean isCandidateRegistered(final Entity entity) {
- return domService.isCandidateRegistered(toDOMEntity(entity));
- }
-
- @Override
- public void close() {
- }
-
- private static DOMEntity toDOMEntity(final Entity from) {
- return new DOMEntity(from.getType(), from.getId());
- }
-
- private static Optional<EntityOwnershipState> toEntityOwnershipState(
- final Optional<org.opendaylight.mdsal.eos.common.api.EntityOwnershipState> from) {
- if (!from.isPresent()) {
- return Optional.absent();
- }
-
- org.opendaylight.mdsal.eos.common.api.EntityOwnershipState fromState = from.get();
- return Optional.of(new EntityOwnershipState(
- fromState == org.opendaylight.mdsal.eos.common.api.EntityOwnershipState.IS_OWNER,
- fromState != org.opendaylight.mdsal.eos.common.api.EntityOwnershipState.NO_OWNER));
- }
-
- private static class EntityOwnershipCandidateRegistrationAdapter extends AbstractObjectRegistration<Entity>
- implements EntityOwnershipCandidateRegistration {
- private final DOMEntityOwnershipCandidateRegistration domRegistration;
-
- EntityOwnershipCandidateRegistrationAdapter(final DOMEntityOwnershipCandidateRegistration domRegistration,
- final Entity entity) {
- super(entity);
- this.domRegistration = Preconditions.checkNotNull(domRegistration);
- }
-
- @Override
- protected void removeRegistration() {
- domRegistration.close();
- }
- }
-
- private static class EntityOwnershipListenerRegistrationAdapter extends
- AbstractObjectRegistration<EntityOwnershipListener> implements EntityOwnershipListenerRegistration {
- private final String entityType;
- private final DOMEntityOwnershipListenerRegistration domRegistration;
-
- EntityOwnershipListenerRegistrationAdapter(final String entityType, final EntityOwnershipListener listener,
- final DOMEntityOwnershipListenerRegistration domRegistration) {
- super(listener);
- this.entityType = Preconditions.checkNotNull(entityType);
- this.domRegistration = Preconditions.checkNotNull(domRegistration);
- }
-
- @Override
- public String getEntityType() {
- return entityType;
- }
-
- @Override
- protected void removeRegistration() {
- domRegistration.close();
- }
- }
-
- private static class DOMEntityOwnershipListenerAdapter implements DOMEntityOwnershipListener {
- private final EntityOwnershipListener delegateListener;
-
- DOMEntityOwnershipListenerAdapter(final EntityOwnershipListener delegateListener) {
- this.delegateListener = Preconditions.checkNotNull(delegateListener);
- }
-
- @Override
- @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
- public void ownershipChanged(final DOMEntityOwnershipChange ownershipChange) {
- final DOMEntity domEntity = ownershipChange.getEntity();
- Entity entity = new Entity(domEntity.getType(),
- domEntity.getIdentifier());
- delegateListener.ownershipChanged(new EntityOwnershipChange(entity, ownershipChange.getState().wasOwner(),
- ownershipChange.getState().isOwner(),
- ownershipChange.getState().hasOwner(),
- ownershipChange.inJeopardy()));
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
-
- <reference id="domEntityOwnershipService" interface="org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService"/>
-
- <bean id="legacyEntityOwnershipService" class="org.opendaylight.controller.md.sal.dom.clustering.impl.LegacyEntityOwnershipServiceAdapter"
- destroy-method="close">
- <argument ref="domEntityOwnershipService"/>
- </bean>
-
- <service ref="legacyEntityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"
- odl:type="default"/>
-</blueprint>
+++ /dev/null
-/*
- * Copyright (c) 2016 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.controller.md.sal.dom.clustering.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.base.Optional;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
-import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipChange;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListenerRegistration;
-import org.opendaylight.mdsal.eos.common.api.EntityOwnershipChangeState;
-import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipCandidateRegistration;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipChange;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListenerRegistration;
-import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
-
-/**
- * Unit tests for PreBoronEntityOwnershipServiceAdapter.
- *
- * @author Thomas Pantelis
- */
-@Deprecated
-public class LegacyEntityOwnershipServiceAdapterTest {
- static Entity LEGACY_ENTITY = new Entity("foo", "bar");
- static DOMEntity DOM_ENTITY = new DOMEntity("foo", LEGACY_ENTITY.getId());
-
- @Mock
- private DOMEntityOwnershipService mockDOMService;
-
- private LegacyEntityOwnershipServiceAdapter adapter;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- adapter = new LegacyEntityOwnershipServiceAdapter(mockDOMService);
- }
-
- @Test
- public void testRegisterCandidate() throws Exception {
- DOMEntityOwnershipCandidateRegistration mockDOMReg = mock(DOMEntityOwnershipCandidateRegistration.class);
- doNothing().when(mockDOMReg).close();
- doReturn(mockDOMReg).when(mockDOMService).registerCandidate(DOM_ENTITY);
-
- EntityOwnershipCandidateRegistration reg = adapter.registerCandidate(LEGACY_ENTITY);
-
- assertNotNull("registerCandidate returned null", reg);
- assertEquals("getInstance", LEGACY_ENTITY, reg.getInstance());
-
- reg.close();
- verify(mockDOMReg).close();
- }
-
- @Test(expected = CandidateAlreadyRegisteredException.class)
- public void testAlreadyRegisteredCandidate() throws Exception {
- doThrow(new org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException(DOM_ENTITY))
- .when(mockDOMService).registerCandidate(DOM_ENTITY);
-
- adapter.registerCandidate(LEGACY_ENTITY);
- }
-
- @Test
- public void testRegisterListener() {
- DOMEntityOwnershipListenerRegistration mockDOMReg = mock(DOMEntityOwnershipListenerRegistration.class);
- doNothing().when(mockDOMReg).close();
- doReturn(mockDOMReg).when(mockDOMService)
- .registerListener(eq(DOM_ENTITY.getType()), any(DOMEntityOwnershipListener.class));
- EntityOwnershipListener mockListener = mock(EntityOwnershipListener.class);
- doNothing().when(mockListener).ownershipChanged(any(EntityOwnershipChange.class));
-
- EntityOwnershipListenerRegistration reg = adapter.registerListener(LEGACY_ENTITY.getType(), mockListener);
-
- assertNotNull("registerListener returned null", reg);
- assertEquals("getInstance", mockListener, reg.getInstance());
- assertEquals("getEntityType", LEGACY_ENTITY.getType(), reg.getEntityType());
-
- ArgumentCaptor<DOMEntityOwnershipListener> domListenerCaptor = ArgumentCaptor
- .forClass(DOMEntityOwnershipListener.class);
- verify(mockDOMService).registerListener(eq(DOM_ENTITY.getType()), domListenerCaptor.capture());
-
- DOMEntityOwnershipChange domOwnershipChange = new DOMEntityOwnershipChange(DOM_ENTITY,
- EntityOwnershipChangeState
- .LOCAL_OWNERSHIP_GRANTED);
- domListenerCaptor.getValue().ownershipChanged(domOwnershipChange);
-
- ArgumentCaptor<EntityOwnershipChange> ownershipChangeCaptor = ArgumentCaptor
- .forClass(EntityOwnershipChange.class);
- verify(mockListener).ownershipChanged(ownershipChangeCaptor.capture());
-
- EntityOwnershipChange change = ownershipChangeCaptor.getValue();
- assertEquals("getEntity", LEGACY_ENTITY, change.getEntity());
- assertEquals("wasOwner", false, change.wasOwner());
- assertEquals("isOwner", true, change.isOwner());
- assertEquals("hasOwner", true, change.hasOwner());
-
- reg.close();
- verify(mockDOMReg).close();
- }
-
- @Test
- public void testGetOwnershipState() {
- testGetOwnershipState(EntityOwnershipState.IS_OWNER, true, true);
- testGetOwnershipState(EntityOwnershipState.OWNED_BY_OTHER, false, true);
- testGetOwnershipState(EntityOwnershipState.NO_OWNER, false, false);
-
- doReturn(Optional.absent()).when(mockDOMService).getOwnershipState(DOM_ENTITY);
- assertEquals("isPresent", false, adapter.getOwnershipState(LEGACY_ENTITY).isPresent());
- }
-
- private void testGetOwnershipState(EntityOwnershipState state, boolean expIsOwner, boolean expHasOwner) {
- doReturn(Optional.of(state)).when(mockDOMService).getOwnershipState(DOM_ENTITY);
-
- Optional<org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState> actualState = adapter
- .getOwnershipState(LEGACY_ENTITY);
-
- assertEquals("isPresent", true, actualState.isPresent());
- assertEquals("isOwner", expIsOwner, actualState.get().isOwner());
- assertEquals("hasOwner", expHasOwner, actualState.get().hasOwner());
-
- }
-
- @Test
- public void testIsCandidateRegistered() {
- doReturn(true).when(mockDOMService).isCandidateRegistered(DOM_ENTITY);
- assertEquals("isCandidateRegistered", true, adapter.isCandidateRegistered(LEGACY_ENTITY));
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.controller.config.yang.config.legacy_entity_ownership_service_provider;
-
-import com.google.common.reflect.AbstractInvocationHandler;
-import com.google.common.reflect.Reflection;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
-import org.osgi.framework.BundleContext;
-
-/**
- * Deprecated.
- *
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public class LegacyEntityOwnershipServiceProviderModule extends AbstractLegacyEntityOwnershipServiceProviderModule {
- private BundleContext bundleContext;
-
- public LegacyEntityOwnershipServiceProviderModule(ModuleIdentifier identifier,
- DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public LegacyEntityOwnershipServiceProviderModule(ModuleIdentifier identifier,
- DependencyResolver dependencyResolver,
- LegacyEntityOwnershipServiceProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public AutoCloseable createInstance() {
- final WaitingServiceTracker<EntityOwnershipService> tracker = WaitingServiceTracker.create(
- EntityOwnershipService.class, bundleContext);
- final EntityOwnershipService service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-
- return Reflection.newProxy(AutoCloseableEntityOwnershipService.class, new AbstractInvocationHandler() {
- @Override
- @SuppressWarnings("checkstyle:AvoidHidingCauseException")
- protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
- if (method.getName().equals("close")) {
- tracker.close();
- return null;
- } else {
- try {
- return method.invoke(service, args);
- } catch (InvocationTargetException e) {
- // https://bugs.opendaylight.org/show_bug.cgi?id=6564
- // http://stackoverflow.com/a/10719613/421602
- // https://amitstechblog.wordpress.com/2011/07/24/java-proxies-and-undeclaredthrowableexception/
- throw e.getCause();
- }
- }
- }
- });
- }
-
- public void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- private interface AutoCloseableEntityOwnershipService extends EntityOwnershipService, AutoCloseable {
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.controller.config.yang.config.legacy_entity_ownership_service_provider;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
-import org.opendaylight.controller.config.spi.Module;
-import org.osgi.framework.BundleContext;
-
-/**
- * Deprecated.
- *
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public class LegacyEntityOwnershipServiceProviderModuleFactory
- extends AbstractLegacyEntityOwnershipServiceProviderModuleFactory {
- @Override
- public Module createModule(String instanceName, DependencyResolver dependencyResolver,
- BundleContext bundleContext) {
- LegacyEntityOwnershipServiceProviderModule module = (LegacyEntityOwnershipServiceProviderModule)
- super.createModule(instanceName, dependencyResolver, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public Module createModule(String instanceName, DependencyResolver dependencyResolver,
- DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
- LegacyEntityOwnershipServiceProviderModule module = (LegacyEntityOwnershipServiceProviderModule)
- super.createModule(instanceName, dependencyResolver, old, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.config.impl.cluster.singleton.service.rev160718;
-
-import com.google.common.reflect.AbstractInvocationHandler;
-import com.google.common.reflect.Reflection;
-import java.lang.reflect.Method;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring but remains for backwards compatibility until downstream users
- * of the provided config system service are converted to blueprint.
- */
-@Deprecated
-public class ClusterSingletonServiceProviderModule extends AbstractClusterSingletonServiceProviderModule {
- private BundleContext bundleContext;
-
- public ClusterSingletonServiceProviderModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public ClusterSingletonServiceProviderModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver,
- final ClusterSingletonServiceProviderModule oldModule, final java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
-
- @Override
- public AutoCloseable createInstance() {
- final WaitingServiceTracker<ClusterSingletonServiceProvider> tracker = WaitingServiceTracker
- .create(ClusterSingletonServiceProvider.class, bundleContext);
- final ClusterSingletonServiceProvider service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-
- // Create a proxy to override close to close the ServiceTracker. The actual DOMClusterSingletonServiceProvider
- // instance will be closed via blueprint.
- return Reflection.newProxy(AutoCloseableDOMClusterSingletonServiceProvider.class,
- new AbstractInvocationHandler() {
- @Override
- protected Object handleInvocation(final Object proxy, final Method method, final Object[] args)
- throws Throwable {
- if (method.getName().equals("close")) {
- tracker.close();
- return null;
- } else {
- return method.invoke(service, args);
- }
- }
- });
- }
-
- void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- private interface AutoCloseableDOMClusterSingletonServiceProvider
- extends ClusterSingletonServiceProvider, AutoCloseable {
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2016 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.config.impl.cluster.singleton.service.rev160718;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring but remains for backwards compatibility until downstream users
- * of the provided config system service are converted to blueprint.
- */
-@Deprecated
-public class ClusterSingletonServiceProviderModuleFactory extends AbstractClusterSingletonServiceProviderModuleFactory {
- @Override
- public ClusterSingletonServiceProviderModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver,
- final ClusterSingletonServiceProviderModule oldModule, final AutoCloseable oldInstance, final BundleContext bundleContext) {
- final ClusterSingletonServiceProviderModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
- oldInstance, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public ClusterSingletonServiceProviderModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver,
- final BundleContext bundleContext) {
- final ClusterSingletonServiceProviderModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-}
\ No newline at end of file
+++ /dev/null
-module cluster-singleton-service-impl {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service";
- prefix "cluster-singleton-service";
-
- import config { prefix config; revision-date 2013-04-05; }
- import cluster-singleton-service-spi { prefix spi; revision-date 2016-07-18; }
-
- description "MD-SAL ClusterSingletonServiceProvider service implementation definition";
-
- revision 2016-07-18 {
- description "Initial revision";
- }
-
- identity cluster-singleton-service-impl {
- base config:module-type;
- config:provided-service spi:cluster-singleton-service;
- config:java-name-prefix ClusterSingletonServiceProvider;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case cluster-singleton-service-impl {
- when "/config:modules/config:module/config:type = 'cluster-singleton-service-impl'";
- }
- }
-}
+++ /dev/null
-module cluster-singleton-service-spi {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:md:sal:config:spi:cluster-singleton-service";
- prefix "cluster-singleton-service";
-
- import config { prefix config; revision-date 2013-04-05; }
-
- description "MD-SAL ClusterSingletonServiceProvider service interface definition";
-
- revision 2016-07-18 {
- description "Initial revision";
- }
-
- identity cluster-singleton-service {
- base "config:service-type";
- config:java-class "org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider";
- config:disable-osgi-service-registration;
- }
-}
+++ /dev/null
-module opendaylight-legacy-entity-ownership-service-provider {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:config:legacy-entity-ownership-service-provider";
- prefix "legacy-entity-ownership-service";
-
- import config { prefix config; revision-date 2013-04-05; }
- import opendaylight-entity-ownership-service { prefix legacy-eos-spi; }
-
- description "Legacy EntityOwnershipService implementation";
-
- revision "2016-02-26" {
- description "Initial revision";
- }
-
- identity legacy-entity-ownership-service-provider {
- base config:module-type;
- config:provided-service legacy-eos-spi:entity-ownership-service;
- config:java-name-prefix LegacyEntityOwnershipServiceProvider;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case legacy-entity-ownership-service-provider {
- when "/config:modules/config:module/config:type = 'legacy-entity-ownership-service-provider'";
- }
- }
-}
<packaging>bundle</packaging>
<dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-eos-binding-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller.samples</groupId>
<artifactId>clustering-it-model</artifactId>
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
-import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipChange;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeCommitCohortRegistry;
import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistration;
+import org.opendaylight.mdsal.eos.binding.api.Entity;
+import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange;
+import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListener;
+import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
+import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.Cars;
<reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
<reference id="notificationService" interface="org.opendaylight.controller.sal.binding.api.NotificationProviderService"/>
- <reference id="entityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"/>
+ <reference id="entityOwnershipService" interface="org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService"/>
<reference id="bindingRpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
<reference id="domRpcProviderService" interface="org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService"/>
<reference id="clusterSingletonService" interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>