Package lumis.portal.clock
Class ClockManager
- java.lang.Object
-
- lumis.portal.clock.ClockManager
-
- All Implemented Interfaces:
IClockManager
,IClockManagerSPI
public class ClockManager extends java.lang.Object implements IClockManagerSPI
- Since:
- 4.0.0
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description ClockManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
add(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction)
Add a clock.void
addOrUpdate(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction)
Update the configuration of a clock.void
checkSchedule(SessionConfig sessionConfig, ITransaction transaction)
This method is called at regular intervals by the framework.void
delete(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction)
Delete a clock.void
disable(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction)
Set the "False" value to the enable property of a clock.void
enable(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction)
Set the "True" value to the enable property of a clock.void
executeSchedule(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction)
Deprecated.void
executeSchedule(ClockConfig clockConfig)
Executes a clock implementation.ClockConfig
get(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction)
Get the configuration of the clock.java.util.Collection<java.lang.String>
getClockIdsByServiceId(SessionConfig sessionConfig, java.lang.String serviceId, ITransaction transaction)
Return the Ids of all clocks registered for the specified service.java.util.Collection<ClockConfig>
getDisabledClocks(ITransaction transaction)
Get disabled clocks.java.util.Collection<ClockConfig>
getRunningClocks(long timeSpent, ITransaction transaction)
Get clocks running longer than a specific time in milliseconds.java.util.Collection<ClockConfig>
getRunningClocksInHalfMaxRunTime(ITransaction transaction)
Get clocks running longer than half of its configured maximum run time.boolean
isPortalClockRunning(SessionConfig sessionConfig, ITransaction transaction)
Verify if the portal clock is running.boolean
setRunning(SessionConfig sessionConfig, java.lang.String clockId, boolean running, ITransaction transaction)
Sets the running status of a clock in the database.void
update(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction)
Update the configuration of a clock.
-
-
-
Method Detail
-
checkSchedule
public void checkSchedule(SessionConfig sessionConfig, ITransaction transaction) throws ManagerException, PortalException
This method is called at regular intervals by the framework. The interval period can be configured in the portal config file. For each clockId, a database lock shoud be created to prevent long running clockHandlers to be called repeatedly before they finish. If in the process of handling a clockId, another request for the same clockId needs to be processed, ignore the new request.- Specified by:
checkSchedule
in interfaceIClockManager
- Throws:
ManagerException
PortalException
-
executeSchedule
@Deprecated public void executeSchedule(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction) throws ManagerException, PortalException
Deprecated.Description copied from interface:IClockManager
Execute a registered clock.- Specified by:
executeSchedule
in interfaceIClockManager
- Throws:
ManagerException
PortalException
-
executeSchedule
public void executeSchedule(ClockConfig clockConfig) throws PortalException
Description copied from interface:IClockManager
Executes a clock implementation. Updates the clock scheduling information, such as next run time, accordingly.- Specified by:
executeSchedule
in interfaceIClockManager
- Parameters:
clockConfig
- the clock configuration.- Throws:
PortalException
-
add
public java.lang.String add(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Add a clock.- Specified by:
add
in interfaceIClockManager
- Returns:
- Returns a String.
- Throws:
ManagerException
PortalException
-
addOrUpdate
public void addOrUpdate(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Update the configuration of a clock. If the clock don't exist, it is added to the clock pool.- Specified by:
addOrUpdate
in interfaceIClockManager
- Throws:
ManagerException
PortalException
-
update
public void update(SessionConfig sessionConfig, ClockConfig clockConfig, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Update the configuration of a clock.- Specified by:
update
in interfaceIClockManager
- Throws:
ManagerException
PortalException
-
delete
public void delete(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Delete a clock.- Specified by:
delete
in interfaceIClockManager
- Throws:
ManagerException
PortalException
-
enable
public void enable(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Set the "True" value to the enable property of a clock. If the value of enable property is true the clock will be running.- Specified by:
enable
in interfaceIClockManager
- Throws:
ManagerException
PortalException
-
disable
public void disable(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Set the "False" value to the enable property of a clock. If the value of enable property is false the clock is disable.- Specified by:
disable
in interfaceIClockManager
- Throws:
ManagerException
PortalException
-
get
public ClockConfig get(SessionConfig sessionConfig, java.lang.String clockId, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Get the configuration of the clock.- Specified by:
get
in interfaceIClockManager
- Returns:
- Returns a ClockConfig.
- Throws:
ManagerException
PortalException
-
isPortalClockRunning
public boolean isPortalClockRunning(SessionConfig sessionConfig, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Verify if the portal clock is running.- Specified by:
isPortalClockRunning
in interfaceIClockManager
- Returns:
- Returns true if the portal clock is running and false otherwise.
- Throws:
ManagerException
PortalException
-
setRunning
public boolean setRunning(SessionConfig sessionConfig, java.lang.String clockId, boolean running, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Sets the running status of a clock in the database. Used mainly by the ClockThreadPool class. This method creates it's own transaction.- Specified by:
setRunning
in interfaceIClockManager
- Returns:
- Returns true if the clock running and false otherwise.
- Throws:
ManagerException
PortalException
-
getClockIdsByServiceId
public java.util.Collection<java.lang.String> getClockIdsByServiceId(SessionConfig sessionConfig, java.lang.String serviceId, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IClockManager
Return the Ids of all clocks registered for the specified service.- Specified by:
getClockIdsByServiceId
in interfaceIClockManager
serviceId
- The Id of the service whose clocks you want to return.- Returns:
- A collection of Strings containing the Ids of the clocks associated with the specified service.
- Throws:
ManagerException
PortalException
-
getDisabledClocks
public java.util.Collection<ClockConfig> getDisabledClocks(ITransaction transaction) throws PortalException
Description copied from interface:IClockManagerSPI
Get disabled clocks.- Specified by:
getDisabledClocks
in interfaceIClockManagerSPI
- Returns:
- the disabled clocks, or an empty collection if all are enabled.
- Throws:
PortalException
-
getRunningClocks
public java.util.Collection<ClockConfig> getRunningClocks(long timeSpent, ITransaction transaction) throws PortalException
Description copied from interface:IClockManagerSPI
Get clocks running longer than a specific time in milliseconds.- Specified by:
getRunningClocks
in interfaceIClockManagerSPI
- Parameters:
timeSpent
- minimum time in milliseconds that the clock has been running.transaction
- transaction for persistence access.- Returns:
- the clocks, or an empty collection if none matches the criteria.
- Throws:
PortalException
-
getRunningClocksInHalfMaxRunTime
public java.util.Collection<ClockConfig> getRunningClocksInHalfMaxRunTime(ITransaction transaction) throws PortalException
Description copied from interface:IClockManagerSPI
Get clocks running longer than half of its configured maximum run time.- Specified by:
getRunningClocksInHalfMaxRunTime
in interfaceIClockManagerSPI
- Parameters:
transaction
- transaction for persistence access.- Returns:
- the clocks, or an empty collection if none matches the criteria.
- Throws:
PortalException
-
-