Merge "Make BridgeName strongly typed"
[netvirt.git] / ovsdb-plugin-compatibility-layer / src / main / java / org / opendaylight / ovsdb / compatibility / plugin / impl / ConnectionServiceImpl.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.ovsdb.compatibility.plugin.impl;
9
10 import java.util.List;
11 import java.util.Map;
12
13 import org.opendaylight.controller.sal.core.Node;
14 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbConnectionService;
15 import org.opendaylight.ovsdb.plugin.api.Connection;
16 import org.opendaylight.ovsdb.plugin.api.ConnectionConstants;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 /**
21  * This is a proxy class for ovsdb plugin's OvsdbConnectionService class
22  * It just forward the call to OvsdbConnectionService instance and pass
23  * back the response to the caller.
24  *
25  * @author Anil Vishnoi (vishnoianil@gmail.com)
26  *
27  */
28 public class ConnectionServiceImpl implements OvsdbConnectionService{
29     protected static final Logger logger = LoggerFactory.getLogger(ConnectionServiceImpl.class);
30
31     org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService pluginOvsdbConnectionService;
32
33     public void init() {
34     }
35
36     /**
37      * Function called by the dependency manager when at least one dependency
38      * become unsatisfied or when the component is shutting down because for
39      * example bundle is being stopped.
40      */
41     void destroy() {
42     }
43
44     /**
45      * Function called by dependency manager after "init ()" is called and after
46      * the services provided by the class are registered in the service registry
47      */
48     void start() {
49     }
50
51     /**
52      * Function called by the dependency manager before the services exported by
53      * the component are unregistered, this will be followed by a "destroy ()"
54      * calls
55      */
56     void stopping() {
57     }
58
59     public void setOvsdbConnectionService(org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService pluginOvsdbConnectionService){
60         this.pluginOvsdbConnectionService = pluginOvsdbConnectionService;
61     }
62
63     public void unsetOvsdbConnectionService(org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService pluginOvsdbConnectionService){
64         if(this.pluginOvsdbConnectionService != null)
65             this.pluginOvsdbConnectionService = null;
66     }
67     @Override
68     public Connection getConnection(Node node) {
69         return pluginOvsdbConnectionService.getConnection(node);
70     }
71
72     @Override
73     public Node getNode (String identifier) {
74         return pluginOvsdbConnectionService.getNode(identifier);
75     }
76
77     @Override
78     public List<Node> getNodes() {
79         return pluginOvsdbConnectionService.getNodes();
80     }
81
82     @Override
83     public Node connect(String identifier, Map<ConnectionConstants, String> params) {
84         return pluginOvsdbConnectionService.connect(identifier, params);
85     }
86
87 }