SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


edu.bonn.cs.oose.qeemono
Class QeemonoConnection


public class QeemonoConnection
extends java.lang.Object

This class simplifies the communication with the Qeemono Server

Author:
Mark von Zeschau and Pascal Bihler

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

QeemonoConnection

public QeemonoConnection()
                  throws java.io.IOException
Creates and opens a new connection to the Qeemono Server The client ID will be randomly assigned

Throws:
java.io.IOException - If server connection could not be established

QeemonoConnection

public QeemonoConnection(java.lang.String clientId)
                  throws java.io.IOException
Creates and opens a new connection to the Qeemono Server

Parameters:
clientId - The client Id to use for this connection. The clientId must be composed of a-z,A-Z,0-9,- or _
Throws:
java.io.IOException - If server connection could not be established
Method Detail

testConnection

public static boolean testConnection()
Tests the connection to the Qeemono Server

Returns:
true if the connection could be established, false otherwise

testConnection

public static boolean testConnection(boolean throwException)
                              throws java.lang.Exception
Tests the connection to the Qeemono Server

Parameters:
throwException - if true, this methods throws errors as exception, if false, they are suppressed
Returns:
true if the connection could be established, false otherwise
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Tests the connection and prints out the result

Parameters:
args - ignored
Throws:
java.lang.Exception - if there was an connection exception

close

public void close()
Closes the connection to the Qeemono Server Must be called at the of the program.


getClientId

public java.lang.String getClientId()
Every connection gets a random client ID

Returns:
the client ID of this connection

send

public void send(org.json.JSONObject json)
          throws java.io.IOException
Sends a JSONObject to the server

Parameters:
json - The JSONObject to send
Throws:
java.io.IOException - If something did not work...

getResponse

public org.json.JSONObject getResponse()
                                throws java.io.IOException
Blocks until a server response came in, then returns this response as JSONObject

Returns:
the next server response
Throws:
java.io.IOException - If something did not work

getResponse

public org.json.JSONObject getResponse(long timeout)
                                throws java.io.IOException
Blocks until a server response came in, then returns this response as JSONObject

Parameters:
the - timeout in milliseconds
Returns:
the next server response, null if no response until timeout
Throws:
java.io.IOException - If something did not work

teaching/lectures/oose/2012/blattx/javadoc.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2021