本文整理汇总了Java中org.edgexfoundry.domain.meta.Schedule类的典型用法代码示例。如果您正苦于以下问题:Java Schedule类的具体用法?Java Schedule怎么用?Java Schedule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Schedule类属于org.edgexfoundry.domain.meta包,在下文中一共展示了Schedule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void createScheduleContext(Schedule schedule)
{
synchronized (scheduleContextQueue)
{
if(scheduleIdToScheduleContextMap.containsKey(schedule.getId())) {
// not intended to be an error
logger.info("schedule context " + schedule.getId() + " '" + schedule.getName() + "' already exists.");
} else {
// build a new schedule context
ScheduleContext scheduleContext = new ScheduleContext(schedule);
// store a mapping of schedule id to schedule context
scheduleIdToScheduleContextMap.put(schedule.getId(), scheduleContext);
// enqueue the context
scheduleContextQueue.add(scheduleContext);
logger.info("created schedule context " + scheduleContext.getInfo()
+ " initial start time " + scheduleContext.getNextTime().toString());
}
}
}
示例2: updateScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void updateScheduleContext(Schedule schedule)
{
synchronized (scheduleContextQueue)
{
if(!scheduleIdToScheduleContextMap.containsKey(schedule.getId())) {
// not intended to be an error
logger.error("failed to find schedule for " + schedule.getId() + " " + schedule.getName());
} else {
// remove the schedule context from the queue
scheduleContextQueue.remove(scheduleIdToScheduleContextMap.get(schedule.getId()));
// update the schedule
scheduleIdToScheduleContextMap.get(schedule.getId()).reset(schedule);
// enqueue the context
ScheduleContext scheduleContext = scheduleIdToScheduleContextMap.get(schedule.getId());
scheduleContextQueue.add(scheduleContext);
logger.info("updated schedule " + scheduleContext.getInfo()
+ " initial start time " + scheduleContext.getNextTime().toString());
}
}
}
示例3: addScheduleEventToScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void addScheduleEventToScheduleContext(ScheduleEvent scheduleEvent)
{
synchronized (scheduleContextQueue)
{
// get the schedule for the event
Schedule schedule = scheduleClient.scheduleForName(scheduleEvent.getSchedule());
if(schedule == null) {
logger.error("failed to add schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName() + "' " +
"schedule '" + scheduleEvent.getSchedule() + "' not found");
} else {
// ensure a schedule context exists
createScheduleContext(schedule);
// add the schedule event to the context
scheduleIdToScheduleContextMap.get(schedule.getId()).addScheduleEvent(scheduleEvent);
// add to the schedule event id to schedule id map
scheduleEventIdToScheduleIdMap.put(scheduleEvent.getId(), schedule.getId());
}
}
}
示例4: addDefaultSchedules
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void addDefaultSchedules() {
for (int i = 0; i < defaultSchedules.getSize(); i++) {
String name = defaultSchedules.getName()[i];
String start = defaultSchedules.getStart()[i];
String end = defaultSchedules.getEnd()[i];
String frequency = defaultSchedules.getFrequency()[i];
String cron = defaultSchedules.getCron()[i];
Boolean runOnce = Boolean.valueOf(defaultSchedules.getRunOnce()[i]);
Schedule schedule = new Schedule(name, start, end, frequency, cron, runOnce);
try {
scheduleClient.add(schedule);
} catch (ClientErrorException e) {
// Ignore if the schedule is already present
// schedule.setId(scheduleClient.scheduleForName(name).getId());
// scheduleClient.update(schedule);
}
}
}
示例5: parseTime
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
private ZonedDateTime parseTime(String time) {
// TODO : may support more than one format at some point
DateTimeFormatter dtf =
DateTimeFormatter.ofPattern(Schedule.DATETIME_FORMATS[0]).withZone(ZoneId.systemDefault());
ZonedDateTime zdt = null;
try {
zdt = ZonedDateTime.parse(time, dtf);
} catch (DateTimeParseException e) {
logger.debug("parseTime() failed to parse '" + time + "'");
// throw an exception
// mark as complete (via max iterations?)
}
return zdt;
}
示例6: createScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void createScheduleContext(Schedule schedule) {
synchronized (scheduleContextQueue) {
if (scheduleIdToScheduleContextMap.containsKey(schedule.getId())) {
// not intended to be an error
logger.info("schedule context " + schedule.getId() + " '" + schedule.getName()
+ "' already exists.");
} else {
// build a new schedule context
ScheduleContext scheduleContext = new ScheduleContext(schedule);
// store a mapping of schedule id to schedule context
scheduleIdToScheduleContextMap.put(schedule.getId(), scheduleContext);
// enqueue the context
scheduleContextQueue.add(scheduleContext);
logger.info("created schedule context " + scheduleContext.getInfo() + " initial start time "
+ scheduleContext.getNextTime().toString());
}
}
}
示例7: updateScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void updateScheduleContext(Schedule schedule) {
synchronized (scheduleContextQueue) {
if (!scheduleIdToScheduleContextMap.containsKey(schedule.getId())) {
// not intended to be an error
logger.error("failed to find schedule for " + schedule.getId() + " " + schedule.getName());
} else {
// remove the schedule context from the queue
scheduleContextQueue.remove(scheduleIdToScheduleContextMap.get(schedule.getId()));
// update the schedule
scheduleIdToScheduleContextMap.get(schedule.getId()).reset(schedule);
// enqueue the context
ScheduleContext scheduleContext = scheduleIdToScheduleContextMap.get(schedule.getId());
scheduleContextQueue.add(scheduleContext);
logger.info("updated schedule " + scheduleContext.getInfo() + " initial start time "
+ scheduleContext.getNextTime().toString());
}
}
}
示例8: addScheduleEventToScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void addScheduleEventToScheduleContext(ScheduleEvent scheduleEvent) {
synchronized (scheduleContextQueue) {
// get the schedule for the event
Schedule schedule = scheduleClient.scheduleForName(scheduleEvent.getSchedule());
if (schedule == null) {
logger.error(
"failed to add schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ "' " + "schedule '" + scheduleEvent.getSchedule() + "' not found");
} else {
// ensure a schedule context exists
createScheduleContext(schedule);
// add the schedule event to the context
scheduleIdToScheduleContextMap.get(schedule.getId()).addScheduleEvent(scheduleEvent);
// add to the schedule event id to schedule id map
scheduleEventIdToScheduleIdMap.put(scheduleEvent.getId(), schedule.getId());
}
}
}
示例9: addDefaultSchedules
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void addDefaultSchedules() {
for (int i = 0; i < defaultSchedules.getSize(); i++) {
String name = defaultSchedules.getName()[i];
String start = defaultSchedules.getStart()[i];
String end = defaultSchedules.getEnd()[i];
String frequency = defaultSchedules.getFrequency()[i];
String cron = defaultSchedules.getCron()[i];
Boolean runOnce = Boolean.valueOf(defaultSchedules.getRunOnce()[i]);
Schedule schedule = new Schedule(name, start, end, frequency, cron, runOnce);
try {
scheduleClient.add(schedule);
} catch (ClientErrorException e) {
// Ignore if the schedule is already present
// schedule.setId(scheduleClient.scheduleForName(name).getId());
// scheduleClient.update(schedule);
}
}
}
示例10: addDefaultSchedules
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void addDefaultSchedules() {
for (int i = 0; i < defaultSchedules.getSize(); i++) {
String name = defaultSchedules.getName()[i];
String start = defaultSchedules.getStart()[i];
String end = defaultSchedules.getEnd()[i];
String frequency = defaultSchedules.getFrequency()[i];
String cron = defaultSchedules.getCron()[i];
Boolean runOnce = Boolean.valueOf(defaultSchedules.getRunOnce()[i]);
Schedule schedule = new Schedule(name, start, end, frequency, cron, runOnce);
try {
scheduleClient.add(schedule);
} catch (ClientErrorException e) {
// Ignore if the schedule is already present
// schedule.setId(scheduleClient.scheduleForName(name).getId());
// scheduleClient.update(schedule);
}
}
}
示例11: parseTime
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
private ZonedDateTime parseTime(String time) {
// TODO : may support more than one format at some point
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(Schedule.DATETIME_FORMATS[0])
.withZone(ZoneId.systemDefault());
ZonedDateTime zdt = null;
try {
zdt = ZonedDateTime.parse(time, dtf);
} catch (DateTimeParseException e) {
logger.debug("parseTime() failed to parse '" + time + "'");
// throw an exception
// mark as complete (via max iterations?)
}
return zdt;
}
示例12: parseTime
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
private ZonedDateTime parseTime(String time) {
// TODO : may support more than one format at some point
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(Schedule.DATETIME_FORMATS[0]).withZone(ZoneId.systemDefault());
ZonedDateTime zdt = null;
try {
zdt = ZonedDateTime.parse(time, dtf);
} catch (DateTimeParseException e) {
logger.debug("parseTime() failed to parse '" + time + "'");
// throw an exception
// mark as complete (via max iterations?)
}
return zdt;
}
示例13: updateScheduleEventInScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void updateScheduleEventInScheduleContext(ScheduleEvent scheduleEvent)
{
synchronized (scheduleContextQueue)
{
// get the schedule for the event
String scheduleId = scheduleEventIdToScheduleIdMap.get(scheduleEvent.getId());
if(scheduleId == null) {
logger.error("failed to update schedule event " + scheduleEvent.getName() +
" current schedule " + scheduleEvent.getId() + " not found");
} else {
Schedule schedule = scheduleClient.scheduleForName(scheduleEvent.getSchedule());
if(schedule == null) {
logger.error("failed to update schedule event " + scheduleEvent.getName() +
" schedule " + scheduleEvent.getSchedule() + " not found");
} else {
// see if the event switched schedules
if(scheduleId != schedule.getId()) {
if(!scheduleIdToScheduleContextMap.containsKey(scheduleId)) {
logger.error("failed to switch schedule event " + scheduleEvent.getId() + ", schedule " + scheduleId + " not found");
} else {
// remove the schedule event from the old schedule
removeScheduleEventById(scheduleEvent.getId());
// add the schedule event to the new schedule
addScheduleEventToScheduleContext(scheduleEvent);
}
} else {
// update the schedule event in place
if(!scheduleIdToScheduleContextMap.containsKey(schedule.getId())) {
logger.error("failed to update schedule event " + scheduleEvent.getId() + ", schedule " + schedule.getId() + " not found");
} else {
// update the schedule event in the context
scheduleIdToScheduleContextMap.get(schedule.getId()).updateScheduleEvent(scheduleEvent);
}
}
}
}
}
}
示例14: updateScheduleEventInScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public void updateScheduleEventInScheduleContext(ScheduleEvent scheduleEvent) {
synchronized (scheduleContextQueue) {
// get the schedule for the event
String scheduleId = scheduleEventIdToScheduleIdMap.get(scheduleEvent.getId());
if (scheduleId == null) {
logger.error("failed to update schedule event " + scheduleEvent.getName()
+ " current schedule " + scheduleEvent.getId() + " not found");
} else {
Schedule schedule = scheduleClient.scheduleForName(scheduleEvent.getSchedule());
if (schedule == null) {
logger.error("failed to update schedule event " + scheduleEvent.getName() + " schedule "
+ scheduleEvent.getSchedule() + " not found");
} else {
// see if the event switched schedules
if (scheduleId != schedule.getId()) {
if (!scheduleIdToScheduleContextMap.containsKey(scheduleId)) {
logger.error("failed to switch schedule event " + scheduleEvent.getId()
+ ", schedule " + scheduleId + " not found");
} else {
// remove the schedule event from the old schedule
removeScheduleEventById(scheduleEvent.getId());
// add the schedule event to the new schedule
addScheduleEventToScheduleContext(scheduleEvent);
}
} else {
// update the schedule event in place
if (!scheduleIdToScheduleContextMap.containsKey(schedule.getId())) {
logger.error("failed to update schedule event " + scheduleEvent.getId()
+ ", schedule " + schedule.getId() + " not found");
} else {
// update the schedule event in the context
scheduleIdToScheduleContextMap.get(schedule.getId())
.updateScheduleEvent(scheduleEvent);
}
}
}
}
}
}
示例15: ScheduleContext
import org.edgexfoundry.domain.meta.Schedule; //导入依赖的package包/类
public ScheduleContext(Schedule schedule) {
scheduleEvents = new LinkedHashMap<String, ScheduleEvent>();
reset(schedule);
}