de.cau.cs.kieler.kwebs.client.ui
Class AbstractServerBasedJob

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.core.internal.jobs.InternalJob
          extended by org.eclipse.core.runtime.jobs.Job
              extended by de.cau.cs.kieler.kwebs.client.ui.AbstractServerBasedJob
All Implemented Interfaces:
Comparable, IAdaptable
Direct Known Subclasses:
CheckAvailabilityJob, ServerDetailsJob

public abstract class AbstractServerBasedJob
extends Job

This is an abstract job with the support for testing the servers availability.

Rating red

Field Summary
 
Fields inherited from class org.eclipse.core.runtime.jobs.Job
ASYNC_FINISH, BUILD, DECORATE, INTERACTIVE, LONG, NONE, RUNNING, SHORT, SLEEPING, WAITING
 
Fields inherited from class org.eclipse.core.internal.jobs.InternalJob
manager
 
Constructor Summary
protected AbstractServerBasedJob(String jobName, Shell theparentShell, ServerConfigData theserverConfig)
          Creates a Job.
 
Method Summary
protected abstract  void available(ILayoutServiceClient client, String message)
          Called by this job if the server is available.
protected  boolean checkAvailability()
          Runs the job and checks for service availability.
protected  ServerConfigData getServerConfig()
          Returns the server configuration used for this job.
protected  Shell getShell()
          Returns the shell used for this job.
protected  void processError(Throwable throwable)
          Can be used by sub classes to display errors occurred during execution.
protected  void processMessage(String title, String message)
          Can be used by sub classes to display messages during execution.
protected abstract  void unavailable(ILayoutServiceClient client, String message)
          Called by this job if the server is not available.
 
Methods inherited from class org.eclipse.core.runtime.jobs.Job
addJobChangeListener, belongsTo, cancel, canceling, done, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, removeJobChangeListener, run, schedule, schedule, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, toString, wakeUp, wakeUp, yieldRule
 
Methods inherited from class org.eclipse.core.internal.jobs.InternalJob
compareTo
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

AbstractServerBasedJob

protected AbstractServerBasedJob(String jobName,
                                 Shell theparentShell,
                                 ServerConfigData theserverConfig)
Creates a Job.

Parameters:
jobName - the name of the job
theparentShell - the parent shell
theserverConfig - the server configuration to be tested
Method Detail

getShell

protected Shell getShell()
Returns the shell used for this job.

Returns:
the shell used for this job

getServerConfig

protected ServerConfigData getServerConfig()
Returns the server configuration used for this job.

Returns:
the server configuration used for this job

checkAvailability

protected boolean checkAvailability()
Runs the job and checks for service availability. Display a message box with the result of the test.

Parameters:
monitor - the progress monitor used
Returns:
whether the service is available

processError

protected void processError(Throwable throwable)
Can be used by sub classes to display errors occurred during execution.

Parameters:
throwable - the throwable occurred

processMessage

protected void processMessage(String title,
                              String message)
Can be used by sub classes to display messages during execution.

Parameters:
title - the title of the message
message - the message to display

available

protected abstract void available(ILayoutServiceClient client,
                                  String message)
Called by this job if the server is available.

Parameters:
client - the layout service client used
message - detailed message

unavailable

protected abstract void unavailable(ILayoutServiceClient client,
                                    String message)
Called by this job if the server is not available. The client is not safe to use, it may have been disconnected. Sub classes shall not try to reconnect to the service with it.

Parameters:
client - the layout service client used
message - detailed message