at.ac.tuwien.infosys.sm4all.copal.rest.model
Class RESTfulPublisher

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.rest.model.RESTfulPublisher
All Implemented Interfaces:
DependencyTrackerCustomizer, ContextPublisher, Observer<RegistryObservable.RegistrationState,ContextEventType>, RegistryObservable.RegistryObserver<ContextEventType>, org.osgi.framework.BundleActivator

public class RESTfulPublisher
extends BasePublisher

ContextPublisher that is used by REST service to publish Events.

Author:
sanjin

Constructor Summary
RESTfulPublisher(java.lang.String sourceID, java.lang.String... publishedTypes)
          Creates an instance of RESTful ContextPublisher that publishes Events of specified types and using specified source ID.
 
Method Summary
 void add(Authorization... authorizations)
          Adds specified Authorizations to all ContextEvents published by this RESTfulPublisher.
 void addAttributes(Attribute... attributes)
          Sets specified Attributes in all ContextEvents published by this RESTfulPublisher.
 void appendActions(UnprocessedAction... actions)
          Appends specified UnprocessedActions to all ContextEvents published by this RESTfulPublisher.
 void publish(Event event)
          Publish specified Event.
 void setPriority(int priority)
          Sets the default priority used for all ContextEvents published by this BasePublisher.
 void setTTL(long ttl)
          Sets the default time-to-live used for all ContextEvents published by this BasePublisher.
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, publish, removeAuthorization, 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

RESTfulPublisher

public RESTfulPublisher(java.lang.String sourceID,
                        java.lang.String... publishedTypes)
Creates an instance of RESTful ContextPublisher that publishes Events of specified types and using specified source ID.

Parameters:
sourceID - the source ID.
publishedTypes - the types of published Events.
Method Detail

setTTL

public void setTTL(long ttl)
Description copied from class: BasePublisher
Sets the default time-to-live used for all ContextEvents published by this BasePublisher.

Overrides:
setTTL in class BasePublisher
Parameters:
ttl - the default time-to-live.

setPriority

public void setPriority(int priority)
Description copied from class: BasePublisher
Sets the default priority used for all ContextEvents published by this BasePublisher.

Overrides:
setPriority in class BasePublisher
Parameters:
priority - the default priority.

addAttributes

public void addAttributes(Attribute... attributes)
Sets specified Attributes in all ContextEvents published by this RESTfulPublisher.

Parameters:
attributes - the Attributes.

add

public void add(Authorization... authorizations)
Adds specified Authorizations to all ContextEvents published by this RESTfulPublisher.

Parameters:
authorizations - the Authorizations.

appendActions

public void appendActions(UnprocessedAction... actions)
Appends specified UnprocessedActions to all ContextEvents published by this RESTfulPublisher.

Parameters:
actions - the UnprocessedActions.

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(Event event)
             throws FailedPublishingException,
                    MalformedDocumentException
Publish specified Event.

Parameters:
event - the Event.
Throws:
MalformedDocumentException - if specified Event is not valid for specified type of published Events.
FailedPublishingException - if publishing of specified Event fails.


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