Class RepositoryAction
- Version:
- $Id: RepositoryAction.java,v 1.37 2010/07/14 00:18:49 jweather Exp $
- Author:
- John Weatherley
-
Field Summary
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.struts.action.ActionForwarddoGetRecord(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI GetRecord request.protected org.apache.struts.action.ActionForwarddoIdentify(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI Identify request.protected org.apache.struts.action.ActionForwarddoListMetadataFormats(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI ListMetadataFormats request.protected org.apache.struts.action.ActionForwarddoListRecordsOrIdentifiers(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf, String requestType, int numResults) Handles the OAI ListRecords or ListIdentifiers requests.protected org.apache.struts.action.ActionForwarddoListSets(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI ListSets request.org.apache.struts.action.ActionForwardexecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, HttpServletRequest request, HttpServletResponse response) Processes the OAI-PMH request and creates the corresponding HTTP response by forwarding to a JSP page for rendering.protected static final StringReturn a string for the current time and date, sutiable for display in log files and output to standout:protected final voidOutput a line of text to standard out, with datestamp, if debug is set to true.protected final voidOutput a line of text to error out, with datestamp.static voidsetDebug(boolean db) Sets the debug attribute of the objectMethods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
-
Constructor Details
-
RepositoryAction
public RepositoryAction()
-
-
Method Details
-
execute
public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception Processes the OAI-PMH request and creates the corresponding HTTP response by forwarding to a JSP page for rendering.- Overrides:
executein classorg.apache.struts.action.Action- Parameters:
mapping- The ActionMapping used to select this instanceform- The ActionForm for the given pagerequest- The HTTP request we are processingresponse- The HTTP response we are creating- Returns:
- The ActionForward instance describing where and how control should be forwarded
- Throws:
Exception- If error.
-
doIdentify
protected org.apache.struts.action.ActionForward doIdentify(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI Identify request. From the spec, this request has the following properties:Arguments: None
Error Exception Conditions:
badArgument - The request includes illegal arguments.- Parameters:
request- The HTTP request.mapping- The Struts ActionMapping used for forwarding.num_args- The number of arguments other than the OAI verb or rt.rm- The model used to fetch OAI data.rf- The bean used to handle the response.- Returns:
- The page to forward to that will render the response, or null if handled here.
-
doGetRecord
protected org.apache.struts.action.ActionForward doGetRecord(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI GetRecord request. From the spec, this request has the following properties:Arguments:
identifier - a required argument that specifies the unique identifier of the item in the repository from which the record must be disseminated.
metadataPrefix - a required argument that specifies the metadataPrefix of the format that should be included in the metadata part of the returned record . A record should only be returned if the format specified by the metadataPrefix can be disseminated from the item identified by the value of the identifier argument. The metadata formats supported by a repository and for a particular record can be retrieved using the ListMetadataFormats request.Error and Exception Conditions:
badArgument - The request includes illegal arguments or is missing required arguments.
cannotDisseminateFormat - The value of the metadataPrefix argument is not supported by the item identified by the value of the identifier argument
idDoesNotExist - The value of the identifier argument is unknown or illegal in this repository.- Parameters:
request- The HTTP request.mapping- The Struts ActionMapping used for forwarding.num_args- The number of arguments other than the OAI verb or rt.rm- The model used to fetch OAI data.rf- The bean used to handle the response.- Returns:
- The page to forward to that will render the response, or null if handled here.
-
doListMetadataFormats
protected org.apache.struts.action.ActionForward doListMetadataFormats(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI ListMetadataFormats request. From the spec, this request has the following properties:Arguments:
identifier - an optional argument that specifies the unique identifier of the item for which available metadata formats are being requested. If this argument is omitted, then the response includes all metadata formats supported by this repository. Note that the fact that a metadata format is supported by a repository does not mean that it can be disseminated from all items in the repository.Error and Exception Conditions:
badArgument - The request includes illegal arguments or is missing required arguments.
idDoesNotExist - The value of the identifier argument is unknown or illegal in this repository.
noMetadataFormats - There are no metadata formats available for the specified item.- Parameters:
request- The HTTP request.mapping- The Struts ActionMapping used for forwarding.num_args- The number of arguments other than the OAI verb or rt.rm- The model used to fetch OAI data.rf- The bean used to handle the response.- Returns:
- The page to forward to that will render the response, or null if handled here.
-
doListRecordsOrIdentifiers
protected org.apache.struts.action.ActionForward doListRecordsOrIdentifiers(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf, String requestType, int numResults) Handles the OAI ListRecords or ListIdentifiers requests. From the spec, these requests have the following properties:Arguments:
from - an optional argument with a UTCdatetime value , which specifies a lower bound for datestamp-based selective harvesting.
until - an optional argument with a UTCdatetime value , which specifies a upper bound for datestamp-based selective harvesting.
metadataPrefix - a required argument, which specifies that headers should be returned only if the metadata format matching the supplied metadataPrefix is available or, depending on the repository's support for deletions, has been deleted. The metadata formats supported by a repository and for a particular item can be retrieved using the ListMetadataFormats request.
set - an optional argument with a setSpec value , which specifies set criteria for selective harvesting.
resumptionToken - an exclusive argument with a value that is the flow control token returned by a previous ListIdentifiers request that issued an incomplete list.Error and Exception Conditions:
badArgument - The request includes illegal arguments or is missing required arguments.
badResumptionToken - The value of the resumptionToken argument is invalid or expired.
cannotDisseminateFormat - The value of the metadataPrefix argument is not supported by the repository.
noRecordsMatch- The combination of the values of the from, until , and set arguments results in an empty list.
noSetHierarchy - The repository does not support sets.- Parameters:
request- The HTTP request.mapping- The Struts ActionMapping used for forwarding.num_args- The number of arguments other than the OAI verb or rt.rm- The model used to fetch OAI data.rf- The bean used to handle the response.requestType- The requestType, which must be either ListIdentifiers or ListRecords.numResults- The number of results to provide in the response before returning a resumptionToken.- Returns:
- The page to forward to that will render the response, or null if handled here.
-
doListSets
protected org.apache.struts.action.ActionForward doListSets(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, int num_args, RepositoryManager rm, RepositoryForm rf) Handles the OAI ListSets request. From the spec, this request has the following properties:Arguments
resumptionToken - an exclusive argument with a value that is the flow control token returned by a previous ListSets request that issued an incomplete listError and Exception Conditions
badArgument - The request includes illegal arguments or is missing required arguments.
badResumptionToken - The value of the resumptionToken argument is invalid or expired.
noSetHierarchy - The repository does not support sets.- Parameters:
request- The HTTP request.mapping- The Struts ActionMapping used for forwarding.num_args- The number of arguments other than the OAI verb or rt.rm- The model used to fetch OAI data.rf- The bean used to handle the response.- Returns:
- The page to forward to that will render the response, or null if handled here.
-
getDateStamp
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-
prtlnErr
Output a line of text to error out, with datestamp.- Parameters:
s- The text that will be output to error out.
-
prtln
Output a line of text to standard out, with datestamp, if debug is set to true.- Parameters:
s- The String that will be output.
-
setDebug
public static void setDebug(boolean db) Sets the debug attribute of the object- Parameters:
db- The new debug value
-