fedora.server.management
Class GetNextPIDServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byfedora.server.management.GetNextPIDServlet
All Implemented Interfaces:
Logging, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class GetNextPIDServlet
extends javax.servlet.http.HttpServlet
implements Logging

Title: DescribeRepositoryServlet.java

Description: Implements the "getNextPID" functionality of the Fedora Management LITE (API-M-LITE) interface using a java servlet front end. The syntax defined by API-M-LITE for getting a list of the next available PIDs has the following binding:

  1. getNextPID URL syntax: protocol://hostname:port/fedora/management/getNextPID[?numPIDs=NUMPIDS&namespace=NAMESPACE&xml=BOOLEAN] This syntax requests a list of next available PIDS. The parameter numPIDs determines the number of requested PIDS to generate. If omitted, numPIDs defaults to 1. The namespace parameter determines the namespace to be used in generating the PIDs. If omitted, namespace defaults to the namespace defined in the fedora.fcfg configuration file for the parameter pidNamespace. The xml parameter determines the type of output returned. If the parameter is omitted or has a value of "false", a MIME-typed stream consisting of an html table is returned providing a browser-savvy means of viewing the object profile. If the value specified is "true", then a MIME-typed stream consisting of XML is returned.
  2. Version:
    $Id: GetNextPIDServlet.java,v 1.20 2005/05/10 18:33:29 rlw Exp $
    Author:
    rlw@virginia.edu
    See Also:
    Serialized Form

    Nested Class Summary
     class GetNextPIDServlet.GetNextPIDSerializerThread
               A Thread to serialize an array of PIDs into XML.
     
    Field Summary
    static java.lang.String ACTION_LABEL
               
     
    Constructor Summary
    GetNextPIDServlet()
               
     
    Method Summary
     void destroy()
              Cleans up servlet resources.
     void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
              Process the Fedora API-M-LITE request to generate a list of next available PIDs.
     void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
              For now, treat a HTTP POST request just like a GET request.
     void getNextPID(Context context, int numPIDs, java.lang.String namespace, boolean xml, javax.servlet.http.HttpServletResponse response)
               Get the requested list of next Available PIDs by invoking the approriate method from the Management subsystem.
     void init()
              Initialize servlet.
     void logConfig(java.lang.String message)
              Logs a CONFIG message, indicating what occurred during the server's (or a module's) configuration phase.
     void logFine(java.lang.String message)
              Logs a FINE message, indicating basic information about a request to the server (like hostname, operation name, and success or failure).
     void logFiner(java.lang.String message)
              Logs a FINER message, indicating detailed information about a request to the server (like the full request, full response, and timing information).
     void logFinest(java.lang.String message)
              Logs a FINEST message, indicating method entry/exit or extremely verbose information intended to aid in debugging.
     boolean loggingConfig()
               
     boolean loggingFine()
               
     boolean loggingFiner()
               
     boolean loggingFinest()
               
     boolean loggingInfo()
               
     boolean loggingSevere()
               
     boolean loggingWarning()
               
     void logInfo(java.lang.String message)
              Logs an INFO message, indicating that something relatively uncommon and interesting happened, like server or module startup or shutdown, or a periodic job.
     void logSevere(java.lang.String message)
              Logs a SEVERE message, indicating that the server is inoperable or unable to start.
     void logWarning(java.lang.String message)
              Logs a WARNING message, indicating that an undesired (but non-fatal) condition occured.
     
    Methods inherited from class javax.servlet.http.HttpServlet
    doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
     
    Methods inherited from class javax.servlet.GenericServlet
    getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    ACTION_LABEL

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

    GetNextPIDServlet

    public GetNextPIDServlet()
    Method Detail

    doGet

    public void doGet(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException

    Process the Fedora API-M-LITE request to generate a list of next available PIDs. Parse and validate the servlet input parameters and then execute the specified request.

    Parameters:
    request - The servlet request.
    response - servlet The servlet response.
    Throws:
    javax.servlet.ServletException - If an error occurs that effects the servlet's basic operation.
    java.io.IOException - If an error occurrs with an input or output operation.

    getNextPID

    public void getNextPID(Context context,
                           int numPIDs,
                           java.lang.String namespace,
                           boolean xml,
                           javax.servlet.http.HttpServletResponse response)
                    throws ServerException

    Get the requested list of next Available PIDs by invoking the approriate method from the Management subsystem.

    Parameters:
    context - The context of this request.
    numPIDs - The number of PIDs requested.
    namespace - The namespace of the requested PIDs.
    xml - Boolean that determines format of response; true indicates response format is xml; false indicates response format is html.
    response - The servlet response.
    Throws:
    ServerException - If an error occurred while accessing the Fedora Management subsystem.

    doPost

    public void doPost(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException

    For now, treat a HTTP POST request just like a GET request.

    Parameters:
    request - The servet request.
    response - The servlet response.
    Throws:
    javax.servlet.ServletException - If thrown by doGet.
    java.io.IOException - If thrown by doGet.

    init

    public void init()
              throws javax.servlet.ServletException

    Initialize servlet.

    Throws:
    javax.servlet.ServletException - If the servet cannot be initialized.

    destroy

    public void destroy()

    Cleans up servlet resources.

    Specified by:
    destroy in interface javax.servlet.Servlet

    logSevere

    public final void logSevere(java.lang.String message)
    Logs a SEVERE message, indicating that the server is inoperable or unable to start.

    Specified by:
    logSevere in interface Logging
    Parameters:
    message - The message.

    loggingSevere

    public final boolean loggingSevere()
    Specified by:
    loggingSevere in interface Logging

    logWarning

    public final void logWarning(java.lang.String message)
    Logs a WARNING message, indicating that an undesired (but non-fatal) condition occured.

    Specified by:
    logWarning in interface Logging
    Parameters:
    message - The message.

    loggingWarning

    public final boolean loggingWarning()
    Specified by:
    loggingWarning in interface Logging

    logInfo

    public final void logInfo(java.lang.String message)
    Logs an INFO message, indicating that something relatively uncommon and interesting happened, like server or module startup or shutdown, or a periodic job.

    Specified by:
    logInfo in interface Logging
    Parameters:
    message - The message.

    loggingInfo

    public final boolean loggingInfo()
    Specified by:
    loggingInfo in interface Logging

    logConfig

    public final void logConfig(java.lang.String message)
    Logs a CONFIG message, indicating what occurred during the server's (or a module's) configuration phase.

    Specified by:
    logConfig in interface Logging
    Parameters:
    message - The message.

    loggingConfig

    public final boolean loggingConfig()
    Specified by:
    loggingConfig in interface Logging

    logFine

    public final void logFine(java.lang.String message)
    Logs a FINE message, indicating basic information about a request to the server (like hostname, operation name, and success or failure).

    Specified by:
    logFine in interface Logging
    Parameters:
    message - The message.

    loggingFine

    public final boolean loggingFine()
    Specified by:
    loggingFine in interface Logging

    logFiner

    public final void logFiner(java.lang.String message)
    Logs a FINER message, indicating detailed information about a request to the server (like the full request, full response, and timing information).

    Specified by:
    logFiner in interface Logging
    Parameters:
    message - The message.

    loggingFiner

    public final boolean loggingFiner()
    Specified by:
    loggingFiner in interface Logging

    logFinest

    public final void logFinest(java.lang.String message)
    Logs a FINEST message, indicating method entry/exit or extremely verbose information intended to aid in debugging.

    Specified by:
    logFinest in interface Logging
    Parameters:
    message - The message.

    loggingFinest

    public final boolean loggingFinest()
    Specified by:
    loggingFinest in interface Logging