本文整理汇总了Java中org.edgexfoundry.domain.meta.ScheduleEvent类的典型用法代码示例。如果您正苦于以下问题:Java ScheduleEvent类的具体用法?Java ScheduleEvent怎么用?Java ScheduleEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScheduleEvent类属于org.edgexfoundry.domain.meta包,在下文中一共展示了ScheduleEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
@Async
public void execute(final ScheduleEvent event) {
int returnCode;
String body = event.getParameters();
if(body == null) body = "";
final String url = getURL(event.getAddressable());
String method = event.getAddressable().getMethod().toString();
try {
if (url == null) {
logger.info("no address for schedule event " + event.getName());
} else {
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod(method);
con.setDoOutput(true);
con.setConnectTimeout(timeout);
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Content-Length", "" + body.length());
OutputStream os = con.getOutputStream();
os.write(body.getBytes());
returnCode = con.getResponseCode();
os.close();
logger.debug("executed event " + event.getId() + " '" + event.getName() + "' response code " + returnCode + " url '" + url + "' body '" + body + "'");
}
} catch (Exception e) {
logger.error("exception executing event " + event.getId() + " '" + event.getName() + "' url '" + url + "' body '" + body + "' exception " + e.getMessage());
e.printStackTrace();
}
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:32,代码来源:ScheduleEventHTTPExecutor.java
示例2: removeScheduleById
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public void removeScheduleById(String id)
{
synchronized (scheduleContextQueue)
{
if(!scheduleIdToScheduleContextMap.containsKey(id)) {
logger.error("schedule " + id + " not found.");
} else {
// look up the schedule context
ScheduleContext sc = scheduleIdToScheduleContextMap.get(id);
// remove all event id to schedule id mappings
for(Map.Entry<String, ScheduleEvent> entry : sc.getScheduleEvents().entrySet()) {
scheduleEventIdToScheduleIdMap.remove(entry.getValue().getId());
}
// remove the schedule context from the queue
scheduleContextQueue.remove(sc);
// remove the schedule context from the map (which contains schedule events)
scheduleIdToScheduleContextMap.remove(id);
logger.info("removed schedule " + id );
}
}
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:26,代码来源:Scheduler.java
示例3: addScheduleEventToScheduleContext
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的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());
}
}
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:22,代码来源:Scheduler.java
示例4: initialize
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean initialize(String serviceName) {
boolean loaded = true;
addDefaultSchedules();
addDefaultScheduleEvents();
// <-- SDK Scheduler Block
logger.info("loading schedules");
synchronized (scheduleContextQueue)
{
// get all the schedule events for this service
List<ScheduleEvent> scheduleEventList = null;
try {
scheduleEventList = scheduleEventClient.scheduleEventsForServiceByName(serviceName);
for(ScheduleEvent se : scheduleEventList) addScheduleEventToScheduleContext(se);
} catch (Exception e) {
logger.error("failed to load schedule events for service " + serviceName + " " + e);
e.printStackTrace();
loaded = false;
}
}
// SDK Scheduler Block -->
logger.info("loaded schedules");
return loaded;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:26,代码来源:Scheduler.java
示例5: addScheduleEvent
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean addScheduleEvent(ScheduleEvent scheduleEvent) {
logger.info("adding schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ "' to schedule " + getInfo());
if (scheduleEvents.containsKey(scheduleEvent.getId())) {
logger.error(
"schedule event " + scheduleEvent.getId() + " " + scheduleEvent.getName() + " exists.");
return false;
}
scheduleEvents.put(scheduleEvent.getId(), scheduleEvent);
logger.debug("added schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ "' to schedule " + getInfo());
return true;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:18,代码来源:ScheduleContext.java
示例6: updateScheduleEvent
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean updateScheduleEvent(ScheduleEvent scheduleEvent) {
logger.info("updating schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ "' of schedule " + getInfo());
if (!scheduleEvents.containsKey(scheduleEvent.getId())) {
logger.error("schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ " not found");
return false;
}
scheduleEvents.put(scheduleEvent.getId(), scheduleEvent);
logger.debug("updated schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ "' of schedule " + getInfo());
return true;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:17,代码来源:ScheduleContext.java
示例7: removeScheduleById
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public void removeScheduleById(String id) {
synchronized (scheduleContextQueue) {
if (!scheduleIdToScheduleContextMap.containsKey(id)) {
logger.error("schedule " + id + " not found.");
} else {
// look up the schedule context
ScheduleContext sc = scheduleIdToScheduleContextMap.get(id);
// remove all event id to schedule id mappings
for (Map.Entry<String, ScheduleEvent> entry : sc.getScheduleEvents().entrySet()) {
scheduleEventIdToScheduleIdMap.remove(entry.getValue().getId());
}
// remove the schedule context from the queue
scheduleContextQueue.remove(sc);
// remove the schedule context from the map (which contains schedule events)
scheduleIdToScheduleContextMap.remove(id);
logger.info("removed schedule " + id);
}
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:24,代码来源:Scheduler.java
示例8: addScheduleEventToScheduleContext
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的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());
}
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:21,代码来源:Scheduler.java
示例9: initialize
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean initialize(String serviceName) {
boolean loaded = true;
addDefaultSchedules();
addDefaultScheduleEvents();
logger.info("loading schedules");
synchronized (scheduleContextQueue) {
// get all the schedule events for this service
List<ScheduleEvent> scheduleEventList = null;
try {
scheduleEventList = scheduleEventClient.scheduleEventsForServiceByName(serviceName);
for (ScheduleEvent se : scheduleEventList) {
addScheduleEventToScheduleContext(se);
}
} catch (Exception e) {
logger.error("failed to load schedule events for service " + serviceName + " " + e);
e.printStackTrace();
loaded = false;
}
}
logger.info("loaded schedules");
return loaded;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:24,代码来源:Scheduler.java
示例10: initialize
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean initialize(String serviceName) {
boolean loaded = true;
addDefaultSchedules();
addDefaultScheduleEvents();
logger.info("loading schedules");
synchronized (scheduleContextQueue) {
// get all the schedule events for this service
List<ScheduleEvent> scheduleEventList = null;
try {
scheduleEventList = scheduleEventClient.scheduleEventsForServiceByName(serviceName);
for (ScheduleEvent se : scheduleEventList)
addScheduleEventToScheduleContext(se);
} catch (Exception e) {
logger.error("failed to load schedule events for service " + serviceName + " " + e);
e.printStackTrace();
loaded = false;
}
}
logger.info("loaded schedules");
return loaded;
}
开发者ID:edgexfoundry,项目名称:device-bacnet,代码行数:24,代码来源:Scheduler.java
示例11: addScheduleEvent
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean addScheduleEvent(ScheduleEvent scheduleEvent) {
logger.info("adding schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ "' to schedule " + getInfo());
if (scheduleEvents.containsKey(scheduleEvent.getId())) {
logger.error("schedule event " + scheduleEvent.getId() + " " + scheduleEvent.getName()
+ " exists.");
return false;
}
scheduleEvents.put(scheduleEvent.getId(), scheduleEvent);
logger.debug("added schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName()
+ "' to schedule " + getInfo());
return true;
}
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:18,代码来源:ScheduleContext.java
示例12: execute
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public void execute(LinkedHashMap<String, ScheduleEvent> events) {
if(events == null) {
logger.error("schedule event list is null");
} else {
logger.debug("schedule event list contains " + events.size() + " events");
for(Map.Entry<String, ScheduleEvent> entry : events.entrySet()) {
execute(entry.getValue());
}
}
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:11,代码来源:ScheduleEventExecutor.java
示例13: addScheduleEvent
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean addScheduleEvent(ScheduleEvent scheduleEvent) {
logger.info("adding schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName() + "' to schedule " + getInfo());
if(scheduleEvents.containsKey(scheduleEvent.getId())) {
logger.error("schedule event " + scheduleEvent.getId() + " " + scheduleEvent.getName() + " exists.");
return false;
}
scheduleEvents.put(scheduleEvent.getId(), scheduleEvent);
logger.debug("added schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName() + "' to schedule " + getInfo());
return true;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:11,代码来源:ScheduleContext.java
示例14: updateScheduleEvent
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public boolean updateScheduleEvent(ScheduleEvent scheduleEvent) {
logger.info("updating schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName() + "' of schedule " + getInfo());
if(!scheduleEvents.containsKey(scheduleEvent.getId())) {
logger.error("schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName() + " not found");
return false;
}
scheduleEvents.put(scheduleEvent.getId(), scheduleEvent);
logger.debug("updated schedule event " + scheduleEvent.getId() + " '" + scheduleEvent.getName() + "' of schedule " + getInfo());
return true;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:11,代码来源:ScheduleContext.java
示例15: updateScheduleEventInScheduleContext
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的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);
}
}
}
}
}
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:39,代码来源:Scheduler.java
示例16: execute
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
public void execute(LinkedHashMap<String, ScheduleEvent> events) {
if (events == null) {
logger.error("schedule event list is null");
} else {
logger.debug("schedule event list contains " + events.size() + " events");
for (Map.Entry<String, ScheduleEvent> entry : events.entrySet()) {
execute(entry.getValue());
}
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:11,代码来源:ScheduleEventExecutor.java
示例17: updateScheduleEventInScheduleContext
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的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);
}
}
}
}
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:40,代码来源:Scheduler.java
示例18: execute
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
@Async
public void execute(final ScheduleEvent event) {
int returnCode;
String body = event.getParameters();
if (body == null) {
body = "";
}
final String url = getUrl(event.getAddressable());
String method = event.getAddressable().getMethod().toString();
try {
if (url == null) {
logger.info("no address for schedule event " + event.getName());
} else {
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod(method);
con.setDoOutput(true);
con.setConnectTimeout(timeout);
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Content-Length", "" + body.length());
try (OutputStream os = con.getOutputStream()) {
os.write(body.getBytes());
returnCode = con.getResponseCode();
}
logger.debug("executed event " + event.getId() + " '" + event.getName() + "' response code "
+ returnCode + " url '" + url + "' body '" + body + "'");
}
} catch (Exception e) {
logger.error("exception executing event " + event.getId() + " '" + event.getName() + "' url '"
+ url + "' body '" + body + "' exception " + e.getMessage());
e.printStackTrace();
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:39,代码来源:ScheduleEventHttpExecutor.java
示例19: execute
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
@Async
public void execute(final ScheduleEvent event) {
int returnCode;
String body = event.getParameters();
if(body == null) body = "";
final String url = getURL(event.getAddressable());
String method = event.getAddressable().getMethod().toString();
try {
if (url == null) {
logger.info("no address for schedule event " + event.getName());
} else {
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod(method);
con.setDoOutput(true);
con.setConnectTimeout(timeout);
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Content-Length", "" + body.length());
OutputStream os = null;
try {
os = con.getOutputStream();
os.write(body.getBytes());
returnCode = con.getResponseCode();
} finally {
os.close();
}
logger.debug("executed event " + event.getId() + " '" + event.getName() + "' response code " + returnCode + " url '" + url + "' body '" + body + "'");
}
} catch (Exception e) {
logger.error("exception executing event " + event.getId() + " '" + event.getName() + "' url '" + url + "' body '" + body + "' exception " + e.getMessage());
e.printStackTrace();
}
}
开发者ID:edgexfoundry,项目名称:device-bacnet,代码行数:36,代码来源:ScheduleEventHTTPExecutor.java
示例20: execute
import org.edgexfoundry.domain.meta.ScheduleEvent; //导入依赖的package包/类
@Async
public void execute(final ScheduleEvent event) {
int returnCode;
String body = event.getParameters();
if (body == null) {
body = "";
}
final String url = getUrl(event.getAddressable());
String method = event.getAddressable().getMethod().toString();
try {
if (url == null) {
logger.info("no address for schedule event " + event.getName());
} else {
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod(method);
con.setDoOutput(true);
con.setConnectTimeout(timeout);
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Content-Length", "" + body.length());
try (OutputStream os = con.getOutputStream()) {
os.write(body.getBytes());
returnCode = con.getResponseCode();
}
logger.debug("executed event " + event.getId() + " '" + event.getName()
+ "' response code " + returnCode + " url '" + url + "' body '" + body + "'");
}
} catch (Exception e) {
logger.error("exception executing event " + event.getId() + " '" + event.getName()
+ "' url '" + url + "' body '" + body + "' exception " + e.getMessage());
e.printStackTrace();
}
}
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:39,代码来源:ScheduleEventHttpExecutor.java
注:本文中的org.edgexfoundry.domain.meta.ScheduleEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论