edu.ucsb.adl.middleware.rmi
Class RmiControlServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--edu.ucsb.adl.middleware.rmi.RmiControlServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public final class RmiControlServlet
extends javax.servlet.http.HttpServlet

Controls the RMI interface to the ADL middleware. Specifically, this servlet is invoked by an HTTP GET request specifying one parameter, op. If the value of op is "rebind", the RMI interface is (re)started, that is, the RMI names of the middleware services are (re)bound. If the value of op is "unbind", the RMI names are unbound. If the URL of this servlet is S, then an example of a complete URL is:

S?op=rebind
The successful HTTP status code is 200 (OK). Other possible status codes are 400 (bad request) and 500 (internal server error).

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/rmi/RCS/RmiControlServlet.java,v 1.6 2007/03/01 19:28:14 gjanee Exp $

$Log: RmiControlServlet.java,v $ Revision 1.6 2007/03/01 19:28:14 gjanee
When this servlet is destroyed (i.e., when the middleware webapp is stopped), the RMI server is now shut down as well.

Revision 1.5 2006/06/21 18:15:37 gjanee
To make web browsers a little happier, servlets that formerly returned HTTP status code 204 (no content) now return status code 200 (OK) and return the plain text "DONE\n".

Revision 1.4 2004/03/05 23:41:05 gjanee
If the middleware_configuration_file servlet initialization parameter is not available, we now look for it as a context-wide initialization parameter.

Revision 1.3 2001/10/05 21:51:47 gjanee
Added the rebind_on_load initialization parameter. Other, minor changes.

Revision 1.2 2001/10/04 19:00:40 gjanee
To support the middleware being a web application, we now allow the locations of the RMI server and middleware configuration files to be specified relative to the web application directory.

Revision 1.1 2001/02/22 22:57:53 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library
See Also:
Serialized Form

Constructor Summary
RmiControlServlet()
          Creates an RmiControlServlet.
 
Method Summary
 void destroy()
          Frees all resources held by the servlet and unbinds the RMI names of the middleware services, if bound.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          HTTP GET interface to the servlet.
 void init(javax.servlet.ServletConfig config)
          Initializes the servlet.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, 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
 

Constructor Detail

RmiControlServlet

public RmiControlServlet()
Creates an RmiControlServlet.

Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initializes the servlet.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Parameters:
config - Must contain the following initialization parameters:
rmi_server_configuration_file
The filename of the RMI server configuration file. If the filename is not absolute, it is interpreted relative to the middleware web application directory.
middleware_configuration_file
The filename of the ADL middleware configuration file. If the filename is not absolute, it is interpreted relative to the middleware web application directory.
rebind_on_load
A value of "yes" ("no") indicates the rebind operation should (should not) be performed at the time the servlet is loaded. This option is useful when used in conjunction with the <load-on-startup> web application option.
Throws:
javax.servlet.UnavailableException - If the initialization fails.
javax.servlet.ServletException - If the rebind operation fails.

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException
HTTP GET interface to the servlet.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The HTTP request.
response - The HTTP response, which is either 200 (OK) or an error of some kind.
Throws:
java.io.IOException - On any I/O error.

destroy

public void destroy()
Frees all resources held by the servlet and unbinds the RMI names of the middleware services, if bound.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet