Merge "Bug 4957 RoleContext updated with initialization"
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / role / RoleContext.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 package org.opendaylight.openflowplugin.api.openflow.role;
9
10 import com.google.common.util.concurrent.FutureCallback;
11 import java.util.concurrent.Future;
12 import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
13 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
14 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceContextClosedHandler;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
16
17 /**
18  * Created by kramesha on 9/12/15.
19  */
20 public interface RoleContext extends RoleChangeListener, DeviceContextClosedHandler, RequestContextStack {
21
22     /**
23      * @deprecated do not use it
24      * @param futureCallback - future
25      */
26     @Deprecated
27     void facilitateRoleChange(FutureCallback<Boolean> futureCallback);
28
29     /**
30      * Initialization method is responsible for a registration of
31      * {@link org.opendaylight.controller.md.sal.common.api.clustering.Entity}
32      * and listen for notification from service. {@link Future} returned object is used primary
33      * for new connection initialization phase where we have to wait for actual Role.
34      * The {@link Future} has to be canceled if device is in disconnected state or when
35      * {@link org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService} returns
36      * {@link org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException}
37      * @return InitializationFuture for to know where first initial Election is done and we know role.
38      * @throws CandidateAlreadyRegisteredException - we have registered Entity so drop actual connection
39      */
40     Future<OfpRole> initialization() throws CandidateAlreadyRegisteredException;
41
42 }