jrun.jms.core.persistence
Interface PersistentAdapter

All Known Implementing Classes:
AbstractPersistentAdapter

public interface PersistentAdapter


Method Summary
 boolean addDestination(java.lang.String name, boolean queue)
          Add a new destination to the database.
 boolean addDurableConsumer(java.lang.String topic, java.lang.String consumer)
          Add the specified durable consumer
 boolean addMessage(MessageImpl message)
          Add a new message to the database.
 boolean addMessageHandle(PersistentMessageHandle handle)
          Add the specified persistent message handle.
 boolean checkDestination(java.lang.String name)
          Determine if a particular destination name exists
 boolean clearDB()
          Clear everthing (all messages, handles, destinations, etc.) out of the persistent manager's storage.
 boolean clearMessages()
          Clear all messages and message handles out of the persistent manager's storage.
 void closePersistentStore()
          Close persistentStore if open if open.
 boolean durableConsumerExists(java.lang.String name)
          Check if the durable consumer exists
 java.util.Enumeration getAllDestinations()
          Get a list of all destinations stored in the database
 java.util.HashMap getAllDurableConsumers()
          Return a dictionary of all registered durable consumers.
 int getDurableConsumerMessageCount(java.lang.String destination, java.lang.String name)
          Return the number of unsent message for the specified durable consumer.
 java.util.Enumeration getDurableConsumers(java.lang.String topic)
          Get an enumerated list of all durable consumers for the specified JmsTopic destination
 MessageImpl getMessage(java.lang.String id)
          Get a message from the persistence store.
 java.util.Vector getMessageHandles(JmsDestination destination, java.lang.String name)
          Get all the persistent message handles for the specified destination and consumer name.
 java.util.Vector getMessages(PersistentMessageHandle handle)
          Get at least the next message given the specified persistent handle.
 java.util.Vector getNonExpiredMessages(JmsDestination destination)
          Retrieve a list of unexpired MessageHandle objects, for the specified destination.
 int getQueueMessageCount(java.lang.String name)
          Get the number of unsent messages for a the specified queue
 java.util.Vector getUnprocessedMessages()
          Return a list of unprocessed messages.
 int purgeMessages()
          Purge all processed messages from the database.
 boolean removeDestination(java.lang.String destination)
          Remove the destination with the specified name and all registered consumers from the database.
 boolean removeDurableConsumer(java.lang.String consumer)
          Remove the durable consumer for the specified topic.
 int removeExpiredMessageHandles(java.lang.String name)
          Remove any expired message handles associated with the specified destination.
 int removeExpiredMessages()
          Remove all expired messages and associated references from the database.
 boolean removeMessage(java.lang.String id)
          Remove the message with the specified identity from the database
 boolean removeMessageHandle(PersistentMessageHandle handle)
          Remove the specified persistent message handle.
 void setupPersistentStore(PersistenceManagerMetaData metadata)
          Constructs a persistent store using the specified configuration information.
 boolean updateMessage(MessageImpl message)
          Update this message in the database
 boolean updateMessageHandle(PersistentMessageHandle handle)
          Update the specified persistent message handle.
 

Method Detail

setupPersistentStore

public void setupPersistentStore(PersistenceManagerMetaData metadata)
                          throws FailedToCreateStoreException
Constructs a persistent store using the specified configuration information.
Parameters:
metadata - - database configuration information
Throws:
FailedToCreateStoreException - Cannot create the persistent store.

closePersistentStore

public void closePersistentStore()
Close persistentStore if open if open.

addMessage

public boolean addMessage(MessageImpl message)
                   throws PersistenceException
Add a new message to the database.
Parameters:
MessageImpl - the new message to add
Returns:
boolean true if the message was successfully added.

updateMessage

public boolean updateMessage(MessageImpl message)
                      throws PersistenceException
Update this message in the database
Parameters:
MessageImpl - the new message to update
Returns:
boolean true if the message was successfully added.

removeMessage

public boolean removeMessage(java.lang.String id)
                      throws PersistenceException
Remove the message with the specified identity from the database
Parameters:
name - - the identity of the message to remove.
Returns:
boolean - true if successful

removeExpiredMessages

public int removeExpiredMessages()
                          throws PersistenceException
Remove all expired messages and associated references from the database. It uses the current time to determine messages that have exipred.

getNonExpiredMessages

public java.util.Vector getNonExpiredMessages(JmsDestination destination)
                                       throws PersistenceException
Retrieve a list of unexpired MessageHandle objects, for the specified destination.
Parameters:
destination - - the destination in question
Returns:
Vector - collection of unexpired message handles

getMessage

public MessageImpl getMessage(java.lang.String id)
                       throws PersistenceException
Get a message from the persistence store.
Parameters:
String - The id of the message to search for
Returns:
MessageImpl The message if found otherwise null

getMessages

public java.util.Vector getMessages(PersistentMessageHandle handle)
                             throws PersistenceException
Get at least the next message given the specified persistent handle. The handle encodes all the information, including destination and timestamp, required to fetch that and successive messages. This will fault in more than one message for performance
Parameters:
handle - - the persistent handle to resolve
Returns:
Vector - a vector of MessageImpl

getUnprocessedMessages

public java.util.Vector getUnprocessedMessages()
                                        throws PersistenceException
Return a list of unprocessed messages. These are messages that have been stored in the database but not processed.
Returns:
Vector - a collection of un processed messages

addMessageHandle

public boolean addMessageHandle(PersistentMessageHandle handle)
                         throws PersistenceException
Add the specified persistent message handle.
Parameters:
handle - - the persistent handle to add
Returns:
boolean - true if it was updated successfully

updateMessageHandle

public boolean updateMessageHandle(PersistentMessageHandle handle)
                            throws PersistenceException
Update the specified persistent message handle.
Parameters:
handle - - the persistent handle to update
Returns:
boolean - true if it was updated successfully

removeExpiredMessageHandles

public int removeExpiredMessageHandles(java.lang.String name)
                                throws PersistenceException
Remove any expired message handles associated with the specified destination.
Parameters:
name - - the name of the destination for which expired handles should be removed
Returns:
int - the number of expired handles actually removed

removeMessageHandle

public boolean removeMessageHandle(PersistentMessageHandle handle)
                            throws PersistenceException
Remove the specified persistent message handle.
Parameters:
handle - - the persistent handle to remove
Returns:
boolean - true if it was updated successfully

getMessageHandles

public java.util.Vector getMessageHandles(JmsDestination destination,
                                          java.lang.String name)
                                   throws PersistenceException
Get all the persistent message handles for the specified destination and consumer name.

The returned messages reference unacked or unsent messages

NEED A STRATEGY WHEN WE HAVE LOTS OF MESSAGE HANDLES

Parameters:
destination - - the destination to reference
name - - the consumer name

addDurableConsumer

public boolean addDurableConsumer(java.lang.String topic,
                                  java.lang.String consumer)
                           throws PersistenceException
Add the specified durable consumer
Parameters:
topic - - the name of the topic
name - - the name of the consumer
Returns:
boolean - true if successful

removeDurableConsumer

public boolean removeDurableConsumer(java.lang.String consumer)
                              throws PersistenceException
Remove the durable consumer for the specified topic.
Parameters:
consumer - - the consumer name
Returns:
boolean - true if successful

durableConsumerExists

public boolean durableConsumerExists(java.lang.String name)
                              throws PersistenceException
Check if the durable consumer exists
Parameters:
name - - durable consumer name
Returns:
boolean - true if it exists and false otherwise

getDurableConsumers

public java.util.Enumeration getDurableConsumers(java.lang.String topic)
                                          throws PersistenceException
Get an enumerated list of all durable consumers for the specified JmsTopic destination
Parameters:
topic - - the topic to query
Returns:
Vector - list of durable subscriber names

getAllDurableConsumers

public java.util.HashMap getAllDurableConsumers()
                                         throws PersistenceException
Return a dictionary of all registered durable consumers. The dictionary is keyed on consumer name and maps to the underlying destination name. The destination name maybe a wildcard
Returns:
HashMap key=consumer name and value is destination

addDestination

public boolean addDestination(java.lang.String name,
                              boolean queue)
                       throws PersistenceException
Add a new destination to the database.
Parameters:
name - - the destination name
queue - - true if it pertains to a queue
Returns:
boolean - true if destination was added

removeDestination

public boolean removeDestination(java.lang.String destination)
                          throws PersistenceException
Remove the destination with the specified name and all registered consumers from the database. Consumer registrations.
Parameters:
destination - - the name of the destination
Returns:
boolean - true if successful.

checkDestination

public boolean checkDestination(java.lang.String name)
                         throws PersistenceException
Determine if a particular destination name exists
Parameters:
name - - the name to query
Returns:
boolean - true if it exists; false otherwise

getAllDestinations

public java.util.Enumeration getAllDestinations()
                                         throws PersistenceException
Get a list of all destinations stored in the database
Returns:
Enumeration - the list of destinations

getQueueMessageCount

public int getQueueMessageCount(java.lang.String name)
                         throws PersistenceException
Get the number of unsent messages for a the specified queue
Parameters:
name - - the name of the queue
Returns:
int - the number of unsent or unacked messages

getDurableConsumerMessageCount

public int getDurableConsumerMessageCount(java.lang.String destination,
                                          java.lang.String name)
                                   throws PersistenceException
Return the number of unsent message for the specified durable consumer.
Parameters:
destination - - the destination name
name - - the name of the durable subscriber
Returns:
int - the nmber of unsent or unacked messages

purgeMessages

public int purgeMessages()
                  throws PersistenceException
Purge all processed messages from the database.
Returns:
int - the number of messages purged

clearDB

public boolean clearDB()
                throws FailedToCreateStoreException
Clear everthing (all messages, handles, destinations, etc.) out of the persistent manager's storage. Returns success/failure.

clearMessages

public boolean clearMessages()
                      throws FailedToCreateStoreException
Clear all messages and message handles out of the persistent manager's storage. Returns success/failure.


Copyright � 2002 Macromedia Corporation. All Rights Reserved.