|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventstore.fs.SimpleEventFileResolver
public class SimpleEventFileResolver
Very straightforward implementation of the EventFileResolver that stores files in a directory structure underneath a given base directory. Events of a single aggregate are appended to a pair of files, one for regular events and one for snapshot events. Directories are used to separate files for different aggregate types.
Field Summary | |
---|---|
static String |
FILE_EXTENSION_EVENTS
Describes the file extension used for files containing domain events. |
static String |
FILE_EXTENSION_SNAPSHOTS
Describes the file extension used for files containing snapshot events. |
Constructor Summary | |
---|---|
SimpleEventFileResolver(File baseDir)
Initialize the SimpleEventFileResolver with the given baseDir . |
Method Summary | |
---|---|
boolean |
eventFileExists(String type,
Object identifier)
Indicates whether there is a file containing (regular) events for the given aggregateIdentifier of
given type . |
InputStream |
openEventFileForReading(String type,
Object identifier)
Provides an input stream to the (regular) events file for the aggregate with the given aggregateIdentifier and of given type . |
OutputStream |
openEventFileForWriting(String type,
Object aggregateIdentifier)
Provides an output stream to the (regular) events file for the aggregate with the given aggregateIdentifier and of given type . |
InputStream |
openSnapshotFileForReading(String type,
Object identifier)
Provides an input stream to the snapshot events file for the aggregate with the given aggregateIdentifier and of given type . |
OutputStream |
openSnapshotFileForWriting(String type,
Object aggregateIdentifier)
Provides an output stream to the snapshot events file for the aggregate with the given aggregateIdentifier and of given type . |
boolean |
snapshotFileExists(String type,
Object identifier)
Indicates whether there is a file containing snapshot events for the given aggregateIdentifier of
given type . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String FILE_EXTENSION_EVENTS
public static final String FILE_EXTENSION_SNAPSHOTS
Constructor Detail |
---|
public SimpleEventFileResolver(File baseDir)
baseDir
.
Note that the resource supplied must point to a folder and should contain a trailing slash. See org.springframework.core.io.FileSystemResource#FileSystemResource(String)
.
baseDir
- The directory where event files are stored.Method Detail |
---|
public OutputStream openEventFileForWriting(String type, Object aggregateIdentifier) throws IOException
EventFileResolver
aggregateIdentifier
and of given type
. Written bytes are appended to already existing
information.
The caller of this method is responsible for closing the output stream when all data has been written to it.
openEventFileForWriting
in interface EventFileResolver
type
- The type of aggregate to open the stream foraggregateIdentifier
- the identifier of the aggregate
IOException
- when an error occurs while opening a filepublic OutputStream openSnapshotFileForWriting(String type, Object aggregateIdentifier) throws IOException
EventFileResolver
aggregateIdentifier
and of given type
. Written bytes are appended to already existing
information.
The caller of this method is responsible for closing the output stream when all data has been written to it.
openSnapshotFileForWriting
in interface EventFileResolver
type
- The type of aggregate to open the stream foraggregateIdentifier
- the identifier of the aggregate
IOException
- when an error occurs while opening a filepublic InputStream openEventFileForReading(String type, Object identifier) throws IOException
EventFileResolver
aggregateIdentifier
and of given type
.
The caller of this method is responsible for closing the input stream when done reading from it.
openEventFileForReading
in interface EventFileResolver
type
- The type of aggregate to open the stream foridentifier
- the identifier of the aggregate
IOException
- when an error occurs while opening a filepublic InputStream openSnapshotFileForReading(String type, Object identifier) throws IOException
EventFileResolver
aggregateIdentifier
and of given type
.
The caller of this method is responsible for closing the input stream when done reading from it.
openSnapshotFileForReading
in interface EventFileResolver
type
- The type of aggregate to open the stream foridentifier
- the identifier of the aggregate
IOException
- when an error occurs while opening a filepublic boolean eventFileExists(String type, Object identifier) throws IOException
EventFileResolver
aggregateIdentifier
of
given type
.
eventFileExists
in interface EventFileResolver
type
- The type of aggregateidentifier
- the identifier of the aggregate
true
if an event log exists for the aggregate, false
otherwise.
IOException
- when an error occurs while reading from the FileSystem. The existence of the event file is
undetermined.public boolean snapshotFileExists(String type, Object identifier) throws IOException
EventFileResolver
aggregateIdentifier
of
given type
.
snapshotFileExists
in interface EventFileResolver
type
- The type of aggregateidentifier
- the identifier of the aggregate
true
if a snapshot event log exists for the aggregate, false
otherwise.
IOException
- when an error occurs while reading from the FileSystem. The existence of the event file is
undetermined.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |