Stellent
HowToComponents
JavaDoc

intradoc.common
Class FileQueue

java.lang.Object
  |
  +--intradoc.common.FileQueue

public class FileQueue
extends java.lang.Object


Field Summary
static short AVAILABLE_MESSAGE
           
protected  java.lang.String m_dir
           
protected  int m_expirationInterval
           
protected  java.io.File m_file
           
protected  java.io.RandomAccessFile m_fileAccess
           
protected  FileQueueHeader m_header
           
protected  FixedFieldFormatter m_headerFormatter
           
protected  int m_headerLen
           
protected  boolean m_isReserved
           
protected  int m_loadedMsgHeaderIndex
           
protected  FileMessageHeader m_msgHeader
           
protected  int m_msgHeaderLen
           
protected  FixedFieldFormatter m_msgHeadFormatter
           
protected  boolean m_queueFilePresent
           
protected  java.lang.String m_queueName
           
static int MAX_NUM_MESSAGES_ALLOWED
           
static int MAX_SIZE_ALLOWED
           
static int MIN_NUM_MESSAGES
           
static int MIN_ORIGINAL_SIZE
           
static int MIN_SIZE
           
static short RESERVED_MESSAGE
           
 
Constructor Summary
FileQueue()
           
FileQueue(java.lang.String dir)
           
 
Method Summary
 void appendMessage(java.lang.String queueName, java.lang.String id, java.lang.String msg)
           
protected  void appendMessageEntry(java.lang.String id, java.lang.String msg)
           
protected  boolean checkExpiredReservation(FileMessageHeader msgHeader, int curMarker)
           
protected  void checkForRebuild(int msgLen)
           
protected  void checkIsWriteAccessible()
           
protected  void closeFile()
           
protected  int computeMarker()
           
 boolean continueReservation(java.lang.String queueName, FileMessageHeader msgHeader)
           
protected  void createNewQueue(int numMessages, int size, FileQueue oldQueue)
           
protected  FileQueue createNewQueueInstance()
           
protected  void deleteCurrentEntry()
           
 boolean deleteMessage(java.lang.String queueName, java.lang.String id)
           
protected  boolean findFirstAvailableMessage()
           
protected  boolean findFirstNonDeletedFollowing()
           
 java.lang.String findMessage(java.lang.String queueName, java.lang.String id, boolean reserveMsg, FileMessageHeader msgHeader)
           
protected  boolean findMessageHeaderById(java.lang.String id)
           
 int getCount(java.lang.String queueName)
           
 int getCreationLength()
           
 java.lang.String getFirstAvailableMessage(java.lang.String queueName, boolean reserveMsg, FileMessageHeader msgHeader)
           
 long getLastModified(java.lang.String queueName)
           
 java.lang.String getMessageByIndex(int index, java.lang.String queueName, FileMessageHeader msgHeader, boolean reserveMsg)
           
protected  java.lang.String getMessageContents(FileMessageHeader msgHeader)
           
protected  boolean incrementHeaderIndex()
           
 void init()
           
protected  void loadQueue(java.lang.String queueName)
           
protected  void rebuildQueue(int msgLen)
           
 void release()
           
protected  void releaseAccess()
           
 void reserve()
           
protected  void reserveAccess()
           
protected  void reserveCurrentMessage()
           
 void reset()
           
 java.lang.String reverseMessage(java.lang.String queueName, FileMessageHeader msgHeader)
           
protected  void serializeBytes(long pos, byte[] data, boolean isWrite)
           
protected  void serializeMessageHeader(boolean isWrite)
           
protected  void serializeQueueHeader(boolean isWrite)
           
 void setDirectory(java.lang.String dir)
           
 boolean transferMessage(java.lang.String fromQueue, java.lang.String toQueue, java.lang.String id, java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_NUM_MESSAGES

public static final int MIN_NUM_MESSAGES
See Also:
Constant Field Values

MIN_ORIGINAL_SIZE

public static final int MIN_ORIGINAL_SIZE
See Also:
Constant Field Values

MIN_SIZE

public static final int MIN_SIZE
See Also:
Constant Field Values

MAX_NUM_MESSAGES_ALLOWED

public static final int MAX_NUM_MESSAGES_ALLOWED
See Also:
Constant Field Values

MAX_SIZE_ALLOWED

public static final int MAX_SIZE_ALLOWED
See Also:
Constant Field Values

AVAILABLE_MESSAGE

public static final short AVAILABLE_MESSAGE
See Also:
Constant Field Values

RESERVED_MESSAGE

public static final short RESERVED_MESSAGE
See Also:
Constant Field Values

m_dir

protected java.lang.String m_dir

m_headerLen

protected int m_headerLen

m_msgHeaderLen

protected int m_msgHeaderLen

m_expirationInterval

protected int m_expirationInterval

m_headerFormatter

protected FixedFieldFormatter m_headerFormatter

m_msgHeadFormatter

protected FixedFieldFormatter m_msgHeadFormatter

m_queueFilePresent

protected boolean m_queueFilePresent

m_fileAccess

protected java.io.RandomAccessFile m_fileAccess

m_queueName

protected java.lang.String m_queueName

m_file

protected java.io.File m_file

m_header

protected FileQueueHeader m_header

m_msgHeader

protected FileMessageHeader m_msgHeader

m_loadedMsgHeaderIndex

protected int m_loadedMsgHeaderIndex

m_isReserved

protected boolean m_isReserved
Constructor Detail

FileQueue

public FileQueue()

FileQueue

public FileQueue(java.lang.String dir)
Method Detail

setDirectory

public void setDirectory(java.lang.String dir)

init

public void init()

reset

public void reset()

reserve

public void reserve()

release

public void release()

getLastModified

public long getLastModified(java.lang.String queueName)

getCreationLength

public int getCreationLength()

appendMessage

public void appendMessage(java.lang.String queueName,
                          java.lang.String id,
                          java.lang.String msg)
                   throws java.io.IOException
java.io.IOException

deleteMessage

public boolean deleteMessage(java.lang.String queueName,
                             java.lang.String id)
                      throws java.io.IOException
java.io.IOException

getFirstAvailableMessage

public java.lang.String getFirstAvailableMessage(java.lang.String queueName,
                                                 boolean reserveMsg,
                                                 FileMessageHeader msgHeader)
                                          throws java.io.IOException
java.io.IOException

getMessageByIndex

public java.lang.String getMessageByIndex(int index,
                                          java.lang.String queueName,
                                          FileMessageHeader msgHeader,
                                          boolean reserveMsg)
                                   throws java.io.IOException
java.io.IOException

findMessage

public java.lang.String findMessage(java.lang.String queueName,
                                    java.lang.String id,
                                    boolean reserveMsg,
                                    FileMessageHeader msgHeader)
                             throws java.io.IOException
java.io.IOException

continueReservation

public boolean continueReservation(java.lang.String queueName,
                                   FileMessageHeader msgHeader)
                            throws java.io.IOException
java.io.IOException

reverseMessage

public java.lang.String reverseMessage(java.lang.String queueName,
                                       FileMessageHeader msgHeader)
                                throws java.io.IOException
java.io.IOException

transferMessage

public boolean transferMessage(java.lang.String fromQueue,
                               java.lang.String toQueue,
                               java.lang.String id,
                               java.lang.String msg)
                        throws java.io.IOException
java.io.IOException

getCount

public int getCount(java.lang.String queueName)
             throws java.io.IOException
java.io.IOException

appendMessageEntry

protected void appendMessageEntry(java.lang.String id,
                                  java.lang.String msg)
                           throws java.io.IOException
java.io.IOException

checkForRebuild

protected void checkForRebuild(int msgLen)
                        throws java.io.IOException
java.io.IOException

findMessageHeaderById

protected boolean findMessageHeaderById(java.lang.String id)
                                 throws java.io.IOException
java.io.IOException

deleteCurrentEntry

protected void deleteCurrentEntry()
                           throws java.io.IOException
java.io.IOException

findFirstAvailableMessage

protected boolean findFirstAvailableMessage()
                                     throws java.io.IOException
java.io.IOException

checkExpiredReservation

protected boolean checkExpiredReservation(FileMessageHeader msgHeader,
                                          int curMarker)

findFirstNonDeletedFollowing

protected boolean findFirstNonDeletedFollowing()
                                        throws java.io.IOException
java.io.IOException

getMessageContents

protected java.lang.String getMessageContents(FileMessageHeader msgHeader)
                                       throws java.io.IOException
java.io.IOException

checkIsWriteAccessible

protected void checkIsWriteAccessible()
                               throws java.io.IOException
java.io.IOException

loadQueue

protected void loadQueue(java.lang.String queueName)
                  throws java.io.IOException
java.io.IOException

createNewQueue

protected void createNewQueue(int numMessages,
                              int size,
                              FileQueue oldQueue)
                       throws java.io.IOException
java.io.IOException

rebuildQueue

protected void rebuildQueue(int msgLen)
                     throws java.io.IOException
java.io.IOException

reserveAccess

protected void reserveAccess()

releaseAccess

protected void releaseAccess()

closeFile

protected void closeFile()
                  throws java.io.IOException
java.io.IOException

incrementHeaderIndex

protected boolean incrementHeaderIndex()

reserveCurrentMessage

protected void reserveCurrentMessage()
                              throws java.io.IOException
java.io.IOException

serializeQueueHeader

protected void serializeQueueHeader(boolean isWrite)
                             throws java.io.IOException
java.io.IOException

serializeMessageHeader

protected void serializeMessageHeader(boolean isWrite)
                               throws java.io.IOException
java.io.IOException

serializeBytes

protected void serializeBytes(long pos,
                              byte[] data,
                              boolean isWrite)
                       throws java.io.IOException
java.io.IOException

computeMarker

protected int computeMarker()

createNewQueueInstance

protected FileQueue createNewQueueInstance()
                                    throws java.io.IOException
java.io.IOException


(c) 1996-2005  All rights reserved.  Stellent, Inc.