This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
KNXActivator.java
50 lines (44 loc) · 1.54 KB
/
KNXActivator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.knx.internal;
import org.openhab.binding.knx.internal.logging.LogAdapter;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tuwien.auto.calimero.log.LogManager;
/**
* Extension of the default OSGi bundle activator
*/
public final class KNXActivator implements BundleActivator {
private static Logger logger = LoggerFactory.getLogger(KNXActivator.class);
private final LogAdapter logAdapter = new LogAdapter();
/**
* Called whenever the OSGi framework starts our bundle
*/
@Override
public void start(BundleContext bc) throws Exception {
logger.debug("KNX binding has been started.");
// Set global (null) logger for calimero.
LogManager.getManager().addWriter(null, logAdapter);
}
/**
* Called whenever the OSGi framework stops our bundle
*/
@Override
public void stop(BundleContext bc) throws Exception {
// Remove global (null) logger for calimero.
LogManager.getManager().removeWriter(null, logAdapter);
logger.debug("KNX binding has been stopped.");
}
}