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
public abstract class AbstractAmqCommand extends AbstractCommand
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.console.command.AbstractCommand
COMMAND_OPTION_DELIMETER, context
-
-
Constructor Summary
Constructors Constructor Description AbstractAmqCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeAllConnections()
Close all created connections.protected Connection
createConnection()
Establishes a connection to the remote broker specified by the broker url.protected Connection
createConnection(String username, String password)
Establishes a connection to the remote broker specified by the broker url.protected URI
getBrokerUrl()
Get the current broker url.ConnectionFactory
getConnectionFactory()
String
getPassword()
PasswordFactory
getPasswordFactory()
String
getUsername()
protected void
handleOption(String token, List tokens)
Handle the --amqurl option.protected void
setBrokerUrl(String address)
Set the broker url.protected void
setBrokerUrl(URI brokerUrl)
Set the broker url.void
setFactory(ConnectionFactory factory)
void
setPassword(String password)
void
setPasswordFactory(PasswordFactory passwordFactory)
void
setUsername(String username)
-
Methods inherited from class org.apache.activemq.console.command.AbstractCommand
execute, handleException, parseOptions, printHelp, printHelpFromFile, runTask, setCommandContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.console.command.Command
getName, getOneLineDescription
-
-
-
-
Method Detail
-
createConnection
protected Connection createConnection() throws JMSException
Establishes a connection to the remote broker specified by the broker url.- Returns:
- - connection to the broker
- Throws:
JMSException
-
createConnection
protected Connection createConnection(String username, String password) throws 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:
JMSException
-
closeAllConnections
protected void closeAllConnections()
Close all created connections.
-
handleOption
protected void handleOption(String token, List tokens) throws Exception
Handle the --amqurl option.- Overrides:
handleOption
in classAbstractCommand
- Parameters:
token
- - current optiontokens
- - succeeding list of arguments- Throws:
Exception
-
setBrokerUrl
protected void setBrokerUrl(URI brokerUrl)
Set the broker url.- Parameters:
brokerUrl
- - new broker url
-
setBrokerUrl
protected void setBrokerUrl(String address) throws URISyntaxException
Set the broker url.- Parameters:
address
- - address of the new broker url- Throws:
URISyntaxException
-
getBrokerUrl
protected URI getBrokerUrl()
Get the current broker url.- Returns:
- current broker url
-
getConnectionFactory
public ConnectionFactory getConnectionFactory()
- Returns:
- the factory
-
getUsername
public String getUsername()
- Returns:
- the username
-
setFactory
public void setFactory(ConnectionFactory factory)
- Parameters:
factory
- the factory to set
-
setUsername
public void setUsername(String username)
- Parameters:
username
- the username to set
-
getPassword
public String getPassword()
- Returns:
- the password
-
setPassword
public void setPassword(String password)
- Parameters:
password
- the password to set
-
getPasswordFactory
public PasswordFactory getPasswordFactory()
- Returns:
- the passwordFactory
-
setPasswordFactory
public void setPasswordFactory(PasswordFactory passwordFactory)
- Parameters:
passwordFactory
- the passwordFactory to set
-
-