Add common entity ownership interfaces
[mdsal.git] / common / mdsal-common-api / src / main / java / org / opendaylight / mdsal / common / api / clustering / GenericEntityOwnershipListenerRegistration.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.mdsal.common.api.clustering;
9
10 import javax.annotation.Nonnull;
11 import org.opendaylight.yangtools.concepts.ObjectRegistration;
12 import org.opendaylight.yangtools.concepts.Path;
13
14 /**
15  * An interface that records a request to register a ownership status change listener for a given Entity.
16  * Calling close on the registration will unregister listeners and future ownership changes will not
17  * be delivered to the listener.
18  *
19  * @author Thomas Pantelis
20  *
21  * @param <P> the instance identifier path type
22  */
23 public interface GenericEntityOwnershipListenerRegistration<P extends Path<P>,
24         L extends GenericEntityOwnershipListener<P, ? extends GenericEntityOwnershipChange<P, ? extends GenericEntity<P>>>>
25             extends ObjectRegistration<L> {
26
27     /**
28      * @return the entity type that the listener was registered for
29      */
30     @Nonnull String getEntityType();
31
32     /**
33      * Unregister the listener
34      */
35     @Override
36     void close();
37 }