Class Client

  • All Implemented Interfaces:
    UsesPort

    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 17411 2017-04-28 14:50:38Z colin $
    Author:
    tlerios@marketcetera.com
    • Field Detail

      • username

        private String username
        username value
    • Constructor Detail

      • Client

        public Client​(String inHost,
                      int inPort,
                      AppId inAppId,
                      ContextClassProvider inContextClassProvider)
        Create a new Client instance.
        Parameters:
        inHost - a String value
        inPort - an int value
        inAppId - an AppId value
        inContextClassProvider - a ContextClassProvider 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

      • getUsername

        public String getUsername()
        Get the username value.
        Returns:
        a String value
      • setUsername

        private void setUsername​(String inUsername)
        Sets the username value.
        Parameters:
        inUsername - a String value
      • setSessionId

        private void setSessionId​(SessionId sessionId)
        Sets the receiver's session ID to the given one.
        Parameters:
        sessionId - The session ID, which may be null.
      • 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.