activemq::transport::IOTransport Class Reference

#include <IOTransport.h>

Inheritance diagram for activemq::transport::IOTransport:

activemq::transport::Transport activemq::concurrent::Runnable List of all members.

Public Member Functions

 IOTransport ()
virtual ~IOTransport ()
virtual void oneway (Command *command) throw ( CommandIOException, exceptions::UnsupportedOperationException )
virtual Responserequest (Command *command) throw ( CommandIOException, exceptions::UnsupportedOperationException )
virtual void setCommandListener (CommandListener *listener)
virtual void setCommandReader (CommandReader *reader)
virtual void setCommandWriter (CommandWriter *writer)
virtual void setTransportExceptionListener (TransportExceptionListener *listener)
virtual void setInputStream (io::InputStream *is)
virtual void setOutputStream (io::OutputStream *os)
virtual void start () throw ( cms::CMSException )
virtual void close () throw ( cms::CMSException )
virtual void run ()

Private Member Functions

void fire (exceptions::ActiveMQException &ex)
void fire (Command *command)

Private Attributes

CommandListenerlistener
CommandReaderreader
CommandWriterwriter
TransportExceptionListenerexceptionListener
io::InputStreaminputStream
io::OutputStreamoutputStream
concurrent::Threadthread
bool closed

Detailed Description

Implementation of the Transport interface that performs marshalling of commands to IO streams. This class does not implement the request method, it only handles oneway messages. A thread polls on the input stream for in-coming commands. When a command is received, the command listener is notified. The polling thread is not started until the start method is called. The close method will close the associated streams. Close can be called explicitly by the user, but is also called in the destructor. Once this object has been closed, it cannot be restarted.


Constructor & Destructor Documentation

IOTransport::IOTransport  ) 
 

IOTransport::~IOTransport  )  [virtual]
 


Member Function Documentation

void IOTransport::close  )  throw ( cms::CMSException ) [virtual]
 

Stops the polling thread and closes the streams. This can be called explicitly, but is also called in the destructor. Once this object has been closed, it cannot be restarted.

Exceptions:
CMSException if errors occur.

void activemq::transport::IOTransport::fire Command command  )  [inline, private]
 

Notify the command listener.

Parameters:
command the command the send

void activemq::transport::IOTransport::fire exceptions::ActiveMQException ex  )  [inline, private]
 

Notify the excpetion listener

Parameters:
ex the exception to send

void IOTransport::oneway Command command  )  throw ( CommandIOException, exceptions::UnsupportedOperationException ) [virtual]
 

Sends a one-way command. Does not wait for any response from the broker.

Parameters:
command the command to be sent.
Exceptions:
CommandIOException if an exception occurs during writing of the command.
UnsupportedOperationException if this method is not implemented by this transport.

Implements activemq::transport::Transport.

virtual Response* activemq::transport::IOTransport::request Command command  )  throw ( CommandIOException, exceptions::UnsupportedOperationException ) [inline, virtual]
 

Not supported by this class - throws an exception.

Parameters:
command the command to be sent.
Returns:
the response to the command sent.
Exceptions:
UnsupportedOperationException. 

Implements activemq::transport::Transport.

void IOTransport::run  )  [virtual]
 

Runs the polling thread.

Implements activemq::concurrent::Runnable.

virtual void activemq::transport::IOTransport::setCommandListener CommandListener listener  )  [inline, virtual]
 

Assigns the command listener for non-response commands.

Parameters:
listener the listener.

Implements activemq::transport::Transport.

virtual void activemq::transport::IOTransport::setCommandReader CommandReader reader  )  [inline, virtual]
 

Sets the command reader.

Parameters:
reader the object that will be used for reading command objects.

Implements activemq::transport::Transport.

virtual void activemq::transport::IOTransport::setCommandWriter CommandWriter writer  )  [inline, virtual]
 

Sets the command writer.

Parameters:
writer the object that will be used for writing command objects.

Implements activemq::transport::Transport.

virtual void activemq::transport::IOTransport::setInputStream io::InputStream is  )  [inline, virtual]
 

Sets the input stream for in-coming commands.

Parameters:
is The input stream.

virtual void activemq::transport::IOTransport::setOutputStream io::OutputStream os  )  [inline, virtual]
 

Sets the output stream for out-going commands.

Parameters:
os The output stream.

virtual void activemq::transport::IOTransport::setTransportExceptionListener TransportExceptionListener listener  )  [inline, virtual]
 

Sets the observer of asynchronous exceptions from this transport.

Parameters:
listener the listener of transport exceptions.

Implements activemq::transport::Transport.

void IOTransport::start  )  throw ( cms::CMSException ) [virtual]
 

Starts this transport object and creates the thread for polling on the input stream for commands. If this object has been closed, throws an exception. Before calling start, the caller must set the IO streams and the reader and writer objects.

Exceptions:
CMSException if an error occurs or if this transport has already been closed.


Member Data Documentation

bool activemq::transport::IOTransport::closed [private]
 

Flag marking this transport as closed.

TransportExceptionListener* activemq::transport::IOTransport::exceptionListener [private]
 

Listener of exceptions from this transport.

io::InputStream* activemq::transport::IOTransport::inputStream [private]
 

The input stream for incoming commands.

CommandListener* activemq::transport::IOTransport::listener [private]
 

Listener to incoming commands.

io::OutputStream* activemq::transport::IOTransport::outputStream [private]
 

The output stream for out-going commands.

CommandReader* activemq::transport::IOTransport::reader [private]
 

Reads commands from the input stream.

concurrent::Thread* activemq::transport::IOTransport::thread [private]
 

The polling thread.

CommandWriter* activemq::transport::IOTransport::writer [private]
 

Writes commands to the output stream.


The documentation for this class was generated from the following files:
Generated on Thu Aug 3 18:03:33 2006 for activemq-cpp by  doxygen 1.4.5