fedora.server.journal
Class JournalConsumer

java.lang.Object
  extended by fedora.server.journal.JournalConsumer
All Implemented Interfaces:
JournalWorker, Management

public class JournalConsumer
extends java.lang.Object
implements JournalWorker

The JournalWorker class to use in recovery mode or in* following mode.

Create a JournalConsumerThread to process the journal. If any calls to Management methods come in from outside, reject them.

Version:
$Id: JournalConsumer.java 6410 2007-12-14 19:51:22Z cwilper $
Author:
jblake@cs.cornell.edu

Constructor Summary
JournalConsumer(java.util.Map parameters, java.lang.String role, ServerInterface server)
          Get the appropriate JournalReader and JournalRecoveryLog, based on the server parameters, and create a JournalConsumerThread that will process the journal entries, using that reader and that log.
 
Method Summary
 java.lang.String addDatastream(Context context, java.lang.String pid, java.lang.String dsID, java.lang.String[] altIDs, java.lang.String dsLabel, boolean versionable, java.lang.String MIMEType, java.lang.String formatURI, java.lang.String location, java.lang.String controlGroup, java.lang.String dsState, java.lang.String checksumType, java.lang.String checksum, java.lang.String logMessage)
          Reject API calls from outside while we are in recovery mode.
 boolean addRelationship(Context context, java.lang.String pid, java.lang.String relationship, java.lang.String objURI, boolean isLiteral, java.lang.String datatype)
          Reject API calls from outside while we are in recovery mode.
 boolean adminPing(Context context)
          Reject API calls from outside while we are in recovery mode.
 java.lang.String compareDatastreamChecksum(Context context, java.lang.String pid, java.lang.String dsID, java.util.Date versionDate)
          Reject API calls from outside while we are in recovery mode.
 java.io.InputStream exportObject(Context context, java.lang.String pid, java.lang.String format, java.lang.String exportContext, java.lang.String encoding)
          Reject API calls from outside while we are in recovery mode.
 Datastream getDatastream(Context context, java.lang.String pid, java.lang.String datastreamID, java.util.Date asOfDateTime)
          Reject API calls from outside while we are in recovery mode.
 Datastream[] getDatastreamHistory(Context context, java.lang.String pid, java.lang.String datastreamID)
          Reject API calls from outside while we are in recovery mode.
 Datastream[] getDatastreams(Context context, java.lang.String pid, java.util.Date asOfDateTime, java.lang.String dsState)
          Reject API calls from outside while we are in recovery mode.
 java.lang.String[] getNextPID(Context context, int numPIDs, java.lang.String namespace)
          Reject API calls from outside while we are in recovery mode.
 Property[] getObjectProperties(Context context, java.lang.String pid)
          Reject API calls from outside while we are in recovery mode.
 java.io.InputStream getObjectXML(Context context, java.lang.String pid, java.lang.String encoding)
          Reject API calls from outside while we are in recovery mode.
 RelationshipTuple[] getRelationships(Context context, java.lang.String pid, java.lang.String relationship)
          Reject API calls from outside while we are in recovery mode.
 java.io.InputStream getTempStream(java.lang.String id)
          Delegate to the ManagementDelegate.
 java.lang.String ingestObject(Context context, java.io.InputStream serialization, java.lang.String logMessage, java.lang.String format, java.lang.String encoding, boolean newPid)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date modifyDatastreamByReference(Context context, java.lang.String pid, java.lang.String datastreamID, java.lang.String[] altIDs, java.lang.String dsLabel, java.lang.String mimeType, java.lang.String formatURI, java.lang.String dsLocation, java.lang.String checksumType, java.lang.String checksum, java.lang.String logMessage, boolean force)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date modifyDatastreamByValue(Context context, java.lang.String pid, java.lang.String datastreamID, java.lang.String[] altIDs, java.lang.String dsLabel, java.lang.String mimeType, java.lang.String formatURI, java.io.InputStream dsContent, java.lang.String checksumType, java.lang.String checksum, java.lang.String logMessage, boolean force)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date modifyObject(Context context, java.lang.String pid, java.lang.String state, java.lang.String label, java.lang.String ownerId, java.lang.String logMessage)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date[] purgeDatastream(Context context, java.lang.String pid, java.lang.String datastreamID, java.util.Date startDT, java.util.Date endDT, java.lang.String logMessage, boolean force)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date purgeObject(Context context, java.lang.String pid, java.lang.String logMessage, boolean force)
          Reject API calls from outside while we are in recovery mode.
 boolean purgeRelationship(Context context, java.lang.String pid, java.lang.String relationship, java.lang.String objURI, boolean isLiteral, java.lang.String datatype)
          Reject API calls from outside while we are in recovery mode.
 java.lang.String putTempStream(Context context, java.io.InputStream in)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date setDatastreamState(Context context, java.lang.String pid, java.lang.String dsID, java.lang.String dsState, java.lang.String logMessage)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date setDatastreamVersionable(Context context, java.lang.String pid, java.lang.String dsID, boolean versionable, java.lang.String logMessage)
          Reject API calls from outside while we are in recovery mode.
 java.util.Date setDisseminatorState(Context context, java.lang.String pid, java.lang.String dsID, java.lang.String dsState, java.lang.String logMessage)
          Reject API calls from outside while we are in recovery mode.
 void setManagementDelegate(ManagementDelegate delegate)
          Get the ManagementDelegate module and pass it to the JournalConsumerThread, so it can start working.
 void shutdown()
          Tell the thread, the reader and the log to shut down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JournalConsumer

public JournalConsumer(java.util.Map parameters,
                       java.lang.String role,
                       ServerInterface server)
                throws ModuleInitializationException
Get the appropriate JournalReader and JournalRecoveryLog, based on the server parameters, and create a JournalConsumerThread that will process the journal entries, using that reader and that log.

Throws:
ModuleInitializationException
Method Detail

setManagementDelegate

public void setManagementDelegate(ManagementDelegate delegate)
Get the ManagementDelegate module and pass it to the JournalConsumerThread, so it can start working.

Specified by:
setManagementDelegate in interface JournalWorker

shutdown

public void shutdown()
              throws ModuleShutdownException
Tell the thread, the reader and the log to shut down.

Specified by:
shutdown in interface JournalWorker
Throws:
ModuleShutdownException

ingestObject

public java.lang.String ingestObject(Context context,
                                     java.io.InputStream serialization,
                                     java.lang.String logMessage,
                                     java.lang.String format,
                                     java.lang.String encoding,
                                     boolean newPid)
                              throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
ingestObject in interface Management
Throws:
ServerException

modifyObject

public java.util.Date modifyObject(Context context,
                                   java.lang.String pid,
                                   java.lang.String state,
                                   java.lang.String label,
                                   java.lang.String ownerId,
                                   java.lang.String logMessage)
                            throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
modifyObject in interface Management
Throws:
ServerException

getObjectProperties

public Property[] getObjectProperties(Context context,
                                      java.lang.String pid)
                               throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
getObjectProperties in interface Management
Throws:
ServerException

getObjectXML

public java.io.InputStream getObjectXML(Context context,
                                        java.lang.String pid,
                                        java.lang.String encoding)
                                 throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
getObjectXML in interface Management
Throws:
ServerException

exportObject

public java.io.InputStream exportObject(Context context,
                                        java.lang.String pid,
                                        java.lang.String format,
                                        java.lang.String exportContext,
                                        java.lang.String encoding)
                                 throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
exportObject in interface Management
Throws:
ServerException

purgeObject

public java.util.Date purgeObject(Context context,
                                  java.lang.String pid,
                                  java.lang.String logMessage,
                                  boolean force)
                           throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
purgeObject in interface Management
Throws:
ServerException

addDatastream

public java.lang.String addDatastream(Context context,
                                      java.lang.String pid,
                                      java.lang.String dsID,
                                      java.lang.String[] altIDs,
                                      java.lang.String dsLabel,
                                      boolean versionable,
                                      java.lang.String MIMEType,
                                      java.lang.String formatURI,
                                      java.lang.String location,
                                      java.lang.String controlGroup,
                                      java.lang.String dsState,
                                      java.lang.String checksumType,
                                      java.lang.String checksum,
                                      java.lang.String logMessage)
                               throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
addDatastream in interface Management
Throws:
ServerException

modifyDatastreamByReference

public java.util.Date modifyDatastreamByReference(Context context,
                                                  java.lang.String pid,
                                                  java.lang.String datastreamID,
                                                  java.lang.String[] altIDs,
                                                  java.lang.String dsLabel,
                                                  java.lang.String mimeType,
                                                  java.lang.String formatURI,
                                                  java.lang.String dsLocation,
                                                  java.lang.String checksumType,
                                                  java.lang.String checksum,
                                                  java.lang.String logMessage,
                                                  boolean force)
                                           throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
modifyDatastreamByReference in interface Management
Throws:
ServerException

modifyDatastreamByValue

public java.util.Date modifyDatastreamByValue(Context context,
                                              java.lang.String pid,
                                              java.lang.String datastreamID,
                                              java.lang.String[] altIDs,
                                              java.lang.String dsLabel,
                                              java.lang.String mimeType,
                                              java.lang.String formatURI,
                                              java.io.InputStream dsContent,
                                              java.lang.String checksumType,
                                              java.lang.String checksum,
                                              java.lang.String logMessage,
                                              boolean force)
                                       throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
modifyDatastreamByValue in interface Management
Throws:
ServerException

purgeDatastream

public java.util.Date[] purgeDatastream(Context context,
                                        java.lang.String pid,
                                        java.lang.String datastreamID,
                                        java.util.Date startDT,
                                        java.util.Date endDT,
                                        java.lang.String logMessage,
                                        boolean force)
                                 throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
purgeDatastream in interface Management
Throws:
ServerException

getDatastream

public Datastream getDatastream(Context context,
                                java.lang.String pid,
                                java.lang.String datastreamID,
                                java.util.Date asOfDateTime)
                         throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
getDatastream in interface Management
Throws:
ServerException

getDatastreams

public Datastream[] getDatastreams(Context context,
                                   java.lang.String pid,
                                   java.util.Date asOfDateTime,
                                   java.lang.String dsState)
                            throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
getDatastreams in interface Management
Throws:
ServerException

getDatastreamHistory

public Datastream[] getDatastreamHistory(Context context,
                                         java.lang.String pid,
                                         java.lang.String datastreamID)
                                  throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
getDatastreamHistory in interface Management
Throws:
ServerException

putTempStream

public java.lang.String putTempStream(Context context,
                                      java.io.InputStream in)
                               throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
putTempStream in interface Management
Throws:
ServerException

getTempStream

public java.io.InputStream getTempStream(java.lang.String id)
                                  throws ServerException
Delegate to the ManagementDelegate. Note: Unlike other methods of the Management interface, this method is not exposed at the service level. Therefore, it is safe to forward the call to the delegate. It is also necessary because, in the course of fulfilling API-M requests that involve uploaded content, this method is invoked by internal server code.

Specified by:
getTempStream in interface Management
Throws:
ServerException

setDatastreamState

public java.util.Date setDatastreamState(Context context,
                                         java.lang.String pid,
                                         java.lang.String dsID,
                                         java.lang.String dsState,
                                         java.lang.String logMessage)
                                  throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
setDatastreamState in interface Management
Throws:
ServerException

setDatastreamVersionable

public java.util.Date setDatastreamVersionable(Context context,
                                               java.lang.String pid,
                                               java.lang.String dsID,
                                               boolean versionable,
                                               java.lang.String logMessage)
                                        throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
setDatastreamVersionable in interface Management
Throws:
ServerException

compareDatastreamChecksum

public java.lang.String compareDatastreamChecksum(Context context,
                                                  java.lang.String pid,
                                                  java.lang.String dsID,
                                                  java.util.Date versionDate)
                                           throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
compareDatastreamChecksum in interface Management
Throws:
ServerException

setDisseminatorState

public java.util.Date setDisseminatorState(Context context,
                                           java.lang.String pid,
                                           java.lang.String dsID,
                                           java.lang.String dsState,
                                           java.lang.String logMessage)
                                    throws ServerException
Reject API calls from outside while we are in recovery mode.

Throws:
ServerException

getNextPID

public java.lang.String[] getNextPID(Context context,
                                     int numPIDs,
                                     java.lang.String namespace)
                              throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
getNextPID in interface Management
Throws:
ServerException

adminPing

public boolean adminPing(Context context)
                  throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
adminPing in interface Management
Throws:
ServerException

getRelationships

public RelationshipTuple[] getRelationships(Context context,
                                            java.lang.String pid,
                                            java.lang.String relationship)
                                     throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
getRelationships in interface Management
Throws:
ServerException

addRelationship

public boolean addRelationship(Context context,
                               java.lang.String pid,
                               java.lang.String relationship,
                               java.lang.String objURI,
                               boolean isLiteral,
                               java.lang.String datatype)
                        throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
addRelationship in interface Management
Throws:
ServerException

purgeRelationship

public boolean purgeRelationship(Context context,
                                 java.lang.String pid,
                                 java.lang.String relationship,
                                 java.lang.String objURI,
                                 boolean isLiteral,
                                 java.lang.String datatype)
                          throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
purgeRelationship in interface Management
Throws:
ServerException