• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ProfileResource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ProfileResource类属于org.edgexfoundry.domain.meta包,在下文中一共展示了ProfileResource类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generate

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
/**
 * generate DeviceProfile<br>
 * Use {@link org.edgexfoundry.domain.meta.DeviceProfile#DeviceProfile()} to generate DeviceProfile
 * 
 * @param name name which matched with Device and addressable
 * @param deviceObjectList list of DeviceObject
 * @param profileResourceList list of ProfileResource
 * @param commandList list of Command
 * 
 * @return generated DeviceProfile
 */
public DeviceProfile generate(String name, List<DeviceObject> deviceObjectList,
    List<ProfileResource> profileResourceList, List<Command> commandList) {
  if (name == null || name.isEmpty()) {
    return null;
  }

  DeviceProfile deviceProfile = new DeviceProfile();
  deviceProfile.setOrigin(new Timestamp(System.currentTimeMillis()).getTime());
  deviceProfile.setCreated(new Timestamp(System.currentTimeMillis()).getTime());
  deviceProfile.setName(name);
  deviceProfile.setManufacturer(OPCUADefaultMetaData.MANUFACTURER.getValue());
  deviceProfile.setModel(OPCUADefaultMetaData.MODEL.getValue());
  deviceProfile.setDescription(OPCUADefaultMetaData.DESCRIPTION_DEVICEPROFILE.getValue());
  deviceProfile.setObjects(OPCUADefaultMetaData.OBJ.getValue());
  String[] labels =
      {OPCUADefaultMetaData.LABEL1.getValue(), OPCUADefaultMetaData.LABEL2.getValue()};
  deviceProfile.setLabels(labels);

  deviceProfile.setDeviceResources(deviceObjectList);
  deviceProfile.setResources(profileResourceList);
  deviceProfile.setCommands(commandList);

  return deviceProfile;
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:36,代码来源:DeviceProfileGenerator.java


示例2: initMetaData

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
/**
 * Initialize MetaData<br>
 * Use {@link DeviceObjectGenerator#generate(String, String)} to generate DeviceObject<br>
 * Use {@link #createWellKnownSetList(String)} to create list of wellknown command<br>
 * Use {@link ProfileResourceGenerator#generate(String, List, List)} to generate
 * ProfileResource<br>
 * Use {@link CommandGenerator#generate(String, String)} to generate Command<br>
 * Use {@link DeviceProfileGenerator#generate(String, List, List, List)} to generate
 * DeviceProfile<br>
 * Use {@link DeviceEnroller#addDeviceProfileToMetaData(DeviceProfile)} to add DeviceProfile to
 * MetaData<br>
 * Use {@link DeviceGenerator#generate(String)} to generate Device<br>
 * Use {@link DeviceEnroller#addDeviceToMetaData(Device)} to add Device to MetaData
 * 
 * @param name name of Device
 */
public void initMetaData(String name) {
  List<DeviceObject> deviceObjectList = new ArrayList<DeviceObject>();
  List<ProfileResource> profileResourceList = new ArrayList<ProfileResource>();
  List<Command> commandList = new ArrayList<Command>();

  String command_type = OPCUACommandIdentifier.WELLKNOWN_COMMAND.getValue();
  for (OPCUACommandIdentifier wellknownCommand : OPCUACommandIdentifier.WELLKNOWN_COMMAND_LIST) {
    String commandName = wellknownCommand.getValue();
    deviceObjectList.add(DeviceObjectGenerator.generate(commandName, command_type));
    List<ResourceOperation> setList = createWellKnownSetList(commandName);
    List<ResourceOperation> getList = null;
    profileResourceList.add(ProfileResourceGenerator.generate(commandName, getList, setList));
    commandList.add(CommandGenerator.generate(commandName, null));
  }

  if (null != deviceProfileGenerator && null != deviceEnroller && null != deviceGenerator) {
    DeviceProfile deviceProfile =
        deviceProfileGenerator.generate(name, deviceObjectList, profileResourceList, commandList);
    deviceEnroller.addDeviceProfileToMetaData(deviceProfile);
    Device device = deviceGenerator.generate(name);
    deviceEnroller.addDeviceToMetaData(device);
  } else {
    logger.error("metadata instacne is invalid");
  }
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:42,代码来源:OPCUAMetadataGenerateManager.java


示例3: test_resourceOperation_update_with_params

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
@Test
public void test_resourceOperation_update_with_params() throws Exception {
  logger.info("[TEST] test_resourceOperation_update_with_params");
  String name = "name";
  ResourceOperation operation = ProfileResourceGenerator.createGetOperation(name, "read", 1);
  List<ResourceOperation> getList = new ArrayList<ResourceOperation>();
  getList.add(operation);

  operation = ProfileResourceGenerator.createGetOperation(name, "write", 1);
  List<ResourceOperation> setList = new ArrayList<ResourceOperation>();
  setList.add(operation);

  ProfileResource resource = ProfileResourceGenerator.generate(name, getList, setList);
  assertNotNull(resource);
  logger.info("[PASS] test_resourceOperation_update_with_params");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:17,代码来源:OPCUAMetaDataGeneratorTest.java


示例4: update

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
/**
 * update DeviceProfile in DeviceProfile
 * 
 * @param name name which matched with Device and addressable
 * @param profileResource updated ProfileResource
 * 
 * @return updated DeviceProfile
 */
public DeviceProfile update(String name, ProfileResource profileResource) {
  if (deviceProfileClient == null || profileResource == null) {
    return null;
  }

  DeviceProfile deviceProfile = deviceProfileClient.deviceProfileForName(name);
  List<ProfileResource> profileResourceList = deviceProfile.getResources();
  profileResourceList.add(profileResource);
  deviceProfile.setResources(profileResourceList);
  return deviceProfile;
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:20,代码来源:DeviceProfileGenerator.java


示例5: updateMethodService

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
/**
 * Add method Service to DeviecProfile<br>
 * Use {@link #createAttributeGetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link #createAttributeSetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link ProfileResourceGenerator#generate(String, List, List)} to generate
 * ProfileResource<br>
 * Use {@link DeviceProfileGenerator#update(String, ProfileResource)} to update ProfileResource to
 * DeviceProfile<br>
 * Use {@link CommandGenerator#generate(String, String)} to generate Command<br>
 * Use {@link DeviceProfileGenerator#update(String, Command)} to update Comand to
 * DeviceProfile<br>
 * Use {@link DeviceObjectGenerator#generate(String, String)} to generate DeviceObject<br>
 * Use {@link DeviceProfileGenerator#update(String, DeviceObject)} to update DeviceObject to
 * DeviceProfile<br>
 * Use {@link DeviceEnroller#updateDeviceProfileToMetaData(DeviceProfile)} to update DeviceProfile
 * to MetaData
 * 
 * @param deviceProfileName name of DeviceProfile
 * @param commandType Type of Command ( attribute or method or wellknown )
 * @param keyList list of provider key
 */
public void updateMethodService(String deviceProfileName, String commandType,
    ArrayList<String> keyList) {
  if (keyList == null) {
    return;
  }

  for (String providerKey : keyList) {
    String deviceInfoName = providerKey.replaceAll(OPCUADefaultMetaData.BEFORE_REPLACE_WORD,
        OPCUADefaultMetaData.AFTER_REPLACE_WORD);

    List<ResourceOperation> getList = createMethodGetResourceOperation(deviceInfoName);
    List<ResourceOperation> setList = createMethodSetResourceOperation(deviceInfoName);
    ProfileResource profileResource =
        ProfileResourceGenerator.generate(deviceInfoName, getList, setList);

    if (deviceProfileGenerator == null || deviceEnroller == null) {
      return;
    }
    DeviceProfile deviceProfile =
        deviceProfileGenerator.update(deviceProfileName, profileResource);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    Command command = CommandGenerator.generate(deviceInfoName, null);
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, command);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    DeviceObject deviceObject = DeviceObjectGenerator.generate(deviceInfoName, commandType);
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, deviceObject);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);
  }
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:55,代码来源:OPCUAMetadataGenerateManager.java


示例6: generate

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
/**
 * generate ProfileResource<br>
 * Use {@link org.edgexfoundry.domain.meta.ProfileResource#ProfileResource()} to create
 * ProfileResource instance
 * 
 * @param name name of ProfileResource
 * @param getList list of GetOperation
 * @param setList list of SetOperation
 * 
 * @return generated ProfileResource
 */
public static ProfileResource generate(String name, List<ResourceOperation> getList,
    List<ResourceOperation> setList) {
  if (name == null || name.isEmpty()) {
    return null;
  }

  ProfileResource profileResource = new ProfileResource();
  profileResource.setName(name);
  profileResource.setGet(getList);
  profileResource.setSet(setList);
  return profileResource;
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:24,代码来源:ProfileResourceGenerator.java


示例7: test_deviceProfile_update_without_profileResource

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
@Test
public void test_deviceProfile_update_without_profileResource() throws Exception {
  logger.info("[TEST] test_deviceProfile_update_without_profileResource");
  DeviceProfileGenerator generator = new DeviceProfileGenerator();
  String name = "name";
  ProfileResource resource = null;
  DeviceProfile profile = generator.update(name, resource);
  assertNull(profile);
  logger.info("[PASS] test_deviceProfile_update_without_profileResource");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:11,代码来源:OPCUAMetaDataGeneratorTest.java


示例8: test_resourceOperation_update_without_name

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
@Test
public void test_resourceOperation_update_without_name() throws Exception {
  logger.info("[TEST] test_resourceOperation_update_without_name");
  ProfileResource resource = ProfileResourceGenerator.generate(null, null, null);
  assertNull(resource);
  logger.info("[PASS] test_resourceOperation_update_without_name");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:8,代码来源:OPCUAMetaDataGeneratorTest.java


示例9: test_resourceOperation_update_without_lists

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
@Test
public void test_resourceOperation_update_without_lists() throws Exception {
  logger.info("[TEST] test_resourceOperation_update_without_lists");
  String name = "name";
  ProfileResource resource = ProfileResourceGenerator.generate(name, null, null);
  assertNotNull(resource);
  logger.info("[PASS] test_resourceOperation_update_without_lists");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:9,代码来源:OPCUAMetaDataGeneratorTest.java


示例10: updateAttributeService

import org.edgexfoundry.domain.meta.ProfileResource; //导入依赖的package包/类
/**
 * Add Attribute Service to DeviecProfile<br>
 * Use {@link org.edge.protocol.opcua.providers.EdgeServices#getAttributeProvider(String)} to get
 * EdgeAttribute Provider<br>
 * Use {@link #createAttributeGetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link #createAttributeSetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link ProfileResourceGenerator#generate(String, List, List)} to generate
 * ProfileResource<br>
 * Use {@link DeviceProfileGenerator#update(String, ProfileResource)} to update ProfileResource to
 * DeviceProfile<br>
 * Use {@link CommandGenerator#generate(String, String)} to generate Command<br>
 * Use {@link DeviceProfileGenerator#update(String, Command)} to update Comand to
 * DeviceProfile<br>
 * Use {@link DeviceObjectGenerator#generate(String, String)} to generate DeviceObject<br>
 * Use {@link DeviceProfileGenerator#update(String, DeviceObject)} to update DeviceObject to
 * DeviceProfile<br>
 * Use {@link DeviceEnroller#updateDeviceProfileToMetaData(DeviceProfile)} to update DeviceProfile
 * to MetaData
 * 
 * @param deviceProfileName name of DeviceProfile
 * @param commandType Type of Command ( attribute or method or wellknown )
 * @param keyList list of provider key
 */
public void updateAttributeService(String deviceProfileName, String commandType,
    ArrayList<String> keyList) {
  if (keyList == null) {
    return;
  }
  for (String providerKey : keyList) {
    EdgeAttributeProvider provider = EdgeServices.getAttributeProvider(providerKey);
    EdgeMapper mapper = null;
    if (provider != null) {
      mapper = provider.getAttributeService(providerKey).getMapper();
    }
    if (mapper == null) {
      mapper = new EdgeMapper();
    }

    String deviceInfoName = providerKey.replaceAll(OPCUADefaultMetaData.BEFORE_REPLACE_WORD,
        OPCUADefaultMetaData.AFTER_REPLACE_WORD);

    List<ResourceOperation> getList = createAttributeGetResourceOperation(deviceInfoName);
    List<ResourceOperation> setList = createAttributeSetResourceOperation(deviceInfoName);
    ProfileResource profileResource =
        ProfileResourceGenerator.generate(deviceInfoName, getList, setList);

    if (deviceProfileGenerator == null || deviceEnroller == null) {
      return;
    }
    DeviceProfile deviceProfile =
        deviceProfileGenerator.update(deviceProfileName, profileResource);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    Command command = CommandGenerator.generate(deviceInfoName,
        mapper.getMappingData(EdgeMapperCommon.PROPERTYVALUE_READWRITE.name()));
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, command);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    DeviceObject deviceObject = DeviceObjectGenerator.generate(deviceInfoName, commandType);
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, deviceObject);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);
  }
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:66,代码来源:OPCUAMetadataGenerateManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GameProfile类代码示例发布时间:2022-05-22
下一篇:
Java BottomSheetDialog类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap