org.n52.wps.server.request
Class Request

java.lang.Object
  extended by org.n52.wps.server.request.Request
All Implemented Interfaces:
java.util.concurrent.Callable<Response>
Direct Known Subclasses:
CapabilitiesRequest, DescribeProcessRequest, ExecuteRequest, RetrieveResultRequest

public abstract class Request
extends java.lang.Object
implements java.util.concurrent.Callable<Response>

The client requests some operation from the server. The request generates a unique reference based on the client, time and a count. Not secure! Upcoming references are easily guessed or altered.

See Also:
java.rmi.server.UID

Field Summary
protected  org.w3c.dom.Document doc
           
protected  java.util.UUID id
           
protected static org.apache.log4j.Logger LOGGER
           
protected  org.apache.commons.collections.map.CaseInsensitiveMap map
           
static java.lang.String SUPPORTED_VERSION
           
 
Constructor Summary
Request(org.apache.commons.collections.map.CaseInsensitiveMap map)
          Create a Request based on a CaseInsensitiveMap as input (HTTP GET)
Request(org.w3c.dom.Document doc)
          Create a Request based on a Document as input (HTTP POST)
 
Method Summary
static java.lang.String accumulateString(java.lang.String[] strings)
          Accumulates the Strings in an array, separated by ", " (without quotes).
abstract  Response call()
          After creation a Request is handled.
abstract  java.lang.Object getAttachedResult()
           
protected  org.w3c.dom.Document getDocument()
          Returns the user input in Document form
protected  org.apache.commons.collections.map.CaseInsensitiveMap getMap()
          Returns the user input in Map form
protected  java.lang.String[] getMapArray(java.lang.String key, boolean required)
          Retrieve an array of values from the client-input-map with a lookup-key
static java.lang.String[] getMapArray(java.lang.String key, org.apache.commons.collections.map.CaseInsensitiveMap map, boolean required)
          Retrieve an array of values from an input-map with a lookup-key
protected  java.lang.String getMapValue(java.lang.String key, boolean required)
          Retrieve a value from the client-input-map with a lookup-key
static java.lang.String getMapValue(java.lang.String key, org.apache.commons.collections.map.CaseInsensitiveMap map, boolean required)
          Retrieve a value from an input-map with a lookup-key
protected  java.lang.String[] getRequestedVersions(boolean mandatory)
          Returns the version that the client requested.
 java.util.UUID getUniqueId()
           
 boolean requireVersion(java.lang.String version, boolean mandatory)
          The process (request) on the server could require a specific version on the client
abstract  boolean validate()
          There should be some validation required on the (input of the) clients Request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected org.apache.commons.collections.map.CaseInsensitiveMap map

doc

protected org.w3c.dom.Document doc

LOGGER

protected static org.apache.log4j.Logger LOGGER

id

protected java.util.UUID id

SUPPORTED_VERSION

public static final java.lang.String SUPPORTED_VERSION
See Also:
Constant Field Values
Constructor Detail

Request

public Request(org.apache.commons.collections.map.CaseInsensitiveMap map)
        throws ExceptionReport
Create a Request based on a CaseInsensitiveMap as input (HTTP GET)

Parameters:
map - The Map which holds the client input.
Throws:
ExceptionReport

Request

public Request(org.w3c.dom.Document doc)
        throws ExceptionReport
Create a Request based on a Document as input (HTTP POST)

Parameters:
doc - The Document which holds the client input.
Throws:
ExceptionReport
Method Detail

getDocument

protected org.w3c.dom.Document getDocument()
Returns the user input in Document form

Returns:
Document || null if Request(Map, outputstream) was used

getMap

protected org.apache.commons.collections.map.CaseInsensitiveMap getMap()
Returns the user input in Map form

Returns:
Map || null if Request(Document, OutputStream) was used

getMapValue

public static java.lang.String getMapValue(java.lang.String key,
                                           org.apache.commons.collections.map.CaseInsensitiveMap map,
                                           boolean required)
                                    throws ExceptionReport
Retrieve a value from an input-map with a lookup-key

Parameters:
key - The lookup-key
map - The input-map to look in
required - If the key-value pair must be in the map.
Returns:
The value of the key-value pair
Throws:
ExceptionReport

getMapArray

public static java.lang.String[] getMapArray(java.lang.String key,
                                             org.apache.commons.collections.map.CaseInsensitiveMap map,
                                             boolean required)
                                      throws ExceptionReport
Retrieve an array of values from an input-map with a lookup-key

Parameters:
key - The lookup-key
map - The input-map to look in
required - If the key-value pair must be in the map.
Returns:
The array of values of the key-value pair
Throws:
ExceptionReport

getMapValue

protected java.lang.String getMapValue(java.lang.String key,
                                       boolean required)
                                throws ExceptionReport
Retrieve a value from the client-input-map with a lookup-key

Parameters:
The - lookup-key
Returns:
The value of the key-value pair
Throws:
ExceptionReport

getMapArray

protected java.lang.String[] getMapArray(java.lang.String key,
                                         boolean required)
                                  throws ExceptionReport
Retrieve an array of values from the client-input-map with a lookup-key

Parameters:
The - lookup-key
Returns:
The array of values of the key-value pair
Throws:
ExceptionReport

getRequestedVersions

protected java.lang.String[] getRequestedVersions(boolean mandatory)
                                           throws ExceptionReport
Returns the version that the client requested.

Returns:
An array of versions that are compatible with the client
Throws:
ExceptionReport

requireVersion

public boolean requireVersion(java.lang.String version,
                              boolean mandatory)
                       throws ExceptionReport
The process (request) on the server could require a specific version on the client

Parameters:
version - The version that is required on the client
Returns:
True if the required version matches, False otherwise.
Throws:
ExceptionReport

accumulateString

public static java.lang.String accumulateString(java.lang.String[] strings)
Accumulates the Strings in an array, separated by ", " (without quotes).

Parameters:
strings - The array to accumulate
Returns:
The accumulated String

getUniqueId

public java.util.UUID getUniqueId()

getAttachedResult

public abstract java.lang.Object getAttachedResult()

call

public abstract Response call()
                       throws ExceptionReport
After creation a Request is handled. This is done by calling this method. This handling could contain a lot of computations. These computations should be called from within this method.

Specified by:
call in interface java.util.concurrent.Callable<Response>
Returns:
A Reponse to the client Request
Throws:
ExceptionReport
See Also:
Callable.call()

validate

public abstract boolean validate()
                          throws ExceptionReport
There should be some validation required on the (input of the) clients Request.

Returns:
True if the clients Request can be handled without problems, False otherwise
Throws:
ExceptionReport


Copyright © 2007-2011 52north.org. All Rights Reserved.