org.hornetq.jms.server.impl
Class JMSServerManagerImpl

java.lang.Object
  extended by org.hornetq.jms.server.impl.JMSServerManagerImpl
All Implemented Interfaces:
org.hornetq.core.server.ActivateCallback, org.hornetq.core.server.HornetQComponent, JMSServerManager

public class JMSServerManagerImpl
extends Object
implements JMSServerManager, org.hornetq.core.server.ActivateCallback

A Deployer used to create and add to JNDI queues, topics and connection factories. Typically this would only be used in an app server env.

JMS Connection Factories & Destinations can be configured either using configuration files or using a JMSConfiguration object.

If configuration files are used, JMS resources are redeployed if the files content is changed. If a JMSConfiguration object is used, the JMS resources can not be redeployed.

Author:
Andy Taylor, Jeff Mesnil, Tim Fox

Constructor Summary
JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server)
           
JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server, BindingRegistry registry)
          This constructor is used by the Application Server's integration
JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server, JMSConfiguration configuration)
           
JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server, String configFileName)
           
JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server, String configFilename, JMSStorageManager storageManager)
          Deprecated. 
 
Method Summary
 void activated()
           
 void addAddressSettings(String address, org.hornetq.core.settings.impl.AddressSettings addressSettings)
           
 boolean addConnectionFactoryToJNDI(String name, String jndiBinding)
           
 boolean addQueueToJndi(String queueName, String jndiBinding)
           
 void addSecurity(String addressMatch, Set<org.hornetq.core.security.Role> roles)
           
 boolean addTopicToJndi(String topicName, String jndiBinding)
           
 boolean closeConnectionsForAddress(String ipAddress)
           
 void createConnectionFactory(boolean storeConfig, ConnectionFactoryConfiguration cfConfig, String... jndi)
           
 void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, List<String> connectorNames, String... jndiBindings)
           
 void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, List<String> connectorNames, String clientID, long clientFailureCheckPeriod, long connectionTTL, long callTimeout, long callFailoverTimeout, boolean cacheLargeMessagesClient, int minLargeMessageSize, boolean compressLargeMessage, int consumerWindowSize, int consumerMaxRate, int confirmationWindowSize, int producerWindowSize, int producerMaxRate, boolean blockOnAcknowledge, boolean blockOnDurableSend, boolean blockOnNonDurableSend, boolean autoGroup, boolean preAcknowledge, String loadBalancingPolicyClassName, int transactionBatchSize, int dupsOKBatchSize, boolean useGlobalPools, int scheduledThreadPoolMaxSize, int threadPoolMaxSize, long retryInterval, double retryIntervalMultiplier, long maxRetryInterval, int reconnectAttempts, boolean failoverOnInitialConnection, String groupId, String... jndiBindings)
           
 void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, String discoveryGroupName, String... jndiBindings)
           
 void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, String discoveryGroupName, String clientID, long clientFailureCheckPeriod, long connectionTTL, long callTimeout, long callFailoverTimeout, boolean cacheLargeMessagesClient, int minLargeMessageSize, boolean compressLargeMessages, int consumerWindowSize, int consumerMaxRate, int confirmationWindowSize, int producerWindowSize, int producerMaxRate, boolean blockOnAcknowledge, boolean blockOnDurableSend, boolean blockOnNonDurableSend, boolean autoGroup, boolean preAcknowledge, String loadBalancingPolicyClassName, int transactionBatchSize, int dupsOKBatchSize, boolean useGlobalPools, int scheduledThreadPoolMaxSize, int threadPoolMaxSize, long retryInterval, double retryIntervalMultiplier, long maxRetryInterval, int reconnectAttempts, boolean failoverOnInitialConnection, String groupId, String... jndiBindings)
           
 boolean createQueue(boolean storeConfig, String queueName, String selectorString, boolean durable, String... jndi)
          Creates a JMS Queue.
 boolean createTopic(boolean storeConfig, String topicName, String... jndi)
          Creates a JMS Topic
 void deActivate()
           
 boolean destroyConnectionFactory(String name)
          destroys a connection factory.
 boolean destroyQueue(String name)
          destroys a queue and removes it from JNDI or BindingRegistry
 boolean destroyTopic(String name)
          destroys a topic and removes it from JNDI or BindingRegistry
 org.hornetq.core.settings.impl.AddressSettings getAddressSettings(String address)
           
 org.hornetq.core.server.HornetQServer getHornetQServer()
           
 JMSStorageManager getJMSStorageManager()
           
 String[] getJNDIOnConnectionFactory(String factoryName)
           
 String[] getJNDIOnQueue(String queue)
           
 String[] getJNDIOnTopic(String topic)
           
 BindingRegistry getRegistry()
           
 Set<org.hornetq.core.security.Role> getSecurity(String addressMatch)
           
 String getVersion()
           
protected  HornetQConnectionFactory internalCreateCFPOJO(ConnectionFactoryConfiguration cfConfig)
           
 boolean isStarted()
          Has the Server been started.
 String[] listConnectionIDs()
           
 String listPreparedTransactionDetailsAsHTML()
           
 String listPreparedTransactionDetailsAsJSON()
           
 String[] listRemoteAddresses()
           
 String[] listRemoteAddresses(String ipAddress)
           
 String[] listSessions(String connectionID)
           
 void preActivate()
           
 void recoverJndiBindings(String name, PersistedType type)
           
 HornetQConnectionFactory recreateCF(String name, ConnectionFactoryConfiguration cf)
          Call this method to have a CF rebound to JNDI and stored on the Journal
 boolean removeConnectionFactoryFromJNDI(String name)
           
 boolean removeConnectionFactoryFromJNDI(String name, String jndi)
           
 boolean removeQueueFromJNDI(String name)
          Remove the queue from JNDI or BindingRegistry.
 boolean removeQueueFromJNDI(String name, String jndi)
          Remove the queue from JNDI or BindingRegistry.
 boolean removeTopicFromJNDI(String name)
          Remove the topic from JNDI or BindingRegistry.
 boolean removeTopicFromJNDI(String name, String jndi)
          Remove the topic from JNDI or BindingRegistry.
 void replaceStorageManager(JMSStorageManager newStorage)
           
 void setContext(Context context)
           
 void setRegistry(BindingRegistry registry)
          Set this property if you want something other than JNDI for your registry
protected  boolean shutdownConnectionFactory(String name)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMSServerManagerImpl

public JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server)
                     throws Exception
Throws:
Exception

JMSServerManagerImpl

public JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server,
                            BindingRegistry registry)
                     throws Exception
This constructor is used by the Application Server's integration

Parameters:
server -
registry -
Throws:
Exception

JMSServerManagerImpl

public JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server,
                            String configFileName)
                     throws Exception
Throws:
Exception

JMSServerManagerImpl

public JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server,
                            JMSConfiguration configuration)
                     throws Exception
Throws:
Exception

JMSServerManagerImpl

@Deprecated
public JMSServerManagerImpl(org.hornetq.core.server.HornetQServer server,
                                       String configFilename,
                                       JMSStorageManager storageManager)
Deprecated. 

Unused

Method Detail

preActivate

public void preActivate()
Specified by:
preActivate in interface org.hornetq.core.server.ActivateCallback

activated

public void activated()
Specified by:
activated in interface org.hornetq.core.server.ActivateCallback

deActivate

public void deActivate()
Specified by:
deActivate in interface org.hornetq.core.server.ActivateCallback

recoverJndiBindings

public void recoverJndiBindings(String name,
                                PersistedType type)
                         throws NamingException
Throws:
NamingException

start

public void start()
           throws Exception
Specified by:
start in interface org.hornetq.core.server.HornetQComponent
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface org.hornetq.core.server.HornetQComponent
Throws:
Exception

isStarted

public boolean isStarted()
Description copied from interface: JMSServerManager
Has the Server been started.

Specified by:
isStarted in interface org.hornetq.core.server.HornetQComponent
Specified by:
isStarted in interface JMSServerManager
Returns:
true if the server us running

getRegistry

public BindingRegistry getRegistry()
Specified by:
getRegistry in interface JMSServerManager

setRegistry

public void setRegistry(BindingRegistry registry)
Description copied from interface: JMSServerManager
Set this property if you want something other than JNDI for your registry

Specified by:
setRegistry in interface JMSServerManager

getHornetQServer

public org.hornetq.core.server.HornetQServer getHornetQServer()
Specified by:
getHornetQServer in interface JMSServerManager

addAddressSettings

public void addAddressSettings(String address,
                               org.hornetq.core.settings.impl.AddressSettings addressSettings)
Specified by:
addAddressSettings in interface JMSServerManager

getAddressSettings

public org.hornetq.core.settings.impl.AddressSettings getAddressSettings(String address)
Specified by:
getAddressSettings in interface JMSServerManager

addSecurity

public void addSecurity(String addressMatch,
                        Set<org.hornetq.core.security.Role> roles)
Specified by:
addSecurity in interface JMSServerManager

getSecurity

public Set<org.hornetq.core.security.Role> getSecurity(String addressMatch)
Specified by:
getSecurity in interface JMSServerManager

setContext

public void setContext(Context context)
Specified by:
setContext in interface JMSServerManager

getVersion

public String getVersion()
Specified by:
getVersion in interface JMSServerManager

createQueue

public boolean createQueue(boolean storeConfig,
                           String queueName,
                           String selectorString,
                           boolean durable,
                           String... jndi)
                    throws Exception
Description copied from interface: JMSServerManager
Creates a JMS Queue.

Specified by:
createQueue in interface JMSServerManager
queueName - The name of the queue to create
Returns:
true if the queue is created or if it existed and was added to JNDI
Throws:
Exception - if problems were encountered creating the queue.

createTopic

public boolean createTopic(boolean storeConfig,
                           String topicName,
                           String... jndi)
                    throws Exception
Description copied from interface: JMSServerManager
Creates a JMS Topic

Specified by:
createTopic in interface JMSServerManager
topicName - the name of the topic
jndi - the names of the binding for JNDI or BindingRegistry
Returns:
true if the topic was created or if it existed and was added to JNDI
Throws:
Exception - if a problem occurred creating the topic

addTopicToJndi

public boolean addTopicToJndi(String topicName,
                              String jndiBinding)
                       throws Exception
Specified by:
addTopicToJndi in interface JMSServerManager
Throws:
Exception

getJNDIOnQueue

public String[] getJNDIOnQueue(String queue)
Specified by:
getJNDIOnQueue in interface JMSServerManager

getJNDIOnTopic

public String[] getJNDIOnTopic(String topic)
Specified by:
getJNDIOnTopic in interface JMSServerManager

getJNDIOnConnectionFactory

public String[] getJNDIOnConnectionFactory(String factoryName)
Specified by:
getJNDIOnConnectionFactory in interface JMSServerManager

addQueueToJndi

public boolean addQueueToJndi(String queueName,
                              String jndiBinding)
                       throws Exception
Specified by:
addQueueToJndi in interface JMSServerManager
Throws:
Exception

addConnectionFactoryToJNDI

public boolean addConnectionFactoryToJNDI(String name,
                                          String jndiBinding)
                                   throws Exception
Specified by:
addConnectionFactoryToJNDI in interface JMSServerManager
Throws:
Exception

removeQueueFromJNDI

public boolean removeQueueFromJNDI(String name,
                                   String jndi)
                            throws Exception
Description copied from interface: JMSServerManager
Remove the queue from JNDI or BindingRegistry. Calling this method does not destroy the destination.

Specified by:
removeQueueFromJNDI in interface JMSServerManager
Parameters:
name - the name of the destination to remove from JNDI or BindingRegistry
Returns:
true if removed
Throws:
Exception - if a problem occurred removing the destination

removeQueueFromJNDI

public boolean removeQueueFromJNDI(String name)
                            throws Exception
Description copied from interface: JMSServerManager
Remove the queue from JNDI or BindingRegistry. Calling this method does not destroy the destination.

Specified by:
removeQueueFromJNDI in interface JMSServerManager
Parameters:
name - the name of the destination to remove from JNDI or BindingRegistry
Returns:
true if removed
Throws:
Exception - if a problem occurred removing the destination

removeTopicFromJNDI

public boolean removeTopicFromJNDI(String name,
                                   String jndi)
                            throws Exception
Description copied from interface: JMSServerManager
Remove the topic from JNDI or BindingRegistry. Calling this method does not destroy the destination.

Specified by:
removeTopicFromJNDI in interface JMSServerManager
Parameters:
name - the name of the destination to remove from JNDI or BindingRegistry
Returns:
true if removed
Throws:
Exception - if a problem occurred removing the destination

removeTopicFromJNDI

public boolean removeTopicFromJNDI(String name)
                            throws Exception
Description copied from interface: JMSServerManager
Remove the topic from JNDI or BindingRegistry. Calling this method does not destroy the destination.

Specified by:
removeTopicFromJNDI in interface JMSServerManager
Parameters:
name - the name of the destination to remove from JNDI or BindingRegistry
Returns:
true if removed
Throws:
Exception - if a problem occurred removing the destination

removeConnectionFactoryFromJNDI

public boolean removeConnectionFactoryFromJNDI(String name,
                                               String jndi)
                                        throws Exception
Specified by:
removeConnectionFactoryFromJNDI in interface JMSServerManager
Throws:
Exception

removeConnectionFactoryFromJNDI

public boolean removeConnectionFactoryFromJNDI(String name)
                                        throws Exception
Specified by:
removeConnectionFactoryFromJNDI in interface JMSServerManager
Throws:
Exception

destroyQueue

public boolean destroyQueue(String name)
                     throws Exception
Description copied from interface: JMSServerManager
destroys a queue and removes it from JNDI or BindingRegistry

Specified by:
destroyQueue in interface JMSServerManager
Parameters:
name - the name of the queue to destroy
Returns:
true if destroyed
Throws:
Exception - if a problem occurred destroying the queue

destroyTopic

public boolean destroyTopic(String name)
                     throws Exception
Description copied from interface: JMSServerManager
destroys a topic and removes it from JNDI or BindingRegistry

Specified by:
destroyTopic in interface JMSServerManager
Parameters:
name - the name of the topic to destroy
Returns:
true if the topic was destroyed
Throws:
Exception - if a problem occurred destroying the topic

createConnectionFactory

public void createConnectionFactory(String name,
                                    boolean ha,
                                    JMSFactoryType cfType,
                                    List<String> connectorNames,
                                    String... jndiBindings)
                             throws Exception
Specified by:
createConnectionFactory in interface JMSServerManager
Throws:
Exception

createConnectionFactory

public void createConnectionFactory(String name,
                                    boolean ha,
                                    JMSFactoryType cfType,
                                    List<String> connectorNames,
                                    String clientID,
                                    long clientFailureCheckPeriod,
                                    long connectionTTL,
                                    long callTimeout,
                                    long callFailoverTimeout,
                                    boolean cacheLargeMessagesClient,
                                    int minLargeMessageSize,
                                    boolean compressLargeMessage,
                                    int consumerWindowSize,
                                    int consumerMaxRate,
                                    int confirmationWindowSize,
                                    int producerWindowSize,
                                    int producerMaxRate,
                                    boolean blockOnAcknowledge,
                                    boolean blockOnDurableSend,
                                    boolean blockOnNonDurableSend,
                                    boolean autoGroup,
                                    boolean preAcknowledge,
                                    String loadBalancingPolicyClassName,
                                    int transactionBatchSize,
                                    int dupsOKBatchSize,
                                    boolean useGlobalPools,
                                    int scheduledThreadPoolMaxSize,
                                    int threadPoolMaxSize,
                                    long retryInterval,
                                    double retryIntervalMultiplier,
                                    long maxRetryInterval,
                                    int reconnectAttempts,
                                    boolean failoverOnInitialConnection,
                                    String groupId,
                                    String... jndiBindings)
                             throws Exception
Specified by:
createConnectionFactory in interface JMSServerManager
Throws:
Exception

createConnectionFactory

public void createConnectionFactory(String name,
                                    boolean ha,
                                    JMSFactoryType cfType,
                                    String discoveryGroupName,
                                    String clientID,
                                    long clientFailureCheckPeriod,
                                    long connectionTTL,
                                    long callTimeout,
                                    long callFailoverTimeout,
                                    boolean cacheLargeMessagesClient,
                                    int minLargeMessageSize,
                                    boolean compressLargeMessages,
                                    int consumerWindowSize,
                                    int consumerMaxRate,
                                    int confirmationWindowSize,
                                    int producerWindowSize,
                                    int producerMaxRate,
                                    boolean blockOnAcknowledge,
                                    boolean blockOnDurableSend,
                                    boolean blockOnNonDurableSend,
                                    boolean autoGroup,
                                    boolean preAcknowledge,
                                    String loadBalancingPolicyClassName,
                                    int transactionBatchSize,
                                    int dupsOKBatchSize,
                                    boolean useGlobalPools,
                                    int scheduledThreadPoolMaxSize,
                                    int threadPoolMaxSize,
                                    long retryInterval,
                                    double retryIntervalMultiplier,
                                    long maxRetryInterval,
                                    int reconnectAttempts,
                                    boolean failoverOnInitialConnection,
                                    String groupId,
                                    String... jndiBindings)
                             throws Exception
Specified by:
createConnectionFactory in interface JMSServerManager
Throws:
Exception

createConnectionFactory

public void createConnectionFactory(String name,
                                    boolean ha,
                                    JMSFactoryType cfType,
                                    String discoveryGroupName,
                                    String... jndiBindings)
                             throws Exception
Specified by:
createConnectionFactory in interface JMSServerManager
Throws:
Exception

recreateCF

public HornetQConnectionFactory recreateCF(String name,
                                           ConnectionFactoryConfiguration cf)
                                    throws Exception
Description copied from interface: JMSServerManager
Call this method to have a CF rebound to JNDI and stored on the Journal

Specified by:
recreateCF in interface JMSServerManager
Throws:
Exception

createConnectionFactory

public void createConnectionFactory(boolean storeConfig,
                                    ConnectionFactoryConfiguration cfConfig,
                                    String... jndi)
                             throws Exception
Specified by:
createConnectionFactory in interface JMSServerManager
Throws:
Exception

getJMSStorageManager

public JMSStorageManager getJMSStorageManager()

replaceStorageManager

public void replaceStorageManager(JMSStorageManager newStorage)

internalCreateCFPOJO

protected HornetQConnectionFactory internalCreateCFPOJO(ConnectionFactoryConfiguration cfConfig)
                                                 throws HornetQException
Parameters:
cfConfig -
Returns:
Throws:
HornetQException

destroyConnectionFactory

public boolean destroyConnectionFactory(String name)
                                 throws Exception
Description copied from interface: JMSServerManager
destroys a connection factory.

Specified by:
destroyConnectionFactory in interface JMSServerManager
Parameters:
name - the name of the connection factory to destroy
Returns:
true if the connection factory was destroyed
Throws:
Exception - if a problem occurred destroying the connection factory

shutdownConnectionFactory

protected boolean shutdownConnectionFactory(String name)
                                     throws Exception
Parameters:
name -
Throws:
Exception

listRemoteAddresses

public String[] listRemoteAddresses()
                             throws Exception
Specified by:
listRemoteAddresses in interface JMSServerManager
Throws:
Exception

listRemoteAddresses

public String[] listRemoteAddresses(String ipAddress)
                             throws Exception
Specified by:
listRemoteAddresses in interface JMSServerManager
Throws:
Exception

closeConnectionsForAddress

public boolean closeConnectionsForAddress(String ipAddress)
                                   throws Exception
Specified by:
closeConnectionsForAddress in interface JMSServerManager
Throws:
Exception

listConnectionIDs

public String[] listConnectionIDs()
                           throws Exception
Specified by:
listConnectionIDs in interface JMSServerManager
Throws:
Exception

listSessions

public String[] listSessions(String connectionID)
                      throws Exception
Specified by:
listSessions in interface JMSServerManager
Throws:
Exception

listPreparedTransactionDetailsAsJSON

public String listPreparedTransactionDetailsAsJSON()
                                            throws Exception
Specified by:
listPreparedTransactionDetailsAsJSON in interface JMSServerManager
Throws:
Exception

listPreparedTransactionDetailsAsHTML

public String listPreparedTransactionDetailsAsHTML()
                                            throws Exception
Specified by:
listPreparedTransactionDetailsAsHTML in interface JMSServerManager
Throws:
Exception


Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.