org.xins.server.frontend
Class FrontendCallingConvention

java.lang.Object
  extended byorg.xins.common.manageable.Manageable
      extended byorg.xins.server.CallingConvention
          extended byorg.xins.server.CustomCallingConvention
              extended byorg.xins.server.frontend.FrontendCallingConvention

public class FrontendCallingConvention
extends CustomCallingConvention

XINS Front-end Framework calling convention.

Since:
XINS 1.5.0.
Version:
$Revision: 1.67 $ $Date: 2009/10/28 10:47:36 $
Author:
Anthony Goubard

Nested Class Summary
 
Nested classes inherited from class org.xins.common.manageable.Manageable
Manageable.State
 
Field Summary
 
Fields inherited from class org.xins.common.manageable.Manageable
BOOTSTRAPPED, BOOTSTRAPPING, DEINITIALIZING, INITIALIZING, UNUSABLE, USABLE
 
Constructor Summary
FrontendCallingConvention(API api)
          Creates a new FrontendCallingConvention instance.
 
Method Summary
protected  void bootstrapImpl(PropertyReader bootstrapProperties)
          Performs the bootstrap procedure (actual implementation).
protected  FunctionRequest convertRequestImpl(HttpServletRequest httpRequest)
          Converts an HTTP request to a XINS request (implementation method).
protected  void convertResultImpl(FunctionResult xinsResult, HttpServletResponse httpResponse, HttpServletRequest httpRequest)
          Converts a XINS result to an HTTP response (implementation method).
protected  void initImpl(PropertyReader runtimeProperties)
          Performs the initialization procedure (actual implementation).
protected  boolean matches(HttpServletRequest httpRequest)
          Checks if the specified request can possibly be handled by this calling convention as a function invocation.
 
Methods inherited from class org.xins.server.CustomCallingConvention
getAPI, getSupportedMethods, getSupportedMethods, parseXMLRequest, parseXMLRequest
 
Methods inherited from class org.xins.common.manageable.Manageable
assertUsable, bootstrap, deinit, deinitImpl, getState, init, isBootstrapped, isUsable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrontendCallingConvention

public FrontendCallingConvention(API api)
                          throws IllegalArgumentException
Creates a new FrontendCallingConvention instance.

Parameters:
api - the API, needed for the SOAP messages, cannot be null.
Throws:
IllegalArgumentException - if api == null.
Method Detail

bootstrapImpl

protected void bootstrapImpl(PropertyReader bootstrapProperties)
                      throws MissingRequiredPropertyException,
                             InvalidPropertyValueException,
                             BootstrapException
Description copied from class: Manageable
Performs the bootstrap procedure (actual implementation). When this method is called from Manageable.bootstrap(PropertyReader), the state and the argument will have been checked and the state will have been set to Manageable.BOOTSTRAPPING.

The implementation of this method in class Manageable is empty.

Overrides:
bootstrapImpl in class Manageable
Parameters:
bootstrapProperties - the bootstrap properties, not null.
Throws:
MissingRequiredPropertyException - if a required property is not given.
BootstrapException - if the bootstrapping failed for any other reason.
InvalidPropertyValueException - if the value of a certain property is invalid.

initImpl

protected void initImpl(PropertyReader runtimeProperties)
                 throws MissingRequiredPropertyException,
                        InvalidPropertyValueException,
                        InitializationException
Description copied from class: Manageable
Performs the initialization procedure (actual implementation). When this method is called from Manageable.init(PropertyReader), the state and the argument will have been checked and the state will have been set to Manageable.INITIALIZING.

The implementation of this method in class Manageable is empty.

Overrides:
initImpl in class Manageable
Parameters:
runtimeProperties - the initialization properties, not null.
Throws:
MissingRequiredPropertyException - if a required property is not given.
InvalidPropertyValueException - if the value of a certain property is invalid.
InitializationException - if the initialization failed, for any other reason.

matches

protected boolean matches(HttpServletRequest httpRequest)
                   throws Exception
Description copied from class: CustomCallingConvention
Checks if the specified request can possibly be handled by this calling convention as a function invocation.

Implementations of this method should be optimized for performance, as this method may be called for each incoming request. Also, this method should not have any side-effects except possibly some caching in case there is a match.

The default implementation of this method always returns true.

If this method throws any exception, the exception is logged as an ignorable exception and false is assumed.

This method should only be called by the XINS/Java Server Framework.

Overrides:
matches in class CustomCallingConvention
Parameters:
httpRequest - the HTTP request to investigate, never null.
Returns:
true if this calling convention is possibly able to handle this request, or false if it is definitely not able to handle this request.
Throws:
Exception - if analysis of the request causes an exception; in this case false will be assumed by the framework.

convertRequestImpl

protected FunctionRequest convertRequestImpl(HttpServletRequest httpRequest)
                                      throws InvalidRequestException,
                                             FunctionNotSpecifiedException
Converts an HTTP request to a XINS request (implementation method). This method should only be called from class CustomCallingConvention. Only then it is guaranteed that the httpRequest argument is not null.

Parameters:
httpRequest - the HTTP request, will not be null.
Returns:
the XINS request object, never null.
Throws:
InvalidRequestException - if the request is considerd to be invalid.
FunctionNotSpecifiedException - if the request does not indicate the name of the function to execute.

convertResultImpl

protected void convertResultImpl(FunctionResult xinsResult,
                                 HttpServletResponse httpResponse,
                                 HttpServletRequest httpRequest)
                          throws IOException
Converts a XINS result to an HTTP response (implementation method).

Parameters:
xinsResult - the XINS result object that should be converted to an HTTP response, will not be null.
httpResponse - the HTTP response object to configure, will not be null.
httpRequest - the HTTP request sent by the client, will not be null.
Throws:
IOException - if calling any of the methods in httpResponse causes an I/O error.


See http://www.xins.org/.