uk.org.ogsadai.engine
Interface Request

All Superinterfaces:
SessionParticipant
All Known Implementing Classes:
ActivityRequest

public interface Request
extends SessionParticipant

This is the interface that the RequestEngine uses for processing requests without concerning itself with the implementation. After the process method had been invoked, the response document becomes available via the getResponse method. Note that this does not guarantee that the request processing is complete. See the method comments for more details.

Author:
The OGSA-DAI Project Team

Method Summary
 ProcessingStatus getStatus()
          Obtains the processing status of the request.
 void initialise(EngineConfiguration config, RequestContext context, ResponseBuilder builder)
          Initialises this request before its processing can commence.
 void process()
          Initiates the processing of the request.
 void terminate()
          Terminates the request.
 void waitForResponse()
          Waits for the response building to complete.
 
Methods inherited from interface uk.org.ogsadai.sessions.SessionParticipant
getSession, getSessionStrategy, setSession
 

Method Detail

initialise

public void initialise(EngineConfiguration config,
                       RequestContext context,
                       ResponseBuilder builder)
                throws java.lang.IllegalStateException,
                       RequestSpecificationException,
                       RequestExecutionException
Initialises this request before its processing can commence.

Initialisation may be performed once only, prior to invoking any of the other methods on the Request interface.

Throws:
java.lang.IllegalStateException - If invoked after the processing of the request has been initiated or terminated.
RequestSpecificationException - if the request fails to execute due to a problem in the request e.g. it specifies an unsupported activity or a query expression is has incorrect syntax.
RequestExecutionException - if the request fails to execute due to a problem in the e.g. a database connection disappears or a file is corrupted.

process

public void process()
             throws java.lang.IllegalStateException
Initiates the processing of the request. After this method returns the response will be available via the ResponseBuilder passed into the process method.

All implementations of this method must ensure that processing is a non-blocking operation; e.g., by delegating the actual processing to a separate thread. This method should return as soon as processing is suitably initiated and should not wait until processing completes.

Throws:
java.lang.IllegalStateException - if invoked before the request has been initialised, or after processing has commenced, completed or terminated.

waitForResponse

public void waitForResponse()
Waits for the response building to complete. After this method returns, the response product can be retrieved from the ResponseBuilder. This may or may not indicate that the request processing is complete, depending on the type of request. For example some requests produce no response data, so the response may be available before processing completes.


terminate

public void terminate()
Terminates the request. When this method returns, any threads and other resources associated with the request must be finished with.


getStatus

public ProcessingStatus getStatus()
Obtains the processing status of the request.

Returns:
the current status as a ProcessingStatus object.