mermaid::support::service::Service Class Reference

Service class. More...

#include <Service.hpp>

Inheritance diagram for mermaid::support::service::Service:
Inheritance graph
[legend]
Collaboration diagram for mermaid::support::service::Service:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void addDataFeed (shared_ptr< DataFeed > dataFeed)
void addServiceInterface (shared_ptr< ServiceInterface > serviceInterface)
shared_ptr< ActiveObjectgetActiveObject ()
 ActiveObject getter.
shared_ptr< DataBoxgetDataBoxForDataFeed (std::string dataFeedName)
 DataBox builder for a specific DataFeed.
virtual shared_ptr< EntitygetEntity ()
 Entity getter.
virtual shared_ptr
< ServiceConfiguration
getServiceConfiguration ()
 ServiceConfiguration getter.
virtual shared_ptr
< ServiceInstanceDescription
getServiceInstanceDescription ()
 ServiceInstanceDescription getter.
virtual std::vector
< shared_ptr
< ServiceTypeDescription > > 
getServiceTypeDescriptions ()
 ServiceTypeDescription getter.
virtual void initialize ()=0
 Service initializer method.
shared_ptr< ServiceRequestmakeNewServiceRequest (std::string targetEntityName, std::string targetServiceName, std::string targetServiceInterfaceName)
 Creates a new ServiceRequest.
void registerDataFeedInputHandler (std::string producerEntityName, std::string producerServiceName, std::string dataFeedName, shared_ptr< DataFeedInputHandlerMethodBase > handlerMethod)
 Registers a DataFeedInputHandler.
void registerServiceInterfaceHandlerMethod (std::string serviceInterfaceName, shared_ptr< ServiceInterfaceHandlerMethodBase > handlerMethod)
 Registers a ServiceInterfaceHandler.
void sendServiceRequest (shared_ptr< ServiceRequest > serviceRequest, shared_ptr< ServiceReplyHandlerMethodBase > replyHandlerMethod=shared_ptr< ServiceReplyHandlerMethodBase >())
 Sends a ServiceRequest.
void sendToDataFeed (std::string dataFeedName, shared_ptr< DataBox > dataBox)
 Method used to send data to a DataFeed.
 Service (shared_ptr< ActiveObject > ao, shared_ptr< Entity > entity, shared_ptr< ServiceInstanceDescription > serviceInstanceDescription, shared_ptr< ServiceConfiguration > serviceConfiguration)
 Constructor. This constructor must be called by the specific class's constructor.
virtual void update ()
 Method that is called regularly by the ServiceUpdateTask.
virtual ~Service ()
 Destructor.

Protected Member Functions

void debug (const std::string &msg) const
 Quickly log a debug message.
const shared_ptr< Logger > & debug () const
 Service Debug Logger getter.
void logger (const std::string &msg) const
 Quickly log a message.
const shared_ptr< Logger > & logger () const
 Service Logger getter.

Friends

class ServiceDataFeedDeliveryTask
class ServiceReplyDeliveryTask
class ServiceRequestDeliveryTask

Detailed Description

Service class.

This is the base class of all services that will be running inside ActiveObjects.

Author:
Marco Barbosa + Nelson Ramos

Definition at line 88 of file Service.hpp.


Constructor & Destructor Documentation

Service::Service ( shared_ptr< ActiveObject ao,
shared_ptr< Entity entity,
shared_ptr< ServiceInstanceDescription serviceInstanceDescription,
shared_ptr< ServiceConfiguration serviceConfiguration 
)

Constructor. This constructor must be called by the specific class's constructor.

Author:
Marco Barbosa + Nelson Ramos

Definition at line 70 of file Service.cpp.

Service::~Service (  )  [virtual]

Destructor.

Author:
Marco Barbosa + Nelson Ramos

Definition at line 90 of file Service.cpp.


Member Function Documentation

void Service::addServiceInterface ( shared_ptr< ServiceInterface serviceInterface  ) 
Todo:
Make these methods protected.

Definition at line 185 of file Service.cpp.

void mermaid::support::service::Service::debug ( const std::string &  msg  )  const [inline, protected]

Quickly log a debug message.

Author:
Joao Reis

Definition at line 345 of file Service.hpp.

const shared_ptr< Logger > & mermaid::support::service::Service::debug (  )  const [inline, protected]

Service Debug Logger getter.

This method returns the Service Debug Logger. Use this logger for debugging purposes only.

Returns:
Service Logger.
Author:
Joao Reis

Definition at line 341 of file Service.hpp.

shared_ptr< ActiveObject > Service::getActiveObject (  ) 

ActiveObject getter.

This method returns the ActiveObject in which the Service is running.

Returns:
ActiveObject in which the Service is running.
Author:
Marco Barbosa

Definition at line 247 of file Service.cpp.

shared_ptr< DataBox > Service::getDataBoxForDataFeed ( std::string  dataFeedName  ) 

DataBox builder for a specific DataFeed.

This method builds a DataBox formatted according to the defined data format of the specified DataFeed

Parameters:
dataFeedName The name of the DataFeed with which this DataBox should be compatible
Returns:
A DataBox correctly formatted for the specified DataFeed..
Author:
Marco Barbosa

Definition at line 324 of file Service.cpp.

shared_ptr< Entity > Service::getEntity (  )  [virtual]

Entity getter.

This method returns the Entity to which the Service belongs.

Returns:
Entity to which the Service belongs.
Author:
Marco Barbosa

Definition at line 242 of file Service.cpp.

shared_ptr< ServiceConfiguration > Service::getServiceConfiguration (  )  [virtual]

ServiceConfiguration getter.

This method returns the ServiceConfiguration of the Service.

Returns:
ServiceConfiguration of the Service
Author:
Marco Barbosa

Definition at line 237 of file Service.cpp.

shared_ptr< ServiceInstanceDescription > Service::getServiceInstanceDescription (  )  [virtual]

ServiceInstanceDescription getter.

This method returns the ServiceInstanceDescription of the Service.

Returns:
ServiceInstanceDescription of the Service
Author:
Marco Barbosa

Definition at line 232 of file Service.cpp.

std::vector< shared_ptr< ServiceTypeDescription > > Service::getServiceTypeDescriptions (  )  [virtual]

ServiceTypeDescription getter.

This method returns the ServiceTypeDescription of the Service.

Returns:
ServiceTypeDescription of the Service.
Author:
Marco Barbosa

Definition at line 227 of file Service.cpp.

virtual void mermaid::support::service::Service::initialize (  )  [pure virtual]

Service initializer method.

Method that will be called when the Service is ready for user initializations.

Author:
Marco Barbosa

Implemented in dummy::DummyService, components::ioservice::IOTestReadService, components::ioservice::IOTestWriteService, and TestService.

void mermaid::support::service::Service::logger ( const std::string &  msg  )  const [inline, protected]

Quickly log a message.

Author:
Joao Reis

Definition at line 337 of file Service.hpp.

const shared_ptr< Logger > & mermaid::support::service::Service::logger (  )  const [inline, protected]

Service Logger getter.

This method returns the Service Logger. Use this logger for error and reporting purposes only.

Returns:
Service Logger.
Author:
Joao Reis

Definition at line 333 of file Service.hpp.

shared_ptr< ServiceRequest > Service::makeNewServiceRequest ( std::string  targetEntityName,
std::string  targetServiceName,
std::string  targetServiceInterfaceName 
)

Creates a new ServiceRequest.

This method is used to build a new ServiceRequest to be sent to the specified target.

Parameters:
targetEntityName The name of the Entity in which the target Service is located.
targetServiceName The name of the target Service.
targetServiceInterfaceName The name of the ServiceInterface to which the ServiceRequest should be delivered.
Returns:
A ServiceRequest configured to be sent to the specified target ServiceInterface
Author:
Marco Barbosa

Definition at line 253 of file Service.cpp.

void Service::registerDataFeedInputHandler ( std::string  producerEntityName,
std::string  producerServiceName,
std::string  dataFeedName,
shared_ptr< DataFeedInputHandlerMethodBase handlerMethod 
)

Registers a DataFeedInputHandler.

This method is used to register a DataFeedInputHandler for a specified DataFeed.

Parameters:
producerEntityName The name of the Entity in which the producer Service is located.
producerServiceName The name of the producer Service.
dataFeedName The name of the DataFeed for which this handler will handle data.
handlerMethod The DataFeedInputHandlerHandlerMethod which points to the handler method to be called upon reception of the data.
Author:
Marco Barbosa

Definition at line 345 of file Service.cpp.

void Service::registerServiceInterfaceHandlerMethod ( std::string  serviceInterfaceName,
shared_ptr< ServiceInterfaceHandlerMethodBase handlerMethod 
)

Registers a ServiceInterfaceHandler.

This method is used to define the handler for a Service's ServiceInterface. The available interfaces are defined in the ServiceTypeDescription XML file.

Parameters:
serviceInterfaceName The name of the interface for which to register the handler
handler The handler for this ServiceInterface
Author:
Marco Barbosa

Definition at line 213 of file Service.cpp.

void Service::sendServiceRequest ( shared_ptr< ServiceRequest serviceRequest,
shared_ptr< ServiceReplyHandlerMethodBase replyHandlerMethod = shared_ptr<ServiceReplyHandlerMethodBase>() 
)

Sends a ServiceRequest.

This method is used to send a ServiceRequest which was previously built using the makeNewServiceRequest method and to define a handler in which he corresponding ServiceReply will be handled.

Parameters:
serviceRequest The ServiceRequest to be sent (the Service to which it will be delivered was already defined in the makeNewServiceRequest method)
replyHandler The handler for the ServiceReply ServiceRequestFailedException Throws ServiceRequestFailedException whenever it is impossible to send the Service Request.
Author:
Marco Barbosa

Definition at line 266 of file Service.cpp.

void Service::sendToDataFeed ( std::string  dataFeedName,
shared_ptr< DataBox dataBox 
)

Method used to send data to a DataFeed.

This method is used to send data to a DataFeed owned by the Service. The available DataFeed are specified in the ServiceTypeDescription XML file.

Parameters:
dataFeedName The name of the local DataFeed to which the data is going to be sent.
dataBox DataBox with the data that is going to be sent to the data feed. This DataBox must have been obtained using the getDataBoxForDataFeed method.
Author:
Marco Barbosa

Definition at line 337 of file Service.cpp.

void Service::update (  )  [virtual]

Method that is called regularly by the ServiceUpdateTask.

This method is called by the ServiceUpdateTask at a rate which is defined in the Service instance's ServiceConfiguration

Author:
Marco Barbosa + Nelson Ramos

Reimplemented in dummy::DummyService, components::ioservice::IOTestReadService, components::ioservice::IOTestWriteService, and TestService.

Definition at line 96 of file Service.cpp.

Generated on Fri Mar 4 22:15:50 2011 for MeRMaID::support by  doxygen 1.6.3