dk.netarkivet.viewerproxy
Class GetDataResolver

java.lang.Object
  extended by dk.netarkivet.viewerproxy.CommandResolver
      extended by dk.netarkivet.viewerproxy.GetDataResolver
All Implemented Interfaces:
URIResolver, URIResolverHandler

public class GetDataResolver
extends CommandResolver

Wrapper for an URIResolver, which retrieves raw data on given specific URLs, and forwards all others to the wrapped handler. This allows you to get metadata, individual files, and individual records.


Field Summary
(package private)  ViewerArcRepositoryClient client
          The client for the arc repository.
static java.lang.String FILE_NAME_PARAMETER
          Parameter defining the file to return the getting files or records.
static java.lang.String FILE_OFFSET_PARAMETER
          Parameter defining the offset into an ARC file for getting a record.
static java.lang.String GET_FILE_COMMAND
          Command for getting a single file from the bitarchive.
static java.lang.String GET_METADATA_COMMAND
          Command for getting all metadata for a single job.
static java.lang.String GET_RECORD_COMMAND
          Command for getting a specific record (file+offset) from an ARC file in the bitarchive.
static java.lang.String JOB_ID_PARAMETER
          Parameter for ids of jobs to get metadata for.
 
Fields inherited from class dk.netarkivet.viewerproxy.CommandResolver
ur, VIEWERPROXY_COMMAND_NAME
 
Fields inherited from interface dk.netarkivet.viewerproxy.URIResolver
NOT_FOUND
 
Constructor Summary
GetDataResolver(URIResolver ur, ViewerArcRepositoryClient client)
          Make a new GetDataResolver, which calls commands on the arcrepository, and forwards all other requests to the given URIResolver.
 
Method Summary
protected  boolean executeCommand(Request request, Response response)
          Handles parsing of the URL and delegating to relevant methods for known commands.
 
Methods inherited from class dk.netarkivet.viewerproxy.CommandResolver
isCommandHostRequest, lookup, setURIResolver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

client

ViewerArcRepositoryClient client
The client for the arc repository.


GET_FILE_COMMAND

public static final java.lang.String GET_FILE_COMMAND
Command for getting a single file from the bitarchive.

See Also:
Constant Field Values

GET_RECORD_COMMAND

public static final java.lang.String GET_RECORD_COMMAND
Command for getting a specific record (file+offset) from an ARC file in the bitarchive.

See Also:
Constant Field Values

GET_METADATA_COMMAND

public static final java.lang.String GET_METADATA_COMMAND
Command for getting all metadata for a single job.

See Also:
Constant Field Values

FILE_NAME_PARAMETER

public static final java.lang.String FILE_NAME_PARAMETER
Parameter defining the file to return the getting files or records.

See Also:
Constant Field Values

FILE_OFFSET_PARAMETER

public static final java.lang.String FILE_OFFSET_PARAMETER
Parameter defining the offset into an ARC file for getting a record.

See Also:
Constant Field Values

JOB_ID_PARAMETER

public static final java.lang.String JOB_ID_PARAMETER
Parameter for ids of jobs to get metadata for.

See Also:
Constant Field Values
Constructor Detail

GetDataResolver

public GetDataResolver(URIResolver ur,
                       ViewerArcRepositoryClient client)
Make a new GetDataResolver, which calls commands on the arcrepository, and forwards all other requests to the given URIResolver.

Parameters:
ur - The URIResolver to handle all other uris.
client - the arcrepository client
Throws:
ArgumentNotValid - if either argument is null.
Method Detail

executeCommand

protected boolean executeCommand(Request request,
                                 Response response)
Handles parsing of the URL and delegating to relevant methods for known commands. Commands are: getFile - params: fileName - effect: get the full file specified by the parameter from the bitarchive. getRecord - params: fileName,offset - effect: get a single ARC record from the bitarchive. getMetadata - params: jobID - effect: get all metadata for a single job from the bitarchive.

Specified by:
executeCommand in class CommandResolver
Parameters:
request - The request to check
response - The response to give command results to if it is a command
Returns:
Whether this was a command URL
Throws:
IOFailure - in any trouble.