|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fcrepo.server.journal.readerwriter.multicast.Transport
public abstract class Transport
Transport.java
The abstract superclass of Journal Transport objects. It enforces the constructors of subclasses, by requiring parent, server, etc.
Sub-classes must implement the four life-cycle methods:
openFile,
getWriter, closeFile, and
shutdown. Each of these should call
testStateChange before operating, in case the
Transport is in an invalid state for that operation. The exception is
getWriter, which does not change the Transport state,
and should call testWriterState instead.
| Nested Class Summary | |
|---|---|
static class |
Transport.State
The states of in the life-cycle of a Transport. |
| Field Summary | |
|---|---|
protected boolean |
crucial
If this transport throws an Exception, is it a crucial problem? |
protected Map<String,String> |
parameters
The parameters that were passed to this Transport for its use. |
protected TransportParent |
parent
The parent can format a file header or footer. |
| Constructor Summary | |
|---|---|
Transport(Map<String,String> parameters,
boolean crucial,
TransportParent parent)
|
|
| Method Summary | |
|---|---|
abstract void |
closeFile()
Subclasses should implement this to close a logical journal file. |
Transport.State |
getState()
|
abstract XMLEventWriter |
getWriter()
Subclasses should implement this to provite an XMLEventWriter for
the JournalWriter to write to. |
boolean |
isCrucial()
|
abstract void |
openFile(String repositoryHash,
String filename,
Date currentDate)
Subclasses should implement this to create a new logical journal file. |
void |
setState(Transport.State newState)
Subclasses should call this to change the current state, after the operation has been performed. |
abstract void |
shutdown()
Subclasses should implement this to close any resources associated with the Transport (unless it is already shut down). |
void |
testStateChange(Transport.State desiredState)
Subclasses should call this before attempting an operation that will change the current state, so if the change is not permitted, it will not be performed. |
protected void |
testWriterState()
Subclasses should call this before executing a getWriter request. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Map<String,String> parameters
protected final boolean crucial
protected final TransportParent parent
| Constructor Detail |
|---|
public Transport(Map<String,String> parameters,
boolean crucial,
TransportParent parent)
throws JournalException
JournalException| Method Detail |
|---|
public boolean isCrucial()
public void testStateChange(Transport.State desiredState)
throws JournalException
Subclasses should call this before attempting an operation that will change the current state, so if the change is not permitted, it will not be performed.
Note that a redundant call to Shutdown is not considered an error.
JournalException
protected void testWriterState()
throws JournalException
getWriter request. This insures that the Transport
is in the proper state.
JournalException
public void setState(Transport.State newState)
throws JournalException
JournalExceptionpublic Transport.State getState()
public abstract void openFile(String repositoryHash,
String filename,
Date currentDate)
throws JournalException
testStateChange before performing
the operation, and call
TransportParent.writeDocumentHeader(XMLEventWriter, String, Date)
to do the formatting.
JournalException
public abstract XMLEventWriter getWriter()
throws JournalException
XMLEventWriter for
the JournalWriter to write to. Check testWriterState() before
performing the operation.
JournalException
public abstract void closeFile()
throws JournalException
testStateChange before performing the
operation, and call
TransportParent.writeDocumentTrailer(XMLEventWriter) to do the
formatting.
JournalException
public abstract void shutdown()
throws JournalException
testStateChange before performing the
operation.
JournalException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||