preparing QueueKeeper and message translation
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / OpenflowPluginProvider.java
1 /**
2  * Copyright (c) 2013 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.openflow.md.core.sal;
9
10 import java.util.Collection;
11 import java.util.Collections;
12
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
15 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
16 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
17 import org.opendaylight.yangtools.yang.binding.RpcService;
18 import org.osgi.framework.BundleContext;
19
20 /**
21  * OFPlugin provider implementation
22  */
23 public class OpenflowPluginProvider implements BindingAwareProvider {
24
25     private BindingAwareBroker broker;
26
27     private BundleContext context;
28
29     public BundleContext getContext() {
30         return context;
31     }
32
33     public void setContext(BundleContext context) {
34         this.context = context;
35     }
36
37     SalRegistrationManager registrationManager = new SalRegistrationManager();
38
39     @Override
40     public void onSessionInitiated(ProviderContext session) {
41         registrationManager.onSessionInitiated(session);
42     }
43
44     @Override
45     public void onSessionInitialized(ConsumerContext session) {
46         // NOOP
47     }
48
49     @Override
50     public Collection<? extends ProviderFunctionality> getFunctionality() {
51         return Collections.emptySet();
52     }
53
54     @Override
55     public java.util.Collection<? extends RpcService> getImplementations() {
56         return Collections.emptySet();
57     }
58
59     public BindingAwareBroker getBroker() {
60         return broker;
61     }
62
63     public void setBroker(BindingAwareBroker broker) {
64         this.broker = broker;
65         broker.registerProvider(this, context);
66     };
67
68     public void unsetBroker(BindingAwareBroker broker) {
69         this.broker = null;
70     };
71 }