Session

com.kesoftware.imu.Session

com.kesoftware.imu.Session

Since: 1.0

Description

Manages a connection to an IMu server.

The server’s host name and port can be specified by setting properties on the object or by setting class-based default properties.

Class Properties

Method

Details

defaultHost

The name of the host to connect to if no object-specific host has been supplied.

Getter:

String getDefaultHost()

Setter:

setDefaultHost(String value)

defaultPort

The number of the port on the host if no object-specific port has been supplied.

Getter:

int getDefaultPort()

Setter:

setDefaultPort(int value)

Constructors

Constructor

Details

Session(host, port)

Session(String host, int port)

Creates a Session object with the specified host and port.

Parameters:

host (String)

The host to connect to.

port (int)

The port on the host to connect on.

Session(host)

Session(String host)

Creates a Session object with the specified host.

The port to connect on will be taken from the defaultPort class property.

Parameters:

host (String)

The host to connect to.

Session(port)

Session(int port)

Creates a Session object with the specified port.

The host to connect to will be taken from the defaultHost class property.

Parameters:

port (int)

The port on the host to connect on.

Session()

Session()

Creates a Session object.

The host to connect to will be taken from the defaultHost class property.

The port to connect on will be taken from the defaultPort class property.

Properties

Property

Details

close

A flag controlling whether the connection to the server should be closed after the next request. This flag is passed to the server as part of the next request to allow it to clean up.

Getter:

boolean getClose()

Setter:

setClose(boolean value)

context

The unique identifier assigned by the server to the current session.

Getter:

String getContext()

Setter:

setContext(String value)

host

The name of the host to connect to. Setting this property after the connection has been established has no effect.

Getter:

String getHost()

Setter:

setHost(String value)

port

The number of the port on the host to connect to. Setting this property after the connection has been established has no effect.

Getter:

int getPort()

Setter:

setPort(int value)

suspend

A flag controlling whether the server process handling this session should begin listening on a distinct, process-specific port to ensure a new session connects to the same server process.

This is part of IMu's mechanism for maintaining state. If this flag is set to true, then after the next request is made to the server, the Session's port property will be altered to the process specific port number.

Getter:

boolean getSuspend()

Setter:

setSuspend(boolean value)

Methods

Property

Details

connect()

void connect()

Open a connection to an IMu server.

Returns:

void

 

Throws:

IMuException

The connection could not be opened.

disconnect()

void disconnect()

Closes the connection to the IMu server.

Returns:

void

 

login(login, password, spawn)

Map login(String login, String password, boolean spawn)

Logs in as the given user with the given password.

The password parameter may be null. This will cause the server to use server-side authentication (such as .rhosts authentication) to authenticate the user.

Parameters:

login (String)

The name of the user to login as.

password (String)

The user's password for authentication.

spawn (boolean)

A flag indicating whether the process should create a new child process specifically for handling the newly logged in user's requests.

Returns:

Map

 

Throws:

IMuException

The login request failed.

Exception

A low-level socket error occurred.

login(login, password)

Map login(String login, String password)

Logs in as the given user with the given password.

The password parameter may be null. This will cause the server to use server-side authentication (such as .rhosts authentication) to authenticate the user.

Spawn defaults to true causing the server to create a new child process specifically for handling the newly logged in user's requests.

Parameters:

login (String)

The name of the user to login as.

password (String)

The user's password for authentication.

Returns:

Map

 

Throws:

IMuException

The login request failed.

Exception

A low-level socket error occurred.

login(login)

Map login(String login)

Logs in as the given user.

Uses server-side authentication (such as .rhosts authentication) to authenticate the user.

The server will spawn a new child process specifically for handling the newly logged in user's requests.

Parameters:

login (String)

The name of the user to login as.

Returns:

Map

 

Throws:

IMuException

The login request failed.

Exception

A low-level socket error occurred.

logout()

Map logout()

Logs the user out of the server.

Returns:

Map

 

request(request)

Map request(Map request)

Submits a low-level request to the IMu server.

Parameters:

request (Map)

A Map object containing the request parameters.

Returns:

Map

A Map object containing the server's response.

Throws:

IMuException

A server-side error occurred.