xmlBlaster 2.2.0 API

org.xmlBlaster.client.script
Class StreamCallback

java.lang.Object
  extended by org.xmlBlaster.client.script.StreamCallback
All Implemented Interfaces:
I_Callback

public class StreamCallback
extends java.lang.Object
implements I_Callback

StreamCallback is a sample implementation of the I_Callback interface which provides basic functionality as a callback to the XmlScriptInterpreter. It writes the information it gets from the update method to the output stream in an xml formatted way. <p/> If you want another behavior (for example by outputting the content in base64) you can overwrite the writeContent method.

Author:
Michele Laghi

Field Summary
private  Global global
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  java.lang.String offset
           
private  java.io.OutputStream out
           
 
Constructor Summary
StreamCallback(Global global, java.io.OutputStream out, java.lang.String offset)
          The constructor
 
Method Summary
 java.lang.String update(java.lang.String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos)
          Enforced by I_Callback
protected  void writeContent(java.lang.String contentStr, java.lang.StringBuffer buf)
          Invoked in the update method to write out the content in an xml formatted way.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private final java.lang.String ME
See Also:
Constant Field Values

global

private Global global

log

private static java.util.logging.Logger log

out

private java.io.OutputStream out

offset

private java.lang.String offset
Constructor Detail

StreamCallback

public StreamCallback(Global global,
                      java.io.OutputStream out,
                      java.lang.String offset)
The constructor

Parameters:
global - The global
out - the output stream to which you want to send the information coming to the update method.
offset - the offset to use.
Method Detail

writeContent

protected void writeContent(java.lang.String contentStr,
                            java.lang.StringBuffer buf)
Invoked in the update method to write out the content in an xml formatted way.

Parameters:
content - the content to write
buf - the StringBuffer object to fill with the content

update

public java.lang.String update(java.lang.String cbSessionId,
                               UpdateKey updateKey,
                               byte[] content,
                               UpdateQos updateQos)
                        throws XmlBlasterException
Enforced by I_Callback

Specified by:
update in interface I_Callback
Parameters:
cbSessionId - The session ID specified by the client which registered the callback. You can specify a cbSessionId during connection (with ConnectQos) and this is bounced back here so you can authenticate the message.
updateKey - The arrived key containing the topic name
content - The arrived message content. This is your payload.
Throws:
XmlBlasterException
See Also:
I_XmlBlasterAccess

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.