edu.ucsb.adl.middleware.rmi
Class RmiServer

java.lang.Object
  |
  +--edu.ucsb.adl.middleware.rmi.RmiServer

public final class RmiServer
extends java.lang.Object

Standalone RMI server. This class supports the RMI interface to the ADL middleware independently of the HTTP servlet interface.

This class obtains configuration information from a server configuration file, which is a Java properties file that defines the properties listed below. Property values may be indirectly specified using the notation @P where P is the name of another property (see ExtendedProperties for more information).

registry
The URL of the RMI registry to use, e.g., "rmi://piru.alexandria.ucsb.edu".
create_registry
Must be "yes" or "no". If "yes", the hostname specified in the registry URL must be "localhost", and the middleware creates a local RMI registry that listens on the port number specified in the registry URL.
S.name
For middleware service S, the RMI name of the service, e.g., "/edu/ucsb/adl/middleware/rmi/ConfigurationService". For the purposes of the configuration file, the middleware service names are: cancel, collection, configuration, identifiers, metadata, query, reference, results, status, unload, and unreference.

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

$Log: RmiServer.java,v $ Revision 1.6 2007/03/01 19:35:20 gjanee
Augmented unbind to destroy the RMI registry if it was created by the middleware.

Revision 1.5 2006/06/24 05:39:42 gjanee
Added the identifiers service.

Revision 1.4 2004/09/23 18:15:51 gjanee
Rewrite to use classes edu.ucsb.adl.middleware.ExtendedProperties and edu.ucsb.adl.middleware.XmlUtils.

Revision 1.3 2004/03/11 01:40:39 gjanee
Added the ability to create local RMI registries. Added the create_registry property.

Revision 1.2 2001/09/14 22:25:20 gjanee
Added the reference, unreference, and unload services.

Revision 1.1 2001/02/22 18:25:53 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library

Method Summary
static void main(java.lang.String[] args)
          Standalone RMI server.
static void rebind(java.lang.String serverConfigurationFile, java.lang.String middlewareConfigurationFile, boolean logMessages)
          Binds/rebinds the RMI names of the middleware services.
static void unbind(java.lang.String serverConfigurationFile)
          Unbinds the RMI names of the middleware services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
                 throws InternalErrorException
Standalone RMI server.

Parameters:
args - Command-line arguments.
Throws:
InternalErrorException - If any error occurs. Note that the Java VM may not exit on exception because RMI starts up additional, non-daemon threads.

rebind

public static void rebind(java.lang.String serverConfigurationFile,
                          java.lang.String middlewareConfigurationFile,
                          boolean logMessages)
                   throws InternalErrorException
Binds/rebinds the RMI names of the middleware services. A local RMI registry is created if requested and if necessary. The services are started up if necessary. If any error is encountered, an attempt is made to unbind the RMI names (see unbind below).

Parameters:
serverConfigurationFile - The filename of the RMI server configuration file.
middlewareConfigurationFile - The filename of a middleware configuration file.
logMessages - Indicates if informational startup messages should be written to System.err.
Throws:
InternalErrorException - If any error is encountered.

unbind

public static void unbind(java.lang.String serverConfigurationFile)
                   throws InternalErrorException
Unbinds the RMI names of the middleware services. This has the side effect of releasing the references to the bridge objects (CancelServiceImpl, ConfigurationServiceImpl, etc.), and when the latter are garbage-collected, they will in turn release their references to the middleware services. Finally, the middleware services will shut down when no longer referenced. Also, if the RMI registry was created by the middleware, it is destroyed.

Parameters:
serverConfigurationFile - The filename of the RMI server configuration file.
Throws:
InternalErrorException - If any error is encountered.