org.activemq.transport.jabber
Class JabberWireFormat

java.lang.Object
  extended byorg.activemq.io.AbstractWireFormat
      extended byorg.activemq.transport.jabber.JabberWireFormat
All Implemented Interfaces:
WireFormat

public class JabberWireFormat
extends AbstractWireFormat

A wire format which uses XMPP format of messages

Version:
$Revision: 1.1 $

Field Summary
 
Fields inherited from class org.activemq.io.AbstractWireFormat
cachingEnabled, transportDataIn, transportDataOut
 
Fields inherited from interface org.activemq.io.WireFormat
DEFAULT_MAXIMUM_MESSAGE_SIZE
 
Constructor Summary
JabberWireFormat()
           
 
Method Summary
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
 WireFormat copy()
          Creates a new copy of this wire format so it can be used in another thread/context
protected  Packet createConnectionInfo()
           
protected  Packet createConsumerPacket()
           
protected  ActiveMQDestination createDestination(String typeName, String text)
           
protected  String encodeBinary(byte[] data, int offset, int length)
           
 int getCurrentWireFormatVersion()
           
 PrintWriter getWriter()
           
protected  String getXmppType(ActiveMQMessage message)
           
protected  void initialize()
           
protected  boolean readElement(javax.xml.stream.XMLStreamReader reader, ActiveMQTextMessage message)
           
protected  Packet readMessage(javax.xml.stream.XMLStreamReader reader)
           
 Packet readPacket(int firstByte, DataInput in)
          A helper method for working with sockets where the first byte is read first, then the rest of the message is read.
 void readPacket(javax.xml.stream.XMLStreamReader reader, List returnPackets)
          Reads a packet from the XML stream
protected  String readXMLAsText(javax.xml.stream.XMLStreamReader reader)
           
 void setWriter(PrintWriter writer)
           
protected  String toString(Destination destination)
           
protected  void writeBytesMessage(ActiveMQBytesMessage message, DataOutput out)
           
protected  void writeEndElement(javax.xml.stream.XMLStreamReader reader)
           
protected  void writeMessage(ActiveMQMessage message, String body, DataOutput out)
           
protected  void writeObjectMessage(ActiveMQObjectMessage message, DataOutput out)
           
 Packet writePacket(Packet packet, DataOutput out)
          Writes the packet to the given output stream
protected  void writeQName(QName name)
           
protected  void writeStartElement(javax.xml.stream.XMLStreamReader reader)
           
protected  void writeTextMessage(ActiveMQTextMessage message, DataOutput out)
           
 
Methods inherited from class org.activemq.io.AbstractWireFormat
doesSupportMessageCompression, doesSupportMessageFragmentation, fromBytes, fromBytes, getTransportDataIn, getTransportDataOut, initiateClientSideProtocol, initiateServerSideProtocol, isCachingEnabled, readPacket, readPacket, registerTransportStreams, setCachingEnabled, setTransportDataIn, setTransportDataOut, toBytes, writePacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JabberWireFormat

public JabberWireFormat()
Method Detail

copy

public WireFormat copy()
Description copied from interface: WireFormat
Creates a new copy of this wire format so it can be used in another thread/context

Returns:

readPacket

public Packet readPacket(int firstByte,
                         DataInput in)
                  throws IOException
Description copied from interface: WireFormat
A helper method for working with sockets where the first byte is read first, then the rest of the message is read.

Its common when dealing with sockets to have different timeout semantics until the first non-zero byte is read of a message, after which time a zero timeout is used.

Parameters:
firstByte - the first byte of the packet
in - the rest of the packet
Returns:
Throws:
IOException

readPacket

public void readPacket(javax.xml.stream.XMLStreamReader reader,
                       List returnPackets)
                throws javax.xml.stream.XMLStreamException,
                       JMSException
Reads a packet from the XML stream

Parameters:
reader -
returnPackets -
Throws:
javax.xml.stream.XMLStreamException
JMSException

writePacket

public Packet writePacket(Packet packet,
                          DataOutput out)
                   throws IOException,
                          JMSException
Description copied from interface: WireFormat
Writes the packet to the given output stream

Parameters:
packet -
out -
Returns:
a response packet - or null
Throws:
IOException
JMSException

canProcessWireFormatVersion

public boolean canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version

Parameters:
version - the version number to test
Returns:
true if can accept the version

getCurrentWireFormatVersion

public int getCurrentWireFormatVersion()
Returns:
the current version of this wire format

getWriter

public PrintWriter getWriter()

setWriter

public void setWriter(PrintWriter writer)

createConnectionInfo

protected Packet createConnectionInfo()

createConsumerPacket

protected Packet createConsumerPacket()

initialize

protected void initialize()
                   throws IOException
Throws:
IOException

readMessage

protected Packet readMessage(javax.xml.stream.XMLStreamReader reader)
                      throws javax.xml.stream.XMLStreamException,
                             JMSException
Throws:
javax.xml.stream.XMLStreamException
JMSException

readElement

protected boolean readElement(javax.xml.stream.XMLStreamReader reader,
                              ActiveMQTextMessage message)
                       throws JMSException,
                              javax.xml.stream.XMLStreamException
Throws:
JMSException
javax.xml.stream.XMLStreamException

readXMLAsText

protected String readXMLAsText(javax.xml.stream.XMLStreamReader reader)
                        throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

writeStartElement

protected void writeStartElement(javax.xml.stream.XMLStreamReader reader)

writeEndElement

protected void writeEndElement(javax.xml.stream.XMLStreamReader reader)

writeQName

protected void writeQName(QName name)

createDestination

protected ActiveMQDestination createDestination(String typeName,
                                                String text)

toString

protected String toString(Destination destination)

writeObjectMessage

protected void writeObjectMessage(ActiveMQObjectMessage message,
                                  DataOutput out)
                           throws JMSException,
                                  IOException
Throws:
JMSException
IOException

writeTextMessage

protected void writeTextMessage(ActiveMQTextMessage message,
                                DataOutput out)
                         throws JMSException,
                                IOException
Throws:
JMSException
IOException

writeBytesMessage

protected void writeBytesMessage(ActiveMQBytesMessage message,
                                 DataOutput out)
                          throws IOException
Throws:
IOException

writeMessage

protected void writeMessage(ActiveMQMessage message,
                            String body,
                            DataOutput out)
                     throws IOException
Throws:
IOException

encodeBinary

protected String encodeBinary(byte[] data,
                              int offset,
                              int length)

getXmppType

protected String getXmppType(ActiveMQMessage message)


Copyright © 2004-2007 Protique, Ltd.. All Rights Reserved.