001package de.mnl.osgi.log4j2osgi;
002
003import java.util.Dictionary;
004import java.util.Hashtable;
005
006import org.apache.logging.log4j.spi.Provider;
007import org.osgi.framework.BundleActivator;
008import org.osgi.framework.BundleContext;
009import org.osgi.framework.ServiceRegistration;
010
011public class Activator implements BundleActivator {
012
013    private ServiceRegistration<Provider> serviceRegistration;
014
015    @Override
016    public void start(BundleContext context) throws Exception {
017        Dictionary<String, Object> props = new Hashtable<>();
018        props.put("APIVersion", "2.6.0");
019        serviceRegistration = context.registerService(Provider.class,
020            new OsgiProvider(), props);
021    }
022
023    @Override
024    public void stop(BundleContext context) throws Exception {
025        serviceRegistration.unregister();
026    }
027
028}