com.ibm.wbi.request
Class Request

com.ibm.wbi.request.Request

public class Request

A request is responsible for dispatching the required megs to modify or generate a response. A request lives while at least one meg is still processing the request.


Field Summary
protected  java.lang.Class byteStoreClass
          Byte store class.
static java.lang.String COPYRIGHT
          IBM copyright information.
protected  Meg currentMegBlockOn
          The current meg that the chain is blocking on.
protected  RequestEvent currentRequestEvent
          Current request event that we are working on.
protected  RequestInfo currentRequestInfo
          Current request info we are working on.
protected  com.ibm.wbi.request.TmHandle currentThreadHandle
          Current thread element handle we are working on (wraps the meg running).
protected  com.ibm.wbi.request.DecipheredProtocol deciphered
          The deciphered protocol.
protected  int id
          The sublayer id that generated the request.
protected  com.ibm.wbi.request.MegBucket megBucket
          A meg bucket created from the meg repository used to determine dynamic meg chains that satisfy the incoming/outgoing request.
protected  com.ibm.wbi.request.MegRepository megRepository
          The main meg repository for the proxy.
protected  int megsRunning
          This is a counter of how many megs are currently working on the request.
protected static com.ibm.wbi.ras.TransProxyRASDirector ras
          The RAS object to be used for conditionally logging and tracing information.
protected  com.ibm.wbi.request.RequestHandle requestHandle
          The handle to the incoming request.
protected  com.ibm.wbi.request.RequestManager requestManager
          The request manager that launched this request.
protected  com.ibm.wbi.request.ResponseHandle responseHandle
          The handle to the outgoing response.
protected  com.ibm.wbi.request.MegThreadDispatch threadDispatch
          The thread dispatcher to use to spawn megs in their own thread.
protected  boolean wasLastMegRequestRejected
          Determines if the last meg that was dispatched rejected the request or not.
 
Constructor Summary
Request(com.ibm.wbi.request.RequestManager requestManager, int id, com.ibm.wbi.request.MegRepository megRepository, com.ibm.wbi.request.RequestHandle requestHandle, com.ibm.wbi.request.ResponseHandle responseHandle)
          Constructs a new request.
 
Method Summary
 void cleanup()
          This is a last ditch effort to cleanup any lose references in a request that has not been service.
protected  void createNextCurrentRequestEvent()
          Create the next request event.
protected  void dispatchEditorsAndMonitors()
          Dispatch the editors and monitors that satisfy the request.
protected  void dispatchGenerators()
          Dispatch the generator that satisfies the request.
protected  void dispatchRequestEditors()
          Dispatch the request editors that satisfy the request.
 RequestEvent getCurrentRequestEvent()
          Gets the current request event object.
 java.lang.String getRequestIdentificationString()
          Get the request identification string.
 com.ibm.wbi.request.RequestManager getRequestManager()
          Get the request manager associated with this request.
 int getSubLayerIdentification()
          Get the unique identifier for the sublayer that is handling this request.
 boolean isActive()
          Determine if the request is still active.
 void megEnded()
          Called by a meg to indicate that it has ended.
 void megStarted()
          Called by a meg to indicate that it has started.
 void processNextMeg(Meg meg, boolean isRejected)
          Called when the next meg in the chain (currently blocking) should be run.
 long threadManagerRun(com.ibm.wbi.request.ThreadManagerArgument argument)
          This will decipher the request using the protocol interpreter and dispatch the megs for the request, then encode the response to the response handle..
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
IBM copyright information.

ras

protected static com.ibm.wbi.ras.TransProxyRASDirector ras
The RAS object to be used for conditionally logging and tracing information. The decision concerning whether to trace or log at this time is made within the RAS objects. Therefore a call to the ras object may or may not cause a trace or log message to be written to console, file, or network.

requestManager

protected com.ibm.wbi.request.RequestManager requestManager
The request manager that launched this request.

threadDispatch

protected com.ibm.wbi.request.MegThreadDispatch threadDispatch
The thread dispatcher to use to spawn megs in their own thread.

megRepository

protected com.ibm.wbi.request.MegRepository megRepository
The main meg repository for the proxy.

megBucket

protected com.ibm.wbi.request.MegBucket megBucket
A meg bucket created from the meg repository used to determine dynamic meg chains that satisfy the incoming/outgoing request.

requestHandle

protected com.ibm.wbi.request.RequestHandle requestHandle
The handle to the incoming request.

responseHandle

protected com.ibm.wbi.request.ResponseHandle responseHandle
The handle to the outgoing response.

currentMegBlockOn

protected Meg currentMegBlockOn
The current meg that the chain is blocking on. It blocks until the meg writes to it's response output stream.

megsRunning

protected int megsRunning
This is a counter of how many megs are currently working on the request. When this counter goes to zero, the request is done and should be cleaned up.

currentRequestEvent

protected RequestEvent currentRequestEvent
Current request event that we are working on.

currentRequestInfo

protected RequestInfo currentRequestInfo
Current request info we are working on.

byteStoreClass

protected java.lang.Class byteStoreClass
Byte store class.

currentThreadHandle

protected com.ibm.wbi.request.TmHandle currentThreadHandle
Current thread element handle we are working on (wraps the meg running).

wasLastMegRequestRejected

protected boolean wasLastMegRequestRejected
Determines if the last meg that was dispatched rejected the request or not.

deciphered

protected com.ibm.wbi.request.DecipheredProtocol deciphered
The deciphered protocol.

id

protected int id
The sublayer id that generated the request.
Constructor Detail

Request

public Request(com.ibm.wbi.request.RequestManager requestManager,
               int id,
               com.ibm.wbi.request.MegRepository megRepository,
               com.ibm.wbi.request.RequestHandle requestHandle,
               com.ibm.wbi.request.ResponseHandle responseHandle)
Constructs a new request.
Parameters:
requestManager - The manager of this request.
id - The sublayer id that generated the request.
megRepository - The main meg repository of the proxy.
protocol - The protocol interpreter for the request.
request - The request handle for the request.
response - The response handle for the request.
Method Detail

processNextMeg

public void processNextMeg(Meg meg,
                           boolean isRejected)
Called when the next meg in the chain (currently blocking) should be run.
Parameters:
meg - The meg that is done blocking the chain (it has written to the response output stream).
isRejected - true if the meg rejected the request.

cleanup

public void cleanup()
This is a last ditch effort to cleanup any lose references in a request that has not been service. This call leaves the request useless.

threadManagerRun

public long threadManagerRun(com.ibm.wbi.request.ThreadManagerArgument argument)
                      throws java.lang.Exception
This will decipher the request using the protocol interpreter and dispatch the megs for the request, then encode the response to the response handle..
Parameters:
argument - Should always be null because it is not used. It is required in the ThreadManagerInterface though.
Returns:
Proxy.NOERROR
Throws:
java.lang.Exception - If anything unexpected occurs.

megStarted

public void megStarted()
Called by a meg to indicate that it has started.

megEnded

public void megEnded()
Called by a meg to indicate that it has ended.

isActive

public boolean isActive()
Determine if the request is still active.
Returns:
true if request is still active.

getRequestIdentificationString

public java.lang.String getRequestIdentificationString()
Get the request identification string.
Returns:
The request identification.

getSubLayerIdentification

public int getSubLayerIdentification()
Get the unique identifier for the sublayer that is handling this request.
Returns:
The sublayer identification.

getRequestManager

public com.ibm.wbi.request.RequestManager getRequestManager()
Get the request manager associated with this request.
Returns:
The request manager.

getCurrentRequestEvent

public RequestEvent getCurrentRequestEvent()
Gets the current request event object. If threadManagerRun(...) has completed, this object will be the request event passed to the last editor (or the generator if no editors fired).
Returns:
The current request event.

dispatchRequestEditors

protected void dispatchRequestEditors()
Dispatch the request editors that satisfy the request. This is a dynamically built chain.

dispatchGenerators

protected void dispatchGenerators()
Dispatch the generator that satisfies the request. This will be dynamic if generators reject the requests.

dispatchEditorsAndMonitors

protected void dispatchEditorsAndMonitors()
Dispatch the editors and monitors that satisfy the request. This is a dynamically built chain.

createNextCurrentRequestEvent

protected void createNextCurrentRequestEvent()
Create the next request event.