com.epam.fixengine.storage.file
Class FlatFileMessageStorage

java.lang.Object
  extended by com.epam.fixengine.storage.file.AbstractFileMessageStorage
      extended by com.epam.fixengine.storage.file.FlatFileMessageStorage
All Implemented Interfaces:
MessageStorage
Direct Known Subclasses:
IndexedMessageStorage, MMFMessageStorage, SlicedFileMessageStorage

public class FlatFileMessageStorage
extends AbstractFileMessageStorage

File message storage implementation.


Field Summary
protected  ByteBuffer buffer
           
protected  long channelLength
           
protected  long channelPosition
           
protected  byte[] dateFormattedBuffer
           
protected static long DELTA
           
protected  int maxBufferSize
           
protected  int maxStorageGrowSize
           
protected static byte[] NEW_LINE
           
protected  boolean storageGrowSize
           
protected  long timestamp
           
protected  boolean timestampsInLogs
           
protected static int WRITE_BUFFER_LENGTH_DEF
           
 
Fields inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
accessFile, calendar, channel, configuration
 
Constructor Summary
FlatFileMessageStorage()
          Deprecated. 
FlatFileMessageStorage(Configuration config)
           
 
Method Summary
 long appendMessageInternal(long timestamp, byte[] message, int offset, int length)
          Appends message to storage
protected  long getNextSequenceNumber()
          Gets next sequence number.
 boolean isEnabledTimestamp()
           
protected  void openStorageFile()
           
 void retrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking)
          The method retrieveMessages is not supported in this instance.
static long retrieveSequenceNumber(String fileName)
          Retrieves the last sequence number.
 
Methods inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
appendMessage, appendMessage, appendMessageInternal, backupFile, backupStorage, backupStorageFile, close, deleteFile, deleteStorageFile, getFile, getFormatLength, getPrefixFormat, initialize, initialized, isClosed, retrieveMessage, setBackupFileLocator, setFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELTA

protected static final long DELTA
See Also:
Constant Field Values

NEW_LINE

protected static final byte[] NEW_LINE

WRITE_BUFFER_LENGTH_DEF

protected static final int WRITE_BUFFER_LENGTH_DEF
See Also:
Constant Field Values

dateFormattedBuffer

protected byte[] dateFormattedBuffer

buffer

protected ByteBuffer buffer

maxBufferSize

protected int maxBufferSize

timestamp

protected long timestamp

timestampsInLogs

protected boolean timestampsInLogs

maxStorageGrowSize

protected int maxStorageGrowSize

storageGrowSize

protected boolean storageGrowSize

channelPosition

protected long channelPosition

channelLength

protected long channelLength
Constructor Detail

FlatFileMessageStorage

@Deprecated
public FlatFileMessageStorage()
Deprecated. 

Creates FlatFileMessageStorage.


FlatFileMessageStorage

public FlatFileMessageStorage(Configuration config)
Method Detail

openStorageFile

protected void openStorageFile()
                        throws IOException
Overrides:
openStorageFile in class AbstractFileMessageStorage
Throws:
IOException

retrieveMessages

public void retrieveMessages(long from,
                             long to,
                             MessageStorageListener listener,
                             boolean blocking)
                      throws IOException
The method retrieveMessages is not supported in this instance.

Specified by:
retrieveMessages in interface MessageStorage
Specified by:
retrieveMessages in class AbstractFileMessageStorage
Parameters:
from - the from sequence number
to - the to sequence number
listener - the callback listener
blocking - if parameter is true, the execution start in current
thread context, otherwise in the new thread context.
Throws:
UnsupportedOperationException
IOException - - if error occurred.
See Also:
AbstractFileMessageStorage.retrieveMessages(long, long, com.epam.fixengine.storage.MessageStorageListener, boolean)

getNextSequenceNumber

protected long getNextSequenceNumber()
                              throws IOException
Description copied from class: AbstractFileMessageStorage
Gets next sequence number.

Specified by:
getNextSequenceNumber in class AbstractFileMessageStorage
Throws:
IOException - - if I/O error occurred

appendMessageInternal

public long appendMessageInternal(long timestamp,
                                  byte[] message,
                                  int offset,
                                  int length)
                           throws IOException
Appends message to storage

Specified by:
appendMessageInternal in class AbstractFileMessageStorage
Parameters:
timestamp - the timestamp parameter
message - the array of bytes
offset -
length - @throws IOException - if I/O error occurred
Throws:
IOException

isEnabledTimestamp

public boolean isEnabledTimestamp()

retrieveSequenceNumber

public static long retrieveSequenceNumber(String fileName)
                                   throws IOException
Retrieves the last sequence number.

Parameters:
fileName - the file name
Throws:
IOException - - if I/O error occurred


Copyright © 2000-2014 EPAM Systems. All Rights Reserved.