All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.matrixweb.smaller.jpegtran.Activator Maven / Gradle / Ivy

package de.matrixweb.smaller.jpegtran;

import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import de.matrixweb.smaller.resource.Processor;

/**
 * @author markusw
 */
public class Activator implements BundleActivator {

  private ServiceRegistration registration;

  private JpegtranProcessor processor;

  /**
   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
   */
  @Override
  public void start(final BundleContext context) {
    this.processor = new JpegtranProcessor();

    final Hashtable props = new Hashtable();
    props.put("name", "jpegtran");
    props.put("version", "");
    props.put("service.ranking", Integer.valueOf(10));
    this.registration = context.registerService(Processor.class,
        this.processor, props);
  }

  /**
   * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
   */
  @Override
  public void stop(final BundleContext context) {
    if (this.registration != null) {
      this.registration.unregister();
      this.registration = null;
    }
    this.processor.dispose();
    this.processor = null;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy