org.openuat.channel.http
Class CommPlain

java.lang.Object
  extended by org.openuat.channel.http.CommPlain
All Implemented Interfaces:
java.lang.Runnable, ifComm

public class CommPlain
extends java.lang.Object
implements ifComm

Author:
Christoph Egger Must be run as a thread!!! Example: comm = new Comm(); Thread commThread = new Thread(comm); commThread.start(); Additional, the calling object must also be run as thread! In the run() method of the calling object, "this.wait()" has to be called, and in the "handleStringEvent" method, "this.notify()" has to be called, which stops the waiting in the run() method. Further work has to be done triggered by the run() method.

Constructor Summary
CommPlain()
          Standard Constructor
CommPlain(java.lang.String _serverLocation)
          Constructor updating the location of the server
 
Method Summary
 java.lang.String getLog()
           
 void getMsg(java.lang.String _folder, ifListener _guest)
          Triggers the reception of all message from a specific folder.
 void getMsgSince(java.lang.String _folder, int _time, ifListener _guest)
          Triggers the reception of all messages which were sent starting at a specific time untul now from a specific folder.
 void getSince()
          Called by the run method when the reception of messages, sent at a specific time until now is triggered by getMsgSince
 void run()
          Run method of the Thread.
 void send()
          Called by the run method when sending of a message, is triggered by sendMsg
 void sendMsg(java.lang.String _folder, java.lang.String _msg, ifListener _guest)
          Triggers sending of a message
 void setServerLocation(java.lang.String _serverLocation)
          Updates the location of the server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommPlain

public CommPlain()
Standard Constructor


CommPlain

public CommPlain(java.lang.String _serverLocation)
Constructor updating the location of the server

Parameters:
_serverLocation - location of the server where the put.php and get.php scripts lie
Method Detail

getLog

public java.lang.String getLog()

setServerLocation

public void setServerLocation(java.lang.String _serverLocation)
Updates the location of the server

Parameters:
_serverLocation - location of the server where the put.php and get.php scripts lie

getMsg

public void getMsg(java.lang.String _folder,
                   ifListener _guest)
Triggers the reception of all message from a specific folder.

implementation of ifComm

Specified by:
getMsg in interface ifComm
Parameters:
_folder - folder name where the desired messages are
_guest - calling application thread
See Also:
ifComm

getMsgSince

public void getMsgSince(java.lang.String _folder,
                        int _time,
                        ifListener _guest)
Triggers the reception of all messages which were sent starting at a specific time untul now from a specific folder.

implementation of ifComm

Specified by:
getMsgSince in interface ifComm
Parameters:
_folder - folder name where the desired messages are
_time - starting time, oldest wanted message
_guest - calling application thread
See Also:
ifComm

getSince

public void getSince()
Called by the run method when the reception of messages, sent at a specific time until now is triggered by getMsgSince

See Also:
Comm#run(), Comm#getMsgSince(String, int , ifListener)

sendMsg

public void sendMsg(java.lang.String _folder,
                    java.lang.String _msg,
                    ifListener _guest)
Triggers sending of a message

Specified by:
sendMsg in interface ifComm
Parameters:
_folder - folder name where the message shall be placed
_msg - message to send
_guest - calling application thread

send

public void send()
Called by the run method when sending of a message, is triggered by sendMsg

See Also:
Comm#run(), Comm#sendMsg(String, String, ifListener)

run

public void run()
Run method of the Thread.

calls the specific methods when a notify() is send by another thread.

Specified by:
run in interface java.lang.Runnable


2005-2009, Rene Mayrhofer.