org.modeshape.jcr.journal

## Class LocalJournal

- java.lang.Object
- - org.modeshape.jcr.journal.LocalJournal

- All Implemented Interfaces:
    ChangeSetListener, ChangeJournal

      @ThreadSafe
      public class LocalJournal
      extends Object
      implements ChangeJournal

  An append only journal implementation which stores each `ChangeSet` (either local or remove) on the local FS.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.modeshape.jcr.journal.ChangeJournal

      `ChangeJournal.Records`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `LocalJournal(String journalLocation)`
    `` | `LocalJournal(String journalLocation, boolean asyncWritesEnabled, int maxDaysToKeepEntries)` Creates a new journal instance, in stopped state.

  - ### 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
    `protected String` | `getJournalLocation()`
    `String` | `journalId()` Returns the id of this change journal.
    `JournalRecord` | `lastRecord()` Returns the last record from the journal.
    `void` | `notify(ChangeSet changeSet)` Notifies a listener of the given changes.
    `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.
    `protected void` | `removeRecordsOlderThan(long millisInUtc)`
    `void` | `shutdown()` Stops the journal.
    `void` | `start()` Starts this journal instance.
    `protected LocalJournal` | `withSearchTimeDelta(long searchTimeDelta)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalJournal

          public LocalJournal(String journalLocation,
                      boolean asyncWritesEnabled,
                      int maxDaysToKeepEntries)

      Creates a new journal instance, in stopped state.
      Parameters:
        `journalLocation` - the folder location on the FS where the entries should be saved. Must not be `null`
        `asyncWritesEnabled` - flag which indicates if disk write should be asynchronous or not.
        `maxDaysToKeepEntries` - the maximum number of days this journal should store entries on disk. A negative value or 0

    - #### LocalJournal

          protected LocalJournal(String journalLocation)

  - ### Method Detail

    - #### start

          public void start()
                     throws RepositoryException

      Description copied from interface: `ChangeJournal`
      Starts this journal instance.
      Specified by:
        `start` in interface `ChangeJournal`
      Throws:
        `RepositoryException`

    - #### shutdown

          public void shutdown()

      Description copied from interface: `ChangeJournal`
      Stops the journal.
      Specified by:
        `shutdown` in interface `ChangeJournal`

    - #### notify

          public void notify(ChangeSet changeSet)

      Description copied from interface: `ChangeSetListener`
      Notifies a listener of the given changes.
      Specified by:
        `notify` in interface `ChangeSetListener`
      Parameters:
        `changeSet` - a `non-null` `ChangeSet`

    - #### addRecords

          public void addRecords(JournalRecord... records)

      Description copied from interface: `ChangeJournal`
      Adds one or more journal records to a journal.
      Specified by:
        `addRecords` in interface `ChangeJournal`
      Parameters:
        `records` - a `JournalRecord` array.

    - #### removeOldRecords

          public void removeOldRecords()

      Description copied from interface: `ChangeJournal`
      Removes older entries. Each journal is free to decide the semantics behind "old".
      Specified by:
        `removeOldRecords` in interface `ChangeJournal`

    - #### removeRecordsOlderThan

          protected void removeRecordsOlderThan(long millisInUtc)

    - #### getJournalLocation

          protected String getJournalLocation()

    - #### allRecords

          public ChangeJournal.Records allRecords(boolean descendingOrder)

      Description copied from interface: `ChangeJournal`
      Returns all the records this journal holds
      Specified by:
        `allRecords` in interface `ChangeJournal`
      Parameters:
        `descendingOrder` - flag which indicates whether the entries
      Returns:
        a `ChangeJournal.Records` instance

    - #### lastRecord

          public JournalRecord lastRecord()

      Description copied from interface: `ChangeJournal`
      Returns the last record from the journal.
      Specified by:
        `lastRecord` in interface `ChangeJournal`
      Returns:
        either a `JournalRecord` instance or `null` if the journal is empty.

    - #### recordsNewerThan

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

      Description copied from interface: `ChangeJournal`
      Returns all records that have changesets which are newer than a given timestamp.
      Specified by:
        `recordsNewerThan` in interface `ChangeJournal`
      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`

    - #### journalId

          public String journalId()

      Description copied from interface: `ChangeJournal`
      Returns the id of this change journal.
      Specified by:
        `journalId` in interface `ChangeJournal`
      Returns:
        a `String`, never `null`

    - #### withSearchTimeDelta

          protected LocalJournal withSearchTimeDelta(long searchTimeDelta)

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