xmlBlaster 1.6.2 API

org.xmlBlaster.protocol.http.ajax
Class BlasterInstance

java.lang.Object
  extended byorg.xmlBlaster.protocol.http.ajax.BlasterInstance
All Implemented Interfaces:
I_Callback

class BlasterInstance
extends java.lang.Object
implements I_Callback

One browser session maps on exactly one xmlBlaster login session.

Callback messages are send as xml to the browser:

 <xmlBlasterResponse>
  <update>
    <qos>...</qos>
    <key>...</key>
    <content>...</content>
  </update>
 </xmlBlasterResponse>
 

Author:
Marcel Ruff xmlBlaster@marcelruff.info 2007

Field Summary
private  java.util.Map blasterInstanceMap
           
private  BlockingQueueWrapper blockingQueueWrapper
           
private  Global glob
           
private  java.lang.String id
           
private static java.util.logging.Logger log
           
private  java.lang.String RELATED_AJAX
           
private  javax.servlet.http.HttpSession session
           
private  java.lang.String sessionId
           
private  StorageId storageId
           
private  I_Queue updateQueue
           
private  I_XmlBlasterAccess xmlBlasterAccess
           
 
Constructor Summary
BlasterInstance(javax.servlet.http.HttpServletRequest req, java.util.Map blasterInstanceMap)
           
 
Method Summary
 void execute(byte[] xmlScriptRaw, java.io.Writer out)
           
 java.lang.String getCbSessionId()
           
 java.lang.String getGpsTopicId()
           
 javax.servlet.http.HttpSession getSession()
           
 java.lang.String getStartupPos()
           
 I_XmlBlasterAccess getXmlBlasterAccess()
           
 void init(javax.servlet.http.HttpServletRequest req, java.util.Properties props)
           
(package private)  void plainGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.io.StringWriter out)
           
 void put(MsgUnit msgUnit)
           
 int sendUpdates(java.io.Writer out, boolean onlyContent, int numEntries, long timeout)
          This method gets the entries in the correct form, i.e.
 void setSession(javax.servlet.http.HttpSession session)
           
 void setXmlBlasterAccess(I_XmlBlasterAccess xmlBlasterAccess)
           
 void shutdown()
           
 java.lang.String update(java.lang.String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos)
          This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode about a new message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

blasterInstanceMap

private java.util.Map blasterInstanceMap

xmlBlasterAccess

private I_XmlBlasterAccess xmlBlasterAccess

glob

private Global glob

id

private java.lang.String id

session

private javax.servlet.http.HttpSession session

sessionId

private java.lang.String sessionId

storageId

private StorageId storageId

updateQueue

private I_Queue updateQueue

RELATED_AJAX

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

blockingQueueWrapper

private BlockingQueueWrapper blockingQueueWrapper
Constructor Detail

BlasterInstance

public BlasterInstance(javax.servlet.http.HttpServletRequest req,
                       java.util.Map blasterInstanceMap)
Method Detail

getGpsTopicId

public java.lang.String getGpsTopicId()

getCbSessionId

public java.lang.String getCbSessionId()

init

public void init(javax.servlet.http.HttpServletRequest req,
                 java.util.Properties props)
          throws XmlBlasterException
Throws:
XmlBlasterException

execute

public void execute(byte[] xmlScriptRaw,
                    java.io.Writer out)
             throws XmlBlasterException,
                    java.io.UnsupportedEncodingException,
                    java.io.IOException
Throws:
XmlBlasterException
java.io.UnsupportedEncodingException
java.io.IOException

getSession

public javax.servlet.http.HttpSession getSession()

setSession

public void setSession(javax.servlet.http.HttpSession session)

getXmlBlasterAccess

public I_XmlBlasterAccess getXmlBlasterAccess()

setXmlBlasterAccess

public void setXmlBlasterAccess(I_XmlBlasterAccess xmlBlasterAccess)

put

public void put(MsgUnit msgUnit)
         throws XmlBlasterException
Throws:
XmlBlasterException

sendUpdates

public int sendUpdates(java.io.Writer out,
                       boolean onlyContent,
                       int numEntries,
                       long timeout)
                throws XmlBlasterException,
                       java.io.IOException
This method gets the entries in the correct form, i.e. the first stored comes first.

Parameters:
out - The out stream
onlyContent - if false the complete MsgUnit XML is send
numEntries - if -1 unlimited
timeout - if 0 not blocking, if timeout > 0: blocking, if timeout < 0: infinite blocking
Returns:
Number of send updates
Throws:
XmlBlasterException
java.io.IOException

update

public java.lang.String update(java.lang.String cbSessionId,
                               UpdateKey updateKey,
                               byte[] content,
                               UpdateQos updateQos)
                        throws XmlBlasterException
Description copied from interface: I_Callback
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode about a new message.

So you should implement in your client code the I_Callback interface - suppling the update() method where you can do with the message whatever you want.

The raw protocol driver specific update() method (e.g. CORBA-BlasterCallback.update()) is unpacked and for each arrived message this update is called.

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

getStartupPos

public java.lang.String getStartupPos()

shutdown

public void shutdown()

plainGet

void plainGet(javax.servlet.http.HttpServletRequest req,
              javax.servlet.http.HttpServletResponse res,
              java.io.StringWriter out)
        throws java.io.IOException,
               XmlBlasterException
Throws:
java.io.IOException
XmlBlasterException

xmlBlaster 1.6.2 API

Copyright © 1999-2007 The xmlBlaster.org contributers.