at.ac.tuwien.infosys.sm4all.copal.api.publisher
Class SimplePublisher

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.osgi.GenericActivator
      extended by at.ac.tuwien.infosys.sm4all.copal.api.publisher.BasePublisher
          extended by at.ac.tuwien.infosys.sm4all.copal.api.publisher.SimplePublisher
All Implemented Interfaces:
DependencyTrackerCustomizer, ContextPublisher, Observer<RegistryObservable.RegistrationState,ContextEventType>, RegistryObservable.RegistryObserver<ContextEventType>, org.osgi.framework.BundleActivator

public class SimplePublisher
extends BasePublisher

Simple ContextPublisher that can publish ContextEvents of only one ContextEventType.

Author:
sanjin

Constructor Summary
protected SimplePublisher(java.lang.String sourceID, ContextEventType publishedType)
          Creates an instance of simple ContextPublisher with specified source ID and and published ContextEventType.
 
Method Summary
 boolean isStarted()
          Returns if this SimplePublisher is started and can publish ContextEvents.
 void publish(ContextEvent event)
          Publish specified ContextEvent.
protected  boolean start(ContextEventType type)
          This method is called when PublishingService becomes available for publishing @link ContextEvent}s of the specified ContextEventType.
protected  void stop(ContextEventType type)
          This method is called when PublishingService becomes unavailable for publishing ContextEvents of the specified ContextEventType.
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.publisher.BasePublisher
add, add, appendAction, getPublishedTypes, getSourceID, isStarted, removeAuthorization, setPriority, setTTL, start, stop, unsetPriority, unsetTTL, update
 
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

SimplePublisher

protected SimplePublisher(java.lang.String sourceID,
                          ContextEventType publishedType)
Creates an instance of simple ContextPublisher with specified source ID and and published ContextEventType.

Parameters:
sourceID - the source ID of this ContextPublisher.
publishedType - the published ContextEventType.
Method Detail

isStarted

public boolean isStarted()
Returns if this SimplePublisher is started and can publish ContextEvents.

Returns:
if this SimplePublisher is started.

start

protected boolean start(ContextEventType type)
Description copied from class: BasePublisher
This method is called when PublishingService becomes available for publishing @link ContextEvent}s of the specified ContextEventType. This method should be implemented by specific publishers and is meant as a notification that publisher can start publishing ContextEvents of this ContextEventType.

Specified by:
start in class BasePublisher
Parameters:
type - the ContextEventType of published events.
Returns:
if this BasePublisher has been successfully started for specified ContextEventType.

stop

protected void stop(ContextEventType type)
Description copied from class: BasePublisher
This method is called when PublishingService becomes unavailable for publishing ContextEvents of the specified ContextEventType. This method should be implemented by specific publishers and is meant as a notification that publisher should stop publishing ContextEvents of this ContextEventType.

Specified by:
stop in class BasePublisher
Parameters:
type - the ContextEventType of published ContextEvents.

publish

public void publish(ContextEvent event)
             throws FailedPublishingException
Description copied from class: BasePublisher
Publish specified ContextEvent.

Overrides:
publish in class BasePublisher
Parameters:
event - the ContextEvent.
Throws:
FailedPublishingException - if publishing was unsuccessful.


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