Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
public class QeemonoConnection
This class simplifies the communication with the Qeemono Server
Constructor Summary | |
---|---|
QeemonoConnection()
Creates and opens a new connection to the Qeemono Server The client ID will be randomly assigned |
|
QeemonoConnection(java.lang.String clientId)
Creates and opens a new connection to the Qeemono Server |
Method Summary | |
---|---|
void |
close()
Closes the connection to the Qeemono Server Must be called at the of the program. |
java.lang.String |
getClientId()
Every connection has a client ID |
org.json.JSONObject |
getResponse()
Blocks until a server response came in, then returns this response as JSONObject |
org.json.JSONObject |
getResponse(long timeout)
Blocks until a server response came in, then returns this response as JSONObject |
static void |
main(java.lang.String[] args)
Tests the connection and prints out the result |
void |
send(org.json.JSONObject json)
Sends a JSONObject to the server |
static boolean |
testConnection()
Tests the connection to the Qeemono Server |
static boolean |
testConnection(boolean throwException)
Tests the connection to the Qeemono Server |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QeemonoConnection() throws java.io.IOException
java.io.IOException
- If server connection could not be establishedpublic QeemonoConnection(java.lang.String clientId) throws java.io.IOException
clientId
- The client Id to use for this connection. The clientId must be composed of a-z,A-Z,0-9,- or _
java.io.IOException
- If server connection could not be establishedMethod Detail |
---|
public static boolean testConnection()
public static boolean testConnection(boolean throwException) throws java.lang.Exception
throwException
- if true, this methods throws errors as exception, if false, they are suppressed
java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- ignored
java.lang.Exception
- if there was an connection exceptionpublic void close()
public java.lang.String getClientId()
public void send(org.json.JSONObject json) throws java.io.IOException
json
- The JSONObject to send
java.io.IOException
- If something did not work...public org.json.JSONObject getResponse() throws java.io.IOException
java.io.IOException
- If something did not workpublic org.json.JSONObject getResponse(long timeout) throws java.io.IOException
the
- timeout in milliseconds
java.io.IOException
- If something did not work