com.caucho.hmtp
Class HmtpWebSocketWriter

java.lang.Object
  extended by com.caucho.bam.broker.AbstractBrokerStream
      extended by com.caucho.bam.broker.AbstractBroker
          extended by com.caucho.hmtp.HmtpWebSocketWriter
All Implemented Interfaces:
Broker, MessageStream

public class HmtpWebSocketWriter
extends AbstractBroker

HmtpWriteStream writes HMTP packets to an OutputStream.


Constructor Summary
HmtpWebSocketWriter(java.io.OutputStream os)
           
 
Method Summary
 void close()
          Close the Broker
 void flush()
           
 java.lang.String getAddress()
          The address of the stream
 boolean isClosed()
          Returns true if the broker has been closed
 void message(java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a message to a given address
 void messageError(java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Sends a message error to a given address
 void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a queryGet to a given address
 void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Sends a query error to a given address
 void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a queryResult to a given address
 void setAddress(java.lang.String address)
          The address of the stream
 
Methods inherited from class com.caucho.bam.broker.AbstractBroker
addMailbox, getBroker, getBrokerMailbox, getMailbox, removeMailbox
 
Methods inherited from class com.caucho.bam.broker.AbstractBrokerStream
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HmtpWebSocketWriter

public HmtpWebSocketWriter(java.io.OutputStream os)
                    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getAddress

public java.lang.String getAddress()
The address of the stream

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

setAddress

public void setAddress(java.lang.String address)
The address of the stream


message

public void message(java.lang.String to,
                    java.lang.String from,
                    java.io.Serializable payload)
Sends a message to a given address

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

messageError

public void messageError(java.lang.String to,
                         java.lang.String from,
                         java.io.Serializable payload,
                         BamError error)
Sends a message error to a given address

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

query

public void query(long id,
                  java.lang.String to,
                  java.lang.String from,
                  java.io.Serializable payload)
Sends a queryGet to a given address

Specified by:
query in interface MessageStream
Overrides:
query in class AbstractBrokerStream
Parameters:
id - the query id
to - the address of the target actor
from - the address of the source actor
payload - the message payload

queryResult

public void queryResult(long id,
                        java.lang.String to,
                        java.lang.String from,
                        java.io.Serializable payload)
Sends a queryResult to a given address

Specified by:
queryResult in interface MessageStream
Overrides:
queryResult in class AbstractBrokerStream
Parameters:
id - the query id
to - the address of the target actor
from - the address of the source actor
payload - the message payload

queryError

public void queryError(long id,
                       java.lang.String to,
                       java.lang.String from,
                       java.io.Serializable payload,
                       BamError error)
Sends a query error to a given address

Specified by:
queryError in interface MessageStream
Overrides:
queryError in class AbstractBrokerStream
Parameters:
id - the query identifier
to - the address of the target actor
from - the address of the source actor
payload - the message payload
error - the message error

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

flush

public void flush()

close

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

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