当前位置: 首页>>代码示例>>Java>>正文


Java ResourceOperation.getObject方法代码示例

本文整理汇总了Java中org.edgexfoundry.domain.meta.ResourceOperation.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceOperation.getObject方法的具体用法?Java ResourceOperation.getObject怎么用?Java ResourceOperation.getObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.edgexfoundry.domain.meta.ResourceOperation的用法示例。


在下文中一共展示了ResourceOperation.getObject方法的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();;
		}			
	}
}
 
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:43,代码来源:ModbusHandler.java

示例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();;
		}			
	}
}
 
开发者ID:edgexfoundry,项目名称:device-bacnet,代码行数:42,代码来源:BACNetHandler.java

示例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();
    }
  }
}
 
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:49,代码来源:MqttHandler.java

示例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();;
    }
  }
}
 
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:50,代码来源:BleHandler.java


注:本文中的org.edgexfoundry.domain.meta.ResourceOperation.getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。