at.ac.tuwien.infosys.sm4all.copal.core.internal
Class ContextPublisherRegistryImpl

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.util.BaseObservable<RegistryObservable.RegistrationState,V,RegistryObservable.RegistryObserver<V>>
      extended by at.ac.tuwien.infosys.sm4all.copal.api.util.BaseRegistry<K,V>
          extended by at.ac.tuwien.infosys.sm4all.copal.core.internal.RegistryService<java.lang.String,ContextPublisher>
              extended by at.ac.tuwien.infosys.sm4all.copal.core.internal.ContextPublisherRegistryImpl
All Implemented Interfaces:
ContextPublisherRegistry, Observable<RegistryObservable.RegistrationState,ContextPublisher,RegistryObservable.RegistryObserver<ContextPublisher>>, Registry<java.lang.String,ContextPublisher>, RegistryObservable<ContextPublisher>, org.osgi.framework.BundleActivator

public class ContextPublisherRegistryImpl
extends RegistryService<java.lang.String,ContextPublisher>
implements ContextPublisherRegistry

Implementation of the ContextPublisherRegistry interface.

Author:
fei, sanjin

Nested Class Summary
 
Nested classes/interfaces inherited from interface at.ac.tuwien.infosys.sm4all.copal.api.util.RegistryObservable
RegistryObservable.RegistrationState, RegistryObservable.RegistryObserver<T>
 
Constructor Summary
ContextPublisherRegistryImpl()
          Creates an instance of the ContextPublisherRegistry implementation.
 
Method Summary
 ContextPublisher[] getAll()
          Returns all currently registered ContextPublishers.
 ContextPublisher[] getAll(java.lang.String eventType)
          Returns all ContextPublishers which publish events of specified event type.
protected  java.lang.String getKey(ContextPublisher publisher)
          Return the key for specified value.
 boolean isStarted()
          Returns if this ContextPublisherRegistry has been started by an OSGi framework.
 void register(ContextPublisher publisher)
          Registers specified value.
 void unregister(java.lang.String sourceID)
          Unregisters value associated with specified key.
protected  void unregisterAll()
          Unregisters all registered values.
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.core.internal.RegistryService
attach, detach, start, stop
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.util.BaseRegistry
get, getValues, isRegistered, set, setValues
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.util.BaseObservable
detachAll, getObservers, notifyAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface at.ac.tuwien.infosys.sm4all.copal.api.service.ContextPublisherRegistry
get, isRegistered
 
Methods inherited from interface at.ac.tuwien.infosys.sm4all.copal.api.util.Observable
attach, detach
 

Constructor Detail

ContextPublisherRegistryImpl

public ContextPublisherRegistryImpl()
Creates an instance of the ContextPublisherRegistry implementation.

Method Detail

isStarted

public boolean isStarted()
Returns if this ContextPublisherRegistry has been started by an OSGi framework.

Overrides:
isStarted in class RegistryService<java.lang.String,ContextPublisher>
Returns:
if this ContextPublisherRegistry has been started by an OSGi framework.

register

public void register(ContextPublisher publisher)
              throws AlreadyRegisteredException
Description copied from class: BaseRegistry
Registers specified value. If there is already a value associated with same key the old value will remain registered and this method will throw AlreadyRegisteredException.

Specified by:
register in interface ContextPublisherRegistry
Specified by:
register in interface Registry<java.lang.String,ContextPublisher>
Overrides:
register in class BaseRegistry<java.lang.String,ContextPublisher>
Parameters:
publisher - the value.
Throws:
AlreadyRegisteredException - if a value with same key is already registered.
See Also:
BaseRegistry.set(Object...)

unregister

public void unregister(java.lang.String sourceID)
                throws NotRegisteredException
Description copied from class: BaseRegistry
Unregisters value associated with specified key. If there is no value associated with specified key the registry remains unchanged and this method will throw NotRegisteredException.

Specified by:
unregister in interface ContextPublisherRegistry
Specified by:
unregister in interface Registry<java.lang.String,ContextPublisher>
Overrides:
unregister in class BaseRegistry<java.lang.String,ContextPublisher>
Parameters:
sourceID - the key.
Throws:
NotRegisteredException - if there is no value associated with specified key.

getAll

public ContextPublisher[] getAll()
Description copied from interface: ContextPublisherRegistry
Returns all currently registered ContextPublishers.

Specified by:
getAll in interface ContextPublisherRegistry
Specified by:
getAll in interface Registry<java.lang.String,ContextPublisher>
Returns:
all currently registered ContextPublishers.

getAll

public ContextPublisher[] getAll(java.lang.String eventType)
Description copied from interface: ContextPublisherRegistry
Returns all ContextPublishers which publish events of specified event type.

Specified by:
getAll in interface ContextPublisherRegistry
Parameters:
eventType - the name of the ContextEventType.
Returns:
all ContextPublishers which publish events of specified event type.

getKey

protected java.lang.String getKey(ContextPublisher publisher)
Description copied from class: BaseRegistry
Return the key for specified value.

Specified by:
getKey in class BaseRegistry<java.lang.String,ContextPublisher>
Parameters:
publisher - the value.
Returns:
the key.

unregisterAll

protected void unregisterAll()
Description copied from class: BaseRegistry
Unregisters all registered values.

Overrides:
unregisterAll in class BaseRegistry<java.lang.String,ContextPublisher>


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