org.apache.felix.examples.eventlistener
Class Activator

java.lang.Object
  extended by org.apache.felix.examples.eventlistener.Activator
All Implemented Interfaces:
EventListener, BundleActivator, ServiceListener

public class Activator
extends Object
implements BundleActivator, ServiceListener

This class implements a simple bundle that utilizes the OSGi framework's event mechanism to listen for service events. Upon receiving a service event, it prints out the event's details.

Author:
Felix Project Team

Constructor Summary
Activator()
           
 
Method Summary
 void serviceChanged(ServiceEvent event)
          Implements ServiceListener.serviceChanged().
 void start(BundleContext context)
          Implements BundleActivator.start().
 void stop(BundleContext context)
          Implements BundleActivator.stop().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Activator

public Activator()
Method Detail

start

public void start(BundleContext context)
Implements BundleActivator.start(). Prints a message and adds itself to the bundle context as a service listener.

Specified by:
start in interface BundleActivator
Parameters:
context - the framework context for the bundle.

stop

public void stop(BundleContext context)
Implements BundleActivator.stop(). Prints a message and removes itself from the bundle context as a service listener.

Specified by:
stop in interface BundleActivator
Parameters:
context - the framework context for the bundle.

serviceChanged

public void serviceChanged(ServiceEvent event)
Implements ServiceListener.serviceChanged(). Prints the details of any service event from the framework.

Specified by:
serviceChanged in interface ServiceListener
Parameters:
event - the fired service event.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.