org.xmlBlaster.test.classtest
Class XmlScriptInterpreterTest.TestAccessor
java.lang.Object
org.xmlBlaster.client.protocol.AbstractCallbackExtended
org.xmlBlaster.client.XmlBlasterAccess
org.xmlBlaster.test.classtest.XmlScriptInterpreterTest.TestAccessor
- All Implemented Interfaces:
- I_Callback, I_CallbackRaw, I_ConnectionHandler, I_XmlBlasterAccess, I_CallbackExtended, I_XmlBlaster, XmlBlasterAccessMBean, I_ConnectionStatusListener, I_PostSendListener
- Enclosing class:
- XmlScriptInterpreterTest
public class XmlScriptInterpreterTest.TestAccessor
- extends XmlBlasterAccess
Methods inherited from class org.xmlBlaster.client.XmlBlasterAccess |
connect, createStorageId, createSynchronousCache, createTemporaryTopic, createTemporaryTopic, createTemporaryTopic, disconnect, erase, forcePollingForTesting, get, getBuildJavaVendor, getBuildJavaVersion, getBuildTimestamp, getCached, getCbServer, getConnectionQueueId, getConnectionQueueMaxMsgs, getConnectionQueueNumMsgs, getConnectionState, getConnectQos, getConnectReturnQos, getContextNode, getDispatcherActive, getDispatchStatistic, getFileDumper, getGlobal, getId, getLogId, getLoginDate, getLoginName, getNumErase, getNumGet, getNumPublish, getNumSubscribe, getNumUnSubscribe, getNumUpdate, getNumUpdateOneway, getPingRoundTripDelay, getPluginUsage, getPublicSessionId, getQueue, getRevisionNumber, getRoundTripDelay, getSecurityPlugin, getServerNodeId, getSessionName, getState, getStorageIdStr, getToDeadXmlBlasterException, getUpdateListener, getUptime, getUserObject, getVersion, initCbServer, invokeErase, invokeGet, invokePublish, invokeSubscribe, invokeUnSubscribe, isAlive, isCallbackConfigured, isCallbackDispatcherActive, isConnected, isDead, isPolling, isShutdown, leaveServer, leaveServer, lostConnection, main, peekClientMessages, peekClientMessagesToFile, ping, postSend, publishOneway, publishStream, receive, refreshSession, registerConnectionListener, registerPostSendListener, request, sendAdministrativeCommand, sendingFailed, setCallbackDispatcherActive, setClientErrorHandler, setDispatcherActive, setServerNodeId, setStorageIdStr, setUpdateListener, setUserObject, subscribe, subscribe, subscribe, toAlive, toAliveSync, toDead, toPolling, toXml, toXml, unSubscribe, update, usage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
doRemoteCalls
private boolean doRemoteCalls
key
private java.lang.String key
qos
private java.lang.String qos
content
private byte[] content
XmlScriptInterpreterTest.TestAccessor
public XmlScriptInterpreterTest.TestAccessor(Global global,
boolean doRemoteCalls)
getQos
public java.lang.String getQos()
getKey
public java.lang.String getKey()
getContent
public byte[] getContent()
connect
public ConnectReturnQos connect(ConnectQos qos,
I_Callback callback)
throws XmlBlasterException
- Description copied from interface:
I_XmlBlasterAccess
- Login to xmlBlaster.
Connecting with the default configuration (which checks xmlBlaster.properties and
your command line arguments):
import org.xmlBlaster.util.Global;
...
I_XmlBlasterAccess xmlBlasterAccess = glob.getXmlBlasterAccess();
xmlBlasterAccess.connect(null, null);
The default behavior is to poll automatically for the server if it is not found.
As we have not specified a listener for returned messages from the server there
is no callback server created.
This example shows how to configure different behavior:
// Example how to configure fail safe settings
ConnectQos connectQos = new ConnectQos(glob);
Address address = new Address(glob);
address.setDelay(4000L); // retry connecting every 4 sec
address.setRetries(-1); // -1 == forever
address.setPingInterval(0L); // switched off
addr.setType("SOCKET"); // don't use CORBA protocol, but use SOCKET instead
connectQos.setAddress(address);
CallbackAddress cbAddress = new CallbackAddress(glob);
cbAddress.setDelay(4000L); // retry connecting every 4 sec
cbAddress.setRetries(-1); // -1 == forever
cbAddress.setPingInterval(4000L); // ping every 4 seconds
connectQos.addCallbackAddress(cbAddress);
xmlBlasterAccess.connect(connectQos, new I_Callback() {
public String update(String cbSessionId, UpdateKey updateKey, byte[] content,
UpdateQos updateQos) {
if (updateKey.isInternal()) {
return "";
}
if (updateQos.isErased()) {
return "";
}
log.info(ME, "Receiving asynchronous message '" + updateKey.getOid() +
"' state=" + updateQos.getState() + " in default handler");
return "";
}
}); // Login to xmlBlaster, default handler for updates;
- Specified by:
connect
in interface I_XmlBlasterAccess
- Overrides:
connect
in class XmlBlasterAccess
- Parameters:
qos
- Your configuration desirecallback
- If not null a callback server will be created and
callback messages will be routed to your updateListener.update() method.
- Returns:
- Can only be null if '-dispatch/connection/doSendConnect false' was set
- Throws:
XmlBlasterException
- only if connection state is DEAD, typically thrown on wrong configurations.
You must call connect again with different settings.- See Also:
I_XmlBlasterAccess.connect(ConnectQos, I_Callback)
subscribe
public SubscribeReturnQos subscribe(java.lang.String key,
java.lang.String qos)
throws XmlBlasterException
- Specified by:
subscribe
in interface I_XmlBlaster
- Overrides:
subscribe
in class XmlBlasterAccess
- Throws:
XmlBlasterException
- See Also:
I_XmlBlasterAccess.subscribe(SubscribeKey, SubscribeQos)
unSubscribe
public UnSubscribeReturnQos[] unSubscribe(java.lang.String key,
java.lang.String qos)
throws XmlBlasterException
- Specified by:
unSubscribe
in interface I_XmlBlaster
- Overrides:
unSubscribe
in class XmlBlasterAccess
- Throws:
XmlBlasterException
- See Also:
I_XmlBlasterAccess.unSubscribe(UnSubscribeKey, UnSubscribeQos)
publish
public PublishReturnQos publish(MsgUnit msgUnit)
throws XmlBlasterException
- Specified by:
publish
in interface I_XmlBlasterAccess
- Specified by:
publish
in interface I_XmlBlaster
- Overrides:
publish
in class XmlBlasterAccess
- Throws:
XmlBlasterException
- See Also:
I_XmlBlasterAccess.publish(MsgUnit)
publishArr
public PublishReturnQos[] publishArr(MsgUnit[] msgUnits)
throws XmlBlasterException
- Specified by:
publishArr
in interface I_XmlBlaster
- Overrides:
publishArr
in class XmlBlasterAccess
- Throws:
XmlBlasterException
get
public MsgUnit[] get(java.lang.String key,
java.lang.String qos)
throws XmlBlasterException
- Specified by:
get
in interface I_XmlBlaster
- Overrides:
get
in class XmlBlasterAccess
- Throws:
XmlBlasterException
- See Also:
I_XmlBlasterAccess.get(GetKey, GetQos)
erase
public EraseReturnQos[] erase(java.lang.String key,
java.lang.String qos)
throws XmlBlasterException
- Specified by:
erase
in interface I_XmlBlaster
- Overrides:
erase
in class XmlBlasterAccess
- Throws:
XmlBlasterException
- See Also:
I_XmlBlasterAccess.erase(EraseKey, EraseQos)
disconnect
public boolean disconnect(DisconnectQos qos)
- Description copied from interface:
I_XmlBlasterAccess
- Logout from the server.
Behavior on client side:
Destroys pending tail back messages in the client queue
and destroys low level connection and callback server.
You can customize the behavior with disconnectQos.
Behavior on server side:
The server side session resources are destroyed, pending messages are deleted.
NOTE: If you want to keep all resources on server side for this login session
but want to halt your client,
shutdown the callback server with leaveServer(null)
and throw the xmlBlasterAccess instance away.
This is often the case if the client disappears and at a later point wants
to reconnect. On server side the queue for this session remains alive and
collects messages.
If '-dispatch/connection/doSendConnect false' was set call disconnect() nevertheless
to cleanup client side resources.
- Specified by:
disconnect
in interface I_XmlBlasterAccess
- Overrides:
disconnect
in class XmlBlasterAccess
- Parameters:
qos
- Describe the desired behavior on disconnect
- Returns:
- false if connect() wasn't called before or if you call disconnect() multiple times
- See Also:
I_XmlBlasterAccess.disconnect(DisconnectQos)
,
interface.disconnect requirement
Copyright © 1999-2014 The xmlBlaster.org contributers.