at.ac.tuwien.infosys.sm4all.copal.api.helpers
Class AbstractListenersActivator

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.helpers.AbstractListenersActivator
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public abstract class AbstractListenersActivator
extends Object
implements org.osgi.framework.BundleActivator

Abstract helper class to be used as an OSGi Activator for bundles that need to register ContextListeners.

Author:
sanjin

Constructor Summary
AbstractListenersActivator()
          Creates instance of OSGi Activator for bundles that need to register ContextListeners.
 
Method Summary
 ProcessedEventQuery[] getCreatedQueries()
           
 ContextQuery getQuery(String name)
          Get successfully created ContextQuery defined in the context.cfg.xml file that has specified name.
 void register(String queryName, ContextListener listener)
          Register specified ContextListener with ContextQuery with specified name that is defined in the listeners.cfg.xml.
protected  void setFactory(ContextQueryFactory factory)
          Sets the ContextQueryFactory, destroys all previously created ContextQuerys and creates defined ContextQuerys and registers all ContextListeners if ContextQueryFactory is not null .
protected  void start()
          Called when bundle is started.
 void start(org.osgi.framework.BundleContext bundleContext)
           
protected  void start(ContextQueryFactory queryFactory)
          Called when ContextQueryFactory becomes available.
protected  void stop()
          Called when ContextQueryFactory becomes unavailable.
 void stop(org.osgi.framework.BundleContext bundleContext)
           
 void unregister(String queryName, ContextListener listener)
          Do not register specified ContextListener with ContextQuery with specified name that is defined in the listeners.cfg.xml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractListenersActivator

public AbstractListenersActivator()
Creates instance of OSGi Activator for bundles that need to register ContextListeners.

Method Detail

start

protected void start()
Called when bundle is started.


start

protected void start(ContextQueryFactory queryFactory)
Called when ContextQueryFactory becomes available.

Parameters:
queryFactory - the ContextQueryFactory.

stop

protected void stop()
Called when ContextQueryFactory becomes unavailable.


getQuery

public ContextQuery getQuery(String name)
Get successfully created ContextQuery defined in the context.cfg.xml file that has specified name.

Parameters:
name - the name of successfully created ContextQuery.
Returns:
the ContextQuery with specified name or null if query was not successfully created or not defined in the context.cfg.xml file.

getCreatedQueries

public ProcessedEventQuery[] getCreatedQueries()
Returns:
all successfully registered ProcessedEventQuerys defined in the context.cfg.xml file.

start

public final void start(org.osgi.framework.BundleContext bundleContext)
Specified by:
start in interface org.osgi.framework.BundleActivator

stop

public final void stop(org.osgi.framework.BundleContext bundleContext)
Specified by:
stop in interface org.osgi.framework.BundleActivator

register

public final void register(String queryName,
                           ContextListener listener)
Register specified ContextListener with ContextQuery with specified name that is defined in the listeners.cfg.xml.

Parameters:
queryName - the name of the ContextQuery defined in the listeners.cfg.xml.
listener - the ContextListener to register.

unregister

public final void unregister(String queryName,
                             ContextListener listener)
Do not register specified ContextListener with ContextQuery with specified name that is defined in the listeners.cfg.xml

Parameters:
queryName - the name of the ContextQuery defined in the listeners.cfg.xml.
listener - the ContextListener to register.

setFactory

protected void setFactory(ContextQueryFactory factory)
Sets the ContextQueryFactory, destroys all previously created ContextQuerys and creates defined ContextQuerys and registers all ContextListeners if ContextQueryFactory is not null .

Parameters:
factory - the ContextQueryFactory.


Copyright © 2010 Distributed Systems Group, Vienna University of Technology. All Rights Reserved.