fesa-core  4.3.1
fesa::AbstractServerAction Class Referenceabstract

This is the based class for all the server actions in the system which will be executed when a property is requested. TODO discuss the DataType parameter. More...

#include <AbstractServerAction.h>

Inherits fesa::AbstractAction.

Inherited by fesa::GetDiagnosticSetting, fesa::GetMetrics, fesa::ServerAction< DeviceType, DataType, FilterType >, and fesa::SetDiagnosticSetting.

Public Member Functions

 AbstractServerAction (const ServerActionConfig &actionConfig, const AbstractServiceLocator *serviceLocator, const std::map< std::string, const AbstractServiceLocator * > &serviceLocatorRelatedClasses)
 
virtual std::auto_ptr
< PropertyData
executeGet (RequestEvent *event, AbstractDevice &device, const cmw::data::Data &filter)=0
 
virtual void executeSet (RequestEvent *event, AbstractDevice &device, const PropertyData &propertyData, const cmw::data::Data &filter)=0
 
virtual bool hasDataChanged (const RequestEvent &event, AbstractDevice &device, const cmw::data::Data &filter) const
 Check if the data published by this server action's property changed The check will be done only during a subscription The default implementation always returns 'true'. It can be overridden by a FESA class developer. More...
 
virtual bool needFilter ()
 
virtual bool isPartialSetAllowed ()
 
virtual void performCommit (boost::shared_ptr< MultiplexingContext > &transactionCtxt, AbstractDevice *transactionDevice)=0
 this method is executed to commit the transaction CRFESA-764 shouldn't be poor virtual
 
virtual void performRollback (boost::shared_ptr< MultiplexingContext > &transactionCtxt, AbstractDevice *transactionDevice)=0
 this method is executed to rollback the transaction CRFESA-764 shouldn't be poor virtual
 
void triggerOnDemandEventSource (const std::string &sourceName, const MultiplexingContext *context, const char *payload, std::size_t payloadSize, uint32_t msgPrio=DEFAULT_ON_DEMAND_MESSAGE_PRIO)
 
void triggerOnDemandEventSource (const std::string &sourceName, const MultiplexingContext *context, uint32_t msgPrio=DEFAULT_ON_DEMAND_MESSAGE_PRIO)
 
virtual void printConfig (FesaStream *configStream)
 this method prints the action configuration into the stream passed by argument More...
 
virtual void printState (FesaStream *fesaStream, double elapsedTime)
 this method prints the actual state of the action (frequency of the completed actions) into the stream passed by argument More...
 
- Public Member Functions inherited from fesa::AbstractAction
void sendManualNotification (const MultiplexingContext *context) const
 this method sends a manual notification message in order to notify the properties and devices specified in the message
 
void resetManualNotification () const
 Clears any registered properties/devices for the manual notification.
 
void disableAutomaticNotification ()
 
void enableAutomaticNotification ()
 
bool isAutomaticNotificationDisabled () const
 

Protected Types

typedef std::map
< boost::shared_ptr
< OnDemandProducer >
, std::vector< OnDemandMessage > > 
ODProducerToODMessagesMap
 

Protected Member Functions

void checkInvalidatingFields (AbstractDevice *device, const MultiplexingContext *context) const
 
void notify (boost::shared_ptr< MultiplexingContext > &context, AbstractDevice &device, RequestType::RequestType reqType=RequestType::GET)
 this method notifies the properties in the server action More...
 
void registerAllAutomaticallyTriggeredOnDemandEventSources (const MultiplexingContext *context, const char *payload, std::size_t payloadSize, uint32_t msgPrio=DEFAULT_ON_DEMAND_MESSAGE_PRIO)
 
void sendPendingOnDemandMessages (uint32_t synchronizationId)
 Sends pending On Demand messages. Sends all the messages contained in pendingOnDemandMessages_, and empties the vector. More...
 
void clearPendingOnDemandMessages ()
 
- Protected Member Functions inherited from fesa::AbstractAction
virtual void registerManualNotification (const std::string aPropertyName, const std::string aDeviceName)
 Adds a property/device pair for the manual notification.
 

Static Protected Attributes

static
boost::thread_specific_ptr
< ODProducerToODMessagesMap
pendingOnDemandMessages_
 Maps a producer to all its on-demand messages waiting to be sent. The sending of these messages is done by calling sendPendingOnDemandMessages(). When the method returns, the map is emptied.
 

Additional Inherited Members

- Protected Attributes inherited from fesa::AbstractAction
std::string name_
 name of the action
 
std::string className_
 name of the FESA-class, which controls this action
 
NotificationProducertheNotificationProducer_
 the notification producer is used to send properties' notifications to the server side
 
std::set< std::string > automaticallyNotifiedPropertiesCol_
 list of properties that will be notified automatically, after the action has finished
 

Detailed Description

This is the based class for all the server actions in the system which will be executed when a property is requested. TODO discuss the DataType parameter.

Member Typedef Documentation

typedef std::map<boost::shared_ptr<OnDemandProducer>, std::vector<OnDemandMessage> > fesa::AbstractServerAction::ODProducerToODMessagesMap
protected

Maps on demand producers to vectors of on demand messages.

Constructor & Destructor Documentation

fesa::AbstractServerAction::AbstractServerAction ( const ServerActionConfig &  actionConfig,
const AbstractServiceLocator *  serviceLocator,
const std::map< std::string, const AbstractServiceLocator * > &  serviceLocatorRelatedClasses 
)
Parameters
actionConfigwhich contains all the attributes to create the action

Member Function Documentation

void fesa::AbstractServerAction::checkInvalidatingFields ( AbstractDevice device,
const MultiplexingContext context 
) const
protected

Throws if any of the disabling fault-fields of the action is raised.

void fesa::AbstractServerAction::clearPendingOnDemandMessages ( )
protected

Removes all messages from the pending on demand messages.

virtual std::auto_ptr<PropertyData> fesa::AbstractServerAction::executeGet ( RequestEvent event,
AbstractDevice device,
const cmw::data::Data &  filter 
)
pure virtual

This method is called by a Property::get() and calls the user's get-server-action code. It returns a PropertyData object whose ownership is transferred to the caller.

Parameters
devicethe device to use
eventobject containing the context
filteroptional filter data, may be empty
Returns
a PropertyData object containing the result of the get action.
virtual void fesa::AbstractServerAction::executeSet ( RequestEvent event,
AbstractDevice device,
const PropertyData propertyData,
const cmw::data::Data &  filter 
)
pure virtual

This method is called by a Property::set() and calls the user's set-server-action code.

Parameters
devicethe device to use
eventobject containing the context
propertyDataa container object filled with the data to set
filteroptional filter data, may be empty
bool fesa::AbstractServerAction::hasDataChanged ( const RequestEvent event,
AbstractDevice device,
const cmw::data::Data &  filter 
) const
virtual

Check if the data published by this server action's property changed The check will be done only during a subscription The default implementation always returns 'true'. It can be overridden by a FESA class developer.

Parameters
eventThe request event that triggered this server action
deviceThe device this server action's property belongs to
filterThe data filter
Returns
'true' if the data published by the property changed, 'false' otherwise
bool fesa::AbstractServerAction::isPartialSetAllowed ( )
virtual
Returns
true if the action supports partial sets
bool fesa::AbstractServerAction::needFilter ( )
virtual
Returns
true if the action needs a filter
void fesa::AbstractServerAction::notify ( boost::shared_ptr< MultiplexingContext > &  context,
AbstractDevice device,
RequestType::RequestType  reqType = RequestType::GET 
)
protected

this method notifies the properties in the server action

Parameters
transactionCtxtthe multiplexing context to be notified
devicewhich triggers the notification
void fesa::AbstractServerAction::printConfig ( FesaStream *  configStream)
virtual

this method prints the action configuration into the stream passed by argument

Parameters
configStreamin which the information will be printed
void fesa::AbstractServerAction::printState ( FesaStream *  fesaStream,
double  elapsedTime 
)
virtual

this method prints the actual state of the action (frequency of the completed actions) into the stream passed by argument

Parameters
fesaStreamin which the information will be printed
void fesa::AbstractServerAction::registerAllAutomaticallyTriggeredOnDemandEventSources ( const MultiplexingContext context,
const char *  payload,
std::size_t  payloadSize,
uint32_t  msgPrio = DEFAULT_ON_DEMAND_MESSAGE_PRIO 
)
protected

Registers an on demand message for every automatically triggered on demand event source. They are sent by sendPendingOnDemandMessages().

void fesa::AbstractServerAction::sendPendingOnDemandMessages ( uint32_t  synchronizationId)
protected

Sends pending On Demand messages. Sends all the messages contained in pendingOnDemandMessages_, and empties the vector.

Parameters
synchronizationIdthe synchronization id to wait for before executing the event
void fesa::AbstractServerAction::triggerOnDemandEventSource ( const std::string &  sourceName,
const MultiplexingContext context,
const char *  payload,
std::size_t  payloadSize,
uint32_t  msgPrio = DEFAULT_ON_DEMAND_MESSAGE_PRIO 
)

This implementation delays the sending of the on demand event till after the execution of the action. This implementation delays the sending of the on demand event till after the execution of the action.

void fesa::AbstractServerAction::triggerOnDemandEventSource ( const std::string &  sourceName,
const MultiplexingContext context,
uint32_t  msgPrio = DEFAULT_ON_DEMAND_MESSAGE_PRIO 
)

This implementation delays the sending of the on demand event till after the execution of the action. This method is only here because of c++ overload resolution: even though it is virtual in the base class (AbstractAction), it needs to be present here to be visible to child classes. It does nothing but call the base implementation (which in turn call the version with the payload parameters).


The documentation for this class was generated from the following files: