Impl date time trigger and updated Zutil
This commit is contained in:
parent
90c1dd7e37
commit
1338f20624
2 changed files with 26 additions and 12 deletions
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
<target name="build-dependencies">
|
||||
<mkdir dir="${buildDir}" />
|
||||
<get src="http://ci.koc.se/jenkins/job/Zutil/142/artifact/build/release/Zutil.jar"
|
||||
<get src="http://ci.koc.se/jenkins/job/Zutil/146/artifact/build/release/Zutil.jar"
|
||||
dest="${libDir}" verbose="true" usetimestamp="true"/>
|
||||
</target>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +1,48 @@
|
|||
package se.hal.trigger;
|
||||
|
||||
import se.hal.intf.HalTrigger;
|
||||
import zutil.CronTimer;
|
||||
import zutil.ui.Configurator;
|
||||
import zutil.ui.Configurator.PreConfigurationActionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class DateTimeTrigger implements HalTrigger {
|
||||
public class DateTimeTrigger implements HalTrigger,PreConfigurationActionListener {
|
||||
|
||||
@Configurator.Configurable("Minute (Cron format)")
|
||||
private String minute = "";
|
||||
private String minute = "00";
|
||||
@Configurator.Configurable("Hour (Cron format)")
|
||||
private String hour = "";
|
||||
private String hour = "12";
|
||||
@Configurator.Configurable("Day of the Month (Cron format)")
|
||||
private String dayOfMonth = "";
|
||||
@Configurator.Configurable("Month of the Year (Cron format)")
|
||||
private String monthOfYear = "";
|
||||
@Configurator.Configurable("Day of the Week (Cron format)")
|
||||
private String dayOfWeek = "";
|
||||
private String dayOfMonth = "*";
|
||||
@Configurator.Configurable("Month (1-12 or Cron format)")
|
||||
private String month = "*";
|
||||
@Configurator.Configurable("Day of the Week (1-7 or Cron format)")
|
||||
private String dayOfWeek = "*";
|
||||
@Configurator.Configurable("Year (Cron format)")
|
||||
private String year = "";
|
||||
private String year = "*";
|
||||
|
||||
private transient CronTimer cronTimer;
|
||||
private transient long timeOut = -1;
|
||||
|
||||
|
||||
@Override
|
||||
public void preConfigurationAction(Configurator configurator, Object obj) {
|
||||
cronTimer = new CronTimer(minute, hour, dayOfMonth, month, dayOfWeek, year);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean evaluate() {
|
||||
return false;
|
||||
if (cronTimer == null)
|
||||
return false;
|
||||
if (timeOut < 0)
|
||||
reset();
|
||||
return timeOut < System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
|
||||
timeOut = cronTimer.next();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue