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

Platform Symphony 5.1 Java API Reference

com.platform.symphony.soam
Interface ServiceContext


public interface ServiceContext

Provides functionality that the service will require throughout its lifetime. This object will be passed to a service instance when it is created. The service instance may choose to cache a reference to this object and call on it any time it is required.

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

See Also:
ServiceContainer.onCreateService(com.platform.symphony.soam.ServiceContext)

Method Summary
 java.lang.String getApplicationName()
          Gets the name of the application.
 java.lang.String getConsumerId()
          Gets the consumer ID.
 java.lang.String getDeployDirectory()
          Gets the deployment directory.
 InterruptEvent getLastInterruptEvent()
          Gets the current interrupt event.
 java.lang.String getLogDirectory()
          Gets the log directory.
 java.lang.String getServiceName()
          Gets the service name.
 ServiceToSlotRatio getServiceToSlotRatio()
          Gets the service to slot ratio for this service instance, which indicates how many slots this service is consuming.
 void publish(ResourceAttribute attribute)
          Publishes the attribute to the system.
 void publish(ResourceAttribute attribute, boolean throwOnFailure)
          Publishes the attribute to the system.
 void setControlCode(int code)
          Sets a service control code for service instance manager.
 void unpublish(ResourceAttribute attribute)
          "Un-Publishes" the attribute from the system.
 void unpublish(ResourceAttribute attribute, boolean throwOnFailure)
          "Un-Publishes" the attribute from the system.
 

Method Detail

getServiceName

java.lang.String getServiceName()
                                throws SoamException
Gets the service name.

Returns:
The service name
Throws:
SoamException

getLastInterruptEvent

InterruptEvent getLastInterruptEvent()
                                     throws SoamException
Gets the current interrupt event. After detecting an interrupt event, it is up to the developer to decide what the best course of action is.

Returns:
The interrupt event
Throws:
SoamException
See Also:
InterruptEvent

setControlCode

void setControlCode(int code)
                    throws SoamException
Sets a service control code for service instance manager.

Parameters:
code - The control code defined in the Application Profile
Throws:
SoamException

getApplicationName

java.lang.String getApplicationName()
                                    throws SoamException
Gets the name of the application.

Returns:
The application name associated with this service instance.
Throws:
SoamException

getConsumerId

java.lang.String getConsumerId()
                               throws SoamException
Gets the consumer ID.

Returns:
The consumer ID associated with the application.
Throws:
SoamException

getDeployDirectory

java.lang.String getDeployDirectory()
                                    throws SoamException
Gets the deployment directory.

Returns:
The deployment directory associated with this service.
Throws:
SoamException

getLogDirectory

java.lang.String getLogDirectory()
                                 throws SoamException
Gets the log directory.

Note: If no log directory was configured in the application profile, this method will return "${SOAM_HOME}/work".

Returns:
The log directory configured for this application.
Throws:
SoamException

getServiceToSlotRatio

ServiceToSlotRatio getServiceToSlotRatio()
                                         throws SoamException
Gets the service to slot ratio for this service instance, which indicates how many slots this service is consuming.

The ratio will be either 1:N or N:1, where N is a positive integer. A 1:N ratio means that this service instance is consuming multiple slots. An N:1 ratio means that this service instance is consuming a fraction of a slot.

Returns:
The service to slot ratio for this service instance.
Throws:
SoamException

publish

void publish(ResourceAttribute attribute)
             throws SoamException
Publishes the attribute to the system.

The service may publish details about an attribute at any time during its lifetime. To reduce coding complexity this method will not throw an exception if the publish cannot be completed successfully. If your service wishes to get an exception on failure to publish then use the overload of this method that includes the throwOnFailure attribute and set its value to [true].

Parameters:
attribute - The attribute being published.
Throws:
SoamException
See Also:
ResourceAttribute

publish

void publish(ResourceAttribute attribute,
             boolean throwOnFailure)
             throws SoamException
Publishes the attribute to the system.

The service may publish details about an attribute at any time during its lifetime.

Parameters:
attribute - The attribute being published.
throwOnFailure - Indicates whether we want the method to throw an exception if it fails to publish the attribute.
Throws:
SoamException
See Also:
ResourceAttribute

unpublish

void unpublish(ResourceAttribute attribute)
               throws SoamException
"Un-Publishes" the attribute from the system.

The service may "un-publish" details about an attribute at any time during its lifetime. To reduce coding complexity, this method will not throw an exception if the "un-publish" cannot be completed successfully. If your service wishes to get an exception on failure to "un-publish" then use the overload of this method that includes the throwOnFailure attribute and set its value to [true].

NOTE: If more than one service instance publishes the same attribute with host-level scope, un-publishing the attribute will simply remove one of the publishing references. This means the system will continue to use the last value published for the attribute until all service instances have un-published the same attribute.

Parameters:
attribute - The attribute being "un-published".
Throws:
SoamException
See Also:
ResourceAttribute

unpublish

void unpublish(ResourceAttribute attribute,
               boolean throwOnFailure)
               throws SoamException
"Un-Publishes" the attribute from the system.

The service may "un-publish" details about an attribute at any time during its lifetime.

Parameters:
attribute - The attribute being un-published.
throwOnFailure - Indicates whether we want the method to throw an exception if it fails to "un-publish" the attribute.
Throws:
SoamException
See Also:
ResourceAttribute

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.