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


Java ContentInstance.setContentInfo方法代码示例

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


在下文中一共展示了ContentInstance.setContentInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapAttributes

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
@Override
protected void mapAttributes(ContentInstanceEntity entity,
		ContentInstance resource) {
	resource.setContent(entity.getContent());
	resource.setExpirationTime(entity.getExpirationTime());
	resource.setContentInfo(entity.getContentInfo());
	resource.setContentSize(BigInteger.valueOf(entity.getByteSize()));
	resource.setCreator(entity.getCreator());
	resource.setOntologyRef(entity.getOntologyRef());
	resource.setStateTag(entity.getStateTag());
	if (!entity.getAnnouncedAttribute().isEmpty()) {
		resource.getAnnouncedAttribute().addAll(
				entity.getAnnouncedAttribute());
	}
	if (!entity.getAnnounceTo().isEmpty()) {
		resource.getAnnounceTo().addAll(entity.getAnnounceTo());
	}
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:19,代码来源:ContentInstanceMapper.java

示例2: createLampAll

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
/**
 * Create the LAMP_ALL container
 * @param poa
 */
private static void createLampAll(String poa) {
	// Creation of the LAMP_ALL container
	AE ae = new AE();
	ae.setRequestReachability(true);
	ae.getPointOfAccess().add(poa);
	ae.setAppID("LAMP_ALL");
	ResponsePrimitive response = RequestSender.createAE(ae, "LAMP_ALL");

	// Create descriptor container if not yet created
	if(response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)){
		// Creation of the DESCRIPTOR container
		Container cnt = new Container();
		cnt.setMaxNrOfInstances(BigInteger.valueOf(10));
		RequestSender.createContainer(SampleConstants.CSE_PREFIX + "/" + "LAMP_ALL", SampleConstants.DESC, cnt);

		// Create the description
		ContentInstance cin = new ContentInstance();
		cin.setContent(ObixUtil.createLampAllDescriptor());
		cin.setContentInfo(MimeMediaType.OBIX);
		RequestSender.createContentInstance(SampleConstants.CSE_PREFIX + "/" + "LAMP_ALL" + "/" + SampleConstants.DESC, null, cin);
	}
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:27,代码来源:LifeCycleManager.java

示例3: setLampState

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
public static void setLampState(String lampId, boolean value){
	// Set the value in the "real world" model
	SampleModel.setLampState(lampId, value);
	// Send the information to the CSE
	String targetID = SampleConstants.CSE_PREFIX + "/" + lampId + "/" + SampleConstants.DATA;
	ContentInstance cin = new ContentInstance();
	cin.setContent(ObixUtil.getStateRep(lampId, value));
	cin.setContentInfo(MimeMediaType.OBIX + ":" + MimeMediaType.ENCOD_PLAIN);
	RequestSender.createContentInstance(targetID, null, cin);
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:11,代码来源:SampleController.java

示例4: createSensorResources

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
public void createSensorResources(String sensorId, int type) {
	String targetId, content;

	targetId = "/" + CSE_ID + "/" + CSE_NAME;
	AE ae = new AE();
	ae.setRequestReachability(true);
	ae.setAppID(ipeId);
	ae.getPointOfAccess().add(ipeId);
	ResponsePrimitive response = RequestSender.createAE(ae, sensorId);

	if (response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
		targetId = "/" + CSE_ID + "/" + CSE_NAME + "/" + sensorId;
		Container cnt = new Container();
		cnt.setMaxNrOfInstances(BigInteger.valueOf(10));
		// Create the DESCRIPTOR container
		RequestSender.createContainer(targetId, DESCRIPTOR, cnt);

		// Create the DATA container
		RequestSender.createContainer(targetId, DATA, cnt);

		// Create the description contentInstance
		content = ObixUtil.getSensorDescriptorRep(sensorId, ipeId);
		targetId = "/" + CSE_ID + "/" + CSE_NAME + "/" + sensorId + "/"
				+ DESCRIPTOR;
		ContentInstance cin = new ContentInstance();
		cin.setContent(content);
		cin.setContentInfo(MimeMediaType.OBIX);
		RequestSender.createContentInstance(targetId, cin);
	}
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:31,代码来源:Monitor.java

示例5: createDataContentInstance

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
public static void createDataContentInstance(int type, String sensorId, String clusterId){
	// Simulate a random measurement of the sensor
	int sensorValue = 10 + (int) (Math.random() * 100);

	// Create the data contentInstance
	String content = ObixUtil.getSensorDataRep(sensorValue, type, sensorId, ipeId, clusterId);
	String targetId = "/" + CSE_ID + "/" + CSE_NAME + "/"
			+ sensorId + "/" + DATA;
	ContentInstance cin = new ContentInstance();
	cin.setContent(content);
	cin.setContentInfo(MimeMediaType.OBIX);
	RequestSender.createContentInstance(targetId, cin);		
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:14,代码来源:Monitor.java

示例6: createSubDataContentInstance

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
public static void createSubDataContentInstance(int type, String sensorId){
	// Simulate a random measurement of the sensor
	int sensorValue = 10 + (int) (Math.random() * 100);

	// Create the data contentInstance
	String content = ObixUtil.getDataSubscriber();
	String targetId = "/" + CSE_ID + "/" + CSE_NAME + "/"
			+ sensorId + "/" + DATA;
	ContentInstance cin = new ContentInstance();
	cin.setContent(content);
	cin.setContentInfo(MimeMediaType.XML);
	RequestSender.createContentInstanceXML(targetId, "SUBSCRIPTION", cin, ResourceType.SUBSCRIPTION);		
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:14,代码来源:Monitor.java

示例7: createSensorResources

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
public void createSensorResources(String sensorId, String type) {
	String targetId, content;

	targetId = "/" + CSE_ID + "/" + CSE_NAME;
	AE ae = new AE();
	ae.setRequestReachability(true);
	ae.setAppID(ipeId);
	ae.getPointOfAccess().add(ipeId);
	ResponsePrimitive response = RequestSender.createAE(ae, sensorId);

	if (response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
		targetId = "/" + CSE_ID + "/" + CSE_NAME + "/" + sensorId;
		Container cnt = new Container();
		cnt.setMaxNrOfInstances(BigInteger.valueOf(10));
		// Create the DESCRIPTOR container
		RequestSender.createContainer(targetId, DESCRIPTOR, cnt);

		// Create the DATA container
		RequestSender.createContainer(targetId, DATA, cnt);

		// Create the description contentInstance
		content = ObixUtil.getSensorDescriptorRep(sensorId, ipeId);
		targetId = "/" + CSE_ID + "/" + CSE_NAME + "/" + sensorId + "/"
				+ DESCRIPTOR;
		ContentInstance cin = new ContentInstance();
		cin.setContent(content);
		cin.setContentInfo(MimeMediaType.OBIX);
		RequestSender.createContentInstance(targetId, cin);
	}
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:31,代码来源:Monitor.java

示例8: createDataContentInstance

import org.eclipse.om2m.commons.resource.ContentInstance; //导入方法依赖的package包/类
public static void createDataContentInstance(SensorDataItem sensorItem){
	// Create the data contentInstance
	String content = ObixUtil.convertSensorDataRep(sensorItem);
	String targetId = "/" + CSE_ID + "/" + CSE_NAME + "/"
			+ sensorItem.mSensorId + "/" + DATA;
	ContentInstance cin = new ContentInstance();
	cin.setContent(content);
	cin.setContentInfo(MimeMediaType.OBIX);
	RequestSender.createContentInstance(targetId, cin);		
}
 
开发者ID:HPCC-Cloud-Computing,项目名称:IoT,代码行数:11,代码来源:Monitor.java


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