com.caucho.xmpp
Class XmppBrokerStream

java.lang.Object
  extended by com.caucho.bam.broker.AbstractBrokerStream
      extended by com.caucho.bam.broker.AbstractBroker
          extended by com.caucho.xmpp.XmppBrokerStream
All Implemented Interfaces:
Broker, MessageStream, SocketLinkDuplexListener

@Module
public class XmppBrokerStream
extends AbstractBroker
implements SocketLinkDuplexListener, Broker

Protocol handler from the TCP/XMPP stream forwarding to the broker


Method Summary
 void close()
          Close the Broker
 java.lang.String getAddress()
          Returns the broker's address, i.e.
 Mailbox getBrokerMailbox()
          Returns a mailbox to the broker itself
 Mailbox getMailbox(java.lang.String address)
          Returns the actor stream for the given address.
 boolean isClosed()
          Returns true if the broker has been closed
 void message(java.lang.String to, java.lang.String from, java.io.Serializable value)
          Handles a message
 void messageError(java.lang.String to, java.lang.String from, java.io.Serializable value, BamError error)
          Handles a message
 void onDisconnect(SocketLinkDuplexController context)
          Called when the connection closes
 void onRead(SocketLinkDuplexController context)
          Called when read data is available
 void onStart(SocketLinkDuplexController context)
          Called when the connection is established
 void onTimeout(SocketLinkDuplexController context)
          Called when the connection times out
 void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable value)
          Handles a get query.
 void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable value, BamError error)
          Handles a query error.
 void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable value)
          Handles a query result.
 boolean serviceWrite(WriteStream os, SocketLinkDuplexController controller)
           
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.bam.broker.AbstractBroker
addMailbox, getBroker, removeMailbox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.bam.broker.Broker
addMailbox, removeMailbox
 
Methods inherited from interface com.caucho.bam.stream.MessageStream
getBroker
 

Method Detail

getAddress

public java.lang.String getAddress()
Description copied from class: AbstractBroker
Returns the broker's address, i.e. the virtual host domain name.

Specified by:
getAddress in interface MessageStream
Overrides:
getAddress in class AbstractBroker

onRead

public void onRead(SocketLinkDuplexController context)
            throws java.io.IOException
Description copied from interface: SocketLinkDuplexListener
Called when read data is available

Specified by:
onRead in interface SocketLinkDuplexListener
Throws:
java.io.IOException

onDisconnect

public void onDisconnect(SocketLinkDuplexController context)
                  throws java.io.IOException
Description copied from interface: SocketLinkDuplexListener
Called when the connection closes

Specified by:
onDisconnect in interface SocketLinkDuplexListener
Throws:
java.io.IOException

onTimeout

public void onTimeout(SocketLinkDuplexController context)
               throws java.io.IOException
Description copied from interface: SocketLinkDuplexListener
Called when the connection times out

Specified by:
onTimeout in interface SocketLinkDuplexListener
Throws:
java.io.IOException

serviceWrite

public boolean serviceWrite(WriteStream os,
                            SocketLinkDuplexController controller)
                     throws java.io.IOException
Throws:
java.io.IOException

message

public void message(java.lang.String to,
                    java.lang.String from,
                    java.io.Serializable value)
Handles a message

Specified by:
message in interface MessageStream
Overrides:
message in class AbstractBrokerStream
Parameters:
to - the target actor's address
from - the source actor's address
value - the message payload

messageError

public void messageError(java.lang.String to,
                         java.lang.String from,
                         java.io.Serializable value,
                         BamError error)
Handles a message

Specified by:
messageError in interface MessageStream
Overrides:
messageError in class AbstractBrokerStream
Parameters:
to - the target actor's address
from - the source actor's address
value - the original message payload
error - the message error

query

public void query(long id,
                  java.lang.String to,
                  java.lang.String from,
                  java.io.Serializable value)
Handles a get query. The get handler must respond with either a QueryResult or a QueryError

Specified by:
query in interface MessageStream
Overrides:
query in class AbstractBrokerStream
Parameters:
id - the query identifier used to match requests with responses
to - the service actor's address
from - the client actor's address
value - the query payload

queryResult

public void queryResult(long id,
                        java.lang.String to,
                        java.lang.String from,
                        java.io.Serializable value)
Handles a query result. The result id will match a pending get or set.

Specified by:
queryResult in interface MessageStream
Overrides:
queryResult in class AbstractBrokerStream
Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
value - the result payload

queryError

public void queryError(long id,
                       java.lang.String to,
                       java.lang.String from,
                       java.io.Serializable value,
                       BamError error)
Handles a query error. The result id will match a pending get or set.

Specified by:
queryError in interface MessageStream
Overrides:
queryError in class AbstractBrokerStream
Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
value - the result payload
error - additional error information

isClosed

public boolean isClosed()
Description copied from class: AbstractBroker
Returns true if the broker has been closed

Specified by:
isClosed in interface MessageStream
Overrides:
isClosed in class AbstractBroker

close

public void close()
Description copied from interface: Broker
Close the Broker

Specified by:
close in interface Broker
Overrides:
close in class AbstractBroker

toString

public java.lang.String toString()
Overrides:
toString in class AbstractBrokerStream

onStart

public void onStart(SocketLinkDuplexController context)
             throws java.io.IOException
Description copied from interface: SocketLinkDuplexListener
Called when the connection is established

Specified by:
onStart in interface SocketLinkDuplexListener
Throws:
java.io.IOException

getBrokerMailbox

public Mailbox getBrokerMailbox()
Description copied from class: AbstractBroker
Returns a mailbox to the broker itself

Specified by:
getBrokerMailbox in interface Broker
Overrides:
getBrokerMailbox in class AbstractBroker

getMailbox

public Mailbox getMailbox(java.lang.String address)
Description copied from class: AbstractBrokerStream
Returns the actor stream for the given address.

Specified by:
getMailbox in interface Broker
Overrides:
getMailbox in class AbstractBroker
Parameters:
address - the address of the mailbox
Returns:
the mailbox with the given address or null