RemoteDeviceDataBroker proxy
[netconf.git] / opendaylight / netconf / abstract-topology / src / main / java / org / opendaylight / netconf / topology / RoleChangeStrategy.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 customizable strategy that gets executed when a BaseTopologyManager|BaseNodeManager is created.
15  * If the election should be executed at another moment, you need to pass the NoopRoleChangeStrategy into the Manager
16  * and the role candidate registration needs to happen in your implemented Node/Topology callback
17  */
18 @Beta
19 public interface RoleChangeStrategy extends RoleChangeListener {
20
21     /**
22      * Your pre-election and election logic goes here, e.g you should register your candidate into the ElectionService
23      * @param electionCandidate NodeListener that should receive the subsequent onRoleChanged callback
24      *                          when a role change occurs.
25      */
26     void registerRoleCandidate(NodeListener electionCandidate);
27
28     /**
29      * Invoke whenever you want to stop candidate from partaking in election.
30      */
31     void unregisterRoleCandidate();
32
33     /**
34      *
35      * @return True/False based on if this candidate is already registered into ownership service
36      */
37     boolean isCandidateRegistered();
38
39 }