Interface Journal
-
- All Known Implementing Classes:
AbstractJournal
,DatabaseJournal
,FileJournal
,JNDIDatabaseJournal
,MemoryJournal
,MSSqlDatabaseJournal
,OracleDatabaseJournal
public interface Journal
Generic journal interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close this journal.InstanceRevision
getInstanceRevision()
Gets the instance that manages the cluster node's local revision.RecordProducer
getProducer(String identifier)
Return the record producer for a given identifier.RecordIterator
getRecords()
Return an iterator over all available records in the journal.RecordIterator
getRecords(long startRevision)
Return an iterator over all records after the specified revision.void
init(String id, NamespaceResolver resolver)
Initialize journal.void
register(RecordConsumer consumer)
Register a record consumer.void
sync(boolean startup)
Synchronize contents from journal.boolean
unregister(RecordConsumer consumer)
Unregister a record processor.
-
-
-
Method Detail
-
init
void init(String id, NamespaceResolver resolver) throws JournalException
Initialize journal.- Parameters:
id
- id this journal should use to write its own recordsresolver
- resolver used when reading/writing records- Throws:
JournalException
- if an error occurs
-
register
void register(RecordConsumer consumer) throws JournalException
Register a record consumer.- Parameters:
consumer
- record consumer- Throws:
JournalException
- if an error occurs
-
unregister
boolean unregister(RecordConsumer consumer)
Unregister a record processor.- Parameters:
consumer
- record processor to unregister- Returns:
true
if the consumer was previously registered;false
otherwise
-
sync
void sync(boolean startup) throws JournalException
Synchronize contents from journal. This will compare the journal's revision with the revisions of all registered consumers and invoke theirRecordConsumer.consume(org.apache.jackrabbit.core.journal.Record)
method when their identifier matches the one found in the records. The startup flag allow for a separate treatment of the initial sync when the cluster nodes starts up. This might be needed for example when there are a lot of old revisions in a database.- Parameters:
startup
- indicates if the cluster node is syncing on startup or does a normal sync.- Throws:
JournalException
- if an error occurs
-
getProducer
RecordProducer getProducer(String identifier) throws JournalException
Return the record producer for a given identifier.- Parameters:
identifier
- identifier- Returns:
- the record producer for a given identifier.
- Throws:
JournalException
- if an error occurs
-
close
void close()
Close this journal. This should release any resources still held by this journal.
-
getInstanceRevision
InstanceRevision getInstanceRevision() throws JournalException
Gets the instance that manages the cluster node's local revision.- Returns:
- the InstanceRevision manager
- Throws:
JournalException
- on error
-
getRecords
RecordIterator getRecords(long startRevision) throws JournalException
Return an iterator over all records after the specified revision.- Parameters:
startRevision
- start point (exlusive)- Returns:
- an iterator over all records after the specified revision.
- Throws:
JournalException
- if an error occurs
-
getRecords
RecordIterator getRecords() throws JournalException
Return an iterator over all available records in the journal.- Returns:
- an iterator over all records.
- Throws:
JournalException
- if an error occurs
-
-