xmlBlaster 2.2.0 client API

org.xmlBlaster.util.qos
Class ConnectQosData

java.lang.Object
  extended by org.xmlBlaster.util.qos.QosData
      extended by org.xmlBlaster.util.qos.ConnectQosData
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class ConnectQosData
extends QosData
implements java.io.Serializable, java.lang.Cloneable

This class encapsulates the qos of a login() or connect().

So you don't need to type the 'ugly' XML ASCII string by yourself. After construction access the ASCII-XML string with the toXml() method.
NOTE: This class is not synchronized and not Serializable (add these functionality when you need it)

See Also:
The interface.connect requirement, ConnectQosSaxFactory, org.xmlBlaster.test.classtest.ConnectQosTest, Serialized Form

Field Summary
protected  org.xmlBlaster.authentication.plugins.I_ClientPlugin clientPlugin
           
protected  java.util.ArrayList clientQueuePropertyList
          Holding queue properties for the client side invocation queue
protected  PropBoolean clusterNode
          Allows to mark that we are an xmlBlaster cluster node.
protected  PropBoolean duplicateUpdates
          If duplicateUpdates=false we will send only one update, even if the same client subscribed multiple times on the same message.
protected  I_ConnectQosFactory factory
           
protected  PluginLoader pMgr
           
protected  PropBoolean ptpAllowed
          PtP messages wanted? True is default

protected  PropBoolean reconnected
          Used for ConnetReturnQos only: If reconnected==true a client has reconnected to an existing session
protected  PropBoolean refreshSession
          If the client automatically notifies xmlBlaster that it is alive and the login session is extended
protected  org.xmlBlaster.authentication.plugins.I_SecurityQos securityQos
           
protected  java.lang.String serverInstanceId
           
protected  ServerRef[] serverRefArr
          The server reference, e.g.
protected  java.util.Vector serverRefVec
           
 
Fields inherited from class org.xmlBlaster.util.qos.QosData
DEFAULT_persistent, glob, rcvTimestamp, routeNodeList, routeNodes, serialData
 
Constructor Summary
ConnectQosData(Global glob)
          Constructor for client side.
ConnectQosData(Global glob, I_ConnectQosFactory factory, java.lang.String serialData, NodeId nodeId)
          Constructs the specialized quality of service object for a connect() or connect-return call.
ConnectQosData(Global glob, NodeId nodeId)
          Constructor for cluster server.
 
Method Summary
 void addAddress(Address address)
           
 void addCallbackAddress(CallbackAddress callback)
          Add a callback address where to send the message

Creates a default CbQueueProperty object to hold the callback address argument.

 boolean addClientQueueProperty(ClientQueueProperty prop)
          Adds a queue description.
 void addServerRef(ServerRef addr)
          Adds a server reference, we check for identical addresses to no contain duplicates.
 java.lang.Object clone()
          Returns a shallow clone, you can change safely all basic or immutable types like boolean, String, int.
 boolean contains(Address other)
          Does the given address belong to this client connection setup?
 boolean duplicateUpdates()
           
 PropBoolean duplicateUpdatesProp()
           
 void eraseClientQueueProperty()
          Usually done on server side as the server is not interested in it
 Address getAddress()
          The current connection address and properties of the xmlBlaster server we want connect to.
 Address[] getAddresses(boolean forceCbAddressCreation)
          The connection address and properties of the xmlBlaster server we want connect to.
protected  org.xmlBlaster.authentication.plugins.I_ClientPlugin getClientPlugin(java.lang.String type, java.lang.String version)
          Load a client side security plugin (for internal use only), is needed to create the security QoS string.
 java.lang.String getClientPluginType()
          Return the type of the referenced security plugin.
 java.lang.String getClientPluginVersion()
          Return the version of the referenced security plugin.
 ClientQueueProperty getClientQueueProperty()
          The current used (or the default) queue property
 ClientQueueProperty[] getClientQueuePropertyArr()
          At least one entry is delivered
 PropBoolean getClusterNodeProp()
           
 CallbackAddress getCurrentCallbackAddress()
          Access the currently used callback address.
 ConnectionStateEnum getInitialConnectionState()
          Returns the connection state directly after the connect() method returns (client side only).
 java.lang.String getInstanceId()
          Unique id of the xmlBlaster server (or a client), changes on each restart.
 PropBoolean getReconnectedProp()
           
 boolean getRefreshSession()
           
 PropBoolean getRefreshSessionProp()
           
 org.xmlBlaster.authentication.plugins.I_SecurityQos getSecurityQos()
           
 ServerRef getServerRef()
          Accessing the ServerRef address of the xmlBlaster server this may be a CORBA-IOR or email or URL ...
 ServerRef[] getServerRefs()
          Accessing the ServerRef addresses of the xmlBlaster server this may be a CORBA-IOR or email or URL ...
 CbQueueProperty getSessionCbQueueProperty()
          Returns never null
 SessionName getSessionName()
          Get our unique SessionName.
 SessionQos getSessionQos()
           
 CbQueueProperty getSubjectQueueProperty()
          The subjectQueue is exactly one instance for a subjectId (a loginName), it is used to hold the PtP messages send to this subject.
 java.lang.String getUserId()
           
 boolean hasAddress()
           
 boolean hasCallbackAddress()
           
 boolean hasSessionCbQueueProperty()
           
 boolean hasSubjectQueueProperty()
           
 boolean isClusterNode()
           
 boolean isPtpAllowed()
           
 PropBoolean isPtpAllowedProp()
           
 boolean isReconnected()
          Used for ConnetReturnQos only.
 org.xmlBlaster.authentication.plugins.I_ClientPlugin loadClientPlugin(java.lang.String type, java.lang.String version, java.lang.String userId, java.lang.String credential)
          Allows to set or overwrite the client side security plugin.
 boolean removeServerRef(ServerRef addr)
           
 boolean removeServerRef(java.lang.String type)
           
 void setAddress(Address address)
          Add an address to which we want to connect, with all the configured parameters.
 void setClusterNode(boolean clusterNode)
           
 void setDuplicateUpdates(boolean duplicateUpdates)
           
 void setInitialConnectionState(ConnectionStateEnum initialConnectionState)
          Set the connection state directly after the connect() (client side only).
 void setInstanceId(java.lang.String instanceId)
          Unique id of the xmlBlaster server (or a client), changes on each restart.
 void setPtpAllowed(boolean ptpAllowed)
           
 void setReconnected(boolean reconnected)
          Used for ConnetReturnQos only: If reconnected==true a client has reconnected to an existing session
 void setRefreshSession(boolean refreshSession)
           
 void setSecurityQos(org.xmlBlaster.authentication.plugins.I_SecurityQos securityQos)
          Force a security configuration.
 void setSessionCbQueueProperty(CbQueueProperty sessionCbQueueProperty)
           
 void setSessionName(SessionName sessionName)
          Set our unique SessionName.
 void setSubjectQueueProperty(CbQueueProperty subjectQueueProperty)
           
 void setUserId(java.lang.String userId)
          Allows to set or overwrite the login name for I_SecurityQos.
 int size()
          The number of bytes of stringified qos
 java.lang.String toString()
          Converts the data into a valid XML ASCII string.
 java.lang.String toXml()
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset, boolean forceReadable)
           
 java.lang.String toXml(java.lang.String extraOffset, java.util.Properties props)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class org.xmlBlaster.util.qos.QosData
addClientProperty, addClientProperty, addClientProperty, addClientProperty, addClientProperty, addClientProperty, addClientProperty, addClientProperty, addClientProperty, addClientProperty, addRouteInfo, clearRoutes, count, dirtyRead, getClientProperties, getClientProperty, getClientProperty, getClientProperty, getClientProperty, getClientProperty, getClientProperty, getClientProperty, getClientProperty, getClientProperty, getClientProperty, getClientPropertyArr, getContentCharset, getContentStr, getContentStrNoEx, getGlobal, getMethod, getNumRouteNodes, getPersistentProp, getRcvTime, getRcvTimestamp, getRcvTimestampNotNull, getRouteNodes, getSender, getState, getStateInfo, hasStateInfo, isAtMaster, isErase, isErased, isForwardError, isFromPersistenceRecovery, isFromPersistenceRecovery, isGet, isOk, isPersistent, isPublish, isSubscribe, isTimeout, isUnSubscribe, isUpdate, propertyExists, setGlobal, setMethod, setPersistent, setRcvTimestamp, setSender, setState, setStateInfo, touchRcvTimestamp, toXmlReadable, writePropertiesXml, writePropertiesXml
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

factory

protected transient I_ConnectQosFactory factory

ptpAllowed

protected PropBoolean ptpAllowed
PtP messages wanted? True is default

 <ptp>false<ptp/> 
 


clusterNode

protected PropBoolean clusterNode
Allows to mark that we are an xmlBlaster cluster node.


refreshSession

protected PropBoolean refreshSession
If the client automatically notifies xmlBlaster that it is alive and the login session is extended


duplicateUpdates

protected PropBoolean duplicateUpdates
If duplicateUpdates=false we will send only one update, even if the same client subscribed multiple times on the same message. Defaults to true.


reconnected

protected PropBoolean reconnected
Used for ConnetReturnQos only: If reconnected==true a client has reconnected to an existing session


serverInstanceId

protected java.lang.String serverInstanceId

pMgr

protected transient PluginLoader pMgr

clientPlugin

protected org.xmlBlaster.authentication.plugins.I_ClientPlugin clientPlugin

securityQos

protected org.xmlBlaster.authentication.plugins.I_SecurityQos securityQos

serverRefArr

protected transient ServerRef[] serverRefArr
The server reference, e.g. the CORBA IOR string or the XMLRPC url This is returned from XmlBlaster connect() and not used for login


serverRefVec

protected java.util.Vector serverRefVec

clientQueuePropertyList

protected transient java.util.ArrayList clientQueuePropertyList
Holding queue properties for the client side invocation queue

Constructor Detail

ConnectQosData

public ConnectQosData(Global glob)
               throws XmlBlasterException
Constructor for client side.

Throws:
XmlBlasterException

ConnectQosData

public ConnectQosData(Global glob,
                      I_ConnectQosFactory factory,
                      java.lang.String serialData,
                      NodeId nodeId)
               throws XmlBlasterException
Constructs the specialized quality of service object for a connect() or connect-return call. NOTE: The serialData is not parsed - use the factory for it. NOTE: The security plugin is not initialized, use loadClientPlugin() to do it

Parameters:
factory - The factory which knows how to serialize and parse me
serialData - The XML based ASCII string (syntax is described in requirement interface.connect)
nodeId - The node id with stripped special characters (see Global#getStrippedId)
Throws:
XmlBlasterException

ConnectQosData

public ConnectQosData(Global glob,
                      NodeId nodeId)
               throws XmlBlasterException
Constructor for cluster server.

Parameters:
nodeId - The the unique cluster node id, supports configuration per node
Throws:
XmlBlasterException
Method Detail

getSubjectQueueProperty

public CbQueueProperty getSubjectQueueProperty()
The subjectQueue is exactly one instance for a subjectId (a loginName), it is used to hold the PtP messages send to this subject.

The subjectQueue has never callback addresses, the addresses of the sessions are used if configured.

Returns:
never null.

setSubjectQueueProperty

public void setSubjectQueueProperty(CbQueueProperty subjectQueueProperty)

hasSubjectQueueProperty

public boolean hasSubjectQueueProperty()

getSessionCbQueueProperty

public CbQueueProperty getSessionCbQueueProperty()
Returns never null


setSessionCbQueueProperty

public void setSessionCbQueueProperty(CbQueueProperty sessionCbQueueProperty)

hasSessionCbQueueProperty

public boolean hasSessionCbQueueProperty()

setSecurityQos

public void setSecurityQos(org.xmlBlaster.authentication.plugins.I_SecurityQos securityQos)
Force a security configuration.

You can use loadClientPlugin() or setUserId() instead which loads the given/default security plugin and does a lookup in the environment.


loadClientPlugin

public org.xmlBlaster.authentication.plugins.I_ClientPlugin loadClientPlugin(java.lang.String type,
                                                                             java.lang.String version,
                                                                             java.lang.String userId,
                                                                             java.lang.String credential)
                                                                      throws XmlBlasterException
Allows to set or overwrite the client side security plugin.

The first goal is a proper connect QoS xml string for authentication.

The second goal is to intercept the messages for encryption (or whatever the plugin supports).

See xmlBlaster.properties, for example:

   Security.Client.DefaultPlugin=gui,1.0
   Security.Client.Plugin[gui][1.0]=org.xmlBlaster.authentication.plugins.gui.ClientSecurityHelper
 

<securityService type='simple' version='1.0'>...</securityService>

Parameters:
credential - passwd If null the environment -passwd is checked
Throws:
XmlBlasterException

setUserId

public void setUserId(java.lang.String userId)
               throws XmlBlasterException
Allows to set or overwrite the login name for I_SecurityQos.

Parameters:
userId - The unique user id (loginName)
Throws:
XmlBlasterException

getClientPlugin

protected org.xmlBlaster.authentication.plugins.I_ClientPlugin getClientPlugin(java.lang.String type,
                                                                               java.lang.String version)
                                                                        throws XmlBlasterException
Load a client side security plugin (for internal use only), is needed to create the security QoS string.

Parameters:
type - If null, the current plugin is used
Returns:
Throws:
XmlBlasterException

getSessionQos

public SessionQos getSessionQos()
Returns:
The session QoS, never null

getSessionName

public SessionName getSessionName()
Get our unique SessionName.

Returns:
The unique SessionName (never null)

setSessionName

public void setSessionName(SessionName sessionName)
Set our unique SessionName.


getServerRefs

public ServerRef[] getServerRefs()
Accessing the ServerRef addresses of the xmlBlaster server this may be a CORBA-IOR or email or URL ...

Only for results of connect() calls (used by clients)

Returns:
An array of ServerRef objects, containing the address and the protocol type If no serverRef available, return an array of 0 length

getServerRef

public ServerRef getServerRef()
Accessing the ServerRef address of the xmlBlaster server this may be a CORBA-IOR or email or URL ...

Only for results of connect() calls (used by clients)

Returns:
The first ServerRef object in the list, containing the address and the protocol type If no serverRef available we return null

addServerRef

public void addServerRef(ServerRef addr)
Adds a server reference, we check for identical addresses to no contain duplicates.


removeServerRef

public boolean removeServerRef(ServerRef addr)
Returns:
true If the entry was found and removed

removeServerRef

public boolean removeServerRef(java.lang.String type)
Returns:
true If the entry of protocol given by type was found and removed

setPtpAllowed

public void setPtpAllowed(boolean ptpAllowed)
Parameters:
Set - if we accept point to point messages

isPtpAllowed

public boolean isPtpAllowed()

isPtpAllowedProp

public PropBoolean isPtpAllowedProp()

setClusterNode

public void setClusterNode(boolean clusterNode)
Parameters:
Set - if we are a cluster node.

isClusterNode

public boolean isClusterNode()
Returns:
Are we a cluster?

getClusterNodeProp

public PropBoolean getClusterNodeProp()
Returns:
The isClusterNode flag object

getRefreshSession

public final boolean getRefreshSession()
Returns:
refreshSession is true if the client automatically notifies xmlBlaster that it is alive and the login session is extended

setRefreshSession

public final void setRefreshSession(boolean refreshSession)
Parameters:
refreshSession - true: The client automatically notifies xmlBlaster that it is alive and the login session is extended

getRefreshSessionProp

public PropBoolean getRefreshSessionProp()
Returns:
The isClusterNode flag object

setDuplicateUpdates

public void setDuplicateUpdates(boolean duplicateUpdates)
Parameters:
Set - if we allow multiple updates for the same message if we have subscribed multiple times to it.

duplicateUpdates

public boolean duplicateUpdates()
Returns:
true if we allow multiple updates for the same message if we have subscribed multiple times to it.

duplicateUpdatesProp

public PropBoolean duplicateUpdatesProp()

setReconnected

public void setReconnected(boolean reconnected)
Used for ConnetReturnQos only: If reconnected==true a client has reconnected to an existing session


isReconnected

public boolean isReconnected()
Used for ConnetReturnQos only.

Returns:
true A client has reconnected to an existing session

getReconnectedProp

public PropBoolean getReconnectedProp()

addAddress

public void addAddress(Address address)

setAddress

public void setAddress(Address address)
Add an address to which we want to connect, with all the configured parameters.

Parameters:
address - An object containing the protocol (e.g. EMAIL) the address (e.g. hugo@welfare.org) and the connection properties

getAddress

public Address getAddress()
The current connection address and properties of the xmlBlaster server we want connect to.

Returns:
never null

getAddresses

public Address[] getAddresses(boolean forceCbAddressCreation)
The connection address and properties of the xmlBlaster server we want connect to.

Returns:
never null

addClientQueueProperty

public boolean addClientQueueProperty(ClientQueueProperty prop)
Adds a queue description. This allows to set all supported attributes of a client side queue and an address to reach xmlBlaster

Parameters:
prop - The property object of the client side queue which shall be established.
Returns:
false if not accepted
See Also:
Address

getClientQueueProperty

public ClientQueueProperty getClientQueueProperty()
The current used (or the default) queue property

Returns:
Never null

hasAddress

public boolean hasAddress()

getClientQueuePropertyArr

public ClientQueueProperty[] getClientQueuePropertyArr()
At least one entry is delivered


contains

public boolean contains(Address other)
Does the given address belong to this client connection setup?


eraseClientQueueProperty

public void eraseClientQueueProperty()
Usually done on server side as the server is not interested in it


addCallbackAddress

public void addCallbackAddress(CallbackAddress callback)
Add a callback address where to send the message

Creates a default CbQueueProperty object to hold the callback address argument.

Parameters:
callback - An object containing the protocol (e.g. EMAIL) and the address (e.g. hugo@welfare.org)

hasCallbackAddress

public boolean hasCallbackAddress()

getCurrentCallbackAddress

public CallbackAddress getCurrentCallbackAddress()
Access the currently used callback address.

Returns:
can be null

getSecurityQos

public org.xmlBlaster.authentication.plugins.I_SecurityQos getSecurityQos()
Returns:
the login credentials or null if not set

getClientPluginType

public java.lang.String getClientPluginType()
Return the type of the referenced security plugin.

Returns:
The type or null if not known

getClientPluginVersion

public java.lang.String getClientPluginVersion()
Return the version of the referenced security plugin.

Returns:
The version or null if not known

getUserId

public java.lang.String getUserId()
Returns:
The user ID or "NoLoginName" if not known

getInitialConnectionState

public ConnectionStateEnum getInitialConnectionState()
Returns the connection state directly after the connect() method returns (client side only).

Returns:
Usually ConnectionStateEnum.ALIVE or ConnectionStateEnum.POLLING

setInitialConnectionState

public void setInitialConnectionState(ConnectionStateEnum initialConnectionState)
Set the connection state directly after the connect() (client side only).


size

public int size()
The number of bytes of stringified qos

Overrides:
size in class QosData
Returns:
The size in bytes of the data in XML form

getInstanceId

public java.lang.String getInstanceId()
Unique id of the xmlBlaster server (or a client), changes on each restart. If 'node/heron' is restarted, the instanceId changes.

Returns:
nodeId + timestamp, '/node/heron/instanceId/33470080380'

setInstanceId

public void setInstanceId(java.lang.String instanceId)
Unique id of the xmlBlaster server (or a client), changes on each restart. If 'node/heron' is restarted, the instanceId changes.

Parameters:
instanceId - e.g. '/node/heron/instanceId/33470080380'

toString

public java.lang.String toString()
Converts the data into a valid XML ASCII string.

Overrides:
toString in class java.lang.Object
Returns:
An XML ASCII string

toXml

public java.lang.String toXml()
Dump state of this object into a XML ASCII string.

Specified by:
toXml in class QosData

toXml

public java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of the connect QoS as a XML ASCII string

toXml

public java.lang.String toXml(java.lang.String extraOffset,
                              java.util.Properties props)
Description copied from class: QosData
Dump state of this object into a XML ASCII string.

Specified by:
toXml in class QosData
Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of the query as a XML ASCII string

toXml

public java.lang.String toXml(java.lang.String extraOffset,
                              boolean forceReadable)

clone

public java.lang.Object clone()
Returns a shallow clone, you can change safely all basic or immutable types like boolean, String, int. Currently TopicProperty and RouteInfo is not cloned (so don't change it)

Overrides:
clone in class QosData

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.