org.fcrepo.server.journal
Class JournalConsumer

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

public class JournalConsumer
extends 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.

Author:
Jim Blake

Constructor Summary
JournalConsumer(Map<String,String> parameters, 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 logger.
 
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)
          Reject API calls from outside while we are in recovery mode.
 boolean addRelationship(Context context, String pid, String relationship, String objURI, boolean isLiteral, String datatype)
          Reject API calls from outside while we are in recovery mode.
 String compareDatastreamChecksum(Context context, String pid, String dsID, Date versionDate)
          Read-only method: pass the call to the ManagementDelegate.
 InputStream export(Context context, String pid, String format, String exportContext, String encoding)
          Read-only method: pass the call to the ManagementDelegate.
 Datastream getDatastream(Context context, String pid, String datastreamID, Date asOfDateTime)
          Read-only method: pass the call to the ManagementDelegate.
 Datastream[] getDatastreamHistory(Context context, String pid, String datastreamID)
          Read-only method: pass the call to the ManagementDelegate.
 Datastream[] getDatastreams(Context context, String pid, Date asOfDateTime, String dsState)
          Read-only method: pass the call to the ManagementDelegate.
 String[] getNextPID(Context context, int numPIDs, String namespace)
          Reject API calls from outside while we are in recovery mode.
 InputStream getObjectXML(Context context, String pid, String encoding)
          Read-only method: pass the call to the ManagementDelegate.
 RelationshipTuple[] getRelationships(Context context, String pid, String relationship)
          Read-only method: pass the call to the ManagementDelegate.
 InputStream getTempStream(String id)
          Delegate to the ManagementDelegate.
 String ingest(Context context, InputStream serialization, String logMessage, String format, String encoding, String pid)
          Reject API calls from outside while we are in recovery 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)
          Reject API calls from outside while we are in recovery mode.
 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)
          Reject API calls from outside while we are in recovery mode.
 Date modifyObject(Context context, String pid, String state, String label, String ownerId, String logMessage, Date lastModifiedDate)
          Reject API calls from outside while we are in recovery mode.
 Date[] purgeDatastream(Context context, String pid, String datastreamID, Date startDT, Date endDT, String logMessage)
          Reject API calls from outside while we are in recovery mode.
 Date purgeObject(Context context, String pid, String logMessage)
          Reject API calls from outside while we are in recovery mode.
 boolean purgeRelationship(Context context, String pid, String relationship, String objURI, boolean isLiteral, String datatype)
          Reject API calls from outside while we are in recovery mode.
 String putTempStream(Context context, InputStream in)
          Reject API calls from outside while we are in recovery mode.
 Date setDatastreamState(Context context, String pid, String dsID, String dsState, String logMessage)
          Reject API calls from outside while we are in recovery mode.
 Date setDatastreamVersionable(Context context, String pid, String dsID, boolean versionable, String logMessage)
          Reject API calls from outside while we are in recovery mode.
 Date setDisseminatorState(Context context, String pid, String dsID, String dsState, 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.
 Validation validate(Context context, String pid, Date asOfDateTime)
          Reject API calls from outside while we are in recovery mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JournalConsumer

public JournalConsumer(Map<String,String> parameters,
                       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 logger.

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

ingest

public String ingest(Context context,
                     InputStream serialization,
                     String logMessage,
                     String format,
                     String encoding,
                     String pid)
              throws ServerException
Reject API calls from outside while we are in recovery mode.

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
Reject API calls from outside while we are in recovery mode.

Specified by:
modifyObject in interface Management
Throws:
ServerException

purgeObject

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

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
Reject API calls from outside while we are in recovery mode.

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
Reject API calls from outside while we are in recovery mode.

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
Reject API calls from outside while we are in recovery mode.

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
Reject API calls from outside while we are in recovery mode.

Specified by:
purgeDatastream in interface Management
Throws:
ServerException

putTempStream

public String putTempStream(Context context,
                            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 Date setDatastreamState(Context context,
                               String pid,
                               String dsID,
                               String dsState,
                               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 Date setDatastreamVersionable(Context context,
                                     String pid,
                                     String dsID,
                                     boolean versionable,
                                     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 Date setDisseminatorState(Context context,
                                 String pid,
                                 String dsID,
                                 String dsState,
                                 String logMessage)
                          throws ServerException
Reject API calls from outside while we are in recovery mode.

Throws:
ServerException

getNextPID

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

Specified by:
getNextPID in interface Management
Throws:
ServerException

addRelationship

public boolean addRelationship(Context context,
                               String pid,
                               String relationship,
                               String objURI,
                               boolean isLiteral,
                               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,
                                 String pid,
                                 String relationship,
                                 String objURI,
                                 boolean isLiteral,
                                 String datatype)
                          throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
purgeRelationship in interface Management
Throws:
ServerException

validate

public Validation validate(Context context,
                           String pid,
                           Date asOfDateTime)
                    throws ServerException
Reject API calls from outside while we are in recovery mode.

Specified by:
validate in interface Management
Throws:
ServerException

compareDatastreamChecksum

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

Specified by:
compareDatastreamChecksum in interface Management
Throws:
ServerException

export

public InputStream export(Context context,
                          String pid,
                          String format,
                          String exportContext,
                          String encoding)
                   throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
export in interface Management
Throws:
ServerException

getObjectXML

public InputStream getObjectXML(Context context,
                                String pid,
                                String encoding)
                         throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getObjectXML in interface Management
Throws:
ServerException

getDatastream

public Datastream getDatastream(Context context,
                                String pid,
                                String datastreamID,
                                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,
                                   String pid,
                                   Date asOfDateTime,
                                   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,
                                         String pid,
                                         String datastreamID)
                                  throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getDatastreamHistory in interface Management
Throws:
ServerException

getRelationships

public RelationshipTuple[] getRelationships(Context context,
                                            String pid,
                                            String relationship)
                                     throws ServerException
Read-only method: pass the call to the ManagementDelegate.

Specified by:
getRelationships in interface Management
Throws:
ServerException

getTempStream

public InputStream getTempStream(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


Copyright © 2011 DuraSpace. All Rights Reserved.