Public Member Functions

com::nmt::mgp::MgpSessionI Interface Reference

A session to the MGP Server. More...

Inheritance diagram for com::nmt::mgp::MgpSessionI:
com::nmt::mgp::MgpSession

List of all members.

Public Member Functions

void connect (String host, int port, boolean useSsl) throws MgpException
 Connect to the server.
void close () throws MgpException
 Clears the session by logging off from the server and closing the current connection.
void sendOperation (int operation, OptionHolder options, boolean doFlush) throws MgpException
 Send an operation to the EMG server.
void sendOperation (int operation, OptionHolder options) throws MgpException
 Send an operation to the EMG server.
int readOperation (OptionHolder options) throws MgpException
 Read an operation request from the server and store the options in the provided option holder.
int readResponse () throws MgpException
 Read the response to the last command sent to the EMG server.
OptionHolder execute (int operation, OptionHolder options) throws MgpException
 Send an operation with arguments to the EMG server, and wait for the response.
void login (String username, String password, String servicetype) throws MgpException
 Login to the server using username and password for authentication.
void login (String username, String password) throws MgpException
 Login to the server using username and password for authentication.
void logoff () throws MgpException
 Logoff from the server.
void reload () throws MgpException
 Reload the configuration on the server, while keeping the connection open.
int sendMessage (Message msg) throws MgpException
 Send a message.
int queryMessage (int id) throws MgpException
 Query the server for status of a message, identified by the specified id.
void deleteMessage (int id) throws MgpException
 Delete a message.
java.sql.ResultSet dbexec (String profile, String sql) throws MgpException, java.sql.SQLException
 Send an SQL string to be executed on the EMG server.
boolean isAdmin ()
 Returns whether user in session is an administrator.
int getAdminFlags ()
 Gets the full administration flags for the currently logged in user.
int getPermissions ()
 Gets the permissions for the currently logged in user.
boolean havePermission (int functions)
 Checks if the current user has all of the given permissions.
boolean havePermission (int mask, boolean all)
 Checks if the current user has any or all of the given permissions.
String getClientConfig ()
 Gets the client configuration string.
void setDebug (boolean on)
 Enables/disables runtime debug output.
OptionHolder getLoginOptions ()
 Gets the current login options.
String getRemoteIp ()
 The IP number of this client, as seen by the server.

Detailed Description

A session to the MGP Server.

When connected to the server it can be used to send and receive operations using MGP (Messaging Gateway Protocol). It provides a way to get information about the server as well as to send and receive messages.


Member Function Documentation

void com::nmt::mgp::MgpSessionI::close (  )  throws MgpException

Clears the session by logging off from the server and closing the current connection.

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::connect ( String  host,
int  port,
boolean  useSsl 
) throws MgpException

Connect to the server.

Parameters:
host the host name to connect to
port the port number to connect to
useSsl true if and only if the communication should use SSL
Exceptions:
MgpException if a communication error occurs

Implemented in com::nmt::mgp::MgpSession.

java.sql.ResultSet com::nmt::mgp::MgpSessionI::dbexec ( String  profile,
String  sql 
) throws MgpException, java.sql.SQLException

Send an SQL string to be executed on the EMG server.

Parameters:
profile the database profile name
sql the SQL string
Returns:
the selected data, or an empty ResultSet if the SQL didn't produce any data (such as an INSERT or UPDATE).

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::deleteMessage ( int  id  )  throws MgpException

Delete a message.

Shortcut for deleting the message identified by the specified id.

Returns message status on success, otherwise an MgpException is thrown.

Parameters:
id the unique identifier of the message, returned by sendMessage(Message)
Exceptions:
MgpException if the message isn't found on the server, or a communication error occurs

Implemented in com::nmt::mgp::MgpSession.

OptionHolder com::nmt::mgp::MgpSessionI::execute ( int  operation,
OptionHolder  options 
) throws MgpException

Send an operation with arguments to the EMG server, and wait for the response.

The implementation of this method should be synchronized to provide a simple multithread safe access point.

Parameters:
operation the operation number, as one of MGP_OP_* from Mgp
options the input parameters, to be sent to the server
Returns:
the returned parameters from the server
Exceptions:
MgpException if a communication error occurs

Implemented in com::nmt::mgp::MgpSession.

int com::nmt::mgp::MgpSessionI::getAdminFlags (  ) 

Gets the full administration flags for the currently logged in user.

Since:
MGP Java 1.5c

Implemented in com::nmt::mgp::MgpSession.

String com::nmt::mgp::MgpSessionI::getClientConfig (  ) 

Gets the client configuration string.

Implemented in com::nmt::mgp::MgpSession.

OptionHolder com::nmt::mgp::MgpSessionI::getLoginOptions (  ) 

Gets the current login options.

Implemented in com::nmt::mgp::MgpSession.

int com::nmt::mgp::MgpSessionI::getPermissions (  ) 

Gets the permissions for the currently logged in user.

The value is a combined bitmask of MGP_ACCESS_* from Mgp.

Since:
MGP Java 1.4

Implemented in com::nmt::mgp::MgpSession.

String com::nmt::mgp::MgpSessionI::getRemoteIp (  ) 

The IP number of this client, as seen by the server.

Implemented in com::nmt::mgp::MgpSession.

boolean com::nmt::mgp::MgpSessionI::havePermission ( int  functions  ) 

Checks if the current user has all of the given permissions.

See also:
havePermission(int, boolean)

Implemented in com::nmt::mgp::MgpSession.

boolean com::nmt::mgp::MgpSessionI::havePermission ( int  mask,
boolean  all 
)

Checks if the current user has any or all of the given permissions.

The permissions should be from the MGP_ACCESS_* constants in Mgp.

Parameters:
mask the bitmask of permissions
all true if all permissions must be present

Implemented in com::nmt::mgp::MgpSession.

boolean com::nmt::mgp::MgpSessionI::isAdmin (  ) 

Returns whether user in session is an administrator.

Deprecated:
As of MGP Java 1.4, use com.nmt.mgp.MgpSessionI#getPermissions() instead and check for the specific functionality.

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::login ( String  username,
String  password,
String  servicetype 
) throws MgpException

Login to the server using username and password for authentication.

Parameters:
username the EMG username, sent as Mgp#MGP_OPTION_USERNAME
password the EMG password, sent as Mgp#MGP_OPTION_PASSWORD
servicetype the systemtype, sent as Mgp#MGP_OPTION_SYSTEMTYPE
Exceptions:
MgpException if a communication error occurs

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::login ( String  username,
String  password 
) throws MgpException

Login to the server using username and password for authentication.

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::logoff (  )  throws MgpException

Logoff from the server.

Implemented in com::nmt::mgp::MgpSession.

int com::nmt::mgp::MgpSessionI::queryMessage ( int  id  )  throws MgpException

Query the server for status of a message, identified by the specified id.

Returns message status on success, otherwise an MgpException is thrown.

Parameters:
id the unique identifier of the message, returned by sendMessage(Message)
Exceptions:
MgpException if the message isn't found on the server, or a communication error occurs

Implemented in com::nmt::mgp::MgpSession.

int com::nmt::mgp::MgpSessionI::readOperation ( OptionHolder  options  )  throws MgpException

Read an operation request from the server and store the options in the provided option holder.

Parameters:
options an empty OptionHolder, which will get filled with the parameters to the operation
Exceptions:
MgpException if a communication error occurs
Deprecated:
Use com.nmt.mgp.MgpSessionI#execute instead.

Implemented in com::nmt::mgp::MgpSession.

int com::nmt::mgp::MgpSessionI::readResponse (  )  throws MgpException

Read the response to the last command sent to the EMG server.

Calls readOperation(OptionHolder), extracts the return code (Mgp.MGP_OPTION_RETCODE) and returns the value as an int.

Exceptions:
MgpException if an error occurs when reading from the stream
See also:
Mgp

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::reload (  )  throws MgpException

Reload the configuration on the server, while keeping the connection open.

Implemented in com::nmt::mgp::MgpSession.

int com::nmt::mgp::MgpSessionI::sendMessage ( Message  msg  )  throws MgpException

Send a message.

Destination address and message data is mandatory. This is checked before the message is sent. If the message is not valid an exception is thrown.

Returns the message id on success, otherwise an MgpException is thrown.

Parameters:
msg A message with message text, destination address etc set
Exceptions:
MgpException if a communication error occurs

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::sendOperation ( int  operation,
OptionHolder  options,
boolean  doFlush 
) throws MgpException

Send an operation to the EMG server.

Parameters:
operation the operation number, one of Mgp.MGP_OP_*
options the list of operation parameters
doFlush true if and only if the socket stream should be flushed after the operation
Deprecated:
Use com.nmt.mgp.MgpSessionI#execute instead.
See also:
Mgp

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::sendOperation ( int  operation,
OptionHolder  options 
) throws MgpException

Send an operation to the EMG server.

This is a simple overload to sendOperation(int,OptionHolder,boolean), with true used as the third argument.

Parameters:
operation the operation number, one of Mgp.MGP_OP_*
options the list of operation parameters
Deprecated:
Use com.nmt.mgp.MgpSessionI#execute instead.

Implemented in com::nmt::mgp::MgpSession.

void com::nmt::mgp::MgpSessionI::setDebug ( boolean  on  ) 

Enables/disables runtime debug output.

Parameters:
on true for debug out, false if not

Implemented in com::nmt::mgp::MgpSession.


The documentation for this interface was generated from the following file: