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

Platform Symphony 5.1 Java API Reference

com.platform.symphony.soam
Class ServiceContainer

java.lang.Object
  extended by com.platform.symphony.soam.ServiceContainer

public abstract class ServiceContainer
extends java.lang.Object

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:

  • onInvoke (mandatory)
  • onCreateService (optional)
  • onDestroyService (optional)
  • onSessionEnter (optional)
  • onSessionLeave (optional)
  • onServiceInterrupt (optional)
  • onSessionUpdate (optional)

  • NOTE: If any of the methods of this class are called after the main(...) method exits, the client or service process may behave in an undefined manner (for example, hang or terminate abnormally).


    Constructor Summary
    ServiceContainer()
              Default Constructor
     
    Method Summary
     void onCreateService(ServiceContext serviceContext)
              The middleware triggers the invocation of this handler just after a Service Instance is started.
     void onDestroyService()
              The middleware triggers the invocation of this handler just before a Service Instance is destroyed.
    abstract  void onInvoke(TaskContext taskContext)
              The middleware triggers the invocation of this handler every time a task input is sent to the service to be processed.
     void onServiceInterrupt(ServiceContext serviceContext)
              The middleware triggers the invocation of this handler every time an interrupt arrives.
     void onSessionEnter(SessionContext 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.
     void onSessionLeave()
              The middleware triggers the invocation of this handler to unbind the Service Instance from its owning Session.
     void onSessionUpdate(SessionContext sessionContext)
              Update this service instance with an update for the binding session.
     int run()
              Runs the service.
     int run(java.lang.String[] args)
              Deprecated. As of Symphony 3.0.1, replaced by run()
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    ServiceContainer

    public ServiceContainer()
    Default Constructor

    Method Detail

    onInvoke

    public abstract void onInvoke(TaskContext taskContext)
                           throws SoamException
    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 - Context for the task passed from the client application to the service.
    Throws:
    SoamException - The application developer can throw SoamException (or subclassed exceptions: FailureException or FatalException) from this method to indicate that an error occurred during task processing.
    See Also:
    TaskContext

    onServiceInterrupt

    public void onServiceInterrupt(ServiceContext serviceContext)
                            throws SoamException
    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.
    Throws:
    Any - exception thrown in this method would be ignored.
    SoamException
    See Also:
    ServiceContext

    onCreateService

    public void onCreateService(ServiceContext serviceContext)
                         throws SoamException
    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 - 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.
    Throws:
    SoamException - The application developer can throw SoamException (or subclassed exceptions: FailureException or FatalException) from this method to indicate that an error occurred during the creation/initializion of the service instance.
    See Also:
    ServiceContext

    onDestroyService

    public void onDestroyService()
                          throws SoamException
    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.

    Throws:
    SoamException - The application developer can throw SoamException (or subclassed exceptions: FailureException or FatalException) from this method to indicate that an error occurred during the destruction/uninitializion of the service instance.
    See Also:
    onCreateService(com.platform.symphony.soam.ServiceContext)

    onSessionEnter

    public void onSessionEnter(SessionContext sessionContext)
                        throws SoamException
    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 - The context contains information about the binding Session
    Throws:
    SoamException - The application developer can throw SoamException (or subclassed exceptions: FailureException or FatalException) from this method to indicate that an error occurred during session-specific initialization or during common data processing.
    See Also:
    SessionContext, onSessionLeave()

    onSessionUpdate

    public void onSessionUpdate(SessionContext sessionContext)
                         throws SoamException
    Update this service instance with an update for the binding session. Called when an update is available for binding session.

    Note: The application developer can throw SoamException (or sub-classed exceptions, etc. FailureException or FatalException) or any of the related smart pointers from this service code to indicate that an error occurred during updating of the common data.

    Parameters:
    sessionContext - The context of the binding session
    Throws:
    SoamException
    See Also:
    SessionContext

    onSessionLeave

    public void onSessionLeave()
                        throws SoamException
    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.

    Throws:
    SoamException - The application developer can throw SoamException (or subclassed exceptions: FailureException or FatalException) 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(com.platform.symphony.soam.SessionContext)

    run

    public final int run()
                  throws SoamException
    Runs the service.

    This method should be called only once for the life of the service. It will block until the middleware has no more use for the service instance.

    Throws:
    SoamException

    run

    public final int run(java.lang.String[] args)
                  throws SoamException
    Deprecated. As of Symphony 3.0.1, replaced by run()

    Runs the service.

    Parameters:
    args - The command line arguments passed to the service program
    Throws:
    SoamException

    Version 5.1
    Date Modified: -DREL_DATE=Apr 28 2011
    Platform Computing. Accelerating Intelligence(TM).
    Copyright (C) 2001-2009 Platform Computing Corporation. All rights reserved.