org.fcrepo.server.journal
Class Journaler

java.lang.Object
  extended by org.fcrepo.server.Parameterized
      extended by org.fcrepo.server.Pluggable
          extended by org.fcrepo.server.Module
              extended by org.fcrepo.server.journal.Journaler
All Implemented Interfaces:
Constants, JournalConstants, Management

public class Journaler
extends Module
implements Management, JournalConstants

A Management module that decorates a ManagementDelegate module with code that either creates a Journal or consumes a Journal, depending on the startup parameters.

Author:
Jim Blake

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.fcrepo.common.Constants
Constants.FedoraHome
 
Field Summary
 
Fields inherited from interface org.fcrepo.server.journal.JournalConstants
ARGUMENT_NAME_ALT_IDS, ARGUMENT_NAME_CHECKSUM, ARGUMENT_NAME_CHECKSUM_TYPE, ARGUMENT_NAME_CONTEXT, ARGUMENT_NAME_CONTROL_GROUP, ARGUMENT_NAME_DATATYPE, ARGUMENT_NAME_DISSEMINATOR_ID, ARGUMENT_NAME_DISSEMINATOR_LABEL, ARGUMENT_NAME_DISSEMINATOR_STATE, ARGUMENT_NAME_DS_CONTENT, ARGUMENT_NAME_DS_ID, ARGUMENT_NAME_DS_LABEL, ARGUMENT_NAME_DS_LOCATION, ARGUMENT_NAME_DS_STATE, ARGUMENT_NAME_ENCODING, ARGUMENT_NAME_END_DATE, ARGUMENT_NAME_FORCE, ARGUMENT_NAME_FORMAT, ARGUMENT_NAME_FORMAT_URI, ARGUMENT_NAME_IN, ARGUMENT_NAME_IS_LITERAL, ARGUMENT_NAME_LABEL, ARGUMENT_NAME_LAST_MODIFIED_DATE, ARGUMENT_NAME_LOCATION, ARGUMENT_NAME_LOG_MESSAGE, ARGUMENT_NAME_MIME_TYPE, ARGUMENT_NAME_NAMESPACE, ARGUMENT_NAME_NEW_PID, ARGUMENT_NAME_NUM_PIDS, ARGUMENT_NAME_OBJECT, ARGUMENT_NAME_OWNERID, ARGUMENT_NAME_PID, ARGUMENT_NAME_RELATIONSHIP, ARGUMENT_NAME_SERIALIZATION, ARGUMENT_NAME_START_DATE, ARGUMENT_NAME_STATE, ARGUMENT_NAME_VERSION_DATE, ARGUMENT_NAME_VERSIONABLE, ARGUMENT_TYPE_BINDING_MAP, ARGUMENT_TYPE_BOOLEAN, ARGUMENT_TYPE_DATE, ARGUMENT_TYPE_INTEGER, ARGUMENT_TYPE_NULL, ARGUMENT_TYPE_STREAM, ARGUMENT_TYPE_STRING, ARGUMENT_TYPE_STRINGARRAY, CONTEXT_MAPNAME_ACTION, CONTEXT_MAPNAME_ENVIRONMENT, CONTEXT_MAPNAME_RECOVERY, CONTEXT_MAPNAME_RESOURCE, CONTEXT_MAPNAME_SUBJECT, DEFAULT_AGE_LIMIT, DEFAULT_FILENAME_PREFIX, DEFAULT_SIZE_LIMIT, DOCUMENT_ENCODING, DOCUMENT_VERSION, FORMAT_JOURNAL_FILENAME_TIMESTAMP, METHOD_ADD_DATASTREAM, METHOD_ADD_DISSEMINATOR, METHOD_ADD_RELATIONSHIP, METHOD_GET_NEXT_PID, METHOD_INGEST, METHOD_MODIFY_DATASTREAM_BY_REFERENCE, METHOD_MODIFY_DATASTREAM_BY_VALUE, METHOD_MODIFY_DISSEMINATOR, METHOD_MODIFY_OBJECT, METHOD_PURGE_DATASTREAM, METHOD_PURGE_DISSEMINATOR, METHOD_PURGE_OBJECT, METHOD_PURGE_RELATIONSHIP, METHOD_PUT_TEMP_STREAM, METHOD_SET_DATASTREAM_STATE, METHOD_SET_DATASTREAM_VERSIONABLE, METHOD_SET_DISSEMINATOR_STATE, PARAMETER_IGNORE_HASH, PARAMETER_JOURNAL_FILE_AGE_LIMIT, PARAMETER_JOURNAL_FILE_SIZE_LIMIT, PARAMETER_JOURNAL_FILENAME_PREFIX, PARAMETER_JOURNAL_MODE, PARAMETER_JOURNAL_READER_CLASSNAME, PARAMETER_JOURNAL_RECOVERY_LOG_CLASSNAME, PARAMETER_JOURNAL_WRITER_CLASSNAME, PARAMETER_RECOVERY_LOG_FILENAME, PARAMETER_RECOVERY_LOG_LEVEL, PASSWORD_CIPHER_TYPE, QNAME_ATTR_BIND_KEY_NAME, QNAME_ATTR_BIND_LABEL, QNAME_ATTR_CLIENT_IP, QNAME_ATTR_DATASTREAM_ID, QNAME_ATTR_DS_BIND_MAP_ID, QNAME_ATTR_DS_BIND_MAP_LABEL, QNAME_ATTR_DS_BIND_MECHANISM_PID, QNAME_ATTR_LOGIN_ID, QNAME_ATTR_METHOD, QNAME_ATTR_NAME, QNAME_ATTR_PASSWORD_TYPE, QNAME_ATTR_REPOSITORY_HASH, QNAME_ATTR_SEQ_NO, QNAME_ATTR_STATE, QNAME_ATTR_TIMESTAMP, QNAME_ATTR_TYPE, QNAME_ATTR_USERID, QNAME_TAG_ARGUMENT, QNAME_TAG_ARRAYELEMENT, QNAME_TAG_CONTEXT, QNAME_TAG_DS_BINDING, QNAME_TAG_DS_BINDING_MAP, QNAME_TAG_JOURNAL, QNAME_TAG_JOURNAL_ENTRY, QNAME_TAG_MULTI_VALUE_MAP, QNAME_TAG_MULTI_VALUE_MAP_KEY, QNAME_TAG_MULTI_VALUE_MAP_VALUE, QNAME_TAG_NOOP, QNAME_TAG_NOW, QNAME_TAG_PASSWORD, SYSTEM_PROPERTY_PREFIX, TIMESTAMP_FORMAT, VALUE_FALSE, VALUE_JOURNAL_MODE_NORMAL, VALUE_JOURNAL_MODE_RECOVER, VALUE_RECOVERY_LOG_LEVEL_HIGH, VALUE_RECOVERY_LOG_LEVEL_LOW, VALUE_RECOVERY_LOG_LEVEL_MEDIUM, VALUE_TRUE
 
Fields inherited from interface org.fcrepo.common.Constants
ACCESS, ACTION, API, ATOM_APIM1_0, ATOM_ZIP1_1, ATOM1_1, AUDIT, AUDIT1_0, BATCH_MODIFY, BATCH_MODIFY1_1, BE_SECURITY, BE_SECURITY1_0, BINDING_SPEC, DATASTREAM, DC, DISSEMINATOR, DS_COMPOSITE_MODEL, DS_COMPOSITE_MODEL1_0, DS_INPUT_SPEC1_0, DS_INPUT_SPEC1_1, ENVIRONMENT, FCFG, FEDORA, FEDORA_APP_CONTEXT_NAME, FEDORA_DEFAULT_APP_CONTEXT, FEDORA_HOME, FOXML, FOXML1_0, FOXML1_0_LEGACY, FOXML1_1, HTTP_REQUEST, MANAGEMENT, METHOD_MAP, METS, METS_EXT, METS_EXT1_0, METS_EXT1_0_LEGACY, METS_EXT1_1, MODEL, MULGARA, OAI_DC, OAI_DC2_0, OAI_FRIENDS, OAI_FRIENDS2_0, OAI_IDENTIFIER, OAI_IDENTIFIER2_0, OAI_PMH, OAI_PMH2_0, OAI_PROV, OAI_PROV2_0, OBJ_DATASTREAMS1_0, OBJ_HISTORY1_0, OBJ_ITEMS1_0, OBJ_METHODS1_0, OBJ_PROFILE1_0, OBJ_VALIDATION1_0, OBJECT, OLD_XLINK, PID_LIST1_0, RDF, RDF_XSD, RECOVERY, RELS_EXT, RELS_EXT1_0, RELS_INT1_0, REPO_DESC1_0, RESOURCE, SDEF, SDEF_METHOD_MAP1_0, SDEP, SDEP_METHOD_MAP1_0, SDEP_METHOD_MAP1_1, SERVICE_PROFILE, SOAP, SOAP_ENC, SUBJECT, TYPES, VIEW, WSDL, WSDL_HTTP, WSDL_MIME, XACML_POLICY, XACML_POLICY1_0, XLINK, XML_XSD, XMLNS, XSI
 
Constructor Summary
Journaler(Map<String,String> moduleParameters, Server server, String role)
           
 
Method Summary
 String addDatastream(Context context, String pid, String dsID, String[] altIDs, String dsLabel, boolean versionable, String MIMEType, String formatURI, String location, String controlGroup, String dsState, String checksumType, String checksum, String logMessage)
          Delegate to the JournalWorker.
 boolean addRelationship(Context context, String pid, String relationship, String object, boolean isLiteral, String datatype)
          Delegate to the JournalWorker.
 String compareDatastreamChecksum(Context context, String pid, String dsID, Date versionDate)
          Delegate to the JournalWorker.
 InputStream export(Context context, String pid, String format, String exportContext, String encoding)
          Delegate to the JournalWorker.
 Datastream getDatastream(Context context, String pid, String datastreamID, Date asOfDateTime)
          Delegate to the JournalWorker.
 Datastream[] getDatastreamHistory(Context context, String pid, String datastreamID)
          Delegate to the JournalWorker.
 Datastream[] getDatastreams(Context context, String pid, Date asOfDateTime, String dsState)
          Delegate to the JournalWorker.
 String[] getNextPID(Context context, int numPIDs, String namespace)
          Delegate to the JournalWorker.
 InputStream getObjectXML(Context context, String pid, String encoding)
          Delegate to the JournalWorker.
 RelationshipTuple[] getRelationships(Context context, String pid, String relationship)
          Delegate to the JournalWorker.
 InputStream getTempStream(String id)
          Delegate to the JournalWorker.
 String ingest(Context context, InputStream serialization, String logMessage, String format, String encoding, String pid)
          Delegate to the JournalWorker.
 void initModule()
          Augment the parameters with values obtained from System Properties, and create the proper worker (JournalCreator or JournalConsumer) for the current mode.
 Date modifyDatastreamByReference(Context context, String pid, String datastreamID, String[] altIDs, String dsLabel, String mimeType, String formatURI, String dsLocation, String checksumType, String checksum, String logMessage, Date lastModifiedDate)
          Delegate to the JournalWorker.
 Date modifyDatastreamByValue(Context context, String pid, String datastreamID, String[] altIDs, String dsLabel, String mimeType, String formatURI, InputStream dsContent, String checksumType, String checksum, String logMessage, Date lastModifiedDate)
          Delegate to the JournalWorker.
 Date modifyObject(Context context, String pid, String state, String label, String ownerId, String logMessage, Date lastModifiedDate)
          Delegate to the JournalWorker.
 void postInitModule()
          Get the ManagementDelegate module and pass it to the worker.
 Date[] purgeDatastream(Context context, String pid, String datastreamID, Date startDT, Date endDT, String logMessage)
          Delegate to the JournalWorker.
 Date purgeObject(Context context, String pid, String logMessage)
          Delegate to the JournalWorker.
 boolean purgeRelationship(Context context, String pid, String relationship, String object, boolean isLiteral, String datatype)
          Delegate to the JournalWorker.
 String putTempStream(Context context, InputStream in)
          Delegate to the JournalWorker.
 Date setDatastreamState(Context context, String pid, String dsID, String dsState, String logMessage)
          Delegate to the JournalWorker.
 Date setDatastreamVersionable(Context context, String pid, String dsID, boolean versionable, String logMessage)
          Delegate to the JournalWorker.
 void shutdownModule()
          Tell the worker to shut down.
 Validation validate(Context context, String pid, Date asOfDateTime)
          Delegate to the JournalWorker.
 
Methods inherited from class org.fcrepo.server.Module
getRole, getServer
 
Methods inherited from class org.fcrepo.server.Pluggable
getHelp, getOptionalParameters, getParameterHelp, getRequiredModuleRoles, getRequiredParameters
 
Methods inherited from class org.fcrepo.server.Parameterized
getParameter, getParameter, getParameter, getParameterList, getParameters, getParameters, parameterNames, setParameter, setParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Journaler

public Journaler(Map<String,String> moduleParameters,
                 Server server,
                 String role)
          throws ModuleInitializationException
Throws:
ModuleInitializationException
Method Detail

initModule

public void initModule()
                throws ModuleInitializationException
Augment the parameters with values obtained from System Properties, and create the proper worker (JournalCreator or JournalConsumer) for the current mode.

Overrides:
initModule in class Module
Throws:
ModuleInitializationException - If initialization values are invalid or initialization fails for some other reason.

postInitModule

public void postInitModule()
                    throws ModuleInitializationException
Get the ManagementDelegate module and pass it to the worker.

Overrides:
postInitModule in class Module
Throws:
ModuleInitializationException - If initialization values are invalid or initialization fails for some other reason.

shutdownModule

public void shutdownModule()
                    throws ModuleShutdownException
Tell the worker to shut down.

Overrides:
shutdownModule in class 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.

ingest

public String ingest(Context context,
                     InputStream serialization,
                     String logMessage,
                     String format,
                     String encoding,
                     String pid)
              throws ServerException
Delegate to the JournalWorker.

Specified by:
ingest in interface Management
Throws:
ServerException

modifyObject

public Date modifyObject(Context context,
                         String pid,
                         String state,
                         String label,
                         String ownerId,
                         String logMessage,
                         Date lastModifiedDate)
                  throws ServerException
Delegate to the JournalWorker.

Specified by:
modifyObject in interface Management
Throws:
ServerException

getObjectXML

public InputStream getObjectXML(Context context,
                                String pid,
                                String encoding)
                         throws ServerException
Delegate to the JournalWorker.

Specified by:
getObjectXML in interface Management
Throws:
ServerException

export

public InputStream export(Context context,
                          String pid,
                          String format,
                          String exportContext,
                          String encoding)
                   throws ServerException
Delegate to the JournalWorker.

Specified by:
export in interface Management
Throws:
ServerException

purgeObject

public Date purgeObject(Context context,
                        String pid,
                        String logMessage)
                 throws ServerException
Delegate to the JournalWorker.

Specified by:
purgeObject in interface Management
Throws:
ServerException

addDatastream

public String addDatastream(Context context,
                            String pid,
                            String dsID,
                            String[] altIDs,
                            String dsLabel,
                            boolean versionable,
                            String MIMEType,
                            String formatURI,
                            String location,
                            String controlGroup,
                            String dsState,
                            String checksumType,
                            String checksum,
                            String logMessage)
                     throws ServerException
Delegate to the JournalWorker.

Specified by:
addDatastream in interface Management
Throws:
ServerException

modifyDatastreamByReference

public Date modifyDatastreamByReference(Context context,
                                        String pid,
                                        String datastreamID,
                                        String[] altIDs,
                                        String dsLabel,
                                        String mimeType,
                                        String formatURI,
                                        String dsLocation,
                                        String checksumType,
                                        String checksum,
                                        String logMessage,
                                        Date lastModifiedDate)
                                 throws ServerException
Delegate to the JournalWorker.

Specified by:
modifyDatastreamByReference in interface Management
Throws:
ServerException

modifyDatastreamByValue

public Date modifyDatastreamByValue(Context context,
                                    String pid,
                                    String datastreamID,
                                    String[] altIDs,
                                    String dsLabel,
                                    String mimeType,
                                    String formatURI,
                                    InputStream dsContent,
                                    String checksumType,
                                    String checksum,
                                    String logMessage,
                                    Date lastModifiedDate)
                             throws ServerException
Delegate to the JournalWorker.

Specified by:
modifyDatastreamByValue in interface Management
Throws:
ServerException

purgeDatastream

public Date[] purgeDatastream(Context context,
                              String pid,
                              String datastreamID,
                              Date startDT,
                              Date endDT,
                              String logMessage)
                       throws ServerException
Delegate to the JournalWorker.

Specified by:
purgeDatastream in interface Management
Throws:
ServerException

getDatastream

public Datastream getDatastream(Context context,
                                String pid,
                                String datastreamID,
                                Date asOfDateTime)
                         throws ServerException
Delegate to the JournalWorker.

Specified by:
getDatastream in interface Management
Throws:
ServerException

getDatastreams

public Datastream[] getDatastreams(Context context,
                                   String pid,
                                   Date asOfDateTime,
                                   String dsState)
                            throws ServerException
Delegate to the JournalWorker.

Specified by:
getDatastreams in interface Management
Throws:
ServerException

getDatastreamHistory

public Datastream[] getDatastreamHistory(Context context,
                                         String pid,
                                         String datastreamID)
                                  throws ServerException
Delegate to the JournalWorker.

Specified by:
getDatastreamHistory in interface Management
Throws:
ServerException

putTempStream

public String putTempStream(Context context,
                            InputStream in)
                     throws ServerException
Delegate to the JournalWorker.

Specified by:
putTempStream in interface Management
Throws:
ServerException

getTempStream

public InputStream getTempStream(String id)
                          throws ServerException
Delegate to the JournalWorker.

Specified by:
getTempStream in interface Management
Throws:
ServerException

setDatastreamState

public Date setDatastreamState(Context context,
                               String pid,
                               String dsID,
                               String dsState,
                               String logMessage)
                        throws ServerException
Delegate to the JournalWorker.

Specified by:
setDatastreamState in interface Management
Throws:
ServerException

setDatastreamVersionable

public Date setDatastreamVersionable(Context context,
                                     String pid,
                                     String dsID,
                                     boolean versionable,
                                     String logMessage)
                              throws ServerException
Delegate to the JournalWorker.

Specified by:
setDatastreamVersionable in interface Management
Throws:
ServerException

compareDatastreamChecksum

public String compareDatastreamChecksum(Context context,
                                        String pid,
                                        String dsID,
                                        Date versionDate)
                                 throws ServerException
Delegate to the JournalWorker.

Specified by:
compareDatastreamChecksum in interface Management
Throws:
ServerException

getNextPID

public String[] getNextPID(Context context,
                           int numPIDs,
                           String namespace)
                    throws ServerException
Delegate to the JournalWorker.

Specified by:
getNextPID in interface Management
Throws:
ServerException

getRelationships

public RelationshipTuple[] getRelationships(Context context,
                                            String pid,
                                            String relationship)
                                     throws ServerException
Delegate to the JournalWorker.

Specified by:
getRelationships in interface Management
Throws:
ServerException

addRelationship

public boolean addRelationship(Context context,
                               String pid,
                               String relationship,
                               String object,
                               boolean isLiteral,
                               String datatype)
                        throws ServerException
Delegate to the JournalWorker.

Specified by:
addRelationship in interface Management
Throws:
ServerException

purgeRelationship

public boolean purgeRelationship(Context context,
                                 String pid,
                                 String relationship,
                                 String object,
                                 boolean isLiteral,
                                 String datatype)
                          throws ServerException
Delegate to the JournalWorker.

Specified by:
purgeRelationship in interface Management
Throws:
ServerException

validate

public Validation validate(Context context,
                           String pid,
                           Date asOfDateTime)
                    throws ServerException
Delegate to the JournalWorker.

Specified by:
validate in interface Management
Throws:
ServerException


Copyright © 2012 DuraSpace. All Rights Reserved.