at.ac.tuwien.infosys.sm4all.copal.esper.internal
Class EsperPublishing

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.osgi.GenericActivator
      extended by at.ac.tuwien.infosys.sm4all.copal.esper.internal.EsperPublishing
All Implemented Interfaces:
DependencyTrackerCustomizer, PublishingService, Observable<RegistryObservable.RegistrationState,XMLContextEventType,RegistryObservable.RegistryObserver<XMLContextEventType>>, Observer<RegistryObservable.RegistrationState,ContextEventType>, RegistryObservable<XMLContextEventType>, RegistryObservable.RegistryObserver<ContextEventType>, org.osgi.framework.BundleActivator

public class EsperPublishing
extends GenericActivator
implements PublishingService, RegistryObservable.RegistryObserver<ContextEventType>, RegistryObservable<XMLContextEventType>

Implementation of the PublishingService interface which uses Esper as actual event system.

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
EsperPublishing(com.espertech.esper.client.EPServiceProvider serviceProvider)
          Creates an instance of the PublishingService implementation which uses specified EPServiceProvider.
 
Method Summary
 void attach(RegistryObservable.RegistryObserver<XMLContextEventType> observer)
          Attaches specified Observer so it will in future receive notifications on changes.
 void detach(RegistryObservable.RegistryObserver<XMLContextEventType> observer)
          Detach specified Observer so it will not receive any future notifications on changes.
 boolean isStarted()
          Returns if this PublishingService has been started by an OSGi framework.
 void publish(ContextEvent... events)
          Publish specified ContextEvents atomically.
protected  void start()
          Called when all dependencies are met.
protected  void stop()
          Called when GenericActivator.start() was previously called and one of the dependencies has been unregistered.
 void update(RegistryObservable.RegistrationState state, ContextEventType eventType)
          Called when specified objects changes its RegistryObservable.RegistrationState with a BaseRegistry.
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.osgi.GenericActivator
addingService, getDependency, modifiedService, register, register, removedService, start, stop, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EsperPublishing

public EsperPublishing(com.espertech.esper.client.EPServiceProvider serviceProvider)
Creates an instance of the PublishingService implementation which uses specified EPServiceProvider.

Parameters:
serviceProvider - the EPServiceProvider.
Method Detail

isStarted

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

Returns:
if this PublishingService has been started by an OSGi framework.

attach

public void attach(RegistryObservable.RegistryObserver<XMLContextEventType> observer)
Description copied from interface: Observable
Attaches specified Observer so it will in future receive notifications on changes.

Specified by:
attach in interface Observable<RegistryObservable.RegistrationState,XMLContextEventType,RegistryObservable.RegistryObserver<XMLContextEventType>>
Parameters:
observer - the Observer.

detach

public void detach(RegistryObservable.RegistryObserver<XMLContextEventType> observer)
Description copied from interface: Observable
Detach specified Observer so it will not receive any future notifications on changes.

Specified by:
detach in interface Observable<RegistryObservable.RegistrationState,XMLContextEventType,RegistryObservable.RegistryObserver<XMLContextEventType>>
Parameters:
observer - the Observer.

start

protected void start()
Description copied from class: GenericActivator
Called when all dependencies are met.

Specified by:
start in class GenericActivator

stop

protected void stop()
Description copied from class: GenericActivator
Called when GenericActivator.start() was previously called and one of the dependencies has been unregistered.

Specified by:
stop in class GenericActivator

publish

public void publish(ContextEvent... events)
             throws FailedPublishingException
Description copied from interface: PublishingService
Publish specified ContextEvents atomically.

Specified by:
publish in interface PublishingService
Parameters:
events - the ContextEvents.
Throws:
FailedPublishingException - if publishing of any ContextEvent was unsuccessful.

update

public void update(RegistryObservable.RegistrationState state,
                   ContextEventType eventType)
Description copied from interface: RegistryObservable.RegistryObserver
Called when specified objects changes its RegistryObservable.RegistrationState with a BaseRegistry.

Specified by:
update in interface Observer<RegistryObservable.RegistrationState,ContextEventType>
Specified by:
update in interface RegistryObservable.RegistryObserver<ContextEventType>
Parameters:
state - the RegistryObservable.RegistrationState.
eventType - the changed object.


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