org.marketcetera.util.ws.stateful
Class Client

java.lang.Object
  extended by org.marketcetera.util.ws.stateless.Node
      extended by org.marketcetera.util.ws.stateless.StatelessClient
          extended by org.marketcetera.util.ws.stateful.Client

public class Client
extends StatelessClient

A client node for stateful communication. Its (optional) application ID is that of the application which hosts the client. A session starts with login(String,char[]) and ends with logout().

Since:
1.0.0
Version:
$Id: Client.java 16154 2012-07-14 16:34:05Z colin $
Author:
tlerios@marketcetera.com

Field Summary
 
Fields inherited from class org.marketcetera.util.ws.stateless.Node
DEFAULT_HOST, DEFAULT_PORT
 
Constructor Summary
Client()
          Creates a new client node with the default server host name and port, and no client application ID.
Client(AppId appId)
          Creates a new client node with the default server host name and port, and the given client application ID.
Client(String host, int port, AppId appId)
          Creates a new client node with the given server host name, port, and client application ID.
Client(String inHost, int inPort, AppId inAppId, Class<?>... inContextClasses)
          Create a new Client instance.
 
Method Summary
 void assertValidSession()
          Asserts that an active session is in progress.
 ClientContext getContext()
          Returns a client context which the client must supply as an argument to every remote call made via proxies obtained from the receiver.
 SessionId getSessionId()
          Returns the receiver's session ID.
 void login(String user, char[] password)
          Initiates a new session using the given credentials.
 void logout()
          Ends an ongoing session.
 
Methods inherited from class org.marketcetera.util.ws.stateless.StatelessClient
fillContext, getAppId, getService
 
Methods inherited from class org.marketcetera.util.ws.stateless.Node
getConnectionUrl, getHost, getId, getPort, setHost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

public Client(String inHost,
              int inPort,
              AppId inAppId,
              Class<?>... inContextClasses)
Create a new Client instance.

Parameters:
inHost - a String value
inPort - an int value
inAppId - an AppId value
inContextClasses - a Class<?>... value

Client

public Client(String host,
              int port,
              AppId appId)
Creates a new client node with the given server host name, port, and client application ID.

Parameters:
host - The host name.
port - The port.
appId - The application ID, which may be null.

Client

public Client(AppId appId)
Creates a new client node with the default server host name and port, and the given client application ID.

Parameters:
appId - The application ID, which may be null.

Client

public Client()
Creates a new client node with the default server host name and port, and no client application ID.

Method Detail

getSessionId

public SessionId getSessionId()
Returns the receiver's session ID.

Returns:
The session ID, which may be null.

assertValidSession

public void assertValidSession()
                        throws I18NException
Asserts that an active session is in progress.

Throws:
I18NException - Thrown if an active session is not in progress.

login

public void login(String user,
                  char[] password)
           throws I18NException,
                  RemoteException
Initiates a new session using the given credentials.

Parameters:
user - The user name.
password - The password.
Throws:
I18NException - Thrown if a session is already in progress.
RemoteException - Thrown if the server is unable to complete the login operation.

logout

public void logout()
            throws RemoteException
Ends an ongoing session.

Throws:
RemoteException - Thrown if the server is unable to complete the logout operation.

getContext

public ClientContext getContext()
Description copied from class: StatelessClient
Returns a client context which the client must supply as an argument to every remote call made via proxies obtained from the receiver.

Overrides:
getContext in class StatelessClient
Returns:
The context.


Copyright © 2012. All Rights Reserved.