2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.ovsdb.compatibility.plugin.impl;
10 import java.util.List;
13 import org.opendaylight.controller.sal.core.Node;
14 import org.opendaylight.ovsdb.compatibility.plugin.api.NodeUtils;
15 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbConnectionService;
16 import org.opendaylight.ovsdb.plugin.api.Connection;
17 import org.opendaylight.ovsdb.plugin.api.ConnectionConstants;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * This is a proxy class for ovsdb plugin's OvsdbConnectionService class
23 * It just forward the call to OvsdbConnectionService instance and pass
24 * back the response to the caller.
26 * @author Anil Vishnoi (vishnoianil@gmail.com)
29 public class ConnectionServiceImpl implements OvsdbConnectionService{
30 protected static final Logger logger = LoggerFactory.getLogger(ConnectionServiceImpl.class);
32 private volatile org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService pluginOvsdbConnectionService;
38 * Function called by the dependency manager when at least one dependency
39 * become unsatisfied or when the component is shutting down because for
40 * example bundle is being stopped.
46 * Function called by dependency manager after "init ()" is called and after
47 * the services provided by the class are registered in the service registry
53 * Function called by the dependency manager before the services exported by
54 * the component are unregistered, this will be followed by a "destroy ()"
60 public void setOvsdbConnectionService(org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService pluginOvsdbConnectionService){
61 this.pluginOvsdbConnectionService = pluginOvsdbConnectionService;
64 public void unsetOvsdbConnectionService(org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService pluginOvsdbConnectionService){
65 this.pluginOvsdbConnectionService = null;
69 public Connection getConnection(Node node) {
70 return pluginOvsdbConnectionService.getConnection(NodeUtils.getMdsalNode(node));
74 public Node getNode (String identifier) {
75 return NodeUtils.getSalNode(pluginOvsdbConnectionService.getNode(identifier));
79 public List<Node> getNodes() {
80 return NodeUtils.getSalNodes(pluginOvsdbConnectionService.getNodes());
84 public Node connect(String identifier, Map<ConnectionConstants, String> params) {
85 return NodeUtils.getSalNode(pluginOvsdbConnectionService.connect(identifier, params));