forked from community/product-iots
Merge pull request #13 from rasika90/master
Generalizing in memory map into any sensor readingapplication-manager-new
commit
fb21dc8b72
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Analytics>
|
||||
<Name>IoTServer_Sensor_Script</Name>
|
||||
<Script>
|
||||
CREATE TEMPORARY TABLE DeviceTemperatureData USING CarbonAnalytics OPTIONS(tableName "ORG_WSO2_IOT_DEVICES_TEMPERATURE");
|
||||
<Script>
|
||||
CREATE TEMPORARY TABLE DeviceTemperatureData USING CarbonAnalytics OPTIONS(tableName "ORG_WSO2_IOT_DEVICES_TEMPERATURE");
|
||||
|
||||
CREATE TEMPORARY TABLE DeviceTemperatureSummaryData USING CarbonAnalytics OPTIONS (tableName "DEVICE_TEMPERATURE_SUMMARY", schema "temperature FLOAT, deviceType STRING -i, deviceId STRING -i, owner STRING -i, time LONG -i",primaryKeys "deviceType, deviceId, owner, time");
|
||||
CREATE TEMPORARY TABLE DeviceTemperatureSummaryData USING CarbonAnalytics OPTIONS (tableName "DEVICE_TEMPERATURE_SUMMARY", schema "temperature FLOAT, deviceType STRING -i, deviceId STRING -i, owner STRING -i, time LONG -i",primaryKeys "deviceType, deviceId, owner, time");
|
||||
|
||||
|
||||
insert overwrite table DeviceTemperatureSummaryData select temperature, meta_deviceType as deviceType, meta_deviceId as deviceId, meta_owner as owner, cast(meta_time/1000 as BIGINT)as time from DeviceTemperatureData group by temperature, meta_deviceType, meta_deviceId, meta_owner, cast(meta_time/1000 as BIGINT);
|
||||
</Script>
|
||||
|
||||
insert overwrite table DeviceTemperatureSummaryData select temperature, meta_deviceType as deviceType, meta_deviceId as deviceId, meta_owner as owner, cast(meta_time/1000 as BIGINT)as time from DeviceTemperatureData group by temperature, meta_deviceType, meta_deviceId, meta_owner, cast(meta_time/1000 as BIGINT);
|
||||
</Script>
|
||||
<CronExpression>0 * * * * ?</CronExpression>
|
||||
</Analytics>
|
||||
|
23
modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/dao/TemperatureRecord.java → modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/dao/DeviceRecord.java
23
modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/dao/TemperatureRecord.java → modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/dao/DeviceRecord.java
@ -0,0 +1,24 @@
|
||||
package org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.dao;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
public class SensorRecord {
|
||||
private String sensorValue;
|
||||
private long time;
|
||||
|
||||
public SensorRecord(String sensorValue, long time) {
|
||||
this.sensorValue = sensorValue;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getSensorValue() {
|
||||
return sensorValue;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue