|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.persistence.PersistenceAdapter | +--org.exolab.jms.persistence.RDBMSAdapter
This adapter is a wrapper class around the persistency mechanism. It isolates the client from the working specifics of the database, by providing a simple straight forward interface. Furure changes to the database will only require changes to the adapter.
Field Summary | |
static java.lang.String |
SCHEMA_VERSION
The schema version number. |
Constructor Summary | |
RDBMSAdapter(DatabaseConfiguration dbConfig,
java.lang.String driver,
java.lang.String url,
java.lang.String userName,
java.lang.String password)
Connects to the given db. |
Method Summary | |
void |
addDestination(java.sql.Connection connection,
java.lang.String name,
boolean queue)
Add a new destination to the database. |
void |
addDurableConsumer(java.sql.Connection connection,
java.lang.String topic,
java.lang.String consumer)
Add the specified durable consumer |
void |
addMessage(java.sql.Connection connection,
MessageImpl message)
Add a new message to the database. |
void |
addMessageHandle(java.sql.Connection connection,
MessageHandle handle)
Add the specified persistent message handle. |
void |
addUser(java.sql.Connection connection,
User user)
|
boolean |
checkDestination(java.sql.Connection connection,
java.lang.String name)
Determine if a particular destination name exists |
void |
close()
Close the database. |
boolean |
durableConsumerExists(java.sql.Connection connection,
java.lang.String name)
Check if the durable consumer exists |
java.util.Enumeration |
getAllDestinations(java.sql.Connection connection)
Get a list of all destinations stored in the database |
java.util.HashMap |
getAllDurableConsumers(java.sql.Connection connection)
Return a dictionary of all registered durable consumers. |
java.util.Enumeration |
getAllUsers(java.sql.Connection connection)
|
java.sql.Connection |
getConnection()
Return a connection to the database from the pool of connections. |
DBConnectionManager |
getDBConnectionManager()
Return a reference to the DBConnectionManager |
int |
getDurableConsumerMessageCount(java.sql.Connection connection,
java.lang.String destination,
java.lang.String name)
Return the number of unsent message for the specified durable consumer. |
java.util.Enumeration |
getDurableConsumers(java.sql.Connection connection,
java.lang.String topic)
Get an enumerated list of all durable consumers for the specified JmsTopic destination |
long |
getLastId(java.sql.Connection connection)
Check to see if the root is created. |
MessageImpl |
getMessage(java.sql.Connection connection,
java.lang.String id)
Get a message from the persistence store. |
java.util.Vector |
getMessageHandles(java.sql.Connection connection,
JmsDestination destination,
java.lang.String name)
Get all the persistent message handles for the specified destination and consumer name. |
java.util.Vector |
getMessages(java.sql.Connection connection,
MessageHandle handle)
Get at least the next message given the specified persistent handle. |
java.util.Vector |
getNonExpiredMessages(java.sql.Connection connection,
JmsDestination destination)
Retrieve a list of unexpired MessageHandle objects,
for the specified destination. |
int |
getQueueMessageCount(java.sql.Connection connection,
java.lang.String name)
Get the number of unsent messages for a the specified queue |
java.util.Vector |
getUnprocessedMessages(java.sql.Connection connection)
Return a list of unprocessed messages. |
User |
getUser(java.sql.Connection connection,
User user)
|
void |
handleEvent(int event,
java.lang.Object callback,
long time)
Handle the specified event, generated by the EventManager . |
int |
purgeMessages()
Incrementally purge all processed messages from the database. |
void |
removeDestination(java.sql.Connection connection,
java.lang.String name)
Remove the destination with the specified name and all registered consumers from the database. |
void |
removeDurableConsumer(java.sql.Connection connection,
java.lang.String consumer)
Remove the durable consumer for the specified topic. |
void |
removeExpiredMessageHandles(java.sql.Connection connection,
java.lang.String consumer)
Remove all expired messages handles associated with this durable consumer. |
void |
removeExpiredMessages(java.sql.Connection connection)
Remove all expired messages and associated references from the database. |
void |
removeMessage(java.sql.Connection connection,
java.lang.String id)
Remove the message with the specified identity from the database |
void |
removeMessageHandle(java.sql.Connection connection,
MessageHandle handle)
Remove the specified persistent message handle. |
void |
removeUser(java.sql.Connection connection,
User user)
|
void |
updateIds(java.sql.Connection connection,
long id)
Update the given id. |
void |
updateMessage(java.sql.Connection connection,
MessageImpl message)
Update this message in the database |
void |
updateMessageHandle(java.sql.Connection connection,
MessageHandle handle)
Update the specified persistent message handle. |
void |
updateUser(java.sql.Connection connection,
User user)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String SCHEMA_VERSION
Constructor Detail |
public RDBMSAdapter(DatabaseConfiguration dbConfig, java.lang.String driver, java.lang.String url, java.lang.String userName, java.lang.String password) throws PersistenceException
PersistenceException
- if a connection cannot be establised to the
databaseMethod Detail |
public void close()
close
in class PersistenceAdapter
public long getLastId(java.sql.Connection connection) throws PersistenceException
PersistenceAdapter
getLastId
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
PersistenceException
- public void updateIds(java.sql.Connection connection, long id) throws PersistenceException
PersistenceAdapter
updateIds
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to useid
- The id to set in the database.PersistenceException
- public void addMessage(java.sql.Connection connection, MessageImpl message) throws PersistenceException
PersistenceAdapter
addMessage
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- the connection to usemessage
- the new message to addPersistenceException
- public void updateMessage(java.sql.Connection connection, MessageImpl message) throws PersistenceException
PersistenceAdapter
updateMessage
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- the connection to usemessage
- the message to updatePersistenceException
- public java.util.Vector getUnprocessedMessages(java.sql.Connection connection) throws PersistenceException
PersistenceAdapter
getUnprocessedMessages
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usePersistenceException
- public void removeMessage(java.sql.Connection connection, java.lang.String id) throws PersistenceException
PersistenceAdapter
removeMessage
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to useid
- the identity of the message to removePersistenceException
- public MessageImpl getMessage(java.sql.Connection connection, java.lang.String id) throws PersistenceException
PersistenceAdapter
getMessage
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to useid
- the id of the message to search forPersistenceException
- public java.util.Vector getMessages(java.sql.Connection connection, MessageHandle handle) throws PersistenceException
PersistenceAdapter
getMessages
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usehandle
- - the persistent handle to resolvePersistenceException
- public void addMessageHandle(java.sql.Connection connection, MessageHandle handle) throws PersistenceException
PersistenceAdapter
addMessageHandle
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usehandle
- - the persistent handle to addPersistenceException
- public void updateMessageHandle(java.sql.Connection connection, MessageHandle handle) throws PersistenceException
PersistenceAdapter
updateMessageHandle
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usehandle
- - the persistent handle to updatePersistenceException
- public void removeMessageHandle(java.sql.Connection connection, MessageHandle handle) throws PersistenceException
PersistenceAdapter
removeMessageHandle
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usehandle
- - the persistent handle to removePersistenceException
- PersistenceException
- public java.util.Vector getMessageHandles(java.sql.Connection connection, JmsDestination destination, java.lang.String name) throws PersistenceException
PersistenceAdapter
The returned messages reference unacked or unsent messages
NEED A STRATEGY WHEN WE HAVE LOTS OF MESSAGE HANDLES
getMessageHandles
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usedestination
- - the destination to referencename
- - the consumer namePersistenceException
- public void addDurableConsumer(java.sql.Connection connection, java.lang.String topic, java.lang.String consumer) throws PersistenceException
PersistenceAdapter
addDurableConsumer
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usetopic
- - the name of the topicconsumer
- the name of the consumerPersistenceException
- public void removeDurableConsumer(java.sql.Connection connection, java.lang.String consumer) throws PersistenceException
PersistenceAdapter
removeDurableConsumer
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to useconsumer
- - the consumer namePersistenceException
- public java.util.Enumeration getDurableConsumers(java.sql.Connection connection, java.lang.String topic) throws PersistenceException
PersistenceAdapter
getDurableConsumers
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usetopic
- - the topic to queryPersistenceException
- public java.util.HashMap getAllDurableConsumers(java.sql.Connection connection) throws PersistenceException
PersistenceAdapter
getAllDurableConsumers
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usePersistenceException
- public boolean durableConsumerExists(java.sql.Connection connection, java.lang.String name) throws PersistenceException
PersistenceAdapter
durableConsumerExists
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usename
- - durable consumer namePersistenceException
- public void addDestination(java.sql.Connection connection, java.lang.String name, boolean queue) throws PersistenceException
PersistenceAdapter
addDestination
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usename
- - the destination namequeue
- - true if it pertains to a queuePersistenceException
- public void removeDestination(java.sql.Connection connection, java.lang.String name) throws PersistenceException
PersistenceAdapter
removeDestination
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usedestination
- - the name of the destinationPersistenceException
- public java.util.Enumeration getAllDestinations(java.sql.Connection connection) throws PersistenceException
PersistenceAdapter
getAllDestinations
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usePersistenceException
- public boolean checkDestination(java.sql.Connection connection, java.lang.String name) throws PersistenceException
PersistenceAdapter
checkDestination
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usename
- - the name to queryPersistenceException
- public int getQueueMessageCount(java.sql.Connection connection, java.lang.String name) throws PersistenceException
PersistenceAdapter
getQueueMessageCount
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usename
- - the name of the queuePersistenceException
- public int getDurableConsumerMessageCount(java.sql.Connection connection, java.lang.String destination, java.lang.String name) throws PersistenceException
PersistenceAdapter
getDurableConsumerMessageCount
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usedestination
- - the destination namename
- - the name of the durable subscriberPersistenceException
- public void removeExpiredMessages(java.sql.Connection connection) throws PersistenceException
PersistenceAdapter
removeExpiredMessages
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usePersistenceException
- public void removeExpiredMessageHandles(java.sql.Connection connection, java.lang.String consumer) throws PersistenceException
PersistenceAdapter
removeExpiredMessageHandles
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to useconsumer
- - the durable consumer namePersistenceException
- public java.util.Vector getNonExpiredMessages(java.sql.Connection connection, JmsDestination destination) throws PersistenceException
PersistenceAdapter
MessageHandle
objects,
for the specified destination.getNonExpiredMessages
in class PersistenceAdapter
org.exolab.jms.persistence.PersistenceAdapter
connection
- - the connection to usedestination
- - the destination in questionPersistenceException
- public void handleEvent(int event, java.lang.Object callback, long time)
EventHandler
EventManager
.handleEvent
in interface EventHandler
org.exolab.jms.events.EventHandler
event
- the event to handlecallback
- the callback objecttime
- the absolute time, in ms, that the event firedpublic java.sql.Connection getConnection() throws PersistenceException
getConnection
in class PersistenceAdapter
PersistenceException
- - if it cannot retrieve a connectionpublic DBConnectionManager getDBConnectionManager()
public void addUser(java.sql.Connection connection, User user) throws PersistenceException
addUser
in class PersistenceAdapter
public java.util.Enumeration getAllUsers(java.sql.Connection connection) throws PersistenceException
getAllUsers
in class PersistenceAdapter
public User getUser(java.sql.Connection connection, User user) throws PersistenceException
getUser
in class PersistenceAdapter
public void removeUser(java.sql.Connection connection, User user) throws PersistenceException
removeUser
in class PersistenceAdapter
public void updateUser(java.sql.Connection connection, User user) throws PersistenceException
updateUser
in class PersistenceAdapter
public int purgeMessages()
purgeMessages
in class PersistenceAdapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |