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, hasUnsubscribejava.sql.Connection myCon
java.sql.Statement myStmt
public boolean hasSyncSend()
hasSyncSend in interface cMsgSubdomainInterfacehasSyncSend in class cMsgSubdomainAdapterpublic boolean hasSendAndGet()
hasSendAndGet in interface cMsgSubdomainInterfacehasSendAndGet in class cMsgSubdomainAdapterpublic void setUDLRemainder(java.lang.String UDLRemainder)
throws cMsgException
setUDLRemainder in interface cMsgSubdomainInterfacesetUDLRemainder in class cMsgSubdomainAdapterUDLRemainder - last part of the UDL appropriate to the subdomain handlercMsgException - neverpublic void registerClient(cMsgClientInfo info) throws cMsgException
registerClient in interface cMsgSubdomainInterfaceregisterClient in class cMsgSubdomainAdapterinfo - information about clientcMsgException - upon errorpublic int handleSyncSendRequest(cMsgMessageFull msg) throws cMsgException
handleSyncSendRequest in interface cMsgSubdomainInterfacehandleSyncSendRequest in class cMsgSubdomainAdaptermsg - message from sendercMsgException - always throws an exception since this is a dummy implementationpublic void handleSendAndGetRequest(cMsgMessageFull msg) throws cMsgException
handleSendAndGetRequest in interface cMsgSubdomainInterfacehandleSendAndGetRequest in class cMsgSubdomainAdaptermsg - 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 cMsgSubdomainInterfacehandleClientShutdown in class cMsgSubdomainAdaptercMsgException - if sql error