com.ibm.twss.platform
Class ServicePlatform

java.lang.Object
  extended by com.ibm.twss.platform.ServicePlatform

public class ServicePlatform
extends java.lang.Object

Provide public interfaces into the TWSS Service Platform, so that new service implementations can be more easily developed. In order to use the runtime context APIs correctly, the ServicePlatformHandler must be included into the webservices.xml for each Web Service Implementation.
<handler> <handler-name>ServicePlatformHandler</handler-name> <handler-class>com.ibm.twss.platform.ServicePlatformHandler</handler-class> </handler>

Version:
1.2

Constructor Summary
ServicePlatform()
           
 
Method Summary
static java.lang.String decrypt(java.lang.String string)
          Decrypt the string in a manner consistent with the TWSS Password datatype.
static java.lang.String encrypt(java.lang.String string)
          Encrypt the string in a manner consistent with the TWSS Password datatype.
static java.lang.String formatUsingText(java.lang.String[] variables, java.lang.String text)
          Format the message string by doing substitutions.
static AdmissionControlInterface getAdmissionControlClient()
          Get the Admission Control client.
static java.lang.String getClusterName()
          Get the current cluster name.
static java.lang.String getCurrentApplicationName()
          Get the current application name.
static java.lang.Exception[] getExceptionsFromInitialization()
          Get the list of exceptions that occurred during the ServicePlatformHandler processing.
static FaultAlarmInterface getFaultAlarmClient()
          Get the Fault Alarm client.
static java.lang.String getGlobalTransactionID()
          Retrieve the transaction ID from the Access Gateway Transaction ID Generation Mediation Primitive Design.
static ServicePlatformLogger getLogger(java.lang.Class cls)
          Creates a wrapped trace logger for use in logging information about class method execution.
static java.lang.String getMessageFromBundle(java.lang.String bundleName, java.lang.String msgId, java.util.Locale locale)
          Get a message from the locale specific messages file in the resource bundle.
static NetworkResourceInterface getNetworkResourceClient()
          Get the Network Resource client.
static NotificationRegistration getNoticationManagementRegistrationClient()
          Get the Notification Registration client.
static int getOperationTargets()
          Retrieve the operationTargets per the Access Gateway Group Resolution Mediation Primitive Design.
static java.lang.String[] getPolicies()
          Retrieve a Set containing all of the policy names found in the incoming policy headers per the Policy/Subscription Mediation Primitive Design.
static java.lang.String getPolicy(java.lang.String policyName)
          Retrieve the value of the policy with the given name per the Policy/Subscription Mediation Primitive Design.
static PrivacyInterface getPrivacyClient()
          Get the Privacy client.
static CallDirection getPxNotificationCallDirectionClient()
          Get the PxNotification Call Direction Notification client.
static CallNotification getPxNotificationCallNotificationClient()
          Get the PxNotification Call Notification client.
static MessageNotification getPxNotificationMessageNotificationClient()
          Get the PxNotification Message Notification client.
static PresenceNotification getPxNotificationPresenceNotificationClient()
          Get the PxNotification Presence Notification client.
static SmsNotification getPxNotificationSmsNotificationClient()
          Get the PxNotification Sms Notification client.
static TerminalLocationNotification getPxNotificationTerminalLocationClient()
          Get the PxNotification Terminal Location Notification client.
static TerminalStatusNotification getPxNotificationTerminalStatusNotificationClient()
          Get the PxNotification Terminal Status Notification client.
static WAPPushNotification getPxNotificationWAPPushNotificationClient()
          Get the PxNotification WAPPush Notification client.
static java.lang.String getRequesterID()
          Retrieve the requester's identity.
static java.util.Locale getRequesterLocale()
          Retrieve the requester's preferred Locale.
static java.lang.String getRequestURL()
          Retrieve the HTTP request URL that the client used to access this operation.
static java.lang.String[] getResolvedGroupURI(java.lang.String groupUri)
          Retrieve a the members of the group with the given groupUri.
static java.lang.String[] getResolvedGroupURIs()
          Retrieve a Array of Strings with all of the unique group URIs found by the Group Resolution Mediation Primitive.
static java.lang.String getSubstitutedMessage(java.lang.String bundleName, java.lang.String messageId, java.util.Locale locale, java.lang.String text, java.lang.String[] variables)
          Get a message with substituted variables.
static TrafficShapingInterface getTrafficShapingClient()
          Get the Traffic Shaping client.
static UsageRecordInterface getUsageRecordClient()
          Get the Usage Record Client.
static void initializeStatsComponent(java.lang.String componentName)
          Initialize the status instance object in the default group for the specified component.
static void publishAverageStat(java.lang.String componentName, int metricID, long countValue)
          Publish a count average statistic.
static void publishCountStat(java.lang.String componentName, int metricID, long count)
          Publish a simple count statistic.
static void publishTimeStat(java.lang.String componentName, int metricID, long timeValue)
          Publish a time average statistic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServicePlatform

public ServicePlatform()
Method Detail

getUsageRecordClient

public static UsageRecordInterface getUsageRecordClient()
Get the Usage Record Client.

Returns:
the client object

getFaultAlarmClient

public static FaultAlarmInterface getFaultAlarmClient()
Get the Fault Alarm client.

Returns:
the client object

getAdmissionControlClient

public static AdmissionControlInterface getAdmissionControlClient()
Get the Admission Control client.

Returns:
the client object

getTrafficShapingClient

public static TrafficShapingInterface getTrafficShapingClient()
Get the Traffic Shaping client.

Returns:
the client object

getNetworkResourceClient

public static NetworkResourceInterface getNetworkResourceClient()
Get the Network Resource client.

Returns:
the client object

getPrivacyClient

public static PrivacyInterface getPrivacyClient()
Get the Privacy client.

Returns:
the client object

getPxNotificationCallDirectionClient

public static CallDirection getPxNotificationCallDirectionClient()
Get the PxNotification Call Direction Notification client.

Returns:
the client object

getPxNotificationCallNotificationClient

public static CallNotification getPxNotificationCallNotificationClient()
Get the PxNotification Call Notification client.

Returns:
the client object

getPxNotificationTerminalStatusNotificationClient

public static TerminalStatusNotification getPxNotificationTerminalStatusNotificationClient()
Get the PxNotification Terminal Status Notification client.

Returns:
the client object

getPxNotificationMessageNotificationClient

public static MessageNotification getPxNotificationMessageNotificationClient()
Get the PxNotification Message Notification client.

Returns:
the client object

getPxNotificationPresenceNotificationClient

public static PresenceNotification getPxNotificationPresenceNotificationClient()
Get the PxNotification Presence Notification client.

Returns:
the client object

getPxNotificationSmsNotificationClient

public static SmsNotification getPxNotificationSmsNotificationClient()
Get the PxNotification Sms Notification client.

Returns:
the client object

getPxNotificationWAPPushNotificationClient

public static WAPPushNotification getPxNotificationWAPPushNotificationClient()
Get the PxNotification WAPPush Notification client.

Returns:
the client object

getPxNotificationTerminalLocationClient

public static TerminalLocationNotification getPxNotificationTerminalLocationClient()
Get the PxNotification Terminal Location Notification client.

Returns:
the client object

getNoticationManagementRegistrationClient

public static NotificationRegistration getNoticationManagementRegistrationClient()
Get the Notification Registration client.

Returns:
the client object

getExceptionsFromInitialization

public static java.lang.Exception[] getExceptionsFromInitialization()
Get the list of exceptions that occurred during the ServicePlatformHandler processing. This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
an unmodifiable array of Exceptions, the web service application should throw a defined exception

getGlobalTransactionID

public static java.lang.String getGlobalTransactionID()
Retrieve the transaction ID from the Access Gateway Transaction ID Generation Mediation Primitive Design. If no transaction id is found in the incoming SOAP message, generate one locally. This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
either the global transaction ID from the incoming SOAP message or the locally generated id, in order of preference.

getOperationTargets

public static int getOperationTargets()
Retrieve the operationTargets per the Access Gateway Group Resolution Mediation Primitive Design. This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
the operation targets count. Defaults to 1 if the header was not found.

getRequesterID

public static java.lang.String getRequesterID()
Retrieve the requester's identity. The identity begins as "UNAUTHENTICATED". If a non-null principal is found using com.ibm.websphere.security.auth.WSSubject's getCallerPrincipal() method, that value is overrides. If an identity is then found using incoming requesterID headers from the Access Gateway in the http://www.ibm.com/schema/twss/v1_0 XML namespace, that value overrides. This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
The requester's identity, or "UNAUTHENTICATED" if no identity could be determined using either WebSphere's WSSubject or incoming TWSS SOAP Headers.

getRequesterLocale

public static java.util.Locale getRequesterLocale()
Retrieve the requester's preferred Locale. The Locale is taken from the incoming SOAP over HTTP request. This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
the requester's preferred Locale, or the default system Locale if the requester did not specify one.

getResolvedGroupURIs

public static java.lang.String[] getResolvedGroupURIs()
Retrieve a Array of Strings with all of the unique group URIs found by the Group Resolution Mediation Primitive. This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
Array of Strings, each one containing a group URI. Empty set if no groups were found.

getResolvedGroupURI

public static java.lang.String[] getResolvedGroupURI(java.lang.String groupUri)
Retrieve a the members of the group with the given groupUri. Found via the Group Resolution Mediation Primitive. This must be called during a web service request that has the ServicePlatformHandler defined.

Parameters:
groupUri - to retrieve.
Returns:
a Array of Strings corresponding to the members, or Collections.EMPTY_LIST if groupUri is not a resolved group.

getPolicy

public static java.lang.String getPolicy(java.lang.String policyName)
Retrieve the value of the policy with the given name per the Policy/Subscription Mediation Primitive Design. This must be called during a web service request that has the ServicePlatformHandler defined.

Parameters:
policyName - whose value is of interest.
Returns:
the policy value from the incoming SOAP headers, or null if no such policy was found in the SOAP headers.

getPolicies

public static java.lang.String[] getPolicies()
Retrieve a Set containing all of the policy names found in the incoming policy headers per the Policy/Subscription Mediation Primitive Design. This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
a Set of Strings corresponding to all found policy names, or Collections.EMPTY_SET if no policies were found.

getRequestURL

public static java.lang.String getRequestURL()
Retrieve the HTTP request URL that the client used to access this operation. Has the same semantics as HttpServletRequest.getRequestURL(), but returns a String instead of a StringBuffer This must be called during a web service request that has the ServicePlatformHandler defined.

Returns:
the URL used by the client to invoke the operation.
See Also:
HttpServletRequest.getRequestURL()

encrypt

public static java.lang.String encrypt(java.lang.String string)
Encrypt the string in a manner consistent with the TWSS Password datatype.

Parameters:
string - the string
Returns:
the result

decrypt

public static java.lang.String decrypt(java.lang.String string)
Decrypt the string in a manner consistent with the TWSS Password datatype.

Parameters:
string - the string
Returns:
the result

initializeStatsComponent

public static void initializeStatsComponent(java.lang.String componentName)
Initialize the status instance object in the default group for the specified component. This initialize method should be called during the initialization of the component, which will create the group and instance objects so that they are visible in the console and can be selected for monitoring.

If the status instance is not initialized, it will be initialized on the first attempt to publish data to it.

A matching com.ibm.soa.common.utils.stats.Stats.xml file must be in the classpath. The WebSphere PMI subsystem defines the contents of the Stats descriptor XML file.

Parameters:
componentName - the componentName

publishCountStat

public static void publishCountStat(java.lang.String componentName,
                                    int metricID,
                                    long count)
Publish a simple count statistic. The count statistic is the current (or most recent) count, amount, or time of something within the system.

Parameters:
componentName - the component Name
metricID - the metric name
count - the current count of something

publishTimeStat

public static void publishTimeStat(java.lang.String componentName,
                                   int metricID,
                                   long timeValue)
Publish a time average statistic. The time statistic is typically an 'recent' average duration, a latency, or a delta time between two points, since the last reset was done. This metric keeps track of minimum and maximum values too, so the application does not need to tabulate those values.

Parameters:
componentName - the component name
metricID - the metric name
timeValue - the value

publishAverageStat

public static void publishAverageStat(java.lang.String componentName,
                                      int metricID,
                                      long countValue)
Publish a count average statistic. The average statistic is some average count or amount since the reset was done.

Parameters:
componentName - the component name
metricID - the metric name
countValue -

getLogger

public static ServicePlatformLogger getLogger(java.lang.Class cls)
Creates a wrapped trace logger for use in logging information about class method execution. The level of this logger is inherited from the parent logger. The log exception methods also provide FFDC support (First Failure Data Capture).

Parameters:
cls - The name of the class associated with this logger
Returns:
A trace logger instance

getSubstitutedMessage

public static java.lang.String getSubstitutedMessage(java.lang.String bundleName,
                                                     java.lang.String messageId,
                                                     java.util.Locale locale,
                                                     java.lang.String text,
                                                     java.lang.String[] variables)
Get a message with substituted variables.

The following elements in the variables String array are assigned:

If a message doesn't need the transaction id or component name, variable[0] and/or variable[1] can be set to null or to an empty string.

If the text is set to null or an empty string, the message text will be retrieved from the locale specific message file in the resource bundle. Returns a message with the placeholders filled in.

Parameters:
bundleName - the resource bundle name stub
messageId - the message id
locale - the locale, null to use the default locale.
text - the text, null to get message text from the resource bundle
variables - the substitution values
Returns:
the message text

getMessageFromBundle

public static java.lang.String getMessageFromBundle(java.lang.String bundleName,
                                                    java.lang.String msgId,
                                                    java.util.Locale locale)
Get a message from the locale specific messages file in the resource bundle.

Parameters:
bundleName - the name of the bundle
msgId - the message ID
locale - the locale
Returns:
the message text

formatUsingText

public static java.lang.String formatUsingText(java.lang.String[] variables,
                                               java.lang.String text)
Format the message string by doing substitutions.

Parameters:
variables - the substitution variables
text - the message text
Returns:
the result string

getCurrentApplicationName

public static java.lang.String getCurrentApplicationName()
Get the current application name.

Returns:
the name (may be either the EAR name or J2EE application name)

getClusterName

public static java.lang.String getClusterName()
Get the current cluster name. This may not return the cluster name until the server is completely started.

Returns:
the cluster name


Copyright © 2003 IBM Corp. All Rights Reserved.