Copyright update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / connection / Activator.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. 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.openflowjava.protocol.impl.connection;
10
11 import java.util.Hashtable;
12
13 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
14 import org.osgi.framework.BundleActivator;
15 import org.osgi.framework.BundleContext;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19
20 /**
21  * Activates library bundle, exposes provided implementations:
22  * <ul>
23  *  <li>{@link SwitchConnectionProviderImpl}</li>
24  * </ul>
25  * 
26  * @author mirehak
27  */
28 public class Activator implements BundleActivator {
29     
30     private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
31
32     @Override
33     public void start(BundleContext context) throws Exception {
34         LOG.debug("starting OF Library");
35         Hashtable<String, String> props = new Hashtable<>();
36         props.put("type", "default");
37         context.registerService(
38                 SwitchConnectionProvider.class.getName(), 
39                 new SwitchConnectionProviderImpl(), props);
40         LOG.debug("started OF Library");
41     }
42
43     @Override
44     public void stop(BundleContext context) throws Exception {
45         LOG.debug("stopping OF Library");
46         //TODO:: add teardown activities (check, if servers are running, stop if necessary..)
47     }
48 }