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 / AbstractEntityOwnershipListenerRegistration.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.EntityOwnershipListener;
13 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListenerRegistration;
14 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
15
16 /**
17  * Abstract base class for an EntityOwnershipListenerRegistration.
18  *
19  * @author Thomas Pantelis
20  */
21 public abstract class AbstractEntityOwnershipListenerRegistration extends AbstractObjectRegistration<EntityOwnershipListener>
22         implements EntityOwnershipListenerRegistration {
23     private final String entityType;
24
25     protected AbstractEntityOwnershipListenerRegistration(@Nonnull EntityOwnershipListener listener,
26             @Nonnull String entityType) {
27         super(listener);
28         this.entityType = Preconditions.checkNotNull(entityType, "entityType cannot be null");
29     }
30
31     @Override
32     public String getEntityType() {
33         return entityType;
34     }
35 }