本文整理汇总了Java中org.edgexfoundry.domain.meta.ResourceOperation.getResource方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceOperation.getResource方法的具体用法?Java ResourceOperation.getResource怎么用?Java ResourceOperation.getResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.edgexfoundry.domain.meta.ResourceOperation
的用法示例。
在下文中一共展示了ResourceOperation.getResource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeOperations
import org.edgexfoundry.domain.meta.ResourceOperation; //导入方法依赖的package包/类
private void executeOperations(Device device, String commandName, String arguments, Boolean immediate, String transactionId) {
String method = (arguments == null) ? "get" : "set";
String deviceName = device.getName();
String deviceId = device.getId();
// get the objects for this device
Map<String, ModbusObject> objects = profiles.getObjects().get(deviceName);
// get the operations for this device's object operation method
List<ResourceOperation> operations = getResourceOperations(deviceName, deviceId, transactionId, commandName, method);
for (ResourceOperation operation: operations) {
String opResource = operation.getResource();
if (opResource != null) {
if (operation.getOperation().equals("get")) {
executeOperations(device, opResource, null, immediate, transactionId);
} else {
executeOperations(device, opResource, arguments, immediate, transactionId);
}
continue;
}
String objectName = operation.getObject();
ModbusObject object = getModbusObject(objects, objectName, transactionId);
//TODO Add property flexibility
if (!operation.getProperty().equals("value"))
throw new ServiceException(new UnsupportedOperationException("Only property of value is implemented for this service!"));
String val = null;
if (method.equals("set"))
val = parseArguments(arguments, operation, device, object, objects);
// command operation for client processing
if (requiresQuery(immediate, method, device, operation)) {
String opId = transactions.get(transactionId).newOpId();
final String parameter = val;
new Thread(() -> driver.process(operation, device, object, parameter, transactionId, opId)).start();;
}
}
}
示例2: executeOperations
import org.edgexfoundry.domain.meta.ResourceOperation; //导入方法依赖的package包/类
private void executeOperations(BACNetDevice device, String commandName, String arguments, Boolean immediate, String transactionId) {
String method = (arguments == null) ? "get" : "set";
String deviceName = device.getName();
String deviceId = device.getId();
// get the objects for this device
Map<String, BACNetObject> objects = profiles.getObjects().get(deviceName);
// get the operations for this device's object operation method
List<ResourceOperation> operations = getResourceOperations(deviceName, deviceId, transactionId, commandName, method);
for (ResourceOperation operation: operations) {
String opResource = operation.getResource();
if (opResource != null) {
if (operation.getOperation().equals("get")) {
executeOperations(device, opResource, null, immediate, transactionId);
} else {
executeOperations(device, opResource, arguments, immediate, transactionId);
}
continue;
}
String objectName = operation.getObject();
BACNetObject object = getBACNetObject(objects, objectName, transactionId);
//TODO Add property flexibility
if (!operation.getProperty().equals("value"))
throw new ServiceException(new UnsupportedOperationException("Only property of value is implemented for this service!"));
String val = null;
if (method.equals("set"))
val = parseArguments(arguments, operation, device, object, objects);
// command operation for client processing
if (requiresQuery(immediate, method, device, operation)) {
String opId = transactions.get(transactionId).newOpId();
final String parameter = val;
new Thread(() -> driver.process(operation, device, object, parameter, transactionId, opId)).start();;
}
}
}
示例3: executeOperations
import org.edgexfoundry.domain.meta.ResourceOperation; //导入方法依赖的package包/类
private void executeOperations(Device device, String commandName, String arguments,
Boolean immediate, String transactionId) {
String method = (arguments == null) ? "get" : "set";
String deviceName = device.getName();
String deviceId = device.getId();
// get the objects for this device
Map<String, MqttObject> objects = profiles.getObjects().get(deviceName);
// get the operations for this device's object operation method
List<ResourceOperation> operations =
getResourceOperations(deviceName, deviceId, transactionId, commandName, method);
for (ResourceOperation operation : operations) {
String opResource = operation.getResource();
if (opResource != null) {
if (operation.getOperation().equals("get")) {
executeOperations(device, opResource, null, immediate, transactionId);
} else {
executeOperations(device, opResource, arguments, immediate, transactionId);
}
continue;
}
String objectName = operation.getObject();
MqttObject object = getMqttObject(objects, objectName, transactionId);
// TODO Add property flexibility
if (!operation.getProperty().equals("value")) {
throw new ServiceException(new UnsupportedOperationException(
"Only property of value is implemented for this service!"));
}
String val = null;
if (method.equals("set")) {
val = parseArguments(arguments, operation, device, object, objects);
}
// command operation for client processing
if (requiresQuery(immediate, method, device, operation)) {
String opId = transactions.get(transactionId).newOpId();
final String parameter = val;
new Thread(() -> driver.process(operation, device, object, parameter, transactionId, opId))
.start();
}
}
}
示例4: executeOperations
import org.edgexfoundry.domain.meta.ResourceOperation; //导入方法依赖的package包/类
private void executeOperations(Device device, String commandName, String arguments,
Boolean immediate, String transactionId) {
String method = (arguments == null) ? "get" : "set";
String deviceName = device.getName();
String deviceId = device.getId();
// get the objects for this device
Map<String, BleObject> objects = profiles.getObjects().get(deviceName);
// get the operations for this device's object operation method
List<ResourceOperation> operations =
getResourceOperations(deviceName, deviceId, transactionId, commandName, method);
for (ResourceOperation operation: operations) {
String opResource = operation.getResource();
if (opResource != null) {
if (operation.getOperation().equals("get")) {
executeOperations(device, opResource, null, immediate, transactionId);
} else {
executeOperations(device, opResource, arguments, immediate, transactionId);
}
continue;
}
String objectName = operation.getObject();
BleObject object =
getBleObject(objects, objectName, transactionId);
// TODO Add property flexibility
if (!operation.getProperty().equals("value")) {
throw new ServiceException(new UnsupportedOperationException(
"Only property of value is implemented for this service!"));
}
String val = null;
if (method.equals("set")) {
val = parseArguments(arguments, operation, device, object, objects);
}
// command operation for client processing
if (requiresQuery(immediate, method, device, operation)) {
String opId = transactions.get(transactionId).newOpId();
final String parameter = val;
new Thread(() -> driver.process(operation, device, object, parameter,
transactionId, opId)).start();;
}
}
}