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

Title: JournalConsumer.java

Description: 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 5508 2007-01-17 07:03:16 +0000 (Wed, 17 Jan 2007) cwilper $
Author:
jblake@cs.cornell.edu

Constructor Summary
JournalConsumer(java.util.Map<java.lang.String,java.lang.String> 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.
 java.lang.String addDisseminator(Context context, java.lang.String pid, java.lang.String bDefPID, java.lang.String bMechPid, java.lang.String dissLabel, DSBindingMap bindingMap, java.lang.String dissState, java.lang.String logMessage)
          Reject API calls from outside while we are in recovery mode.
 boolean adminPing(Context context)
          Read-only method: pass the call to the ManagementDelegate.
 java.lang.String compareDatastreamChecksum(Context context, java.lang.String pid, java.lang.String dsID, java.util.Date versionDate)
          Read-only method: pass the call to the ManagementDelegate.
 java.io.InputStream exportObject(Context context, java.lang.String pid, java.lang.String format, java.lang.String exportContext, java.lang.String encoding)
          Read-only method: pass the call to the ManagementDelegate.
 Datastream getDatastream(Context context, java.lang.String pid, java.lang.String datastreamID, java.util.Date asOfDateTime)
          Read-only method: pass the call to the ManagementDelegate.
 Datastream[] getDatastreamHistory(Context context, java.lang.String pid, java.lang.String datastreamID)
          Read-only method: pass the call to the ManagementDelegate.
 Datastream[] getDatastreams(Context context, java.lang.String pid, java.util.Date asOfDateTime, java.lang.String dsState)
          Read-only method: pass the call to the ManagementDelegate.
 Disseminator getDisseminator(Context context, java.lang.String pid, java.lang.String disseminatorID, java.util.Date asOfDateTime)
          Read-only method: pass the call to the ManagementDelegate.
 Disseminator[] getDisseminatorHistory(Context context, java.lang.String pid, java.lang.String disseminatorID)
          Read-only method: pass the call to the ManagementDelegate.
 Disseminator[] getDisseminators(Context context, java.lang.String pid, java.util.Date asOfDateTime, java.lang.String dissState)
          Read-only method: pass the call to the ManagementDelegate.
 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)
          Read-only method: pass the call to the ManagementDelegate.
 java.io.InputStream getObjectXML(Context context, java.lang.String pid, java.lang.String encoding)
          Read-only method: pass the call to the ManagementDelegate.
 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 modifyDisseminator(Context context, java.lang.String pid, java.lang.String disseminatorID, java.lang.String bMechPid, java.lang.String dissLabel, DSBindingMap bindingMap, java.lang.String dissState, 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[] purgeDisseminator(Context context, java.lang.String pid, java.lang.String disseminatorID, java.util.Date endDT, java.lang.String logMessage)
          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.
 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<java.lang.String,java.lang.String> 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

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

addDisseminator

public java.lang.String addDisseminator(Context context,
                                        java.lang.String pid,
                                        java.lang.String bDefPID,
                                        java.lang.String bMechPid,
                                        java.lang.String dissLabel,
                                        DSBindingMap bindingMap,
                                        java.lang.String dissState,
                                        java.lang.String logMessage)
                                 throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
addDisseminator in interface Management
Throws:
ServerException

modifyDisseminator

public java.util.Date modifyDisseminator(Context context,
                                         java.lang.String pid,
                                         java.lang.String disseminatorID,
                                         java.lang.String bMechPid,
                                         java.lang.String dissLabel,
                                         DSBindingMap bindingMap,
                                         java.lang.String dissState,
                                         java.lang.String logMessage,
                                         boolean force)
                                  throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
modifyDisseminator in interface Management
Throws:
ServerException

purgeDisseminator

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

Specified by:
purgeDisseminator 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

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

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.

Specified by:
setDisseminatorState in interface Management
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

compareDatastreamChecksum

public java.lang.String compareDatastreamChecksum(Context context,
                                                  java.lang.String pid,
                                                  java.lang.String dsID,
                                                  java.util.Date versionDate)
                                           throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
compareDatastreamChecksum in interface Management
Throws:
ServerException

getObjectProperties

public Property[] getObjectProperties(Context context,
                                      java.lang.String pid)
                               throws ServerException
Read-only method: pass the call to the ManagementDelegate.

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
Read-only method: pass the call to the ManagementDelegate.

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
Read-only method: pass the call to the ManagementDelegate.

Specified by:
exportObject 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
Read-only method: pass the call to the ManagementDelegate.

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
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getDatastreams in interface Management
Throws:
ServerException

getDatastreamHistory

public Datastream[] getDatastreamHistory(Context context,
                                         java.lang.String pid,
                                         java.lang.String datastreamID)
                                  throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getDatastreamHistory in interface Management
Throws:
ServerException

getDisseminator

public Disseminator getDisseminator(Context context,
                                    java.lang.String pid,
                                    java.lang.String disseminatorID,
                                    java.util.Date asOfDateTime)
                             throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getDisseminator in interface Management
Throws:
ServerException

getDisseminators

public Disseminator[] getDisseminators(Context context,
                                       java.lang.String pid,
                                       java.util.Date asOfDateTime,
                                       java.lang.String dissState)
                                throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getDisseminators in interface Management
Throws:
ServerException

getDisseminatorHistory

public Disseminator[] getDisseminatorHistory(Context context,
                                             java.lang.String pid,
                                             java.lang.String disseminatorID)
                                      throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getDisseminatorHistory in interface Management
Throws:
ServerException

adminPing

public boolean adminPing(Context context)
                  throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
adminPing 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