|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.nmt.mgp.ConnHandler
public class ConnHandler
Manage a connection to an EMG server.
Connection parameters are taken from the Settings class, using the following parameters.
host - the hostname of the server
user - the username valid for the server
pwd - the corresponding password
port - the IP port number
ssl - true if SSL should be used,
otherwise false
| Constructor Summary | |
|---|---|
ConnHandler(java.lang.String theHost,
java.lang.String theUser,
java.lang.String thePassword,
int thePort,
boolean withSsl)
Normal constructor. |
|
| Method Summary | |
|---|---|
java.sql.ResultSet |
dbexec(java.lang.String profile,
java.lang.String sql)
Sends an SQL string to the server, to be executed by the given database profile. |
OptionHolder |
execute(int operation,
OptionHolder options)
|
int |
getAdminFlags()
|
java.lang.String |
getClientConfig()
Returns the MGP option client_config. |
java.lang.String |
getHost()
|
OptionHolder |
getLoginOptions()
Gets the MGP options from the current MgpSession. |
java.lang.String |
getPassword()
|
int |
getPort()
|
java.lang.String |
getRemoteIp()
Returns the MGP option remoteip. |
java.lang.String |
getUser()
|
boolean |
havePermission(int mask,
boolean all)
Checks the permission of the currently logged in user. |
void |
init(java.lang.String str)
Sets the systemtype to be sent to the server. |
boolean |
isAdmin()
Returns true if and only if the current user has full administration rights. |
boolean |
isSsl()
|
void |
readOperation(OptionHolder oph)
Deprecated. Use MgpSessionI.execute(int, com.nmt.mgp.OptionHolder) instead. |
int |
sendMess(Message msg)
Send an MGP Message to the server. |
void |
sendOperation(int operand,
OptionHolder oph)
Sends an operation with parameters to the server. |
void |
sendOperation(int operand,
OptionHolder oph,
boolean doFlush)
Deprecated. Use MgpSessionI.execute(int, com.nmt.mgp.OptionHolder) instead. |
void |
sessionInvalidate()
Close the connection to the server. |
void |
setEmgDebug(boolean inBool)
Sets the debug level for the MgpSession, if any. |
boolean |
test()
Fetches the connection parameters from Setting, and calls test(String,int,String,String,boolean). |
boolean |
test(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pwd,
boolean ssl)
Close the current session, and reconnect. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConnHandler(java.lang.String theHost,
java.lang.String theUser,
java.lang.String thePassword,
int thePort,
boolean withSsl)
| Method Detail |
|---|
public void init(java.lang.String str)
str - the systemtypepublic void sessionInvalidate()
public OptionHolder getLoginOptions()
MgpSession.
public boolean isAdmin()
throws MgpException
MgpException - If a connection can't be made.
public int getAdminFlags()
throws MgpException
MgpException
public java.lang.String getClientConfig()
throws MgpException
client_config.
A connection to the server is made if necessary.
MgpException - If a connection can't be made.
public java.lang.String getRemoteIp()
throws MgpException
remoteip.
A connection to the server is made if necessary.
MgpException - If a connection can't be made.
public void sendOperation(int operand,
OptionHolder oph)
throws MgpException
operand - the operation numberoph - the parameters
MgpException - If a connection can't be made.
public void sendOperation(int operand,
OptionHolder oph,
boolean doFlush)
throws MgpException
MgpSessionI.execute(int, com.nmt.mgp.OptionHolder) instead.
operand - the operation numberoph - the parametersdoFlush - if the data should be flushed
MgpException - If a connection can't be made.
public void readOperation(OptionHolder oph)
throws MgpException
MgpSessionI.execute(int, com.nmt.mgp.OptionHolder) instead.
oph - the container to store the replies in
MgpException - the connection fails
public int sendMess(Message msg)
throws MgpException
Message to the server.
If an MgpException is caught, the connection is closed,
reopened, and a second attempt is made.
No third attempt is made.
msg - the message to send
MgpException - if anything is wrong with the message or
the connection can't be established.
public java.sql.ResultSet dbexec(java.lang.String profile,
java.lang.String sql)
throws MgpException
profile - the database profile namesql - the sql string
MgpException - if the connection failes, or there is
something wrong with the sql statement
public OptionHolder execute(int operation,
OptionHolder options)
throws MgpException
MgpException
public boolean havePermission(int mask,
boolean all)
throws MgpException
mask - the bitmask of permissionsall - if all bits must match
MgpException - if the connection failes
public boolean test()
throws MgpException,
java.io.IOException,
java.lang.Exception
test(String,int,String,String,boolean).
MgpException
java.io.IOException
java.lang.Exception
public boolean test(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pwd,
boolean ssl)
throws MgpException
MgpExceptionpublic void setEmgDebug(boolean inBool)
public final java.lang.String getHost()
public final java.lang.String getPassword()
public final int getPort()
public final boolean isSsl()
public final java.lang.String getUser()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||