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

de.matrixweb.osgi.file.Activator Maven / Gradle / Ivy

Go to download

This implements a very simple file watchdog to be used by the OSGi-Kernel to install maven bundles.

The newest version!
package de.matrixweb.osgi.file;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;

import de.matrixweb.osgi.kernel.maven.Installer;

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

  private ServiceTracker tracker;

  private Watchdog watchdog;

  /**
   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
   */
  @Override
  public void start(final BundleContext context) {
    String deployDir = context.getProperty("deploy.dir");
    if (deployDir == null) {
      deployDir = "deploy";
    }
    this.tracker = new ServiceTracker(context,
        Installer.class, null);
    this.tracker.open();
    this.watchdog = new Watchdog(deployDir, context, this.tracker);
    this.watchdog.start();
  }

  /**
   * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
   */
  @Override
  public void stop(final BundleContext context) {
    this.watchdog.halt();
    this.tracker.close();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy