fedora.server
Class Module

java.lang.Object
  extended byfedora.server.Parameterized
      extended byfedora.server.Pluggable
          extended byfedora.server.Module
All Implemented Interfaces:
Logging
Direct Known Subclasses:
BasicPIDGenerator, ConnectionPoolManagerImpl, DefaultAccess, DefaultDOManager, DefaultDOReplicator, DefaultExternalContentManager, DefaultManagement, DOValidatorModule, DynamicAccessModule, FieldSearchSQLModule, ThreadMonitorModule

public abstract class Module
extends Pluggable
implements Logging

Title: Module.java

Description: The base class for Fedora server modules.

A Module is a singleton object of a Fedora Server instance with a simple lifecycle, supported by the initModule() and shutdownModule() methods, which are automatically called during server startup and shutdown, respectively.

Modules are configured via "param" elements inside module elements in the configuration file. An instance of each module specified in the configuration file is automatically created at startup and is available via the getModule(String) instance method of the Server class.

-----------------------------------------------------------------------------

License and Copyright: The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The entire file consists of original code. Copyright © 2002-2005 by The Rector and Visitors of the University of Virginia and Cornell University. All rights reserved.

-----------------------------------------------------------------------------

Version:
$Id: Module.java,v 1.17 2005/01/11 20:06:05 cwilper Exp $
Author:
cwilper@cs.cornell.edu

Constructor Summary
Module(java.util.Map moduleParameters, Server server, java.lang.String role)
          Creates and initializes the Module.
 
Method Summary
 java.lang.String getRole()
          Gets the role this module fulfills, as given in the constructor.
 Server getServer()
          Gets the Server instance to which this Module belongs.
 void initModule()
          Initializes the Module based on configuration parameters.
 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.
 void postInitModule()
          Second stage of Module initialization.
 void shutdownModule()
          Frees system resources allocated by this Module.
 
Methods inherited from class fedora.server.Pluggable
getHelp, getOptionalParameters, getParameterHelp, getRequiredModuleRoles, getRequiredParameters
 
Methods inherited from class fedora.server.Parameterized
getParameter, getParameters, parameterNames, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Module

public Module(java.util.Map moduleParameters,
              Server server,
              java.lang.String role)
       throws ModuleInitializationException
Creates and initializes the Module.

When the server is starting up, this is invoked as part of the initialization process.

Parameters:
moduleParameters - A pre-loaded Map of name-value pairs comprising the intended configuration of this Module.
server - The Server instance.
role - The role this module fulfills, a java class name.
Throws:
ModuleInitializationException - If initilization values are invalid or initialization fails for some other reason.
Method Detail

getServer

public Server getServer()
Gets the Server instance to which this Module belongs.

Returns:
The Server instance.

getRole

public final java.lang.String getRole()
Gets the role this module fulfills, as given in the constructor.

Role is the name of the class or interface that this concrete Module extends or implements.

Returns:
String The role.

initModule

public void initModule()
                throws ModuleInitializationException
Initializes the Module based on configuration parameters.

Throws:
ModuleInitializationException - If initialization values are invalid or initialization fails for some other reason.

postInitModule

public void postInitModule()
                    throws ModuleInitializationException
Second stage of Module initialization. This is guaranteed to run after all Module's initModule() methods have run.

Throws:
ModuleInitializationException - If initialization values are invalid or initialization fails for some other reason.

shutdownModule

public void shutdownModule()
                    throws ModuleShutdownException
Frees system resources allocated by this Module.

Throws:
ModuleShutdownException - If there is a problem freeing system resources. Note that if there is a problem, it won't end up aborting the shutdown process. Therefore, this method should do everything possible to recover from exceptional situations before throwing an exception.

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