org.exolab.jms.tools.migration.proxy
Class ConsumerStore

java.lang.Object
  |
  +--org.exolab.jms.tools.migration.proxy.ConsumerStore
All Implemented Interfaces:
org.exolab.jms.tools.migration.proxy.DBConstants, Store

public class ConsumerStore
extends java.lang.Object
implements Store, org.exolab.jms.tools.migration.proxy.DBConstants

Provides persistency for Consumer instances.

Version:
$Revision: 1.2 $ $Date: 2005/10/20 14:07:03 $
Author:
Tim Anderson

Field Summary
static java.lang.String CONSUMER_TABLE
           
static java.lang.String DESTINATION_TABLE
           
static java.lang.String MESSAGE_HANDLE_TABLE
           
static java.lang.String MESSAGE_PROPERTIES_TABLE
           
static java.lang.String MESSAGE_TABLE
           
static java.lang.String PROPERTIES_TABLE
           
static java.lang.String SUBSCRIPTION_TABLE
           
static java.lang.String USER_TABLE
           
 
Constructor Summary
ConsumerStore(DestinationStore destinations, java.sql.Connection connection)
          Construct a new ConsumerStore.
 
Method Summary
 void add(Consumer consumer)
          Add a new consumer.
protected  void addMessages(long consumerId, long destinationId, Subscription subscription)
          Add messages for a subscription.
protected  void addSubscriptions(long consumerId, Consumer consumer)
          Add subscriptions for a consumer.
 StoreIterator exportCollection()
          Export the consumers.
 Consumer get(long consumerId)
          Returns a consumer for a given identifier.
 java.util.List getConsumerIds()
          Returns all consumer identifiers.
protected  void getMessages(long consumerId, long destinationId, Subscription subscription)
          Get messages for a subscription.
protected  void getSubscriptions(long consumerId, Consumer consumer)
          Get subscriptions for a consumer.
 void importCollection(StoreIterator iterator)
          Import consumers into the store.
 int size()
          Returns the number of elements in the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_TABLE

public static final java.lang.String PROPERTIES_TABLE

DESTINATION_TABLE

public static final java.lang.String DESTINATION_TABLE

MESSAGE_TABLE

public static final java.lang.String MESSAGE_TABLE

MESSAGE_PROPERTIES_TABLE

public static final java.lang.String MESSAGE_PROPERTIES_TABLE

CONSUMER_TABLE

public static final java.lang.String CONSUMER_TABLE

SUBSCRIPTION_TABLE

public static final java.lang.String SUBSCRIPTION_TABLE

MESSAGE_HANDLE_TABLE

public static final java.lang.String MESSAGE_HANDLE_TABLE

USER_TABLE

public static final java.lang.String USER_TABLE
Constructor Detail

ConsumerStore

public ConsumerStore(DestinationStore destinations,
                     java.sql.Connection connection)
Construct a new ConsumerStore.
Parameters:
destinations - the destination store
connection - the database connection
Method Detail

exportCollection

public StoreIterator exportCollection()
                               throws javax.jms.JMSException,
                                      org.exolab.jms.persistence.PersistenceException
Export the consumers.
Specified by:
exportCollection in interface Store
Returns:
an iterator over the collection
Throws:
javax.jms.JMSException - for any JMS error
org.exolab.jms.persistence.PersistenceException - for any persistence error

importCollection

public void importCollection(StoreIterator iterator)
                      throws javax.jms.JMSException,
                             org.exolab.jms.persistence.PersistenceException
Import consumers into the store.
Specified by:
importCollection in interface Store
Parameters:
iterator - an iterator over the collection
Throws:
javax.jms.JMSException - for any JMS error
org.exolab.jms.persistence.PersistenceException - for any persistence error

size

public int size()
         throws org.exolab.jms.persistence.PersistenceException
Returns the number of elements in the collection.
Specified by:
size in interface Store
Returns:
the number of elements in the collection
Throws:
org.exolab.jms.persistence.PersistenceException - for any persistence error

add

public void add(Consumer consumer)
         throws org.exolab.jms.persistence.PersistenceException
Add a new consumer.
Parameters:
consumer - the consumer to add
Throws:
org.exolab.jms.persistence.PersistenceException - for any persistence error

get

public Consumer get(long consumerId)
             throws org.exolab.jms.persistence.PersistenceException
Returns a consumer for a given identifier.
Parameters:
consumerId - the identity of the consumer
Returns:
the consumer corresponding to consumerId or null if no such consumer exists
Throws:
org.exolab.jms.persistence.PersistenceException - for any persistence error

getConsumerIds

public java.util.List getConsumerIds()
                              throws org.exolab.jms.persistence.PersistenceException
Returns all consumer identifiers.
Returns:
a list of consumer identifiers
Throws:
org.exolab.jms.persistence.PersistenceException - for any persistence error

addSubscriptions

protected void addSubscriptions(long consumerId,
                                Consumer consumer)
                         throws org.exolab.jms.persistence.PersistenceException
Add subscriptions for a consumer.
Parameters:
consumerId - the identity of the consumer
consumer - the consumer
Throws:
org.exolab.jms.persistence.PersistenceException - for any persistence error

addMessages

protected void addMessages(long consumerId,
                           long destinationId,
                           Subscription subscription)
                    throws org.exolab.jms.persistence.PersistenceException
Add messages for a subscription.
Parameters:
consumerId - the identity of the consumer
destinationId - the identify of the destination
subscription - the consumer subscription
Throws:
org.exolab.jms.persistence.PersistenceException - for any persistence error

getSubscriptions

protected void getSubscriptions(long consumerId,
                                Consumer consumer)
                         throws org.exolab.jms.persistence.PersistenceException
Get subscriptions for a consumer.
Parameters:
consumerId - the identity of the consumer
consumer - the consumer to populate
Throws:
org.exolab.jms.persistence.PersistenceException - for any persistence error

getMessages

protected void getMessages(long consumerId,
                           long destinationId,
                           Subscription subscription)
                    throws java.sql.SQLException
Get messages for a subscription.
Parameters:
consumerId - the identity of the consumer
destinationId - the identify of the destination
subscription - the consumer subscription
Throws:
java.sql.SQLException - if a database error is encountered


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.