Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.deegree.portal.owswatch
Class ServiceWatcher

    java.lang.Object
      java.lang.Thread
          org.deegree.portal.owswatch.ServiceWatcher

All Implemented Interfaces:
  Serializable, Runnable

    public class ServiceWatcher

extends Thread
implements Serializable

Mail class of this framework. Its called upon starting tomcat to start watching services and test them regularly according to their test intervals and logs the result through its service invoker

Version:
  $Revision: 20271 $, $Date: 2009-10-21 13:07:15 +0200 (Mi, 21. Okt 2009) $
Author:
  Moataz Elmasry, last edited by: $Author: jmays $
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class java.lang.Thread
`Thread.State, Thread.UncaughtExceptionHandler`

Field Summary

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`ServiceWatcher()`

Method Summary
`protected void` | `addActiveService(ServiceConfiguration service)` Adds an active service to the list of active services.
`void` | `addService(ServiceConfiguration service, ServiceLog servicelog)` adds a new Service to the ServiceList
`void` | `compileDownTimeReport(String webinfPath, OwsWatchConfig conf)` This function is called on starting tomcat.
`boolean` | `containsService(int serviceId)`
`protected String` | `createDownTimeReportBody(Hashtable<Integer,String> missedTests)` Create the content of the down time time report
`void` | `execute(int serviceId)` executes the given service one time in the main thread
`ServiceConfiguration` | `getService(int serviceId)` returns the service identified by its Id in the serviceList
`List<ServiceConfiguration>` | `getServiceList()` returns list of services being watched
`Map<ServiceConfiguration,ServiceLog>` | `getServiceLogs()`
`Map<Integer,ServiceConfiguration>` | `getServices()`
`boolean` | `isThreadsuspended()`
`void` | `refreshAllServices()` RefreshAllServices executes all the requests in the active monitors, and subtract the time from those who are waiting in line and restarts the time for those who had a turn This is the default to be called during the regular tests.
`ServiceConfiguration` | `removeService(int serviceId)` removes the service identify by -id- from the ServiceList
`void` | `run()`
`void` | `setThreadsuspended(boolean threadsuspended)`
`void` | `startServiceConfiguration(int serviceId)` This method will set the threadSuspended vaiable to false in order for the id-th service to restart sending requests
`void` | `stopServiceConfiguration(int serviceId)` This method will set the threadSuspended vaiable to true in order for the id-th service to stop sending GetCapabilities requests
`protected void` | `writeAndSendTimeDownEmail(Hashtable<Integer,String> missedTests, OwsWatchConfig conf)` Authors the down time report and sends it to the designated users

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ServiceWatcher

    public ServiceWatcher()

Method Detail

### run

    public void run()

  Specified by:
    `run` in interface `Runnable`
  Overrides:
    `run` in class `Thread`

### addService

    public void addService(ServiceConfiguration service,
                           ServiceLog servicelog)

  adds a new Service to the ServiceList

  Parameters:
    `service` -
    `servicelog` -

### addActiveService

    protected void addActiveService(ServiceConfiguration service)

  Adds an active service to the list of active services. It also sets when the first test should take place. This is useful to start tests at :00 :15 :30 minutes etc..

  Parameters:
    `service` -

### getService

    public ServiceConfiguration getService(int serviceId)

  returns the service identified by its Id in the serviceList

  Parameters:
    `serviceId` -
  Returns:
    ServiceConfiguration

### removeService

    public ServiceConfiguration removeService(int serviceId)

  removes the service identify by -id- from the ServiceList

  Parameters:
    `serviceId` -
  Returns:
    new ServiceConfiguration

### stopServiceConfiguration

    public void stopServiceConfiguration(int serviceId)

  This method will set the threadSuspended vaiable to true in order for the id-th service to stop sending GetCapabilities requests

  Parameters:
    `serviceId` -

### startServiceConfiguration

    public void startServiceConfiguration(int serviceId)

  This method will set the threadSuspended vaiable to false in order for the id-th service to restart sending requests

  Parameters:
    `serviceId` -

### containsService

    public boolean containsService(int serviceId)

  Parameters:
    `serviceId` -
  Returns:
    true if the currrent Service id at all exists in watcher, false otherwise

### getServiceList

    public List<ServiceConfiguration> getServiceList()

  returns list of services being watched

  Returns:
    the serviceList

### refreshAllServices

    public void refreshAllServices()

  RefreshAllServices executes all the requests in the active monitors, and subtract the time from those who are waiting in line and restarts the time for those who had a turn This is the default to be called during the regular tests. If you want to execute tests in the main thread and without affecting the regular tests executeTest(int) and executeall()

### execute

    public void execute(int serviceId)

  executes the given service one time in the main thread

  Parameters:
    `serviceId` -

### compileDownTimeReport

    public void compileDownTimeReport(String webinfPath,
                                      OwsWatchConfig conf)

  This function is called on starting tomcat. It checks when was the last test performed before tomcat was shutdown. and sends an email to the user, notifying him with the situation and that a number of tests have been missed

  Parameters:
    `webinfPath` - WEB-INF folder path
    `conf` - owsWatch configuration instance

### writeAndSendTimeDownEmail

    protected void writeAndSendTimeDownEmail(Hashtable<Integer,String> missedTests,
                                             OwsWatchConfig conf)

  Authors the down time report and sends it to the designated users

  Parameters:
    `missedTests` - a hastable containing the missed tests
    `conf` - owsWatchConfiguration

### createDownTimeReportBody

    protected String createDownTimeReportBody(Hashtable<Integer,String> missedTests)

  Create the content of the down time time report

  Parameters:
    `missedTests` -
  Returns:
    the down time report

### getServices

    public Map<Integer,ServiceConfiguration> getServices()

  Returns:
    A map of all services

### getServiceLogs

    public Map<ServiceConfiguration,ServiceLog> getServiceLogs()

  Returns:
    Map key = ServiceConfiguration id

### isThreadsuspended

    public boolean isThreadsuspended()

  Returns:
    true if thread is suspended, false otherwise

### setThreadsuspended

    public void setThreadsuspended(boolean threadsuspended)

  Parameters:
    `threadsuspended` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org