Class CommunicationTask

java.lang.Object
  |
  +--CommunicationTask

public class CommunicationTask
extends java.lang.Object

CommunicationTask does the communication with the servlet. It is instantiated with a ServletCommRequest and a URL to the servlet. When start() is called it connects to the servlet on the given URL and creates an InputStream for getting the ServletCommResponse.


Constructor Summary
CommunicationTask(ServletCommRequest screq, java.lang.String servletURL)
          Constructor for creating a CommunicationTask
 
Method Summary
 boolean done()
          Checks if the task is done.
 int getCurrent()
          Gets the current progress of the task
 java.lang.String getError()
          Gets the description of the error occured
 java.lang.String getErrorTitle()
          Gets the title of the error occured
 int getLengthOfTask()
          Gets the maximum length of the task
 java.lang.String getMessage()
          Gets the current status message of the task
 ServletCommResponse getResponse()
          Gets the response from the servlet If the response is empty (null) or if the response was unsuccessfully executed, a popup window with the error is shown.
 void showError(java.lang.String error, java.lang.String title)
          Pops up a window showing the given error.
 void start()
          Starts the communication as a thread of an ActualTask.
 void stop()
          Stops the communication and sets the current progress to it's maximum value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommunicationTask

public CommunicationTask(ServletCommRequest screq,
                         java.lang.String servletURL)
Constructor for creating a CommunicationTask
Parameters:
screq - The request that should be sent.
servletURL - The URL that the request should be sent to
Method Detail

start

public void start()
Starts the communication as a thread of an ActualTask. It waits in a while loop until the ActualTask is done.

stop

public void stop()
Stops the communication and sets the current progress to it's maximum value

done

public boolean done()
Checks if the task is done.
Returns:
is the tas done?

getLengthOfTask

public int getLengthOfTask()
Gets the maximum length of the task
Returns:
the total length of the task

getCurrent

public int getCurrent()
Gets the current progress of the task
Returns:
current progress of the task

getMessage

public java.lang.String getMessage()
Gets the current status message of the task
Returns:
current status message of the task

getError

public java.lang.String getError()
Gets the description of the error occured
Returns:
the description of the error occured

getErrorTitle

public java.lang.String getErrorTitle()
Gets the title of the error occured
Returns:
the title of the error occured

getResponse

public ServletCommResponse getResponse()
Gets the response from the servlet If the response is empty (null) or if the response was unsuccessfully executed, a popup window with the error is shown.
Returns:
the response from the servlet If the response was null a ServletCommResponse is returned with the error text "No response from servlet!"

showError

public void showError(java.lang.String error,
                      java.lang.String title)
Pops up a window showing the given error.
Parameters:
error - The error
title - The title of the error