org.axonframework.eventstore.fs
Interface EventFileResolver

All Known Implementing Classes:
SimpleEventFileResolver

public interface EventFileResolver

Interface that allows basic access to InputStreams and appending OutputStreams to event logs for aggregates.

The streams provided by these methods should be closed by the caller when it has finished using them.

Since:
0.5
Author:
Allard Buijze

Method Summary
 boolean eventFileExists(String type, Object aggregateIdentifier)
          Indicates whether there is a file containing (regular) events for the given aggregateIdentifier of given type.
 InputStream openEventFileForReading(String type, Object aggregateIdentifier)
          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 aggregateIdentifier)
          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 aggregateIdentifier)
          Indicates whether there is a file containing snapshot events for the given aggregateIdentifier of given type.
 

Method Detail

openEventFileForWriting

OutputStream openEventFileForWriting(String type,
                                     Object aggregateIdentifier)
                                     throws IOException
Provides an output stream to the (regular) events file for the aggregate with the given 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.

Parameters:
type - The type of aggregate to open the stream for
aggregateIdentifier - the identifier of the aggregate
Returns:
an OutputStream that appends to the event log of of the given aggregate
Throws:
IOException - when an error occurs while opening a file

openSnapshotFileForWriting

OutputStream openSnapshotFileForWriting(String type,
                                        Object aggregateIdentifier)
                                        throws IOException
Provides an output stream to the snapshot events file for the aggregate with the given 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.

Parameters:
type - The type of aggregate to open the stream for
aggregateIdentifier - the identifier of the aggregate
Returns:
an OutputStream that appends to the snapshot event log of of the given aggregate
Throws:
IOException - when an error occurs while opening a file

openEventFileForReading

InputStream openEventFileForReading(String type,
                                    Object aggregateIdentifier)
                                    throws IOException
Provides an input stream to the (regular) events file for the aggregate with the given aggregateIdentifier and of given type.

The caller of this method is responsible for closing the input stream when done reading from it.

Parameters:
type - The type of aggregate to open the stream for
aggregateIdentifier - the identifier of the aggregate
Returns:
an InputStream that reads from the event log of of the given aggregate
Throws:
IOException - when an error occurs while opening a file

openSnapshotFileForReading

InputStream openSnapshotFileForReading(String type,
                                       Object aggregateIdentifier)
                                       throws IOException
Provides an input stream to the snapshot events file for the aggregate with the given aggregateIdentifier and of given type.

The caller of this method is responsible for closing the input stream when done reading from it.

Parameters:
type - The type of aggregate to open the stream for
aggregateIdentifier - the identifier of the aggregate
Returns:
an InputStream that reads from the snapshot event log of of the given aggregate
Throws:
IOException - when an error occurs while opening a file

eventFileExists

boolean eventFileExists(String type,
                        Object aggregateIdentifier)
                        throws IOException
Indicates whether there is a file containing (regular) events for the given aggregateIdentifier of given type.

Parameters:
type - The type of aggregate
aggregateIdentifier - the identifier of the aggregate
Returns:
true if an event log exists for the aggregate, false otherwise.
Throws:
IOException - when an error occurs while reading from the FileSystem. The existence of the event file is undetermined.

snapshotFileExists

boolean snapshotFileExists(String type,
                           Object aggregateIdentifier)
                           throws IOException
Indicates whether there is a file containing snapshot events for the given aggregateIdentifier of given type.

Parameters:
type - The type of aggregate
aggregateIdentifier - the identifier of the aggregate
Returns:
true if a snapshot event log exists for the aggregate, false otherwise.
Throws:
IOException - when an error occurs while reading from the FileSystem. The existence of the event file is undetermined.


Copyright © 2010-2016. All Rights Reserved.