DLESE Tools
v1.6.0

org.dlese.dpc.services.dds.action
Class DDSServicesAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by org.dlese.dpc.services.dds.action.DDSServicesAction
Direct Known Subclasses:
DDSServicesAction_1_1

public class DDSServicesAction
extends org.apache.struts.action.Action

An Action that handles DDS Web service requests. This class handles DDSWS service version 1.0.

Version:
$Id: DDSServicesAction.java,v 1.57 2010/07/23 01:23:12 jweather Exp $
Author:
John Weatherley
See Also:
DDSServicesForm

Field Summary
static String GET_RECORD_VERB
          The GetRecord request verb
static String LIST_COLLECTIONS
          The list collections request verb
static String LIST_CONTENT_STANDARDS
          The list content standards request verb
static String LIST_FIELDS
          The list fields request verb
static String LIST_GRADE_RANGES
          The list grade ranges request verb
static String LIST_RESOURCE_TYPES
          The list resource types request verb
static String LIST_SUBJECTS
          The list subjects request verb
static String LIST_TERMS
          The list terms request verb
static String LIST_XML_FORMATS
          The list xml formats request verb
static String SEARCH_VERB
          The search request verb
static String SERVICE_INFO
          The ServiceInfo request verb
static String URL_CHECK_VERB
          The UrlCheck request verb
static String USER_SEARCH_VERB
          The seach all request verb
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
DDSServicesAction()
           
 
Method Summary
protected  org.apache.struts.action.ActionForward doGetRecord(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to get a given record from the repository.
protected  org.apache.struts.action.ActionForward doListCollections(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to get a the available collections.
protected  org.apache.struts.action.ActionForward doListFields(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to get a list of the fields in the index.
protected  org.apache.struts.action.ActionForward doListTerms(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to get a list of terms for given field(s) in the index.
protected  org.apache.struts.action.ActionForward doListVocabEntries(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping, String verb)
          Handles a request to list a vocab and it's values including GradeRanges, Subjects, ResourceTypes and ContentStandards.
protected  org.apache.struts.action.ActionForward doListXmlFormats(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to get a the available XML formats.
protected  org.apache.struts.action.ActionForward doSearch(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to perform a search over all records using the Lucene Query Language.
protected  org.apache.struts.action.ActionForward doServiceInfo(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to get a the service information.
protected  org.apache.struts.action.ActionForward doUrlCheck(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to check the repository for the existence of a given URL.
protected  org.apache.struts.action.ActionForward doUserSearch(HttpServletRequest request, HttpServletResponse response, RepositoryManager rm, DDSServicesForm df, org.apache.struts.action.ActionMapping mapping)
          Handles a request to perform a search over item-level records using the User Query Language.
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, HttpServletRequest request, HttpServletResponse response)
          Processes the DDS web service request by forwarding to the appropriate corresponding JSP page for rendering.
protected static String getDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
protected  String getListCollectionsCacheKey()
          Gets the key used for caching the ListCollections response in the application scope.
static int getNumRecords(RepositoryManager rm)
          Gets the number of records that have been indexed inclucing adn, collection, anno and other metadata types regardless of status.
protected  void prtln(String s)
          Output a line of text to standard out, with datestamp, if debug is set to true.
protected  void prtlnErr(String s)
          Output a line of text to error out, with datestamp.
static void setDebug(boolean db)
          Sets the debug attribute of the object
static void setMaxSearchResults(int maxResults)
          Sets the maximum number of search results that can be returned by the service.
protected  void setRecordXml(DDSServicesForm df, ResultDoc resultDoc)
          Sets the record XML in the form bean using the localized version of XML.
 
Methods 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_CHECK_VERB

public static String URL_CHECK_VERB
The UrlCheck request verb


GET_RECORD_VERB

public static String GET_RECORD_VERB
The GetRecord request verb


SEARCH_VERB

public static String SEARCH_VERB
The search request verb


USER_SEARCH_VERB

public static String USER_SEARCH_VERB
The seach all request verb


SERVICE_INFO

public static String SERVICE_INFO
The ServiceInfo request verb


LIST_XML_FORMATS

public static String LIST_XML_FORMATS
The list xml formats request verb


LIST_COLLECTIONS

public static String LIST_COLLECTIONS
The list collections request verb


LIST_GRADE_RANGES

public static String LIST_GRADE_RANGES
The list grade ranges request verb


LIST_SUBJECTS

public static String LIST_SUBJECTS
The list subjects request verb


LIST_CONTENT_STANDARDS

public static String LIST_CONTENT_STANDARDS
The list content standards request verb


LIST_RESOURCE_TYPES

public static String LIST_RESOURCE_TYPES
The list resource types request verb


LIST_FIELDS

public static String LIST_FIELDS
The list fields request verb


LIST_TERMS

public static String LIST_TERMS
The list terms request verb

Constructor Detail

DDSServicesAction

public DDSServicesAction()
Method Detail

getListCollectionsCacheKey

protected String getListCollectionsCacheKey()
Gets the key used for caching the ListCollections response in the application scope. Should be overwritten by the subclasses and updated in the ListCollections.jsp page when a new version is created.

Returns:
The listCollectionsCacheKey value

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 DDS web service request by forwarding to the appropriate corresponding JSP page for rendering.

Overrides:
execute in class org.apache.struts.action.Action
Parameters:
mapping - The ActionMapping used to select this instance
request - The HTTP request we are processing
response - The HTTP response we are creating
form - The ActionForm for the given page
Returns:
The ActionForward instance describing where and how control should be forwarded
Throws:
Exception - If error.

doGetRecord

protected org.apache.struts.action.ActionForward doGetRecord(HttpServletRequest request,
                                                             HttpServletResponse response,
                                                             RepositoryManager rm,
                                                             DDSServicesForm df,
                                                             org.apache.struts.action.ActionMapping mapping)
                                                      throws Exception
Handles a request to get a given record from the repository.

Arguments: identifier, metadataPrefix.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

setRecordXml

protected void setRecordXml(DDSServicesForm df,
                            ResultDoc resultDoc)
Sets the record XML in the form bean using the localized version of XML. This method is overidden in at least one sub-class.

Parameters:
df - The form
resultDoc - The resultDoc

doUserSearch

protected org.apache.struts.action.ActionForward doUserSearch(HttpServletRequest request,
                                                              HttpServletResponse response,
                                                              RepositoryManager rm,
                                                              DDSServicesForm df,
                                                              org.apache.struts.action.ActionMapping mapping)
                                                       throws Exception
Handles a request to perform a search over item-level records using the User Query Language. This request exposes the same search options that users experience when performing a search for educational resources in the DDS.

Arguments: identifier, metadataPrefix.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

doSearch

protected org.apache.struts.action.ActionForward doSearch(HttpServletRequest request,
                                                          HttpServletResponse response,
                                                          RepositoryManager rm,
                                                          DDSServicesForm df,
                                                          org.apache.struts.action.ActionMapping mapping)
                                                   throws Exception
Handles a request to perform a search over all records using the Lucene Query Language.

Arguments: identifier, metadataPrefix.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

doUrlCheck

protected org.apache.struts.action.ActionForward doUrlCheck(HttpServletRequest request,
                                                            HttpServletResponse response,
                                                            RepositoryManager rm,
                                                            DDSServicesForm df,
                                                            org.apache.struts.action.ActionMapping mapping)
Handles a request to check the repository for the existence of a given URL.

Arguments: url (one or more}

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response

doListXmlFormats

protected org.apache.struts.action.ActionForward doListXmlFormats(HttpServletRequest request,
                                                                  HttpServletResponse response,
                                                                  RepositoryManager rm,
                                                                  DDSServicesForm df,
                                                                  org.apache.struts.action.ActionMapping mapping)
                                                           throws Exception
Handles a request to get a the available XML formats.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

doListCollections

protected org.apache.struts.action.ActionForward doListCollections(HttpServletRequest request,
                                                                   HttpServletResponse response,
                                                                   RepositoryManager rm,
                                                                   DDSServicesForm df,
                                                                   org.apache.struts.action.ActionMapping mapping)
                                                            throws Exception
Handles a request to get a the available collections.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

doListFields

protected org.apache.struts.action.ActionForward doListFields(HttpServletRequest request,
                                                              HttpServletResponse response,
                                                              RepositoryManager rm,
                                                              DDSServicesForm df,
                                                              org.apache.struts.action.ActionMapping mapping)
                                                       throws Exception
Handles a request to get a list of the fields in the index.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

doListTerms

protected org.apache.struts.action.ActionForward doListTerms(HttpServletRequest request,
                                                             HttpServletResponse response,
                                                             RepositoryManager rm,
                                                             DDSServicesForm df,
                                                             org.apache.struts.action.ActionMapping mapping)
                                                      throws Exception
Handles a request to get a list of terms for given field(s) in the index.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

doListVocabEntries

protected org.apache.struts.action.ActionForward doListVocabEntries(HttpServletRequest request,
                                                                    HttpServletResponse response,
                                                                    RepositoryManager rm,
                                                                    DDSServicesForm df,
                                                                    org.apache.struts.action.ActionMapping mapping,
                                                                    String verb)
                                                             throws Exception
Handles a request to list a vocab and it's values including GradeRanges, Subjects, ResourceTypes and ContentStandards.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
verb - The verb requested
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

doServiceInfo

protected org.apache.struts.action.ActionForward doServiceInfo(HttpServletRequest request,
                                                               HttpServletResponse response,
                                                               RepositoryManager rm,
                                                               DDSServicesForm df,
                                                               org.apache.struts.action.ActionMapping mapping)
                                                        throws Exception
Handles a request to get a the service information.

Error Exception Conditions:
badArgument - The request includes illegal arguments.

Parameters:
request - The HTTP request
response - The HTTP response
rm - The RepositoryManager used
df - The bean
mapping - ActionMapping used
Returns:
An ActionForward to the JSP page that will handle the response
Throws:
Exception - If error.

getNumRecords

public static final int getNumRecords(RepositoryManager rm)
Gets the number of records that have been indexed inclucing adn, collection, anno and other metadata types regardless of status. Specifically, number of index entries that are not errordocs.

Parameters:
rm - The RepositoryManager being used.
Returns:
The number of records that are currently in the index.

setMaxSearchResults

public static void setMaxSearchResults(int maxResults)
Sets the maximum number of search results that can be returned by the service.

Parameters:
maxResults - The new maxSearchResults value

getDateStamp

protected static final String 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

protected final void prtlnErr(String s)
Output a line of text to error out, with datestamp.

Parameters:
s - The text that will be output to error out.

prtln

protected final void prtln(String s)
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

DLESE Tools
v1.6.0