Class AbstractAmqCommand
java.lang.Object
org.apache.activemq.console.command.AbstractCommand
org.apache.activemq.console.command.AbstractAmqCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
AmqBrowseCommand
-
Field Summary
Fields inherited from class org.apache.activemq.console.command.AbstractCommand
COMMAND_OPTION_DELIMETER, context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClose all created connections.protected jakarta.jms.ConnectionEstablishes a connection to the remote broker specified by the broker url.protected jakarta.jms.ConnectioncreateConnection(String username, String password) Establishes a connection to the remote broker specified by the broker url.protected URIGet the current broker url.jakarta.jms.ConnectionFactoryprotected voidhandleOption(String token, List tokens) Handle the --amqurl option.protected voidsetBrokerUrl(String address) Set the broker url.protected voidsetBrokerUrl(URI brokerUrl) Set the broker url.voidsetFactory(jakarta.jms.ConnectionFactory factory) voidsetPassword(String password) voidsetPasswordFactory(PasswordFactory passwordFactory) voidsetUsername(String username) Methods inherited from class org.apache.activemq.console.command.AbstractCommand
execute, handleException, parseOptions, printHelp, printHelpFromFile, runTask, setCommandContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.activemq.console.command.Command
getName, getOneLineDescription
-
Constructor Details
-
AbstractAmqCommand
public AbstractAmqCommand()
-
-
Method Details
-
createConnection
protected jakarta.jms.Connection createConnection() throws jakarta.jms.JMSExceptionEstablishes a connection to the remote broker specified by the broker url.- Returns:
- - connection to the broker
- Throws:
jakarta.jms.JMSException
-
createConnection
protected jakarta.jms.Connection createConnection(String username, String password) throws jakarta.jms.JMSException Establishes a connection to the remote broker specified by the broker url.- Parameters:
username- - username for the connectionpassword- - password for the connection- Returns:
- - connection to the broker
- Throws:
jakarta.jms.JMSException
-
closeAllConnections
protected void closeAllConnections()Close all created connections. -
handleOption
Handle the --amqurl option.- Overrides:
handleOptionin classAbstractCommand- Parameters:
token- - current optiontokens- - succeeding list of arguments- Throws:
Exception
-
setBrokerUrl
Set the broker url.- Parameters:
brokerUrl- - new broker url
-
setBrokerUrl
Set the broker url.- Parameters:
address- - address of the new broker url- Throws:
URISyntaxException
-
getBrokerUrl
Get the current broker url.- Returns:
- current broker url
-
getConnectionFactory
public jakarta.jms.ConnectionFactory getConnectionFactory()- Returns:
- the factory
-
getUsername
- Returns:
- the username
-
setFactory
public void setFactory(jakarta.jms.ConnectionFactory factory) - Parameters:
factory- the factory to set
-
setUsername
- Parameters:
username- the username to set
-
getPassword
- Returns:
- the password
-
setPassword
- Parameters:
password- the password to set
-
getPasswordFactory
- Returns:
- the passwordFactory
-
setPasswordFactory
- Parameters:
passwordFactory- the passwordFactory to set
-