Bug 4105: Implement EntityOwnershipListener registration/notification
[controller.git] / opendaylight / md-sal / sal-common-impl / src / main / java / org / opendaylight / controller / md / sal / common / impl / clustering / AbstractEntityOwnershipCandidateRegistration.java
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.md.sal.common.impl.clustering;
9
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
13 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidate;
14 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
15 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
16
17 /**
18  * Abstract base class for an EntityOwnershipCandidateRegistration.
19  *
20  * @author Thomas Pantelis
21  */
22 public abstract class AbstractEntityOwnershipCandidateRegistration extends AbstractObjectRegistration<EntityOwnershipCandidate>
23         implements EntityOwnershipCandidateRegistration {
24     private final Entity entity;
25
26     protected AbstractEntityOwnershipCandidateRegistration(@Nonnull EntityOwnershipCandidate candidate,
27             @Nonnull Entity entity) {
28         super(candidate);
29         this.entity = Preconditions.checkNotNull(entity, "entity cannot be null");
30     }
31
32     @Override
33     public Entity getEntity() {
34         return entity;
35     }
36 }