Fix license header violations in transcriber
[neutron.git] / transcriber / src / main / java / org / opendaylight / neutron / transcriber / NeutronTranscriberProvider.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
9 package org.opendaylight.neutron.transcriber;
10
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
13 import org.osgi.framework.BundleContext;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16
17 public class NeutronTranscriberProvider implements BindingAwareProvider, AutoCloseable {
18     private static final Logger LOGGER = LoggerFactory.getLogger(NeutronTranscriberProvider.class);
19
20     private BundleContext bundleContext;
21
22     private Activator activator;
23
24     public NeutronTranscriberProvider(BundleContext bundleContext) {
25         LOGGER.warn("BundleContext set to: {}",bundleContext);
26         this.bundleContext = bundleContext;
27     }
28
29     @Override
30     public void onSessionInitiated(ProviderContext providerContext) {
31         this.activator = new Activator(providerContext);
32         try {
33             LOGGER.warn("BundleContext found to be: {}",bundleContext);
34             this.activator.start(bundleContext);
35         } catch (Exception e) {
36             LOGGER.warn("Unable to start Neutron Transcriber because: ",e);
37         }
38     }
39
40     @Override
41     public void close() throws Exception {
42         this.activator.stop(bundleContext);
43     }
44 }