Activator.java 1.47 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.osgi.framework.BundleActivator
 *  org.osgi.framework.BundleContext
 *  org.osgi.framework.ServiceRegistration
 *  org.osgi.framework.hooks.resolver.ResolverHookFactory
 *  org.osgi.service.cm.ManagedService
 */
package com.adobe.granite.apicontroller;

import com.adobe.granite.apicontroller.FilterResolverHookFactory;
import java.util.Dictionary;
import java.util.Hashtable;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.resolver.ResolverHookFactory;
import org.osgi.service.cm.ManagedService;

public class Activator
implements BundleActivator {
    private ServiceRegistration<?> reg;
    private FilterResolverHookFactory hookFactory;

    public void start(BundleContext context) throws Exception {
        this.hookFactory = new FilterResolverHookFactory();
        Hashtable<String, String> props = new Hashtable<String, String>();
        props.put("service.pid", FilterResolverHookFactory.class.getName());
        this.reg = context.registerService(new String[]{ManagedService.class.getName(), ResolverHookFactory.class.getName()}, (Object)this.hookFactory, props);
        this.hookFactory.setServiceRegistration(this.reg);
    }

    public void stop(BundleContext context) throws Exception {
        this.hookFactory.setServiceRegistration(null);
        this.reg.unregister();
    }
}