org.modeshape.jcr.journal

## Interface ChangeJournal

- All Superinterfaces:
    ChangeSetListener
  All Known Implementing Classes:
    ClusteredJournal, LocalJournal

      public interface ChangeJournal
      extends ChangeSetListener

  An entity which records all changes which occur in a repository via `ChangeSet` instances.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `ChangeJournal.Records` An `Iterable` extension which provides information about the number of entries the underlying collection holds.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRecords(JournalRecord... records)` Adds one or more journal records to a journal.
    `ChangeJournal.Records` | `allRecords(boolean descendingOrder)` Returns all the records this journal holds
    `String` | `journalId()` Returns the id of this change journal.
    `JournalRecord` | `lastRecord()` Returns the last record from the journal.
    `ChangeJournal.Records` | `recordsNewerThan(org.joda.time.DateTime changeSetTime, boolean inclusive, boolean descendingOrder)` Returns all records that have changesets which are newer than a given timestamp.
    `void` | `removeOldRecords()` Removes older entries.
    `void` | `shutdown()` Stops the journal.
    `void` | `start()` Starts this journal instance.

    - ### Methods inherited from interface org.modeshape.jcr.cache.change.ChangeSetListener

      `notify`

- - ### Method Detail

    - #### start

          void start()
                     throws Exception

      Starts this journal instance.
      Throws:
        `Exception` - if anything fails during start

    - #### shutdown

          void shutdown()

      Stops the journal.

    - #### removeOldRecords

          void removeOldRecords()

      Removes older entries. Each journal is free to decide the semantics behind "old".

    - #### allRecords

          ChangeJournal.Records allRecords(boolean descendingOrder)

      Returns all the records this journal holds
      Parameters:
        `descendingOrder` - flag which indicates whether the entries
      Returns:
        a `ChangeJournal.Records` instance

    - #### lastRecord

          JournalRecord lastRecord()

      Returns the last record from the journal.
      Returns:
        either a `JournalRecord` instance or `null` if the journal is empty.

    - #### recordsNewerThan

          ChangeJournal.Records recordsNewerThan(org.joda.time.DateTime changeSetTime,
                                               boolean inclusive,
                                               boolean descendingOrder)

      Returns all records that have changesets which are newer than a given timestamp.
      Parameters:
        `changeSetTime` - the `DateTime` of the changes representing the lower bound; may be null indicating that *all the records* should be returned.
        `inclusive` - flag indicating whether the timestamp should be used inclusively or exclusively
        `descendingOrder` - flag indicating if the records should be returned in ascending order (oldest to newest) or descending order (newest to oldest)
      Returns:
        a `ChangeJournal.Records` instance; never `null`

    - #### addRecords

          void addRecords(JournalRecord... records)

      Adds one or more journal records to a journal.
      Parameters:
        `records` - a `JournalRecord` array.

    - #### journalId

          String journalId()

      Returns the id of this change journal.
      Returns:
        a `String`, never `null`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.