public class Database extends cMsgSubdomainAdapter
UDL:
cMsg:cMsg://host:port/Database?driver=myDriver&url=myURL&account=myAccount&password=myPassword
Modifier and Type | Field and Description |
---|---|
(package private) java.sql.Connection |
myCon
database access objects.
|
(package private) java.sql.Statement |
myStmt |
Constructor and Description |
---|
Database() |
Modifier and Type | Method and Description |
---|---|
void |
addArrayListToPayload(java.lang.String name,
int type,
java.util.ArrayList al,
cMsgMessageFull msg)
Adds ArrayList to message payload.
|
void |
addDataToArrayList(java.sql.ResultSet rs,
int col,
int type,
java.util.ArrayList al)
Adds query result data to ArrayList.
|
void |
handleClientShutdown()
Method to handle a client or domain server (and therefore subdomain handler) shutdown.
|
void |
handleSendAndGetRequest(cMsgMessageFull msg)
Executes sql statement in message text field, returns resultset as payload arrays.
|
int |
handleSyncSendRequest(cMsgMessageFull msg)
Executes sql statement in message text field.
|
boolean |
hasSendAndGet()
Method to tell if the "sendAndGet" cMsg API function is implemented
by this interface implementation in the "handleSendAndGetRequest"
method.
|
boolean |
hasSyncSend()
Method to tell if the "syncSend" cMsg API function is implemented
by this interface implementation in the "handleSyncSendRequest"
method.
|
void |
registerClient(cMsgClientInfo info)
Creates separate database connection for each client connection.
|
void |
setUDLRemainder(java.lang.String UDLRemainder)
Method to give the subdomain handler the appropriate part
of the UDL the client used to talk to the domain server.
|
handleSendRequest, handleShutdownClientsRequest, handleSubscribeAndGetRequest, handleSubscribeRequest, handleUnSendAndGetRequest, handleUnsubscribeAndGetRequest, handleUnsubscribeRequest, hasSend, hasShutdown, hasSubscribe, hasSubscribeAndGet, hasUnsubscribe
java.sql.Connection myCon
java.sql.Statement myStmt
public boolean hasSyncSend()
hasSyncSend
in interface cMsgSubdomainInterface
hasSyncSend
in class cMsgSubdomainAdapter
public boolean hasSendAndGet()
hasSendAndGet
in interface cMsgSubdomainInterface
hasSendAndGet
in class cMsgSubdomainAdapter
public void setUDLRemainder(java.lang.String UDLRemainder) throws cMsgException
setUDLRemainder
in interface cMsgSubdomainInterface
setUDLRemainder
in class cMsgSubdomainAdapter
UDLRemainder
- last part of the UDL appropriate to the subdomain handlercMsgException
- neverpublic void registerClient(cMsgClientInfo info) throws cMsgException
registerClient
in interface cMsgSubdomainInterface
registerClient
in class cMsgSubdomainAdapter
info
- information about clientcMsgException
- upon errorpublic int handleSyncSendRequest(cMsgMessageFull msg) throws cMsgException
handleSyncSendRequest
in interface cMsgSubdomainInterface
handleSyncSendRequest
in class cMsgSubdomainAdapter
msg
- message from sendercMsgException
- always throws an exception since this is a dummy implementationpublic void handleSendAndGetRequest(cMsgMessageFull msg) throws cMsgException
handleSendAndGetRequest
in interface cMsgSubdomainInterface
handleSendAndGetRequest
in class cMsgSubdomainAdapter
msg
- Message to respond tocMsgException
- if error reading database or delivering message to clientpublic void addDataToArrayList(java.sql.ResultSet rs, int col, int type, java.util.ArrayList al)
rs
- ResultSet containing resultscol
- Column numbertype
- JDBC data typeal
- ArrayList to add topublic void addArrayListToPayload(java.lang.String name, int type, java.util.ArrayList al, cMsgMessageFull msg)
name
- Column nametype
- JDBC data typeal
- ArrayList containing resultsmsg
- Messagepublic void handleClientShutdown() throws cMsgException
handleClientShutdown
in interface cMsgSubdomainInterface
handleClientShutdown
in class cMsgSubdomainAdapter
cMsgException
- if sql error