uk.org.ogsadai.service.resource
Class DataServiceResource

java.lang.Object
  |
  +--uk.org.ogsadai.service.resource.DataServiceResource

public class DataServiceResource
extends java.lang.Object

A data service resource class.

Manages the interaction between the presentation (service) layer and the core (engine) layer in OGSA-DAI.

A data service resource includes a data resource accessor (used to access any underlying data resource) and an OGSA-DAI engine (as represented by a uk.org.ogsadai.engine.engine).

Author:
The OGSA-DAI Project Team

Field Summary
private static?java.lang.String COPYRIGHT_NOTICE
??????????Copyright statement
private static?DAILogger LOG
??????????Logger object for logging in this class
private ?ActivityFactory mActivityFactory
??????????Factory for creating activities supported by the resource
private ?DataResourceAccessor mDataResourceAccessor
??????????Manages access to data resource for the data service resource
private ?Engine mEngine
??????????Request execution engine
private ?EngineConfiguration mEngineConfiguration
??????????Request execution engine configuration
private ?java.lang.Object mID
??????????Data service resource ID
private ?Properties mProperties
??????????Data service resource properties
private ?RequestFactory mRequestFactory
??????????Factory to create requests from perform documents
private ?SessionCoordinator mSessionCoordinator
??????????Manages joining/releasing requests to/from sessions
private ?SessionStreamManager mSessionStreamManager
??????????Session stream manager
?
Constructor Summary
DataServiceResource(java.lang.Object?id, ActivitiesConfig?activitiesConfig, DataResourceAccessor?dataResourceAccessor, SessionComponentFactory?sessionComponentFactory, ConcurrencySettings?concurrencySettings, AccessAuthorizer?accessAuthorizer)
??????????Create a new data service resource.
?
Method Summary
private ?void addProperties()
??????????Adds all the properties associated with the data resource accessor and activity factory to the properties of the resource.
?java.lang.Object getBlock(SessionStreamID?id)
??????????Get one block of data from an output stream of a session.
?java.lang.Object getFully(SessionStreamID?id)
??????????Get all the data from an output stream of a session.
?java.lang.Object getID()
??????????Gets the resource ID.
?java.lang.Object getNBlocks(SessionStreamID?id, int?numberOfBlocks)
??????????Get a specific number of blocks of data from an output stream of a session.
?Properties getProperties()
??????????Gets the data service resource properties for the resource.
?SessionStreamManager getSessionStreamManager()
??????????Gets the session stream manager for the resource.
?org.w3c.dom.Document perform(org.w3c.dom.Document?performDocument, RequestContext?requestContext)
??????????Execute a perform document.
?void putBlock(SessionStreamID?id, java.lang.Object?data)
??????????Put a block of data onto an input stream of a session.
?void putFully(SessionStreamID?id, java.lang.Object?data)
??????????Put a complete set of data onto an input stream of a session.
?void terminate()
??????????Terminate a current 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

LOG

private static DAILogger LOG
Logger object for logging in this class


mID

private java.lang.Object mID
Data service resource ID


mProperties

private Properties mProperties
Data service resource properties


mSessionStreamManager

private final SessionStreamManager mSessionStreamManager
Session stream manager


mActivityFactory

private final ActivityFactory mActivityFactory
Factory for creating activities supported by the resource


mDataResourceAccessor

private final DataResourceAccessor mDataResourceAccessor
Manages access to data resource for the data service resource


mSessionCoordinator

private final SessionCoordinator mSessionCoordinator
Manages joining/releasing requests to/from sessions


mRequestFactory

private final RequestFactory mRequestFactory
Factory to create requests from perform documents


mEngine

private Engine mEngine
Request execution engine


mEngineConfiguration

private EngineConfiguration mEngineConfiguration
Request execution engine configuration

Constructor Detail

DataServiceResource

public DataServiceResource(java.lang.Object?id,
                           ActivitiesConfig?activitiesConfig,
                           DataResourceAccessor?dataResourceAccessor,
                           SessionComponentFactory?sessionComponentFactory,
                           ConcurrencySettings?concurrencySettings,
                           AccessAuthorizer?accessAuthorizer)
                    throws ResourceCreationException
Create a new data service resource.

Parameters:
id - Resource ID.
activitiesConfig - Details of the activities associated with the data service resource.
dataResourceAccessor - The data resource acccessor that gives access to any underlying data resource.
sessionComponentFactory - A factory to create the session components to be used by the data service resource.
concurrencySettings - Default concurrency settings for the resource.
accessAuthorizer - Grants or denies access to activites.
Throws:
java.lang.IllegalArgumentException - If any of the arguments is null or the id "".
ResourceCreationException - If the data service resource cannot be created for some reason.
Method Detail

addProperties

private void addProperties()
Adds all the properties associated with the data resource accessor and activity factory to the properties of the resource.


getID

public java.lang.Object getID()
Gets the resource ID.

Returns:
the resource ID.

getProperties

public Properties getProperties()
Gets the data service resource properties for the resource.

Returns:
the properties.

getSessionStreamManager

public SessionStreamManager getSessionStreamManager()
Gets the session stream manager for the resource.

Returns:
the session stream manager.

perform

public org.w3c.dom.Document perform(org.w3c.dom.Document?performDocument,
                                    RequestContext?requestContext)
                             throws ResourceRequestAuthorizationException,
                                    ResourceRequestSpecificationException,
                                    ResourceRequestExecutionException
Execute a perform document.

Parameters:
performDocument - The perform document.
requestContext - Information about the client and the request e.g. client security credentials.
Returns:
response document describing the status and possibly the results of the request.
Throws:
ResourceRequestAuthorizationException - if the request fails because of an authorization problem.
ResourceRequestSpecificationException - 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.
ResourceRequestExecutionException - if the request fails to execute due to a problem in the resource e.g. a database connection disappears or a file is corrupted.

terminate

public void terminate()
               throws ResourceRequestAuthorizationException,
                      ResourceRequestSpecificationException,
                      ResourceRequestExecutionException
Terminate a current request.

Throws:
ResourceRequestAuthorizationException - if the request fails because of an authorization problem.
ResourceRequestSpecificationException - if the request fails to execute due to a problem in the request e.g. the session to which the request belongs does not exist.
ResourceRequestExecutionException - if the request fails to execute due to a problem in the resource.

getFully

public java.lang.Object getFully(SessionStreamID?id)
                          throws ResourceRequestAuthorizationException,
                                 ResourceRequestExecutionException,
                                 ResourceRequestSpecificationException
Get all the data from an output stream of a session.

Parameters:
id - Session and stream identifier.
Returns:
data
Throws:
ResourceRequestAuthorizationException - if the request fails because of an authorization problem.
ResourceRequestSpecificationException - if the request fails to execute due to a problem in the request e.g. it specifies an unknown session or stream.
ResourceRequestExecutionException - if the request fails to execute due to a problem in the resource.
See Also:
SessionStreamManager.getFully(uk.org.ogsadai.sessions.SessionStreamID)

getNBlocks

public java.lang.Object getNBlocks(SessionStreamID?id,
                                   int?numberOfBlocks)
                            throws ResourceRequestAuthorizationException,
                                   ResourceRequestExecutionException,
                                   ResourceRequestSpecificationException
Get a specific number of blocks of data from an output stream of a session.

Parameters:
id - Session and stream identifier.
numberOfBlocks - Number of blocks to get.
Returns:
data
Throws:
ResourceRequestAuthorizationException - if the request fails because of an authorization problem.
ResourceRequestSpecificationException - if the request fails to execute due to a problem in the request e.g. it specifies an unknown session or stream.
ResourceRequestExecutionException - if the request fails to execute due to a problem in the resource.
See Also:
SessionStreamManager.getNBlocks(uk.org.ogsadai.sessions.SessionStreamID, int)

getBlock

public java.lang.Object getBlock(SessionStreamID?id)
                          throws ResourceRequestAuthorizationException,
                                 ResourceRequestExecutionException,
                                 ResourceRequestSpecificationException
Get one block of data from an output stream of a session.

Parameters:
id - Session and stream identifier.
Returns:
data
Throws:
ResourceRequestAuthorizationException - if the request fails because of an authorization problem.
ResourceRequestSpecificationException - if the request fails to execute due to a problem in the request e.g. it specifies an unknown session or stream.
ResourceRequestExecutionException - if the request fails to execute due to a problem in the resource.
See Also:
SessionStreamManager.getNBlocks(uk.org.ogsadai.sessions.SessionStreamID, int)

putBlock

public void putBlock(SessionStreamID?id,
                     java.lang.Object?data)
              throws ResourceRequestAuthorizationException,
                     ResourceRequestExecutionException,
                     ResourceRequestSpecificationException
Put a block of data onto an input stream of a session.

Parameters:
id - Session and stream identifier.
data - Single block of data.
Throws:
ResourceRequestAuthorizationException - if the request fails because of an authorization problem.
ResourceRequestSpecificationException - if the request fails to execute due to a problem in the request e.g. it specifies an unknown session or stream or the stream was closed.
ResourceRequestExecutionException - if the request fails to execute due to a problem in the resource.
See Also:
SessionStreamManager.putBlock(uk.org.ogsadai.sessions.SessionStreamID, java.lang.Object)

putFully

public void putFully(SessionStreamID?id,
                     java.lang.Object?data)
              throws ResourceRequestAuthorizationException,
                     ResourceRequestExecutionException,
                     ResourceRequestSpecificationException
Put a complete set of data onto an input stream of a session.

Parameters:
id - Session and stream identifier.
data - Single block of data.
Throws:
ResourceRequestAuthorizationException - if the request fails because of an authorization problem.
ResourceRequestSpecificationException - if the request fails to execute due to a problem in the request e.g. it specifies an unknown session or stream or the stream was closed.
ResourceRequestExecutionException - if the request fails to execute due to a problem in the resource.
See Also:
SessionStreamManager.putFully(uk.org.ogsadai.sessions.SessionStreamID, java.lang.Object)