Fix netconf-connector-config groupId
[netconf.git] / netconf / abstract-topology / src / main / java / org / opendaylight / netconf / topology / RoleChangeListener.java
1 /*
2  * Copyright (c) 2015 Cisco 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
9 package org.opendaylight.netconf.topology;
10
11 import com.google.common.annotations.Beta;
12
13 /**
14  * A listener that recieves {@link #onRoleChanged(RoleChangeDTO)} callbacks when a role change occurs
15  */
16 @Beta
17 public interface RoleChangeListener {
18
19     /**
20      * Called when a role change occurs
21      * @param roleChangeDTO a DTO that wraps the current ownership status
22      */
23     void onRoleChanged(RoleChangeDTO roleChangeDTO);
24
25     /**
26      * A DTO that wraps an ownership change status
27      */
28     class RoleChangeDTO {
29
30         private final boolean wasOwner;
31         private final boolean isOwner;
32         private final boolean hasOwner;
33
34         public RoleChangeDTO(boolean wasOwner, boolean isOwner, boolean hasOwner) {
35             this.wasOwner = wasOwner;
36             this.isOwner = isOwner;
37             this.hasOwner = hasOwner;
38         }
39
40         public boolean wasOwner() {
41             return wasOwner;
42         }
43
44         public boolean isOwner() {
45             return isOwner;
46         }
47
48         public boolean hasOwner() {
49             return hasOwner;
50         }
51     }
52 }