com.epam.fixengine.storage.file
Class IndexedMessageStorage

java.lang.Object
  extended by com.epam.fixengine.storage.file.AbstractFileMessageStorage
      extended by com.epam.fixengine.storage.file.FlatFileMessageStorage
          extended by com.epam.fixengine.storage.file.IndexedMessageStorage
All Implemented Interfaces:
MessageStorage

public class IndexedMessageStorage
extends FlatFileMessageStorage

Indexed message storage implementation.

See Also:
FilesystemStorageFactory

Field Summary
static String DEFAULT_EXT
           
 
Fields inherited from class com.epam.fixengine.storage.file.FlatFileMessageStorage
buffer, channelLength, channelPosition, dateFormattedBuffer, DELTA, maxBufferSize, maxStorageGrowSize, NEW_LINE, storageGrowSize, timestamp, timestampsInLogs, WRITE_BUFFER_LENGTH_DEF
 
Fields inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
accessFile, calendar, channel, configuration
 
Constructor Summary
IndexedMessageStorage(Configuration config)
           
 
Method Summary
 long appendMessageInternal(long timestamp, byte[] message, int offset, int length)
          Appends message to storage
protected  long appendMessageToFile(long timestamp, byte[] message, int offset, int length)
           
protected  void backupStorageFile(String fullPathToStorageFile, String fullPathToDestinationBackupFile)
          Backups storage file.
 void close()
          Close the storage.
protected  void deleteStorageFile(String fullPathToStorageFile)
          Deletes storage file.
protected  int getFormatLength()
           
protected  long getNextSequenceNumber()
          Gets next sequence number.
protected  void openStorageFile()
          Opens the indexed file.
protected  byte[] readFromStorage(FileChannel readChannel, long readFrom, int msgLen)
           
 void retrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking)
          Retrieves message from storage.
 void setIndexFileExtension(String indexFileExtension)
          Deprecated. 
protected  void setPrefixFormat(String prefixFormat)
          Deprecated. 
 
Methods inherited from class com.epam.fixengine.storage.file.FlatFileMessageStorage
isEnabledTimestamp, retrieveSequenceNumber
 
Methods inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
appendMessage, appendMessage, appendMessageInternal, backupFile, backupStorage, deleteFile, getFile, 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

DEFAULT_EXT

public static final String DEFAULT_EXT
See Also:
Constant Field Values
Constructor Detail

IndexedMessageStorage

public IndexedMessageStorage(Configuration config)
Method Detail

setIndexFileExtension

@Deprecated
public void setIndexFileExtension(String indexFileExtension)
Deprecated. 


setPrefixFormat

@Deprecated
protected void setPrefixFormat(String prefixFormat)
Deprecated. 


getFormatLength

protected int getFormatLength()
Overrides:
getFormatLength in class AbstractFileMessageStorage

retrieveMessages

public void retrieveMessages(long from,
                             long to,
                             MessageStorageListener listener,
                             boolean blocking)
                      throws IOException
Retrieves message from storage.

Specified by:
retrieveMessages in interface MessageStorage
Overrides:
retrieveMessages in class FlatFileMessageStorage
Parameters:
from - the start sequence position
to - the end sequence position
listener - the callback listener
blocking - if sets to true the method call not blocking
Throws:
IOException, - IllegalArgumentException
IOException - - if error occurred.
See Also:
FlatFileMessageStorage

readFromStorage

protected byte[] readFromStorage(FileChannel readChannel,
                                 long readFrom,
                                 int msgLen)
                          throws IOException
Throws:
IOException

openStorageFile

protected void openStorageFile()
                        throws IOException
Opens the indexed file.

Overrides:
openStorageFile in class FlatFileMessageStorage
Throws:
IOException - - if I/O errors occurred

close

public void close()
           throws IOException
Close the storage.

Specified by:
close in interface MessageStorage
Overrides:
close in class AbstractFileMessageStorage
Throws:
IOException - - if I/O error occurred

getNextSequenceNumber

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

Overrides:
getNextSequenceNumber in class FlatFileMessageStorage
Throws:
IOException - - if I/O error occurred
See Also:
AbstractFileMessageStorage.getNextSequenceNumber()

appendMessageInternal

public long appendMessageInternal(long timestamp,
                                  byte[] message,
                                  int offset,
                                  int length)
                           throws IOException
Description copied from class: FlatFileMessageStorage
Appends message to storage

Overrides:
appendMessageInternal in class FlatFileMessageStorage
Parameters:
timestamp - the timestamp parameter
message - the array of bytes
length - @throws IOException - if I/O error occurred
Throws:
IOException
See Also:
AbstractFileMessageStorage.appendMessageInternal(long, byte[], int, int)

appendMessageToFile

protected long appendMessageToFile(long timestamp,
                                   byte[] message,
                                   int offset,
                                   int length)
                            throws IOException
Throws:
IOException

backupStorageFile

protected void backupStorageFile(String fullPathToStorageFile,
                                 String fullPathToDestinationBackupFile)
                          throws IOException
Description copied from class: AbstractFileMessageStorage
Backups storage file.

Overrides:
backupStorageFile in class AbstractFileMessageStorage
Parameters:
fullPathToStorageFile - the path to file of in/out file
fullPathToDestinationBackupFile - the destination place to backup file
Throws:
IOException

deleteStorageFile

protected void deleteStorageFile(String fullPathToStorageFile)
Description copied from class: AbstractFileMessageStorage
Deletes storage file.

Overrides:
deleteStorageFile in class AbstractFileMessageStorage
Parameters:
fullPathToStorageFile - the path to in/out file


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