com.fxcm.messaging
Interface IUserSession


public interface IUserSession

Interface class that defines support of user session entity with predefined fields and behavior.
 


Field Summary
static String PIN
           
 
Method Summary
 void attach(String aSessionID, String aExtraParams)
          Attaches to an existing trading session.
 void close()
          Performs session logout and closes communication channels.
 void force()
          Forces immediate message retrieval on particular instance of User Session ignoring scheduled retrieval interval defined by setInterval() method.
 ISessionStatus getCurrentStatus()
          Obtains current Sesson Status
 
 String getHostParamValue(String aAttributeName)
          Obtains requested attribute value by attribute name from default host descriptor.
 IMessageFactory getMessageFactory()
          Obtains instance of message factory
 
 String getNextRequestID()
          Obtains new unque sequence number withing the session.
 Object getParameter(String aName)
          Retrieve the specified parameter value, null if empty.
 int getQueueSize()
          Obtains session message queue size
 
 String getSessionID()
          Returns session ID unique string
 String getStationParamValue(String aAttributeName)
          Obtains requested attribute value from station element from default host descriptor.
 TradingSessionDesc getTradingSession()
          Obtains descriptor if current Trading Session.
 int getUserID()
          Obtains unique id of user
 
 int getUserKind()
          Obtains code of user type
 
 boolean isClosed()
          Checks if session is closed
 boolean isValid()
          Checks if session is still valid
 
 boolean loadStationDescriptor()
          Loads station descriptor from server.
 boolean open()
          Performs session login and opens all communication channels.
 boolean open(String aExtraParams)
          Performs session login and opens all communication channels.
 void removeMessageListener(IUserMessageListener aListener)
          Un-Register IUserMessageListener from the session.
 void removeMessageListener(IUserTransportableListener aListener)
          Un-Register IUserMessageListener from the session.
 void removeSessionStatusListener(IUserSessionStatusListener aListener)
          Un-Register IUserSessionStatusListener from the session.
 TradingSessionDesc[] retrieveTradingSessions()
          Obtains list of trading session that is available to login.
 String send(IMessage aMessage)
          Sends posts/sends an IMessage to a server to be delivered to all interested parties.
 boolean setMessageListener(IUserMessageListener aListener)
          Register IUserMessageListener within the session.
 boolean setMessageListener(IUserTransportableListener aListener)
          Register IUserMessageListener within the session.
 void setMsgFlags(long aMsgFlags)
          Sets the message flags
 void setParameter(String aName, String aValue)
          Set a extra Parameter
 boolean setSessionStatusListener(IUserSessionStatusListener aListener)
          Register IUserSessionStatusListener within the session.
 void setTradingSession(TradingSessionDesc aTradingSession)
          Sets trading session
 

Field Detail

PIN

static final String PIN
See Also:
Constant Field Values
Method Detail

attach

void attach(String aSessionID,
            String aExtraParams)
            throws com.fxcm.GenericException
Attaches to an existing trading session. Attach is used when a new session will borrow credentials from the provided one. New session's life time is limited by the life time of session it was attached to.

Parameters:
aSessionID - Identifier of session to attach to. The session should be logged in already.
aExtraParams - extra parameters
Throws:
com.fxcm.GenericException - in case of any error

close

void close()
           throws com.fxcm.GenericException
Performs session logout and closes communication channels.
 

Throws:
com.fxcm.GenericException - in case of any error

force

void force()
Forces immediate message retrieval on particular instance of User Session ignoring scheduled retrieval interval defined by setInterval() method. This method has effect when UserSession uses "pull" base protocol (HTTP) as underline communication protocol.
 
If data is found on a server, the retrieved data messages are passed to method update() of registered IUserMessageListener within current session context.


getCurrentStatus

ISessionStatus getCurrentStatus()
Obtains current Sesson Status
 

Returns:
copy of current session status, null if session is not valid

getHostParamValue

String getHostParamValue(String aAttributeName)
Obtains requested attribute value by attribute name from default host descriptor.

Parameters:
aAttributeName - name of attribute.
Returns:
String value of attribute.

getMessageFactory

IMessageFactory getMessageFactory()
Obtains instance of message factory
 

Returns:
singleton instance

getNextRequestID

String getNextRequestID()
                        throws com.fxcm.GenericException
Obtains new unque sequence number withing the session.
 

Returns:
new sequence number
Throws:
com.fxcm.GenericException

getParameter

Object getParameter(String aName)
Retrieve the specified parameter value, null if empty.

Parameters:
aName -

getQueueSize

int getQueueSize()
Obtains session message queue size
 

Returns:
number of messages remaning in message queue, 0 if session is not valid

getSessionID

String getSessionID()
Returns session ID unique string

Returns:
session ID

getStationParamValue

String getStationParamValue(String aAttributeName)
Obtains requested attribute value from station element from default host descriptor.

Parameters:
aAttributeName - name of station attribute.
Returns:
String value of attribute.

getTradingSession

TradingSessionDesc getTradingSession()
Obtains descriptor if current Trading Session.

Returns:
TradingSessionDescripor of current Trading Session

getUserID

int getUserID()
Obtains unique id of user
 

Returns:
unique id of user

getUserKind

int getUserKind()
Obtains code of user type
 

Returns:
code of user type

isClosed

boolean isClosed()
Checks if session is closed

Returns:
true is session is closed; false otherwise

isValid

boolean isValid()
Checks if session is still valid
 

Returns:
true in case of active session; false otherwise

loadStationDescriptor

boolean loadStationDescriptor()
                              throws com.fxcm.GenericException
Loads station descriptor from server.

Returns:
true in case of success; false otherwise
Throws:
com.fxcm.GenericException

open

boolean open()
             throws com.fxcm.GenericException
Performs session login and opens all communication channels.

Returns:
true in case of success, false otherwise
Throws:
com.fxcm.GenericException - in case of any error

open

boolean open(String aExtraParams)
             throws com.fxcm.GenericException
Performs session login and opens all communication channels.

Returns:
true in case of success, false otherwise
Throws:
com.fxcm.GenericException - in case of any error

removeMessageListener

void removeMessageListener(IUserMessageListener aListener)
Un-Register IUserMessageListener from the session.
 

Parameters:
aListener - message listener to deassign

removeMessageListener

void removeMessageListener(IUserTransportableListener aListener)
Un-Register IUserMessageListener from the session.
 

Parameters:
aListener - message listener to deassign

removeSessionStatusListener

void removeSessionStatusListener(IUserSessionStatusListener aListener)
Un-Register IUserSessionStatusListener from the session.
 

Parameters:
aListener - status listener to remove

retrieveTradingSessions

TradingSessionDesc[] retrieveTradingSessions()
                                             throws com.fxcm.GenericException
Obtains list of trading session that is available to login.

Returns:
array of trading session
Throws:
com.fxcm.GenericException - in case of any error

send

String send(IMessage aMessage)
            throws com.fxcm.GenericException
Sends posts/sends an IMessage to a server to be delivered to all interested parties.
 

Parameters:
aMessage - message to send, correct user session ID will be overwritten with current one
Throws:
com.fxcm.GenericException - is thrown in case of any error

setMessageListener

boolean setMessageListener(IUserMessageListener aListener)
Register IUserMessageListener within the session.
 

Parameters:
aListener - message listener to assign
Returns:
true in case of sccess; false otherwise

setMessageListener

boolean setMessageListener(IUserTransportableListener aListener)
Register IUserMessageListener within the session.
 

Parameters:
aListener - message listener to assign
Returns:
true in case of sccess; false otherwise

setMsgFlags

void setMsgFlags(long aMsgFlags)
Sets the message flags

Parameters:
aMsgFlags - See IFixDefs.CHANNEL_* for possible values.

setParameter

void setParameter(String aName,
                  String aValue)
Set a extra Parameter

Parameters:
aName -
aValue -

setSessionStatusListener

boolean setSessionStatusListener(IUserSessionStatusListener aListener)
Register IUserSessionStatusListener within the session.
 

Parameters:
aListener - status listener to assign
Returns:
true in case of success; flase otherwise

setTradingSession

void setTradingSession(TradingSessionDesc aTradingSession)
Sets trading session

Parameters:
aTradingSession - Trading Session Descripor


Copyright © 2012 FXCM, LLC. All Rights Reserved.