Right Java tools for J2EE, Web Service, Grid and more
|Home | Products | Documents | Downloads | Purchase | Support | Company | Partners | Contact |

com.acelet.s.watchdog
Class WatchdogControl

java.lang.Object
  extended by com.acelet.s.watchdog.WatchdogControl

public class WatchdogControl
extends java.lang.Object

Copyright Acelet Corp. 2001 - 2003. All rights reserved

The WatchdogControl is a utility class for SuperWatchdog. It is used for control watchdog and chores from Java program, either from EJB or other Java application.
The methods are very simple, powerful and less error prone.

Version:
1.10, 2003.01.20

Field Summary
static int STATUS_STANDBY
          STATUS_SUSPENDED is an int for using as status value.
static int STATUS_SUSPENDED
          STATUS_SUSPENDED is an int for using as status value.
 
Constructor Summary
WatchdogControl(LogAgent logAgent, java.sql.Connection choreConnection)
          Constructor for WatchdogControl.
 
Method Summary
 int changeChoreStatus(java.lang.String choreName, int newStatus)
          changeChoreStatus changed the status for a chore.
 int deleteChore(java.lang.String choreName)
          deleteChore deletes the chore from chore database.
 void requestRunChore(java.lang.String choreName)
          requestRunChore request SuperWatchdog to run the chore.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_STANDBY

public static final int STATUS_STANDBY
STATUS_SUSPENDED is an int for using as status value.

See Also:
Constant Field Values

STATUS_SUSPENDED

public static final int STATUS_SUSPENDED
STATUS_SUSPENDED is an int for using as status value.

See Also:
Constant Field Values
Constructor Detail

WatchdogControl

public WatchdogControl(LogAgent logAgent,
                       java.sql.Connection choreConnection)
                throws java.lang.Exception
Constructor for WatchdogControl.

Parameters:
choreConnection - The connection to chore database.
logAgent - The LogAgent.
Throws:
Exception.
java.lang.Exception
See Also:
It should be set as auto-commit
Method Detail

changeChoreStatus

public int changeChoreStatus(java.lang.String choreName,
                             int newStatus)
                      throws java.lang.Exception
changeChoreStatus changed the status for a chore. It takes effect immediately. There will be a log message recording the change.

Parameters:
choreName - the name of the chore.
newStatus - the new status. It can be either STATUS_STANDBY or STATUS_SUSPENDED
Returns:
the number of rows changed. It is 1, if successful, 0 otherwise.
Throws:
Exception.
java.lang.Exception

deleteChore

public int deleteChore(java.lang.String choreName)
                throws java.lang.Exception
deleteChore deletes the chore from chore database. It takes effect immediately. There will be a log message recording the change.

Parameters:
choreName - the name of the chore.
Returns:
the number of rows deleted. It is 1, if successful, 0 otherwise.
Throws:
Exception.
java.lang.Exception

requestRunChore

public void requestRunChore(java.lang.String choreName)
                     throws java.lang.Exception
requestRunChore request SuperWatchdog to run the chore. A Doer will take the request and run the chore.

Parameters:
choreName - the name of the chore.
Throws:
Exception.
java.lang.Exception

Copyright Acelet Corporation. 2000-2008. All rights reserved.