uk.org.ogsadai.engine
Class RequestContext

java.lang.Object
  |
  +--uk.org.ogsadai.engine.RequestContext

public class RequestContext
extends java.lang.Object

This class encapsulates information describing the context of a request made to an Engine. This includes the security credentials of the user making the request. An instance of this class is passed as a parameter to the invoke method of the Engine interface in order to initiate a request. This class also provides access to any external inputs and outputs of a request.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement.
private  AttachmentManager mAttachmentManager
          Attachment manager
private  AccessAuthorizer mAuthorizer
          Authorization manager
private  java.lang.Throwable mCause
          Holds the exception that caused the request to fail, if any
private  DataServiceResourceFactory mDataServiceResourceFactory
          A factory that allows activities to create new data service resources.
private  Request mRequest
          The request that this object is the context for.
private  java.lang.String mResourceID
          Resource associated with a request.
private  SecurityContext mSecurityContext
          Security credentials associated with a request.
private  java.lang.String mURL
          URL associated with a request.
 
Constructor Summary
RequestContext()
          Constructs a new invocation context.
RequestContext(SecurityContext securityContext)
          Constructs an invocation context for the specified security context.
 
Method Summary
 AttachmentManager getAttachmentManager()
          Gets the attachment manager through which attachments can be added to the outgoing response.
 AccessAuthorizer getAuthorizer()
          Returns an authorizer that authorizes access to data service resources and activities.
 java.lang.Throwable getCauseOfError()
          If there is an error during the processing of a request, return the exception.
 DataServiceResourceFactory getDataServiceResourceFactory()
          Gets the data service resource factory that can be used to create new data service resources.
 Request getRequest()
          Gets the request that this object is the context for.
 java.lang.String getResourceID()
          Gets the resource ID associated with this request
 SecurityContext getSecurityContext()
          Gets the security context associated with a request.
 java.lang.String getURL()
          Gets the URL associated with this request
 boolean hasError()
          Indicates whether or not there has been an error while the request has been processing.
 void setAttachmentManager(AttachmentManager attachmentManager)
          Sets the attachment manager through which attachments can be added to the outgoing response.
 void setAuthorizer(AccessAuthorizer authorizer)
          Sets the authorizer that authorizes access to data service resources and activities.
 void setDataServiceResourceFactory(DataServiceResourceFactory factory)
          Sets the data service resource factory that can be used to create new data service resources.
 void setError(java.lang.Throwable cause)
          Sets a reference to the first error raised by an activity.
 void setRequest(Request request)
          Sets the request that this object is the context for.
 void setResourceID(java.lang.String resourceID)
          Sets the resource ID associated with this request
 void setSecurityContext(SecurityContext securityContext)
          Sets the security context associated with a request.
 void setURL(java.lang.String url)
          Sets the URL associated with this request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement.

See Also:
Constant Field Values

mSecurityContext

private SecurityContext mSecurityContext
Security credentials associated with a request.


mRequest

private Request mRequest
The request that this object is the context for.


mCause

private java.lang.Throwable mCause
Holds the exception that caused the request to fail, if any


mURL

private java.lang.String mURL
URL associated with a request.


mResourceID

private java.lang.String mResourceID
Resource associated with a request.


mDataServiceResourceFactory

private DataServiceResourceFactory mDataServiceResourceFactory
A factory that allows activities to create new data service resources.


mAttachmentManager

private AttachmentManager mAttachmentManager
Attachment manager


mAuthorizer

private AccessAuthorizer mAuthorizer
Authorization manager

Constructor Detail

RequestContext

public RequestContext()
Constructs a new invocation context.


RequestContext

public RequestContext(SecurityContext securityContext)
Constructs an invocation context for the specified security context.

Parameters:
securityContext - Security context
Method Detail

getSecurityContext

public SecurityContext getSecurityContext()
Gets the security context associated with a request.

Returns:
a SecurityContext instance

setSecurityContext

public final void setSecurityContext(SecurityContext securityContext)
Sets the security context associated with a request.

Parameters:
securityContext - Security context

getDataServiceResourceFactory

public final DataServiceResourceFactory getDataServiceResourceFactory()
Gets the data service resource factory that can be used to create new data service resources.

Returns:
data service resource factory or null if none.

setDataServiceResourceFactory

public final void setDataServiceResourceFactory(DataServiceResourceFactory factory)
Sets the data service resource factory that can be used to create new data service resources.

Parameters:
factory - Data service resource factory or null if none.

getURL

public java.lang.String getURL()
Gets the URL associated with this request

Returns:
the URL associated with this request

setURL

public void setURL(java.lang.String url)
Sets the URL associated with this request

Parameters:
url - URL associated with this request

getResourceID

public java.lang.String getResourceID()
Gets the resource ID associated with this request

Returns:
the resource ID associated with this request

setResourceID

public void setResourceID(java.lang.String resourceID)
Sets the resource ID associated with this request

Parameters:
resourceID - Resource ID associated with this request

setError

public final void setError(java.lang.Throwable cause)
Sets a reference to the first error raised by an activity.

Parameters:
cause - Error raised by an activity.

hasError

public final boolean hasError()
Indicates whether or not there has been an error while the request has been processing.

Returns:
true if there has been an error, otherwise false

getCauseOfError

public final java.lang.Throwable getCauseOfError()
If there is an error during the processing of a request, return the exception.

Returns:
an exception if there has been an error processing the request or otherwise null

setRequest

public final void setRequest(Request request)
Sets the request that this object is the context for.

Parameters:
request - The request.

getRequest

public Request getRequest()
Gets the request that this object is the context for.

Returns:
the request
Throws:
java.lang.IllegalStateException - If this method is called before setRequest.

getAttachmentManager

public AttachmentManager getAttachmentManager()
Gets the attachment manager through which attachments can be added to the outgoing response.

Returns:
The attachment manager or null is there is no attachment manager.

setAttachmentManager

public void setAttachmentManager(AttachmentManager attachmentManager)
Sets the attachment manager through which attachments can be added to the outgoing response.

Parameters:
attachmentManager -

getAuthorizer

public AccessAuthorizer getAuthorizer()
Returns an authorizer that authorizes access to data service resources and activities.

Returns:
access authorizer

setAuthorizer

public void setAuthorizer(AccessAuthorizer authorizer)
Sets the authorizer that authorizes access to data service resources and activities.

Parameters:
authorizer - access authorizer