|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfedora.server.Parameterized
fedora.server.Pluggable
fedora.server.Server
public abstract class Server
The starting point for working with a Fedora repository. This class handles loading, starting, and stopping modules (the module lifecycle), and provides access to core constants.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface fedora.common.Constants |
|---|
Constants.FedoraHome |
| Field Summary | |
|---|---|
static java.lang.String |
BIN_DIR
The directory where server executables are stored, relative to home. |
static java.lang.String |
BUILD_NUMBER
The build number of this release. |
static java.lang.String |
CONFIG_ATTRIBUTE_CLASS
The configuration file's class-specifying attribute for server and module elements. |
static java.lang.String |
CONFIG_ATTRIBUTE_ID
The configuration file datastore element's id attribute. |
static java.lang.String |
CONFIG_ATTRIBUTE_NAME
The configuration file param element's name attribute. |
static java.lang.String |
CONFIG_ATTRIBUTE_ROLE
The configuration file's role-specifying attribute for module elements. |
static java.lang.String |
CONFIG_ATTRIBUTE_VALUE
The configuration file param element's value attribute. |
static java.lang.String |
CONFIG_DIR
The directory where server configuration is stored, relative to home. |
static java.lang.String |
CONFIG_ELEMENT_COMMENT
The configuration file comment element's name. |
static java.lang.String |
CONFIG_ELEMENT_DATASTORE
The configuration file datastore element's name. |
static java.lang.String |
CONFIG_ELEMENT_MODULE
The configuration file module element's name. |
static java.lang.String |
CONFIG_ELEMENT_PARAM
The configuration file param element's name. |
static java.lang.String |
CONFIG_ELEMENT_ROOT
The configuration file root element's name. |
static java.lang.String |
CONFIG_FILE
The configuration filename. |
static java.lang.String |
CONFIG_NAMESPACE
The configuration file elements' namespace. |
static java.lang.String |
DEFAULT_SERVER_CLASS
The name of the default Server implementation class |
static java.lang.String |
EXTENSION_DIR
The directory where server extensions are stored, relative to home. |
static boolean |
GLOBAL_CHOICE
|
static java.lang.String |
HOME_PROPERTY
The name of the property that tells the server where it's based. |
static java.lang.String |
INIT_CONFIG_CONFIG_EXAMININGELEMENT
Tells which config element is being looked at in order to load its parameters into memory. |
static java.lang.String |
INIT_CONFIG_CONFIG_PARAMETERIS
Tells the name and value of a parameter loaded from the config file. |
static java.lang.String |
INIT_CONFIG_SEVERE_BADELEMENT
Indicates that an invalid element was found in the configuration xml. |
static java.lang.String |
INIT_CONFIG_SEVERE_BADNAMESPACE
Indicates that the config file's element's namespace does not match {config.namespace}. |
static java.lang.String |
INIT_CONFIG_SEVERE_BADROOTELEMENT
Indicates that the config file has a mis-named root element. |
static java.lang.String |
INIT_CONFIG_SEVERE_INCOMPLETEPARAM
Indicates that a parameter element in the config file is missing a required element. |
static java.lang.String |
INIT_CONFIG_SEVERE_MALFORMEDXML
Indicates that the config file has malformed XML. |
static java.lang.String |
INIT_CONFIG_SEVERE_NOCLASSGIVEN
Indicates that a module element in the server configuration did not specify an implementing class, but should. |
static java.lang.String |
INIT_CONFIG_SEVERE_NOIDGIVEN
Indicates that a CONFIG_ELEMENT_DATASTORE didn't specify the required CONFIG_ATTRIBUTE_ID. |
static java.lang.String |
INIT_CONFIG_SEVERE_NOROLEGIVEN
Indicates that a module element in the server configuration did not specify a role, but should. |
static java.lang.String |
INIT_CONFIG_SEVERE_REASSIGNMENT
Indicates that an attribute of an element was assigned the same value as a previously specified element's attribute, and that this constitutes a disallowed reassignment. |
static java.lang.String |
INIT_CONFIG_SEVERE_UNREADABLE
Indicates that the config file could not be read. |
static java.lang.String |
INIT_LOG_WARNING_CANTWRITESTARTUPLOG
Indicates that the startup log could not be written to its usual place for some reason, and that we're falling back to stderr. |
static java.lang.String |
INIT_MODULE_SEVERE_BADARGS
Indicates that the module class constructor was invoked improperly due to programmer error. |
static java.lang.String |
INIT_MODULE_SEVERE_CLASSNOTFOUND
Indicates that the module class could not be found. |
static java.lang.String |
INIT_MODULE_SEVERE_ILLEGALACCESS
Indicates that the module class couldn't be accessed due to security misconfiguration. |
static java.lang.String |
INIT_MODULE_SEVERE_ISABSTRACT
Indicates that the module class was abstract, but shouldn't be. |
static java.lang.String |
INIT_MODULE_SEVERE_MISSINGCONSTRUCTOR
Indicates that the module class doesn't have a constructor matching Module(Map, Server, String), but needs one. |
static java.lang.String |
INIT_MODULE_SEVERE_UNFULFILLEDROLE
|
static java.lang.String |
INIT_SERVER_SEVERE_BADARGS
Indicates that the server class constructor was invoked improperly due to programmer error. |
static java.lang.String |
INIT_SERVER_SEVERE_CLASSNOTFOUND
Indicates that the server class could not be found. |
static java.lang.String |
INIT_SERVER_SEVERE_ILLEGALACCESS
Indicates that the server class couldn't be accessed due to security misconfiguration. |
static java.lang.String |
INIT_SERVER_SEVERE_ISABSTRACT
Indicates that the server class was abstract, but shouldn't be. |
static java.lang.String |
INIT_SERVER_SEVERE_MISSINGCONSTRUCTOR
Indicates that the server class doesn't have a constructor matching Server(NodeList, File), but needs one. |
static java.lang.String |
INIT_SERVER_SEVERE_UNFULFILLEDROLE
Indicates that a module role required to be fulfilled by this server was not fulfilled because the configuration did not specify a module with that role. |
static java.lang.String |
INIT_XMLPARSER_SEVERE_MISSING
Indicates that an XML parser could not be found. |
static java.lang.String |
LOG_DIR
The default directory where the server logs are stored. |
static java.lang.String |
LOG_STARTUP_FILE
The startup log file. |
static java.lang.String |
MODULE_CONSTRUCTOR_PARAM1_CLASS
The required module constructor's first parameter's class. |
static java.lang.String |
MODULE_CONSTRUCTOR_PARAM2_CLASS
The required module constructor's second parameter's class. |
static java.lang.String |
MODULE_CONSTRUCTOR_PARAM3_CLASS
The required module constructor's third parameter's class. |
static java.lang.String |
NAMESPACE_PREFIX
The prefix to all fedora-defined namespaces for this version. |
protected static java.util.HashMap |
s_instances
Holds an instance of a Server for each distinct
File given as a parameter to getInstance(...) |
static java.lang.String |
SERVER_CONSTRUCTOR_PARAM1_CLASS
The required server constructor's first parameter's class. |
static java.lang.String |
SERVER_CONSTRUCTOR_PARAM2_CLASS
The required server constructor's second parameter's class. |
static java.lang.String |
STORAGE_FORMAT
The internal XML storage format for digital objects |
static boolean |
USE_CACHE
|
static boolean |
USE_DEFINITIVE_STORE
|
static java.lang.String |
VERSION_MAJOR
The major version of this release. |
static java.lang.String |
VERSION_MINOR
The minor version of this release. |
| Fields inherited from interface fedora.common.Constants |
|---|
ACTION, BDEF, BMECH, DATASTREAM, DC, DISSEMINATOR, ENVIRONMENT, FEDORA, FEDORA_HOME, FEDORA_SYSTEM_DEF_PID, FEDORA_SYSTEM_DEF_URI, HTTP_REQUEST, MODEL, OBJECT, RDF, RECOVERY, RELS_EXT, RESOURCE, SUBJECT, TUCANA, VIEW, XSD |
| Constructor Summary | |
|---|---|
protected |
Server(org.w3c.dom.Element rootConfigElement,
java.io.File homeDir)
Initializes the Server based on configuration. |
| Method Summary | |
|---|---|
protected static void |
configureLog4J(java.lang.String extension)
Configures Log4J using FEDORA_HOME/config/log4j.properties. |
java.util.Iterator |
datastoreConfigIds()
|
void |
finalize()
Calls shutdown() when finalization occurs. |
java.lang.String |
getConfigSummary()
|
static java.util.Date |
getCurrentDate(Context context)
Get the current date from the context. |
DatastoreConfig |
getDatastoreConfig(java.lang.String id)
Gets a DatastoreConfig. |
java.io.File |
getHomeDir()
Gets the server's home directory. |
static Server |
getInstance(java.io.File homeDir)
Provides an instance of the server specified in the configuration file at homeDir/CONFIG_DIR/CONFIG_FILE, or DEFAULT_SERVER_CLASS if unspecified. |
static Server |
getInstance(java.io.File homeDir,
boolean okToStart)
|
static java.util.Locale |
getLocale()
|
Module |
getModule(java.lang.String role)
Gets a loaded Module. |
static PID |
getPID(java.lang.String pidString)
|
ServerStatusFile |
getStatusFile()
Get the status file for the server. |
boolean |
hasInitialized()
Tells whether the server (and loaded modules) have initialized. |
static boolean |
hasInstance(java.io.File homeDir)
|
protected void |
initServer()
Performs any server start-up tasks particular to this type of Server. |
java.util.Iterator |
loadedModuleRoles()
Gets an Iterator over the roles that have been loaded. |
protected java.lang.String |
overrideModuleClass(java.lang.String moduleClass)
|
protected boolean |
overrideModuleRole(java.lang.String moduleRole)
|
static PID |
pidFromFilename(java.lang.String filename)
|
protected void |
postInitServer()
Second stage of Server initialization. |
void |
shutdown(Context context)
Performs shutdown tasks for the modules and the server. |
protected void |
shutdownServer()
Performs shutdown tasks for the server itself. |
java.lang.String |
status(Context context)
|
| Methods inherited from class fedora.server.Pluggable |
|---|
getHelp, getOptionalParameters, getParameterHelp, getRequiredModuleRoles, getRequiredParameters |
| Methods inherited from class fedora.server.Parameterized |
|---|
getParameter, getParameter, getParameters, parameterNames, setParameter, setParameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean USE_CACHE
public static final boolean USE_DEFINITIVE_STORE
public static final boolean GLOBAL_CHOICE
public static java.lang.String VERSION_MAJOR
public static java.lang.String VERSION_MINOR
public static java.lang.String BUILD_NUMBER
public static java.lang.String HOME_PROPERTY
public static java.lang.String STORAGE_FORMAT
public static java.lang.String CONFIG_DIR
public static java.lang.String LOG_DIR
Server subclass.
public static java.lang.String LOG_STARTUP_FILE
Level.
public static java.lang.String CONFIG_FILE
public static java.lang.String EXTENSION_DIR
public static java.lang.String BIN_DIR
public static java.lang.String NAMESPACE_PREFIX
public static java.lang.String CONFIG_NAMESPACE
public static java.lang.String CONFIG_ELEMENT_ROOT
public static java.lang.String CONFIG_ELEMENT_COMMENT
public static java.lang.String CONFIG_ELEMENT_DATASTORE
public static java.lang.String CONFIG_ELEMENT_MODULE
public static java.lang.String CONFIG_ELEMENT_PARAM
public static java.lang.String CONFIG_ATTRIBUTE_CLASS
public static java.lang.String CONFIG_ATTRIBUTE_ROLE
public static java.lang.String CONFIG_ATTRIBUTE_NAME
public static java.lang.String CONFIG_ATTRIBUTE_VALUE
public static java.lang.String CONFIG_ATTRIBUTE_ID
public static java.lang.String SERVER_CONSTRUCTOR_PARAM1_CLASS
public static java.lang.String SERVER_CONSTRUCTOR_PARAM2_CLASS
public static java.lang.String MODULE_CONSTRUCTOR_PARAM1_CLASS
public static java.lang.String MODULE_CONSTRUCTOR_PARAM2_CLASS
public static java.lang.String MODULE_CONSTRUCTOR_PARAM3_CLASS
public static java.lang.String DEFAULT_SERVER_CLASS
public static java.lang.String INIT_XMLPARSER_SEVERE_MISSING
public static java.lang.String INIT_CONFIG_SEVERE_UNREADABLE
public static java.lang.String INIT_CONFIG_SEVERE_MALFORMEDXML
public static java.lang.String INIT_CONFIG_SEVERE_BADROOTELEMENT
public static java.lang.String INIT_CONFIG_SEVERE_BADELEMENT
public static java.lang.String INIT_CONFIG_SEVERE_NOIDGIVEN
public static java.lang.String INIT_CONFIG_SEVERE_BADNAMESPACE
public static java.lang.String INIT_CONFIG_SEVERE_NOROLEGIVEN
public static java.lang.String INIT_CONFIG_SEVERE_NOCLASSGIVEN
public static java.lang.String INIT_CONFIG_SEVERE_REASSIGNMENT
public static java.lang.String INIT_CONFIG_SEVERE_INCOMPLETEPARAM
public static java.lang.String INIT_CONFIG_CONFIG_EXAMININGELEMENT
public static java.lang.String INIT_CONFIG_CONFIG_PARAMETERIS
public static java.lang.String INIT_SERVER_SEVERE_CLASSNOTFOUND
public static java.lang.String INIT_SERVER_SEVERE_ILLEGALACCESS
public static java.lang.String INIT_SERVER_SEVERE_BADARGS
public static java.lang.String INIT_SERVER_SEVERE_MISSINGCONSTRUCTOR
public static java.lang.String INIT_SERVER_SEVERE_UNFULFILLEDROLE
public static java.lang.String INIT_MODULE_SEVERE_UNFULFILLEDROLE
public static java.lang.String INIT_SERVER_SEVERE_ISABSTRACT
public static java.lang.String INIT_MODULE_SEVERE_CLASSNOTFOUND
public static java.lang.String INIT_MODULE_SEVERE_ILLEGALACCESS
public static java.lang.String INIT_MODULE_SEVERE_BADARGS
public static java.lang.String INIT_MODULE_SEVERE_MISSINGCONSTRUCTOR
public static java.lang.String INIT_MODULE_SEVERE_ISABSTRACT
public static java.lang.String INIT_LOG_WARNING_CANTWRITESTARTUPLOG
protected static java.util.HashMap s_instances
Server for each distinct
File given as a parameter to getInstance(...)
| Constructor Detail |
|---|
protected Server(org.w3c.dom.Element rootConfigElement,
java.io.File homeDir)
throws ServerInitializationException,
ModuleInitializationException
NodeList, validates required server params,
initializes the Server, then initializes each module,
validating its required params, then verifies that the server's
required module roles have been met.
rootConfigElement - The root Element of configuration.homeDir - The home directory of fedora, used to interpret
relative paths used in configuration.
ServerInitializationException - If there was an error starting
the server.
ModuleInitializationException - If there was an error starting
a module.| Method Detail |
|---|
protected boolean overrideModuleRole(java.lang.String moduleRole)
protected java.lang.String overrideModuleClass(java.lang.String moduleClass)
protected static void configureLog4J(java.lang.String extension)
throws ServerInitializationException
ServerInitializationExceptionpublic final boolean hasInitialized()
Modules that need to wait
until all initialization has occurred before doing something.
public ServerStatusFile getStatusFile()
public static final boolean hasInstance(java.io.File homeDir)
public final java.lang.String status(Context context)
throws AuthzException
AuthzException
public static final Server getInstance(java.io.File homeDir,
boolean okToStart)
throws ServerInitializationException,
ModuleInitializationException
ServerInitializationException
ModuleInitializationException
public static final Server getInstance(java.io.File homeDir)
throws ServerInitializationException,
ModuleInitializationException
homeDir - The base directory for the server.
ServerInitializationException - If there was an error starting
the server.
ModuleInitializationException - If there was an error starting
a module.public final java.io.File getHomeDir()
public final Module getModule(java.lang.String role)
Module.
role - The role of the Module to get.
Module, null if not found.public final DatastoreConfig getDatastoreConfig(java.lang.String id)
DatastoreConfig.
id - The id as given in the server configuration.
DatastoreConfig, null if not found.public java.util.Iterator datastoreConfigIds()
public final java.util.Iterator loadedModuleRoles()
Iterator over the roles that have been loaded.
Strings) The roles.
protected void initServer()
throws ServerInitializationException
ServerInitializationException - If a severe server startup-related
error occurred.
protected void postInitServer()
throws ServerInitializationException
ServerInitializationException - If a severe server startup-related
error occurred.
public final void shutdown(Context context)
throws ServerShutdownException,
ModuleShutdownException,
AuthzException
Server instance,
if you know your program is the only client of the Server
in the VM instance, you should make an explicit call to this method
so that you can catch and handle its exceptions properly.
If you are usure or know that there may be at least one other client
of the Server in the VM instance, you should call
System.runFinalization() after ensuring you no longer
have a reference. In this case, if there is no other reference
to the object in the VM, finalization will be called (but you will
be unable to catch ShutdownException variants, if thrown).
Right before this is finished, the instance is removed from the server
instances map.
ServerShutdownException - If a severe server shutdown-related error
occurred. USER_REPRESENTED = addName(new XacmlName(this, "subjectRepresented"));
ModuleShutdownException - If a severe module shutdown-related error
occurred.
AuthzException
protected void shutdownServer()
throws ServerShutdownException
ServerShutdownException after
attempts to free every resource have been made.
ServerShutdownException - If a severe server shutdown-related error
occurred.
public final void finalize()
throws ServerShutdownException,
ModuleShutdownException
shutdown() when finalization occurs.
finalize in class java.lang.ObjectServerShutdownException - If a severe server shutdown-related error
occurred.
ModuleShutdownException - If a severe module shutdown-related error
occurred.public static final java.util.Locale getLocale()
public java.lang.String getConfigSummary()
public static PID getPID(java.lang.String pidString)
throws MalformedPidException
MalformedPidException
public static PID pidFromFilename(java.lang.String filename)
throws MalformedPidException
MalformedPidException
public static java.util.Date getCurrentDate(Context context)
throws GeneralException
GeneralException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||