📄 commanddispatcher.java
字号:
log.debug("Calling Source.removeAllReadPoints()");
source.removeAllReadPoints();
NoParamType voidType = replyFactory.createNoParamType();
reply.setRemoveAllReadPoints(voidType);
}
else if (command.getGetReadPoint() != null) {
log.debug("Calling Source.getReadPoint()");
ReadPoint readPoint = source.getReadPoint(command
.getGetReadPoint().getName());
ReadPointReturnType readPointReturn = replyFactory
.createReadPointReturnType();
readPointReturn.setReturnValue(readPoint.getName());
reply.setGetReadPoint(readPointReturn);
}
else if (command.getGetAllReadPoints() != null) {
log.debug("Calling Source.getAllReadPoints()");
ReadPoint[] readPoints = source.getAllReadPoints();
ReadPointListReturnType readPointListReturn = replyFactory
.createReadPointListReturnType();
ReadPointListParamType readPointListItems = replyFactory
.createReadPointListParamType();
ReadPointListParamType.List list = replyFactory
.createReadPointListParamTypeList();
List valueList = list.getValue();
for (int i = 0; i < readPoints.length; i++) {
valueList.add(readPoints[i].getName());
}
readPointListItems.setList(list);
readPointListReturn.setReturnValue(readPointListItems);
reply.setGetAllReadPoints(readPointListReturn);
}
else if (command.getAddReadTriggers() != null) {
log.debug("Calling Source.addReadTriggers()");
org.fosstrak.reader.rprm.core.msg.command.TriggerListParamType.List valueElems = command
.getAddReadTriggers().getTriggers().getList();
List valueList = valueElems.getValue(); // List of strings
// with the read
// points names
/*
* aquiring phase - fetch all read trigger from the RD if a
* read trigger doesn't exist an exception is thrown in the
* RD and we throw this exception up to the dispatch method.
* So either all triggers are added or nothing.
*/
Trigger[] rdReadTriggers = new Trigger[valueList.size()];
int index = 0;
for (Iterator it = valueList.iterator(); it.hasNext();) {
String readTriggerName = (String) it.next();
Trigger readTrigger = readerDevice
.getTrigger(readTriggerName);
rdReadTriggers[index] = readTrigger;
index++;
}
// call addReadPoints on RD
source.addReadTriggers(rdReadTriggers);
// return void
NoParamType voidType = replyFactory.createNoParamType();
reply.setAddReadTriggers(voidType);
}
else if (command.getRemoveReadTriggers() != null) {
log.debug("Calling Source.removeReadTriggers()");
org.fosstrak.reader.rprm.core.msg.command.TriggerListParamType.List valueElems = command
.getRemoveReadTriggers().getTriggers().getList();
List valueList = valueElems.getValue(); // List of strings
// with the read
// trigger names
/*
* aquiring phase - fetch all read triggers from the RD if a
* read trigger doesn't exist an exception then just this
* one should be ignored (all others should be removed).
*/
Trigger[] rdReadTriggers = new Trigger[valueList.size()];
int index = 0;
for (Iterator it = valueList.iterator(); it.hasNext();) {
String readTriggerName = (String) it.next();
try {
Trigger readTrigger = source
.getReadTrigger(readTriggerName);
rdReadTriggers[index] = readTrigger;
index++;
} catch (ReaderProtocolException e) {
// readpoint not found ignore it
}
}
// call removeReadTriggers on RD
source.removeReadTriggers(rdReadTriggers);
// return void
NoParamType voidType = replyFactory.createNoParamType();
reply.setRemoveReadPoints(voidType);
}
else if (command.getRemoveAllReadTriggers() != null) {
log.debug("Calling Source.removeAllReadTriggers()");
;
source.removeAllReadTriggers();
// return void
NoParamType voidType = replyFactory.createNoParamType();
reply.setRemoveAllReadTriggers(voidType);
}
else if (command.getGetReadTrigger() != null) {
log.debug("Calling Source.getReadTrigger()");
Trigger readTrigger = source.getReadTrigger(command
.getGetReadTrigger().getName());
TriggerReturnType triggerReturn = replyFactory
.createTriggerReturnType();
triggerReturn.setReturnValue(readTrigger.getName());
reply.setGetReadTrigger(triggerReturn);
}
else if (command.getGetAllReadTriggers() != null) {
log.debug("Calling Source.getAllReadTriggers()");
Trigger[] readTriggers = source.getAllReadTriggers();
TriggerListReturnType triggerListReturn = replyFactory
.createTriggerListReturnType();
TriggerListParamType triggerListItems = replyFactory
.createTriggerListParamType();
TriggerListParamType.List list = replyFactory
.createTriggerListParamTypeList();
List valueList = list.getValue();
for (int i = 0; i < readTriggers.length; i++) {
valueList.add(readTriggers[i].getName());
}
triggerListItems.setList(list);
triggerListReturn.setReturnValue(triggerListItems);
reply.setGetAllReadTriggers(triggerListReturn);
}
else if (command.getAddTagSelectors() != null) {
log.debug("Calling Source.addTagSelectors()");
org.fosstrak.reader.rprm.core.msg.command.TagSelectorListParamType.List valueElems = command
.getAddTagSelectors().getSelectors().getList();
List valueList = valueElems.getValue(); // List of strings
// with the tag
// selector names
/*
* aquiring phase - fetch all tag selectors from the RD if a
* tag selectors doesn't exist an exception is thrown in the
* RD and we throw this exception up to the dispatch method.
* So either all triggers are added or nothing.
*/
TagSelector[] rdTagSelectors = new TagSelector[valueList
.size()];
int index = 0;
for (Iterator it = valueList.iterator(); it.hasNext();) {
String tagSelectorName = (String) it.next();
TagSelector tagSelector = readerDevice
.getTagSelector(tagSelectorName);
rdTagSelectors[index] = tagSelector;
index++;
}
// call addTagSelectors on RD
source.addTagSelectors(rdTagSelectors);
// return void
NoParamType voidType = replyFactory.createNoParamType();
reply.setAddTagSelectors(voidType);
}
else if (command.getRemoveTagSelectors() != null) {
log.debug("Calling Source.removeTagSelectors()");
NoParamType voidType = replyFactory.createNoParamType();
reply.setRemoveTagSelectors(voidType);
//
org.fosstrak.reader.rprm.core.msg.command.TagSelectorListParamType.List valueElems = command
.getRemoveTagSelectors().getSelectors().getList();
List valueList = valueElems.getValue(); // List of strings
// with the tag
// selector names
/*
* aquiring phase - fetch all tag selectors from the RD if a
* tag selector doesn't exist an exception then just this
* one should be ignored (all others should be removed).
*/
TagSelector[] rdTagSelectors = new TagSelector[valueList
.size()];
int index = 0;
for (Iterator it = valueList.iterator(); it.hasNext();) {
String tagSelectorName = (String) it.next();
try {
TagSelector tagSelector = source
.getTagSelector(tagSelectorName);
rdTagSelectors[index] = tagSelector;
index++;
} catch (ReaderProtocolException e) {
// TagSelector not found ignore it
}
}
// call removeTagSelectors on RD
source.removeTagSelectors(rdTagSelectors);
// return void
}
else if (command.getRemoveAllTagSelectors() != null) {
log.debug("Calling Source.removeAllTagSelectors()");
source.removeAllTagSelectors();
NoParamType voidType = replyFactory.createNoParamType();
reply.setRemoveAllTagSelectors(voidType);
}
else if (command.getGetTagSelector() != null) {
log.debug("Calling Source.getTagSelector()");
TagSelector tagSelector = source.getTagSelector(command
.getGetTagSelector().getName());
TagSelectorReturnType tagSelectorReturn = replyFactory
.createTagSelectorReturnType();
tagSelectorReturn.setReturnValue(tagSelector.getName());
reply.setGetTagSelector(tagSelectorReturn);
}
else if (command.getGetAllTagSelectors() != null) {
log.debug("Calling Source.getTagAllSelectors()");
TagSelector[] tagSelectors = source.getAllTagSelectors();
TagSelectorListReturnType tagSelectorListReturn = replyFactory
.createTagSelectorListReturnType();
TagSelectorListParamType tagSelectorListItems = replyFactory
.createTagSelectorListParamType();
TagSelectorListParamType.List list = replyFactory
.createTagSelectorListParamTypeList();
List valueList = list.getValue();
for (int i = 0; i < tagSelectors.length; i++) {
valueList.add(tagSelectors[i].getName());
}
tagSelectorListItems.setList(list);
tagSelectorListReturn.setReturnValue(tagSelectorListItems);
reply.setGetAllTagSelectors(tagSelectorListReturn);
}
else if (command.getGetGlimpsedTimeout() != null) {
log.debug("Calling Source.getGlimpsedTimeout()");
IntReturnType intReturn = replyFactory
.createIntReturnType();
intReturn.setReturnValue(source.getGlimpsedTimeout());
reply.setGetGlimpsedTimeout(intReturn);
}
else if (command.getSetGlimpsedTimeout() != null) {
log.debug("Calling Source.setGlimpsedTimeout()");
int timeout = command.getSetGlimpsedTimeout().getTimeout();
source.setGlimpsedTimeout(timeout);
// return void
NoParamType voidType = replyFactory.createNoParamType();
reply.setSetGlimpsedTimeout(voidType);
}
else if (command.getGetObservedThreshold() != null) {
log.debug("Calling Source.getObservedThreshold()");
IntReturnType intReturn = replyFactory
.createIntReturnType();
intReturn.setReturnValue(source.getObservedThreshold());
reply.setGetObservedThreshold(intReturn);
}
else if (command.getSetObservedThreshold() != null) {
log.debug("Calling Source.setObservedThreshold()");
int threshold = command.getSetObservedThreshold()
.getThreshold();
source.setObservedThreshold(threshold);
NoParamType voidType = replyFactory.createNoParamType();
reply.setSetObservedThreshold(voidType);
}
else if (command.getGetObservedTimeout() != null) {
log.debug("Calling Source.getObservedTimeout()");
IntReturnType intReturn = replyFactory
.createIntReturnType();
intReturn.setReturnValue(source.getObservedTimeout());
reply.setGetObservedTimeout(intReturn);
}
else if (command.getSetObservedTimeout() != null) {
log.debug("Calling Source.setObservedTimeout()");
int timeout = command.getSetObservedTimeout().getTimeout();
source.setObservedTimeout(timeout);
NoParamType voidType = replyFactory.createNoParamType();
reply.setSetObservedTimeout(voidType);
}
else if (command.getGetLostTimeout() != null) {
log.debug("Calling Source.getLostTimeout()");
IntReturnType intReturn = replyFactory
.createIntReturnType();
intReturn.setReturnValue(source.getLostTimeout());
reply.setGetLostTimeout(intReturn);
}
else if (command.getSetLostTimeout() != null) {
log.debug("Calling Source.setLostTimeout()");
int timeout = command.getSetLostTimeout().getTimeout();
source.setLostTimeout(timeout);
NoParamType voidType = replyFactory.createNoParamType();
reply.setSetLostTimeout(voidType);
}
else if (command.getRawReadIDs() != null) {
log.debug("Calling Source.rawReadIDs");
ReadReport report;
// check if the optional parameter dataSelector is set
DataSelector ds = null;
if (command.getRawReadIDs().getDataSelector() != null
&& !command.getRawReadIDs().getDataSelector()
.equals("null")) {
ds = readerDevice.getDataSelector(command
.getRawReadIDs().getDataSelector());
report = source.rawReadIDs(ds);
} else {
ds = readerDevice.getCurrentDataSelector();
}
report = source.rawReadIDs(ds);
RawReadIDs rawReadTypeReturn = replyFactory
.createSourceReplyRawReadIDs();
ReadReportType reportReply = createReadReportReply(report,
ds);
rawReadTypeReturn.setReturnValue(reportReply);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -