org.apache.activemq.console.command
Class AbstractAmqCommand

java.lang.Object
  extended by org.apache.activemq.console.command.AbstractCommand
      extended by 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
AbstractAmqCommand()
           
 
Method Summary
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, parseOptions, printHelp, 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
 

Constructor Detail

AbstractAmqCommand

public AbstractAmqCommand()
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 connection
password - - 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 class AbstractCommand
Parameters:
token - - current option
tokens - - 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


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.