xmlBlaster 1.6.2 client API

org.xmlBlaster.client.script
Class XmlScriptClient

java.lang.Object
  extended byorg.xmlBlaster.util.SaxHandlerBase
      extended byorg.xmlBlaster.client.script.XmlScriptInterpreter
          extended byorg.xmlBlaster.client.script.XmlScriptClient
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler, I_Callback, org.xml.sax.ext.LexicalHandler

public class XmlScriptClient
extends XmlScriptInterpreter
implements I_Callback

XmlScriptClient

Example for usage:

java javaclients.XmlScript -requestFile inFile.xml -responseFile outFile.xml -updateFile updFile.xml

Author:
Michele Laghi
See Also:
The client.script requirement

Field Summary
 
Fields inherited from class org.xmlBlaster.client.script.XmlScriptInterpreter
cdata, CONTENT_TAG, contentData, ECHO_TAG, INPUT_TAG, key, KEY_TAG, messageList, needsRootEndTag, out, qos, QOS_TAG, response, ROOT_TAG, ROOTRESPONSE_TAG, sendSimpleExceptionFormat, updateCounter, WAIT_TAG, waitMutex, waitNumUpdates
 
Fields inherited from class org.xmlBlaster.util.SaxHandlerBase
character, locator, xmlLiteral, xmlSource
 
Constructor Summary
XmlScriptClient(Global glob, I_XmlBlasterAccess access, I_Callback callback, java.util.HashMap attachments, java.io.OutputStream out)
          This constructor is the most generic one (more degrees of freedom)
XmlScriptClient(Global glob, I_XmlBlasterAccess access, java.io.OutputStream cbStream, java.io.OutputStream responseStream, java.util.HashMap attachments)
          This is a convenience constructor which takes the default I_Callback implementation provided (StreamCallback).
XmlScriptClient(Global glob, java.io.OutputStream out)
          Convenience constructor which takes a minimal amount of parameters.
 
Method Summary
 boolean fireMethod(MethodName methodName, java.lang.String sessionId, java.lang.String requestId, byte type)
          On each remote method invocation this function is called.
static void main(java.lang.String[] args)
           
 void registerMsgUnitCb(I_MsgUnitCb msgUnitCb)
          You can register a callback which can manipulate the MsgUnit just before it is sent.
 void setProperty(java.lang.String key, java.lang.String value)
          Set a property into Global scope.
 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 org.xmlBlaster.client.script.XmlScriptInterpreter
buildMsgUnit, characters, dumpToFile, endCDATA, endElement, flushResponse, initialize, parse, replaceVariable, serialize, startCDATA, startElement, wrapForScripting, wrapForScripting, wrapForScripting, writeElementStart
 
Methods inherited from class org.xmlBlaster.util.SaxHandlerBase
comment, endDocument, endDTD, endEntity, endPrefixMapping, error, fatalError, getUseLexicalHandler, ignorableWhitespace, init, init, init, notationDecl, processingInstruction, setDocumentLocator, setUseLexicalHandler, skippedEntity, startDocument, startDTD, startEntity, startPrefixMapping, toString, toXml, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlScriptClient

public XmlScriptClient(Global glob,
                       I_XmlBlasterAccess access,
                       I_Callback callback,
                       java.util.HashMap attachments,
                       java.io.OutputStream out)
This constructor is the most generic one (more degrees of freedom)

Parameters:
glob - the global to use
access - the I_XmlBlasterAccess to use (can be different from the default given by the global.
callback - The I_Callback implementation to be used (you can provide your own desidered behaviour)
attachments - the attachments where to search when a content is stored in the attachment (with the 'link' attribute)
out - the OutputStream where to send the responses of the invocations done to xmlBlaster

XmlScriptClient

public XmlScriptClient(Global glob,
                       I_XmlBlasterAccess access,
                       java.io.OutputStream cbStream,
                       java.io.OutputStream responseStream,
                       java.util.HashMap attachments)
This is a convenience constructor which takes the default I_Callback implementation provided (StreamCallback).

Parameters:
glob - the global to use
access - the I_XmlBlasterAccess to use (can be different from the default given by the global.
cbStream - the OutputStream where to send the information coming in asynchroneously via the update method (could be different from the synchroneous output stream).
responseStream - the synchroneous OutputStream
attachments - the attachments where to find attached contents
See Also:
StreamCallback

XmlScriptClient

public XmlScriptClient(Global glob,
                       java.io.OutputStream out)
Convenience constructor which takes a minimal amount of parameters. The accessor taken is the one provided by the given global. The I_Callback implementation used is the StreamCallback. The asynchroneous output is sent to the same stream as the synchroneous one.

Parameters:
glob - the global to use. The I_XmlBlasterAccess will be taken from it.
Method Detail

registerMsgUnitCb

public void registerMsgUnitCb(I_MsgUnitCb msgUnitCb)
You can register a callback which can manipulate the MsgUnit just before it is sent.


setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
                 throws XmlBlasterException
Description copied from class: XmlScriptInterpreter
Set a property into Global scope.

Specified by:
setProperty in class XmlScriptInterpreter
Throws:
XmlBlasterException

fireMethod

public boolean fireMethod(MethodName methodName,
                          java.lang.String sessionId,
                          java.lang.String requestId,
                          byte type)
                   throws XmlBlasterException
Description copied from class: XmlScriptInterpreter
On each remote method invocation this function is called.

Specified by:
fireMethod in class XmlScriptInterpreter
Parameters:
methodName -
type - 'I'=invoke 'R'=response 'E'=exception
Returns:
true: The methodName was known and is successfully processed false: The methodName is not known and nothing is processed
Throws:
XmlBlasterException - Will lead to stop parsing further

main

public static void main(java.lang.String[] args)

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
Overrides:
update in class XmlScriptInterpreter
Parameters:
cbSessionId -
updateKey -
content -
updateQos -
Returns:
Throws:
XmlBlasterException

xmlBlaster 1.6.2 client API

Copyright © 1999-2007 The xmlBlaster.org contributers.