jrun.jms.core.messagemgr
Class DestinationManager

java.lang.Object
  |
  +--jrun.jms.core.messagemgr.DestinationManager
All Implemented Interfaces:
GarbageCollectable, MessageManagerEventListener

public class DestinationManager
extends java.lang.Object
implements MessageManagerEventListener, GarbageCollectable


Method Summary
 void collectGarbage()
          Perform any garbage collection on this resource.
 boolean createAdministeredDestination(JmsDestination dest)
          Create an administered destination using the specified destination.
 void createDestination(JmsDestination destination)
          Create a non-administered destination and cache it.
 DestinationCache createDestinationCache(JmsDestination dest)
          Create a destination of the specified type.
 void deleteAdministeredDestination(JmsDestination dest)
          Remove the corresponding administered destination from persistent store, from transient memory and from the jndi context.
 JmsDestination destinationFromString(java.lang.String name)
          Return the JmsDestination corresponding to the specified destination name
 java.util.Iterator destinationNames()
          Return a list of destination names currently supported by the destination manager.
 java.util.Iterator destinations()
          Return a list of DestinationCache objects that are currently active and in memory.
 void destroy()
          Destroy this manager.
 void destroyDestinationCache(DestinationCache cache)
          Delete the specfied destination
 void destroyDestinationCache(JmsDestination dest)
          Delete the specfied destination
 void destroyDestinationCache(java.lang.String name)
          Deprecated. use destroyDestination(JmsDestination) instead
 DestinationCache getDestinationCache(JmsDestination dest)
          Return the destination cache associated with the dest object
 DestinationCache getDestinationCache(MessageImpl message)
          Return the DestinationCache for this message.
 DestinationCache getDestinationCache(java.lang.String dest)
          Return the destination object associated with destination
 int getGarbageCollectionEvent()
          Returns garbage collection event type
protected  Logger getLogger()
          Return a reference to the logger
 boolean hasDestinationCache(JmsDestination dest)
          Check if the specified destination exists.
static DestinationManager instance()
          Return the singleton destination manager, which is created during the initialiation process.
 boolean messageAdded(JmsDestination destination, MessageImpl message)
          This method is called when the #MessageManager adds a message for this destination to the cache
 void messageRemoved(JmsDestination destination, MessageImpl message)
          This method is called when the #MessageManager removes a message from the cache.
 boolean persistentMessageAdded(JmsDestination destination, MessageImpl message)
          This event is called when the MessageMgr adds a persistent message to the cache.
 void persistentMessageRemoved(JmsDestination destination, MessageImpl message)
          This event is called when a message is removed from the DestinationCache.
 void registerConfiguredAdministeredDestinations()
          This method will create the administered destinations specified in the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static DestinationManager instance()
Return the singleton destination manager, which is created during the initialiation process.

createDestinationCache

public DestinationCache createDestinationCache(JmsDestination dest)
Create a destination of the specified type. If the destination alredy exists then simply return it
Parameters:
dest - - the destination to create
Returns:
DestinationCache - the created destination cache

destroyDestinationCache

public void destroyDestinationCache(DestinationCache cache)
Delete the specfied destination
Parameters:
cahe - - the destination to destroy

destroyDestinationCache

public void destroyDestinationCache(java.lang.String name)
Deprecated. use destroyDestination(JmsDestination) instead

Delete the specfied destination
Parameters:
name - - destination name

destroyDestinationCache

public void destroyDestinationCache(JmsDestination dest)
Delete the specfied destination
Parameters:
dest - - the destination to destroy

destinationFromString

public JmsDestination destinationFromString(java.lang.String name)
Return the JmsDestination corresponding to the specified destination name
Parameters:
name - - destination name
Returns:
JmsDestination - the corresponding object or null

getDestinationCache

public DestinationCache getDestinationCache(JmsDestination dest)
Return the destination cache associated with the dest object
Parameters:
dest - - the destination
Returns:
DestinationCache - associated destination object or null

getDestinationCache

public DestinationCache getDestinationCache(java.lang.String dest)
Return the destination object associated with destination
Parameters:
dest - - the name of the destination
Returns:
DestinationCache - associated destination object or null

getDestinationCache

public DestinationCache getDestinationCache(MessageImpl message)
Return the DestinationCache for this message.
Parameters:
message - - the message to query
Returns:
DestinationCache - the corresponding cahce or null

hasDestinationCache

public boolean hasDestinationCache(JmsDestination dest)
Check if the specified destination exists.
Parameters:
dest - - destination to check
Returns:
boolean - true if it exists

createDestination

public void createDestination(JmsDestination destination)
Create a non-administered destination and cache it. It does not check to see whether or not it is an administered destination this must be done by the caller
Parameters:
destination - - the destination to create

createAdministeredDestination

public boolean createAdministeredDestination(JmsDestination dest)
                                      throws javax.jms.JMSException
Create an administered destination using the specified destination. It will create the destination in the database and register it with the jndi context.
Parameters:
dest - - the destination
Returns:
boolean - true if successful

deleteAdministeredDestination

public void deleteAdministeredDestination(JmsDestination dest)
                                   throws javax.jms.JMSException
Remove the corresponding administered destination from persistent store, from transient memory and from the jndi context. This will also remove all durable consumers for this topic.
Parameters:
dest - - the destination to remove
Returns:
boolean - true if successful

destinationNames

public java.util.Iterator destinationNames()
Return a list of destination names currently supported by the destination manager. This includes all types of destinations.
Returns:
Iterator - iterator for JmsDestination objects

destinations

public java.util.Iterator destinations()
Return a list of DestinationCache objects that are currently active and in memory. This will return a list of all destination types (temporary. transient, administered}.
Returns:
Iterator - set of DestinationCache objects

registerConfiguredAdministeredDestinations

public void registerConfiguredAdministeredDestinations()
This method will create the administered destinations specified in the configuration. A topic may also have zero or more preconfigured durable sunbscribers. An equivalent entity for queues does not exist.

messageAdded

public boolean messageAdded(JmsDestination destination,
                            MessageImpl message)
Description copied from interface: MessageManagerEventListener
This method is called when the #MessageManager adds a message for this destination to the cache
Specified by:
messageAdded in interface MessageManagerEventListener
Following copied from interface: jrun.jms.core.messagemgr.MessageManagerEventListener
Parameters:
destination - - the message's destination
message - - message added to cache
Returns:
boolean - true if this message was accepted

messageRemoved

public void messageRemoved(JmsDestination destination,
                           MessageImpl message)
Description copied from interface: MessageManagerEventListener
This method is called when the #MessageManager removes a message from the cache.
Specified by:
messageRemoved in interface MessageManagerEventListener
Following copied from interface: jrun.jms.core.messagemgr.MessageManagerEventListener
Parameters:
destination - - the message's destination
message - - message removed from cache

persistentMessageAdded

public boolean persistentMessageAdded(JmsDestination destination,
                                      MessageImpl message)
                               throws PersistenceException
Description copied from interface: MessageManagerEventListener
This event is called when the MessageMgr adds a persistent message to the cache.
Specified by:
persistentMessageAdded in interface MessageManagerEventListener
Following copied from interface: jrun.jms.core.messagemgr.MessageManagerEventListener
Parameters:
destination - - the message's destination
message - - message added to cache
Returns:
boolean - true if the message was accepted
Throws:
PersistenceException - - if there is a persistence related problem

persistentMessageRemoved

public void persistentMessageRemoved(JmsDestination destination,
                                     MessageImpl message)
                              throws PersistenceException
Description copied from interface: MessageManagerEventListener
This event is called when a message is removed from the DestinationCache.
Specified by:
persistentMessageRemoved in interface MessageManagerEventListener
Following copied from interface: jrun.jms.core.messagemgr.MessageManagerEventListener
Parameters:
message - - message to remove from cache
destination - - the message's destination
Throws:
PersistenceException - - if there is a persistence related problem

getGarbageCollectionEvent

public int getGarbageCollectionEvent()
Description copied from interface: GarbageCollectable
Returns garbage collection event type
Specified by:
getGarbageCollectionEvent in interface GarbageCollectable

collectGarbage

public void collectGarbage()
Description copied from interface: GarbageCollectable
Perform any garbage collection on this resource. This will have the effect of releasing system resources.
Specified by:
collectGarbage in interface GarbageCollectable

getLogger

protected Logger getLogger()
Return a reference to the logger
Returns:
LoggerIfc

destroy

public void destroy()
Destroy this manager. This is brutal and final


Copyright � 2002 Macromedia Corporation. All Rights Reserved.