Visit Platform at http://www.platform.com

Main Page   Class Hierarchy   Compound List   Compound Members  

ServiceContainer Class Reference

The application developer must extend this class to create their own service. More...

List of all members.


Public Methods

virtual void onCreateService (ServiceContextPtr &serviceContext)
 The middleware triggers the invocation of this handler just after a Service Instance is started.

virtual void onDestroyService ()
 The middleware triggers the invocation of this handler just before a Service Instance is destroyed.

virtual void onSessionEnter (SessionContextPtr &sessionContext)
 The middleware triggers the invocation of this handler to bind the Service Instance to its owning Session when common data is provided by the Client.

virtual void onSessionLeave ()
 The middleware triggers the invocation of this handler to unbind the Service Instance from its owning Session.

virtual void onInvoke (TaskContextPtr &taskContext)=0
 The middleware triggers the invocation of this handler every time a task input is sent to the service to be processed.

virtual void onServiceInterrupt (ServiceContextPtr &serviceContext)
 The middleware triggers the invocation of this handler every time an interrupt arrives.

virtual void onSessionUpdate (SessionContextPtr &sessionContext)
 The middleware triggers the invocation of this handler to update session-specific attributes on the service.

void run (void *stack=0, size_t stackSize=0)
 Run's the service container.

int run (int argc, char *argv[], void *stack=0, size_t stackSize=0)

Detailed Description

The application developer must extend this class to create their own service.

The developer must implement the desired methods to allow the middleware to interact with the Service Instance:


Member Function Documentation

virtual void onCreateService ServiceContextPtr   serviceContext [virtual]
 

The middleware triggers the invocation of this handler just after a Service Instance is started.

The application developer must put any service initialization into this handler. Default implementation does nothing.

Parameters:
serviceContext  [IN] - The context contains the information about the service that is required to create a service instance, and all of the functionality that a service will require throughout its lifetime.
Note:
The application developer can throw SoamException (or subclassed exceptions, eg. FailureException or FatalException) or any of the related smartpointers from this method to indicate that an error occurred during the creation/initializion of the service instance.
See also:
ServiceContext

virtual void onDestroyService   [virtual]
 

The middleware triggers the invocation of this handler just before a Service Instance is destroyed.

This handler should do any cleanup for any resources that were used in the onCreateService() method. Exceptions that are thrown in onDestroyService are not returned to the client, they are logged in the SIM log file. Default implementation does nothing.

Note:
The application developer can throw SoamException (or subclassed exceptions, eg. FailureException or FatalException) or any of the related smartpointers from this method to indicate that an error occurred during the destruction/uninitializion of the service instance.
See also:
onCreateService

virtual void onSessionEnter SessionContextPtr   sessionContext [virtual]
 

The middleware triggers the invocation of this handler to bind the Service Instance to its owning Session when common data is provided by the Client.

The application developer must put any session-specific initialization into this handler.
If any common data is available for the associated Session, it should be accessed in the developer's implementation of this method. Default implementation of this handler does nothing.
This handler may be called multiple times during the lifecycle of the service instance, since a service instance can be re-assigned to other sessions.

Parameters:
sessionContext  [IN] - The context contains information about the binding Session
Note:
The application developer can throw SoamException (or subclassed exceptions, eg. FailureException or FatalException) or any of the related smartpointers from this method to indicate that an error occurred during session-specific initialization or during common data processing.
See also:
SessionContext , onSessionLeave

virtual void onSessionLeave   [virtual]
 

The middleware triggers the invocation of this handler to unbind the Service Instance from its owning Session.

This handler should do any cleanup for any resources that were used in the onSessionEnter() method. Exceptions that are thrown in onSessionLeave are not returned to the client, they are logged in the SIM log file. Default implementation does nothing.

Note:
The application developer can throw SoamException (or subclassed exceptions, eg. FailureException or FatalException) or any of the related smartpointers from this method to indicate that an error occurred while executing the logic to unbind the service instance from its binding session.
See also:
onSessionEnter

virtual void onInvoke TaskContextPtr   taskContext [pure virtual]
 

The middleware triggers the invocation of this handler every time a task input is sent to the service to be processed.

The actual service logic should be implemented in this method. This is the only method that is mandatory for the application developer to implement.

Parameters:
taskContext  [IN] - Context for the task passed from the client application to the service.
Note:
The application developer can throw SoamException (or subclassed exceptions, eg. FailureException or FatalException) or any of the related smartpointers from this service code to indicate that an error occurred during task processing.
See also:
TaskContext

virtual void onServiceInterrupt ServiceContextPtr   serviceContext [virtual]
 

The middleware triggers the invocation of this handler every time an interrupt arrives.

The application developer must put any service interrupt handling code into this handler. Default implementation does nothing.

Parameters:
serviceContext  [IN] - The context contains the information about the service interrupt. This interrupt contains the interrupt type (InterruptTaskKilled or InterruptTaskSuspended) and the task grace period.
Note:
Any exception thrown in this method would be ignored.
See also:
ServiceContext

virtual void onSessionUpdate SessionContextPtr   sessionContext [virtual]
 

The middleware triggers the invocation of this handler to update session-specific attributes on the service.

The application developer should implement code to process session updates in this handler. Default implementation of this handler does nothing. If common data is provided, this handler may be called multiple times between invocations of onSessionEnter and onSessionLeave, when common data updates are sent to the service.

Parameters:
sessionContext  [IN] - the context of the binding session
Note:
The application developer can throw SoamException (or subclassed exceptions, eg. FailureException or FatalException) or any of the related smartpointers from this service code to indicate that an error occurred during the update.
See also:
SessionContext

void run void *    stack = 0,
size_t    stackSize = 0
 

Run's the service container.

Initiates the running of the service container so that the service instance can begin servicing the application. This method is mandatory and will return control to the calling thread when the service instance is no longer required by the application. The developer has the ability to influence the thread stack size while the ServiceContainer is being run.

Parameters:
stack  [IN] - If this parameter is not "0" (null) it will assumed to point to the base of the stack. If it is "0" the memory for the stack will automatically be allocated and de/allocated.
stackSize  [IN] - If this parameter is not "0" it is assumed to be the size of the stack to be made available to the ServiceContianer thread. If this parameter is "0" the default stack size will be used.
Exceptions:
SoamException  on failure
NOTE: Do not call this method more than once in the service code.

Limitation: On Linux AS 2.1, the maximum thread stack size the developer can set is 8M due to an imposed O/S limitation.

Additional Information: + LinuxAS 2.1 (glibc 2.2) : 2MB (default) , 8MB (maximum)
+ LinuxAS 3.0 (glibc 2.3) : 8MB (default) , 2GB (maximum)
+ LinuxAS 4.0 (glibc 2.3) : 8MB (default) , 2GB (maximum)
+ Windows 2000/2003 : 1MB (default) , 2GB (maximum)

int run int    argc,
char *    argv[],
void *    stack = 0,
size_t    stackSize = 0
 

Deprecated:
This method was deprecated in Symphony 3.0.1, use
int ServiceContainer::run(void *stack = 0, size_t stackSize = 0) instead.


     
Date Modified: 3 Nov 2008
Platform Support: support@platform.com
Platform Information Development: doc@platform.com

Platform Computing. Accelerating Intelligence(TM).
Copyright © 2001-2008 Platform Computing Corporation. All rights reserved.