|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface MgpSessionI
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.
| Method Summary | |
|---|---|
void |
close()
Clears the session by logging off from the server and closing the current connection. |
void |
connect(java.lang.String host,
int port,
boolean useSsl)
Connect to the server. |
java.sql.ResultSet |
dbexec(java.lang.String profile,
java.lang.String sql)
Send an SQL string to be executed on the EMG server. |
void |
deleteMessage(int id)
Delete a message. |
OptionHolder |
execute(int operation,
OptionHolder options)
Send an operation with arguments to the EMG server, and wait for the response. |
int |
getAdminFlags()
Gets the full administration flags for the currently logged in user. |
java.lang.String |
getClientConfig()
Gets the client configuration string. |
OptionHolder |
getLoginOptions()
Gets the current login options. |
int |
getPermissions()
Gets the permissions for the currently logged in user. |
java.lang.String |
getRemoteIp()
The IP number of this client, as seen by the server. |
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. |
boolean |
isAdmin()
Deprecated. As of MGP Java 1.4, use getPermissions()
instead and check for the specific functionality. |
void |
login(java.lang.String username,
java.lang.String password)
Login to the server using username and password for authentication. |
void |
login(java.lang.String username,
java.lang.String password,
java.lang.String servicetype)
Login to the server using username and password for authentication. |
void |
logoff()
Logoff from the server. |
int |
queryMessage(int id)
Query the server for status of a message, identified by the specified id. |
int |
readOperation(OptionHolder options)
Deprecated. Use execute(int, com.nmt.mgp.OptionHolder) instead. |
int |
readResponse()
Read the response to the last command sent to the EMG server. |
void |
reload()
Reload the configuration on the server, while keeping the connection open. |
int |
sendMessage(Message msg)
Send a message. |
void |
sendOperation(int operation,
OptionHolder options)
Deprecated. Use execute(int, com.nmt.mgp.OptionHolder) instead. |
void |
sendOperation(int operation,
OptionHolder options,
boolean doFlush)
Deprecated. Use execute(int, com.nmt.mgp.OptionHolder) instead. |
void |
setDebug(boolean on)
Enables/disables runtime debug output. |
| Method Detail |
|---|
void connect(java.lang.String host,
int port,
boolean useSsl)
throws MgpException
host - the host name to connect toport - the port number to connect touseSsl - true if and only if the communication should use SSL
MgpException - if a communication error occurs
void close()
throws MgpException
MgpException
void sendOperation(int operation,
OptionHolder options,
boolean doFlush)
throws MgpException
execute(int, com.nmt.mgp.OptionHolder) instead.
operation - the operation number, one of Mgp.MGP_OP_*options - the list of operation parametersdoFlush - true if and only if the socket stream should be flushed
after the operation
MgpExceptionMgp
void sendOperation(int operation,
OptionHolder options)
throws MgpException
execute(int, com.nmt.mgp.OptionHolder) instead.
This is a simple overload to
sendOperation(int,OptionHolder,boolean),
with true used as the third argument.
operation - the operation number, one of Mgp.MGP_OP_*options - the list of operation parameters
MgpException
int readOperation(OptionHolder options)
throws MgpException
execute(int, com.nmt.mgp.OptionHolder) instead.
options - an empty OptionHolder, which will get filled
with the parameters to the operation
MgpException - if a communication error occurs
int readResponse()
throws MgpException
Calls readOperation(OptionHolder), extracts the return code
(Mgp.MGP_OPTION_RETCODE) and returns the value as an int.
MgpException - if an error occurs when reading from the streamMgp
OptionHolder execute(int operation,
OptionHolder options)
throws MgpException
operation - the operation number, as one of MGP_OP_*
from Mgpoptions - the input parameters, to be sent to the server
MgpException - if a communication error occurs
void login(java.lang.String username,
java.lang.String password,
java.lang.String servicetype)
throws MgpException
username - the EMG username, sent as Mgp.MGP_OPTION_USERNAMEpassword - the EMG password, sent as Mgp.MGP_OPTION_PASSWORDservicetype - the systemtype, sent as Mgp.MGP_OPTION_SYSTEMTYPE
MgpException - if a communication error occurs
void login(java.lang.String username,
java.lang.String password)
throws MgpException
MgpException
void logoff()
throws MgpException
MgpException
void reload()
throws MgpException
MgpException
int sendMessage(Message msg)
throws MgpException
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.
msg - A message with message text, destination address etc set
MgpException - if a communication error occurs
int queryMessage(int id)
throws MgpException
Returns message status on success, otherwise an MgpException is thrown.
id - the unique identifier of the message, returned by
sendMessage(Message)
MgpException - if the message isn't found on the server,
or a communication error occurs
void deleteMessage(int id)
throws MgpException
Shortcut for deleting the message identified by the specified id.
Returns message status on success, otherwise an MgpException is thrown.
id - the unique identifier of the message, returned by
sendMessage(Message)
MgpException - if the message isn't found on the server,
or a communication error occurs
java.sql.ResultSet dbexec(java.lang.String profile,
java.lang.String sql)
throws MgpException,
java.sql.SQLException
profile - the database profile namesql - the SQL string
INSERT
or UPDATE).
MgpException
java.sql.SQLExceptionboolean isAdmin()
getPermissions()
instead and check for the specific functionality.
int getAdminFlags()
int getPermissions()
The value is a combined bitmask of MGP_ACCESS_*
from Mgp.
boolean havePermission(int functions)
havePermission(int, boolean)
boolean havePermission(int mask,
boolean all)
MGP_ACCESS_*
constants in Mgp.
mask - the bitmask of permissionsall - true if all permissions must be presentjava.lang.String getClientConfig()
void setDebug(boolean on)
on - true for debug out, false if notOptionHolder getLoginOptions()
java.lang.String getRemoteIp()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||