From: Tom Pantelis Date: Wed, 11 Apr 2018 15:22:58 +0000 (-0400) Subject: Remove deprecated controller EOS APIs and impl X-Git-Tag: release/fluorine~116 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=99f994b3e45963f6ef46bc2b71ab4dd8eea8b9ac Remove deprecated controller EOS APIs and impl Change-Id: Idbbc19646790ad9fd6800845a6dd93a210543811 Signed-off-by: Tom Pantelis --- diff --git a/features/mdsal/odl-mdsal-broker/pom.xml b/features/mdsal/odl-mdsal-broker/pom.xml index d6be56220e..d9e3c2d135 100644 --- a/features/mdsal/odl-mdsal-broker/pom.xml +++ b/features/mdsal/odl-mdsal-broker/pom.xml @@ -24,7 +24,6 @@ etc/opendaylight/karaf 05-clustering.xml - 06-clustered-entity-ownership.xml @@ -50,14 +49,6 @@ xml config - - - ${project.groupId} - sal-clustering-config - ${project.version} - xml - entityownershipconfig - ${project.groupId} diff --git a/features/mdsal/odl-mdsal-broker/src/main/feature/feature.xml b/features/mdsal/odl-mdsal-broker/src/main/feature/feature.xml index d3a77853d2..da9440f8ae 100644 --- a/features/mdsal/odl-mdsal-broker/src/main/feature/feature.xml +++ b/features/mdsal/odl-mdsal-broker/src/main/feature/feature.xml @@ -11,9 +11,6 @@ mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/config - - mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/entityownershipconfig - mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/akkaconf diff --git a/opendaylight/md-sal/sal-clustering-config/pom.xml b/opendaylight/md-sal/sal-clustering-config/pom.xml index c2008f0b85..1ba41e7369 100644 --- a/opendaylight/md-sal/sal-clustering-config/pom.xml +++ b/opendaylight/md-sal/sal-clustering-config/pom.xml @@ -41,11 +41,6 @@ xml config - - ${project.build.directory}/classes/initial/06-clustered-entity-ownership.xml.conf - xml - entityownershipconfig - ${project.build.directory}/classes/initial/akka.conf xml diff --git a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/06-clustered-entity-ownership.xml.conf b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/06-clustered-entity-ownership.xml.conf deleted file mode 100644 index 9eeeac2035..0000000000 --- a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/06-clustered-entity-ownership.xml.conf +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - legacy-eos:legacy-entity-ownership-service-provider - legacy-entity-ownership-service-provider - - - singleton:cluster-singleton-service-impl - cluster-singleton-service-impl - - - - - - legacy-eos:entity-ownership-service - - entity-ownership-service - /modules/module[type='legacy-entity-ownership-service-provider'][name='legacy-entity-ownership-service-provider'] - - - - singleton:cluster-singleton-service - - cluster-singleton-service - /modules/module[type='cluster-singleton-service-impl'][name='cluster-singleton-service-impl'] - - - - - - - - urn:opendaylight:params:xml:ns:yang:controller:config:legacy-entity-ownership-service-provider?module=opendaylight-legacy-entity-ownership-service-provider&revision=2016-02-26 - urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service?module=cluster-singleton-service-impl&revision=2016-07-18 - urn:opendaylight:params:xml:ns:yang:md:sal:config:spi:cluster-singleton-service?module=cluster-singleton-service-spi&revision=2016-07-18 - - diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/CandidateAlreadyRegisteredException.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/CandidateAlreadyRegisteredException.java deleted file mode 100644 index 67286e3d48..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/CandidateAlreadyRegisteredException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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; - } -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/Entity.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/Entity.java deleted file mode 100644 index c97fe51d36..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/Entity.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - * - *

- * 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. - * - *

- * 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. - * - *

- * 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 + '}'; - } -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipCandidateRegistration.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipCandidateRegistration.java deleted file mode 100644 index 487b19251b..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipCandidateRegistration.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 { - - /** - * Unregister the candidate. - */ - @Override - void close(); -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipChange.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipChange.java deleted file mode 100644 index 9496f68c1f..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipChange.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 + "]"; - } -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipListener.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipListener.java deleted file mode 100644 index 2aa20b2352..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipListener.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - * - *

- * The following outlines valid combinations of the ownership status flags in the EntityOwnershipChange - * parameter and their meanings: - *

    - *
  • wasOwner = false, isOwner = true, hasOwner = true - this process has been granted ownership
  • - *
  • wasOwner = true, isOwner = false, hasOwner = true - this process was the owner but ownership - * transitioned to another process
  • - *
  • wasOwner = false, isOwner = false, hasOwner = true - ownership transitioned to another process - * and this process was not the previous owner
  • - *
  • wasOwner = false, isOwner = false, hasOwner = false - the entity no longer has any candidates and - * thus no owner and this process was not the previous owner
  • - *
  • wasOwner = true, isOwner = false, hasOwner = false - the entity no longer has any candidates and - * thus no owner and this process was the previous owner
  • - *
- * @param ownershipChange contains the entity and its ownership status flags - */ - void ownershipChanged(EntityOwnershipChange ownershipChange); -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipListenerRegistration.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipListenerRegistration.java deleted file mode 100644 index db246f847e..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipListenerRegistration.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { - - /** - * Return the entity type that the listener was registered for. - */ - @Nonnull String getEntityType(); - - /** - * Unregister the listener. - */ - @Override - void close(); -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipService.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipService.java deleted file mode 100644 index 8e34d80f47..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipService.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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; - -/** - *

- * 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. - *

- *

- * A component/application may also register interest in the ownership status of an Entity. The listener would be - * notified whenever the ownership status changes. - *

- * - * @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. - * - *

- * 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 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); -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipState.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipState.java deleted file mode 100644 index b98523501d..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityOwnershipState.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 + "]"; - } -} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java index 9d2b88702e..a7445489d0 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java @@ -8,6 +8,7 @@ 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; @@ -28,6 +29,7 @@ public class DataValidationFailedException extends TransactionCommitFailedExcept private static final long serialVersionUID = 1L; + @SuppressFBWarnings("SE_BAD_FIELD") private final Path path; private final Class> pathType; diff --git a/opendaylight/md-sal/sal-common-api/src/main/yang/general-entity.yang b/opendaylight/md-sal/sal-common-api/src/main/yang/general-entity.yang deleted file mode 100644 index ce21e25b88..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/yang/general-entity.yang +++ /dev/null @@ -1,17 +0,0 @@ -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 diff --git a/opendaylight/md-sal/sal-common-api/src/main/yang/opendaylight-entity-ownership-service.yang b/opendaylight/md-sal/sal-common-api/src/main/yang/opendaylight-entity-ownership-service.yang deleted file mode 100644 index 28aee9fd4c..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/main/yang/opendaylight-entity-ownership-service.yang +++ /dev/null @@ -1,19 +0,0 @@ -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 diff --git a/opendaylight/md-sal/sal-common-api/src/test/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityTest.java b/opendaylight/md-sal/sal-common-api/src/test/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityTest.java deleted file mode 100644 index d8da5db5fb..0000000000 --- a/opendaylight/md-sal/sal-common-api/src/test/java/org/opendaylight/controller/md/sal/common/api/clustering/EntityTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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()); - } -} diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/clustering/impl/LegacyEntityOwnershipServiceAdapter.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/clustering/impl/LegacyEntityOwnershipServiceAdapter.java deleted file mode 100644 index c8a59f3419..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/clustering/impl/LegacyEntityOwnershipServiceAdapter.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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 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 toEntityOwnershipState( - final Optional 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 - 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 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())); - } - } -} diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/resources/org/opendaylight/blueprint/legacy-eos.xml b/opendaylight/md-sal/sal-dom-broker/src/main/resources/org/opendaylight/blueprint/legacy-eos.xml deleted file mode 100644 index 2f4c64abe1..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/main/resources/org/opendaylight/blueprint/legacy-eos.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/clustering/impl/LegacyEntityOwnershipServiceAdapterTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/clustering/impl/LegacyEntityOwnershipServiceAdapterTest.java deleted file mode 100644 index ab7cd7a4cb..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/clustering/impl/LegacyEntityOwnershipServiceAdapterTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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 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 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 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)); - } -} diff --git a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModule.java b/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModule.java deleted file mode 100644 index 1d65c3bd92..0000000000 --- a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModule.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 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 { - } - -} diff --git a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModuleFactory.java b/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModuleFactory.java deleted file mode 100644 index f24b7b6da8..0000000000 --- a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModuleFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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; - } -} diff --git a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/ClusterSingletonServiceProviderModule.java b/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/ClusterSingletonServiceProviderModule.java deleted file mode 100644 index d054b4dc71..0000000000 --- a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/ClusterSingletonServiceProviderModule.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 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 diff --git a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/ClusterSingletonServiceProviderModuleFactory.java b/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/ClusterSingletonServiceProviderModuleFactory.java deleted file mode 100644 index 0c4aecbfe6..0000000000 --- a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/ClusterSingletonServiceProviderModuleFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 diff --git a/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-impl-cfg.yang b/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-impl-cfg.yang deleted file mode 100644 index 5cd909de2a..0000000000 --- a/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-impl-cfg.yang +++ /dev/null @@ -1,26 +0,0 @@ -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'"; - } - } -} diff --git a/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-spi-cfg.yang b/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-spi-cfg.yang deleted file mode 100644 index b98660822f..0000000000 --- a/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-spi-cfg.yang +++ /dev/null @@ -1,19 +0,0 @@ -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; - } -} diff --git a/opendaylight/md-sal/sal-dom-config/src/main/yang/opendaylight-legacy-entity-ownership-service-provider.yang b/opendaylight/md-sal/sal-dom-config/src/main/yang/opendaylight-legacy-entity-ownership-service-provider.yang deleted file mode 100644 index 419c4a8cea..0000000000 --- a/opendaylight/md-sal/sal-dom-config/src/main/yang/opendaylight-legacy-entity-ownership-service-provider.yang +++ /dev/null @@ -1,26 +0,0 @@ -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'"; - } - } -} diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml b/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml index e8a9546943..be1ba6cf6e 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml @@ -14,6 +14,10 @@ bundle + + org.opendaylight.mdsal + mdsal-eos-binding-api + org.opendaylight.controller.samples clustering-it-model diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java index 857a61b18c..ed0aa1e3d2 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java @@ -23,16 +23,16 @@ import java.util.concurrent.atomic.AtomicReference; 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; diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/org/opendaylight/blueprint/cluster-test-app.xml b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/org/opendaylight/blueprint/cluster-test-app.xml index 6e14774f3e..2a914ffae7 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/org/opendaylight/blueprint/cluster-test-app.xml +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/org/opendaylight/blueprint/cluster-test-app.xml @@ -6,7 +6,7 @@ - +