Merge "Integration of Fcaps framework"
[vpnservice.git] / fcapsmanager / countermanager / src / main / java / org / opendaylight / vpnservice / fcapsmanager / countermanager / Activator.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.vpnservice.fcapsmanager.countermanager;
9
10 import org.osgi.framework.BundleActivator;
11 import org.osgi.framework.BundleContext;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14
15 import javax.management.InstanceNotFoundException;
16 import javax.management.MBeanException;
17 import javax.management.MalformedObjectNameException;
18 import javax.management.ReflectionException;
19 import java.io.IOException;
20
21 public class Activator implements BundleActivator {
22     private final static org.slf4j.Logger LOG = LoggerFactory.getLogger(Activator.class);
23     private Runnable listener;
24     private Thread listenerThread;
25
26     public void start(BundleContext context) throws InstanceNotFoundException, MalformedObjectNameException, MBeanException, ReflectionException, IOException {
27         LOG.info("Starting countermanager bundle ");
28         PMRegistrationListener notificationListeners = new PMRegistrationListener(context);
29         try {
30             listener = notificationListeners;
31             listenerThread = new Thread(listener);
32             listenerThread.start();
33         } catch (Exception e) {
34             LOG.error("Exception in counter thread {}", e);
35         }
36     }
37
38     public void stop(BundleContext context) {
39         LOG.info("Stopping countermanager bundle ");
40     }
41 }