本文整理汇总了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;
}
示例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");
}
}
示例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");
}
示例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;
}
示例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);
}
}
示例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;
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}
}