at.ac.tuwien.infosys.sm4all.copal.api.processor
Class ProcessorsActivator

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.util.Register<java.lang.String,ContextProcessor,BaseProcessor>
      extended by at.ac.tuwien.infosys.sm4all.copal.api.processor.ProcessorsActivator
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public class ProcessorsActivator
extends Register<java.lang.String,ContextProcessor,BaseProcessor>
implements org.osgi.framework.BundleActivator

AClass to be used as an OSGi BundleActivator for bundles that need to register BaseProcessors.

Author:
sanjin

Field Summary
static java.lang.String CONFIGURATION_FILE
          The name of configuration file that defines ContextEventTypes used by the registered ContextProcessors.
 
Constructor Summary
protected ProcessorsActivator()
          Creates instance of OSGi BundleActivator for bundles that need to register BaseProcessors.
 
Method Summary
protected  java.lang.String getKey(BaseProcessor processor)
          Returns the key for specified value.
 ContextEventType getRegisteredEventType(java.lang.String name)
          Returns registered ContextEventType that has specified name defined in the CONFIGURATION_FILE.
 ContextEventType[] getRegisteredEventTypes()
          Returns all registered ContextEventTypes defined in the CONFIGURATION_FILE.
 void register(BaseProcessor processor)
          Register specified BaseProcessor when ContextProcessorRegistry becomes available (or register it immediately if it is already available).
protected  void setRegistry(ContextProcessorRegistry registry)
          Sets the new ContextProcessorRegistry, unregisters all BaseProcessors from previously set ContextProcessorRegistry if it was not null and registers all BaseProcessors with specified ContextProcessorRegistry if it is not null.
protected  void start()
          Called when bundle is started.
 void start(org.osgi.framework.BundleContext context)
           
protected  void start(ContextProcessorRegistry processorRegistry)
          Called when ContextProcessorRegistry becomes available.
 void stop(org.osgi.framework.BundleContext context)
           
 void unregister(BaseProcessor processor)
          Do not register specified BaseProcessor when ContextProcessorRegistry becomes available (or unregister it immediately if it is already available).
protected  void update(RegistryObservable.RegistrationState state, BaseProcessor processor)
          Called when specified value changes its RegistryObservable.RegistrationState.
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.util.Register
getRegistry, setRegistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_FILE

public static final java.lang.String CONFIGURATION_FILE
The name of configuration file that defines ContextEventTypes used by the registered ContextProcessors.

See Also:
Constant Field Values
Constructor Detail

ProcessorsActivator

protected ProcessorsActivator()
Creates instance of OSGi BundleActivator for bundles that need to register BaseProcessors.

Method Detail

start

protected void start()
Called when bundle is started.


start

protected void start(ContextProcessorRegistry processorRegistry)
Called when ContextProcessorRegistry becomes available.

Parameters:
processorRegistry - the ContextProcessorRegistry.

getRegisteredEventType

public ContextEventType getRegisteredEventType(java.lang.String name)
Returns registered ContextEventType that has specified name defined in the CONFIGURATION_FILE. If ContextEventType with specified name is not defined in the CONFIGURATION_FILE or the ContextEventType was not successfully registered, the null value is returned.

Parameters:
name - the name of registered ContextEventType.
Returns:
the registered ContextEventType.

getRegisteredEventTypes

public ContextEventType[] getRegisteredEventTypes()
Returns all registered ContextEventTypes defined in the CONFIGURATION_FILE.

Returns:
all registered ContextEventTypes.

start

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

stop

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

register

public void register(BaseProcessor processor)
Register specified BaseProcessor when ContextProcessorRegistry becomes available (or register it immediately if it is already available).

Overrides:
register in class Register<java.lang.String,ContextProcessor,BaseProcessor>
Parameters:
processor - the BaseProcessor to register.

unregister

public void unregister(BaseProcessor processor)
Do not register specified BaseProcessor when ContextProcessorRegistry becomes available (or unregister it immediately if it is already available).

Overrides:
unregister in class Register<java.lang.String,ContextProcessor,BaseProcessor>
Parameters:
processor - the BaseProcessor to unregister.

setRegistry

protected void setRegistry(ContextProcessorRegistry registry)
Sets the new ContextProcessorRegistry, unregisters all BaseProcessors from previously set ContextProcessorRegistry if it was not null and registers all BaseProcessors with specified ContextProcessorRegistry if it is not null.

Parameters:
registry - the new ContextProcessorRegistry.

getKey

protected java.lang.String getKey(BaseProcessor processor)
Description copied from class: Register
Returns the key for specified value.

Specified by:
getKey in class Register<java.lang.String,ContextProcessor,BaseProcessor>
Parameters:
processor - the value.
Returns:
the key.

update

protected void update(RegistryObservable.RegistrationState state,
                      BaseProcessor processor)
Description copied from class: Register
Called when specified value changes its RegistryObservable.RegistrationState.

Specified by:
update in class Register<java.lang.String,ContextProcessor,BaseProcessor>
Parameters:
state - the RegistryObservable.RegistrationState
processor - the value.


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