com.wm.app.b2b.server
Class Service

java.lang.Object
  extended by com.wm.app.b2b.server.Service

public abstract class Service
extends java.lang.Object

The Service class contains a collection of methods for gaining access to Objects commonly used by Server services. It may be desirable to subclass Service when creating server-side code, but be aware that there exists the possibility of name-space collisions with your code.


Constructor Summary
Service()
           
 
Method Summary
static void desistContext(Session sess)
          Removes a session from the cluster database.
static IData doInvoke(NSName name, IData input)
          Invokes any service published on the server with the given input arguments.
static IData doInvoke(NSName name, Session session, IData input)
          Invokes any service published on the server with the given input arguments.
static Values doInvoke(NSName name, Session session, Values input)
          Deprecated. Use doInvoke(NSName, Session, IData)
static Values doInvoke(NSName name, Values input)
          Deprecated. Use doInvoke(NSName, IData)
static IData doInvoke(java.lang.String ifc, java.lang.String svc, IData input)
          Invokes any service published on the server with the given input arguments.
static IData doInvoke(java.lang.String ifc, java.lang.String svc, Session session, IData input)
          Invokes any service published on the server with the given input arguments.
static Values doInvoke(java.lang.String ifc, java.lang.String svc, Session session, Values input)
          Deprecated. Use doInvoke(String, String, Session, IData)
static Values doInvoke(java.lang.String ifc, java.lang.String svc, Values input)
          Deprecated. Use doInvoke(String, String, IData)
static ServiceThread doThreadInvoke(NSName svc, IData input)
          Deprecated. Replaced by ServiceThread doThreadInvoke(NSName svc, IData input, long time). Invokes any service published on the server as a thread.
static ServiceThread doThreadInvoke(NSName svc, IData input, long time)
          Invokes any service published on the server as a thread.
static ServiceThread doThreadInvoke(NSName svc, Session session, IData input)
          Deprecated. Replaced by ServiceThread doThreadInvoke(NSName svc, Session session, IData input, long time). Invokes any service published on the server as a thread.
static ServiceThread doThreadInvoke(NSName svc, Session session, IData input, long time)
          Invokes any service published on the server as a thread.
static ServiceThread doThreadInvoke(java.lang.String ifc, java.lang.String svc, IData input)
          Deprecated. Replaced by ServiceThread doThreadInvoke(String ifc, String svc, IData input, long time). Invokes any service published on the server as a thread.
static ServiceThread doThreadInvoke(java.lang.String ifc, java.lang.String svc, IData input, long time)
          Invokes any service published on the server as a thread.
static ServiceThread doThreadInvoke(java.lang.String ifc, java.lang.String svc, Session session, IData input)
          Deprecated. Replaced by ServiceThread doThreadInvoke(String ifc, String svc, Session session, IData input, long time). Invokes any service published on the server as a thread.
static ServiceThread doThreadInvoke(java.lang.String ifc, java.lang.String svc, Session session, IData input, long time)
          Invokes any service published on the server as a thread.
static java.lang.String getBinding(Values input)
          Given the input Values, returns the binding name.
static NSService getCallingService()
          Returns the service that invoked the service from which getCallingService is being executed.
static Values getClusterMembers()
          Returns the members of a cluster.
static java.lang.String getHttpHeaderField(java.lang.String fieldName, com.wm.net.HttpHeader header)
          Returns the string value associated with the specified field name for the specified HttpHeader.
static HttpHeader getHttpRequestHeader()
          Returns the HTTP request header.
static HttpHeader getHttpRequestHeader(Values input)
          Deprecated.  
static HttpHeader getHttpResponseHeader()
          Returns the HTTP response header.
static HttpHeader getHttpResponseHeader(Values input)
          Deprecated.  
static java.lang.String getPackageName(Values input)
          Deprecated.  
static byte[] getRequest(Values input)
          Deprecated.  
static NSService getServiceEntry()
          Given the input Values, returns the NSService currently being invoked.
static NSService getServiceEntry(Values input)
          Deprecated.  
static Session getSession()
          Returns the Session associated with the current thread.
static java.lang.String getTemplate(Values input)
          Deprecated.  
static java.lang.String getTemplateType(Values input)
          Given the input Values, returns the output template type.
static User getUser()
          Returns the User controlling the session associated with the current thread.
static User getUser(Session session)
          Given the session object, return its controlling User.
static boolean hasErrors(Values v)
          Deprecated.  
static boolean isClusterAware()
          Determines if the server participates in a cluster.
static void setBinding(Values input, java.lang.String binding)
          Given the input Values, sets the binding name.
static void setResponse(Values input, byte[] response)
          Given the input Values, sets the raw response.
static void setTemplate(Values input, java.lang.String template)
          Deprecated.  
static void setTemplateType(Values input, java.lang.String temptype)
          Given the input Values, sets the output template type.
static Values throwError(java.lang.String msg)
          Deprecated.  
static Values throwError(java.lang.Throwable e)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Service

public Service()
Method Detail

isClusterAware

public static boolean isClusterAware()
Determines if the server participates in a cluster.


desistContext

public static void desistContext(Session sess)
Removes a session from the cluster database. This is done when the session has expired, or when a user logs out/disconnect for a reason other than cluster redirection.


getClusterMembers

public static Values getClusterMembers()
Returns the members of a cluster.


getSession

public static Session getSession()
Returns the Session associated with the current thread.


getServiceEntry

public static NSService getServiceEntry()
Given the input Values, returns the NSService currently being invoked.


getServiceEntry

public static NSService getServiceEntry(Values input)
Deprecated. 

Given the input Values, returns the NSService currently being invoked.


getCallingService

public static NSService getCallingService()
Returns the service that invoked the service from which getCallingService is being executed. If there is no calling service, this service returns null.

Note: After you execute getCallingService, you can use toString() on the returned NSService object to get a String containing the service's fully qualified service name (i.e., folder:serviceName).


getHttpHeaderField

public static java.lang.String getHttpHeaderField(java.lang.String fieldName,
                                                  com.wm.net.HttpHeader header)
Returns the string value associated with the specified field name for the specified HttpHeader.

Parameters:
fieldName - Field name
header - HTTP header name
Returns:
the string value associated with the specified field name for the specified HttpHeader

getHttpRequestHeader

public static HttpHeader getHttpRequestHeader(Values input)
Deprecated. 

Given the input Values, returns the HTTP request header.


getHttpRequestHeader

public static HttpHeader getHttpRequestHeader()
Returns the HTTP request header.


getHttpResponseHeader

public static HttpHeader getHttpResponseHeader(Values input)
Deprecated. 

Given the input Values, returns the HTTP response header.


getHttpResponseHeader

public static HttpHeader getHttpResponseHeader()
Returns the HTTP response header.


getTemplate

public static java.lang.String getTemplate(Values input)
Deprecated. 

Given the input Values, returns the output template name.


getTemplateType

public static java.lang.String getTemplateType(Values input)
Given the input Values, returns the output template type.


getBinding

public static java.lang.String getBinding(Values input)
Given the input Values, returns the binding name.


getRequest

public static byte[] getRequest(Values input)
Deprecated. 

Given the input Values, returns the raw request.


setTemplate

public static void setTemplate(Values input,
                               java.lang.String template)
Deprecated. 

Given the input Values, sets the output template name.


setTemplateType

public static void setTemplateType(Values input,
                                   java.lang.String temptype)
Given the input Values, sets the output template type.


setResponse

public static void setResponse(Values input,
                               byte[] response)
Given the input Values, sets the raw response. (Overrides output template processing).


setBinding

public static void setBinding(Values input,
                              java.lang.String binding)
Given the input Values, sets the binding name.


getPackageName

public static java.lang.String getPackageName(Values input)
Deprecated. 

Given the input Values, returns the name of the current package directory.


getUser

public static User getUser()
Returns the User controlling the session associated with the current thread.


getUser

public static User getUser(Session session)
Given the session object, return its controlling User.


throwError

public static Values throwError(java.lang.Throwable e)
Deprecated. 

Converts an exception into a Values object. Typically this Values-encoded exception is returned as the output of the service.


throwError

public static Values throwError(java.lang.String msg)
Deprecated. 

Given an error string, generates a ServiceException return it as a Values object. Typically this Values-encoded exception is returned as the output of the service.


hasErrors

public static boolean hasErrors(Values v)
Deprecated. 

Returns true if a Values-encoded exception is contained within the given Values object.


doInvoke

public static Values doInvoke(java.lang.String ifc,
                              java.lang.String svc,
                              Values input)
                       throws java.lang.Exception
Deprecated. Use doInvoke(String, String, IData)

Invokes any service published on the server with the given input arguments.

Parameters:
ifc - Folder name
svc - Service name
input - Input values for service
Returns:
output Values from called service
Throws:
java.lang.Exception

doInvoke

public static IData doInvoke(java.lang.String ifc,
                             java.lang.String svc,
                             IData input)
                      throws java.lang.Exception
Invokes any service published on the server with the given input arguments.

Parameters:
ifc - Folder name
svc - Service name
input - Input values for service
Returns:
output IData from called service
Throws:
java.lang.Exception

doInvoke

public static Values doInvoke(java.lang.String ifc,
                              java.lang.String svc,
                              Session session,
                              Values input)
                       throws java.lang.Exception
Deprecated. Use doInvoke(String, String, Session, IData)

Invokes any service published on the server with the given input arguments.

Parameters:
ifc - Folder name.
svc - Service name.
session - Current session object.
input - Input values for service.
Returns:
output Values from called service.
Throws:
java.lang.Exception

doInvoke

public static IData doInvoke(java.lang.String ifc,
                             java.lang.String svc,
                             Session session,
                             IData input)
                      throws java.lang.Exception
Invokes any service published on the server with the given input arguments.

Parameters:
ifc - Folder name.
svc - Service name.
input - Input values for service.
Returns:
output IData from called service.
Throws:
java.lang.Exception

doInvoke

public static Values doInvoke(NSName name,
                              Values input)
                       throws java.lang.Exception
Deprecated. Use doInvoke(NSName, IData)

Invokes any service published on the server with the given input arguments.

Parameters:
name - Fully-qualified service name (folder:service).
input - Input values for service.
Returns:
output Values from called service.
Throws:
java.lang.Exception

doInvoke

public static IData doInvoke(NSName name,
                             IData input)
                      throws java.lang.Exception
Invokes any service published on the server with the given input arguments.

Parameters:
name - Fully-qualified service name (folder:service).
input - Input values for service.
Returns:
output IData from called service.
Throws:
java.lang.Exception

doInvoke

public static Values doInvoke(NSName name,
                              Session session,
                              Values input)
                       throws java.lang.Exception
Deprecated. Use doInvoke(NSName, Session, IData)

Invokes any service published on the server with the given input arguments.

Parameters:
name - Fully-qualified service name (folder:service).
session - Current session object.
input - Input values for service.
Returns:
output Values from called service.
Throws:
java.lang.Exception

doInvoke

public static IData doInvoke(NSName name,
                             Session session,
                             IData input)
                      throws java.lang.Exception
Invokes any service published on the server with the given input arguments.

Parameters:
name - Fully-qualified service name (folder:service).
session - Current session object.
input - Input values for service.
Returns:
output IData from called service.
Throws:
java.lang.Exception

doThreadInvoke

public static ServiceThread doThreadInvoke(java.lang.String ifc,
                                           java.lang.String svc,
                                           IData input)
Deprecated. Replaced by ServiceThread doThreadInvoke(String ifc, String svc, IData input, long time). Invokes any service published on the server as a thread.

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join.

Parameters:
ifc - Folder name.
svc - Service name.
input - Input values for service.
Returns:
ServiceThread Handle to running service.

doThreadInvoke

public static ServiceThread doThreadInvoke(java.lang.String ifc,
                                           java.lang.String svc,
                                           IData input,
                                           long time)
                                    throws ISRuntimeException

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join. If you specify a non-zero value for the time parameter and you do not want the internal invoke manager to retry the calling service, you must catch the ISRuntimeException that will be thrown if a thread is not available in the specified amount of time.

For example, suppose that a service updates a database and then calls doThreadInvoke(). If an ISRuntimeException is thrown but is not caught, the entire service, including the database update, may be repeated. When calling doThreadInvoke(), you must catch ISRuntimeException. If you want the calling service to be retried, then you can re-throw the ISRuntimeException. In all other cases, throw a new ServiceException that wraps the ISRuntimeException.

Parameters:
ifc - Folder name.
svc - Service name.
input - Input values for service.
time - Length of time (in milliseconds ) to wait for a thread. Specify zero to wait indefinitely. Specify a negative value to return immediately. If a thread is not available within the specified time, an ISRuntimeException is thrown.
Returns:
ServiceThread Handle to running service.
Throws:
ISRuntimeException - thrown if no thread is available within specified time.

doThreadInvoke

public static ServiceThread doThreadInvoke(java.lang.String ifc,
                                           java.lang.String svc,
                                           Session session,
                                           IData input)
Deprecated. Replaced by ServiceThread doThreadInvoke(String ifc, String svc, Session session, IData input, long time). Invokes any service published on the server as a thread.

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join.

Parameters:
ifc - Folder name.
svc - Service name.
session - Current session object.
input - Input values for service.
Returns:
ServiceThread Handle to running service.

doThreadInvoke

public static ServiceThread doThreadInvoke(java.lang.String ifc,
                                           java.lang.String svc,
                                           Session session,
                                           IData input,
                                           long time)
                                    throws ISRuntimeException

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join. If you specify a non-zero value for the time parameter and you do not want the internal invoke manager to retry the calling service, you must catch the ISRuntimeException that will be thrown if a thread is not available in the specified amount of time.

For example, suppose that a service updates a database and then calls doThreadInvoke(). If an ISRuntimeException is thrown but is not caught, the entire service, including the database update, may be repeated. When calling doThreadInvoke(), you must catch ISRuntimeException. If you want the calling service to be retried, then you can re-throw the ISRuntimeException. In all other cases, throw a new ServiceException that wraps the ISRuntimeException.

Parameters:
ifc - Folder name.
svc - Service name.
session - Current session object.
input - Input values for service.
time - Length of time (in milliseconds ) to wait for a thread. Specify zero to wait indefinitely. Specify a negative value to return immediately. If a thread is not available within the specified time, an ISRuntimeException is thrown.
Returns:
ServiceThread Handle to running service.
Throws:
ISRuntimeException - thrown if no thread is available within specified time.

doThreadInvoke

public static ServiceThread doThreadInvoke(NSName svc,
                                           IData input)
Deprecated. Replaced by ServiceThread doThreadInvoke(NSName svc, IData input, long time). Invokes any service published on the server as a thread.

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join.

Parameters:
svc - Fully qualified service name (folder:service).
input - Input values for service.
Returns:
ServiceThread Handle to running service.

doThreadInvoke

public static ServiceThread doThreadInvoke(NSName svc,
                                           IData input,
                                           long time)
                                    throws ISRuntimeException

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join. If you specify a non-zero value for the time parameter and you do not want the internal invoke manager to retry the calling service, you must catch the ISRuntimeException that will be thrown if a thread is not available in the specified amount of time.

For example, suppose that a service updates a database and then calls doThreadInvoke(). If an ISRuntimeException is thrown but is not caught, the entire service, including the database update, may be repeated. When calling doThreadInvoke(), you must catch ISRuntimeException. If you want the calling service to be retried, then you can re-throw the ISRuntimeException. In all other cases, throw a new ServiceException that wraps the ISRuntimeException.

Parameters:
svc - Fully qualified service name (folder:service).
input - Input values for service.
time - Length of time (in milliseconds ) to wait for a thread. Specify zero to wait indefinitely. Specify a negative value to return immediately. If a thread is not available within the specified time, an ISRuntimeException is thrown.
Returns:
ServiceThread Handle to running service.
Throws:
ISRuntimeException - thrown if no thread is available within specified time.

doThreadInvoke

public static ServiceThread doThreadInvoke(NSName svc,
                                           Session session,
                                           IData input)
Deprecated. Replaced by ServiceThread doThreadInvoke(NSName svc, Session session, IData input, long time). Invokes any service published on the server as a thread.

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join.

Parameters:
svc - Fully qualified service name (folder:service).
session - Current session object.
input - Input values for service.
Returns:
ServiceThread Handle to running service.

doThreadInvoke

public static ServiceThread doThreadInvoke(NSName svc,
                                           Session session,
                                           IData input,
                                           long time)
                                    throws ISRuntimeException

Invokes any service published on the server as a thread.

Call getIData() on the resulting ServiceThread object to force a join. If you specify a non-zero value for the time parameter and you do not want the internal invoke manager to retry the calling service, you must catch the ISRuntimeException that will be thrown if a thread is not available in the specified amount of time.

For example, suppose that a service updates a database and then calls doThreadInvoke(). If an ISRuntimeException is thrown but is not caught, the entire service, including the database update, may be repeated. When calling doThreadInvoke(), you must catch ISRuntimeException. If you want the calling service to be retried, then you can re-throw the ISRuntimeException. In all other cases, throw a new ServiceException that wraps the ISRuntimeException.

Parameters:
svc - Fully qualified service name (folder:service).
session - Current session object.
input - Input values for service.
time - Length of time (in milliseconds ) to wait for a thread. Specify zero to wait indefinitely. Specify a negative value to return immediately. If a thread is not available within the specified time, an ISRuntimeException is thrown.
Returns:
ServiceThread Handle to running service.
Throws:
ISRuntimeException - thrown if no thread is available within specified time.