I'm writing a GSN wrapper for a REST service. It basically, returns this output when called from the browser:
1, 23.22
This is my code. Can anybody tell me what I'm doing wrong?
WRAPPER
<?xml version="1.0" encoding="UTF-8"?>
<virtual-sensor name="ForecastService" priority="10" >
<processing-class>
<class-name>org.openiot.gsn.vsensor.BridgeVirtualSensor</class-name>
<init-params>
<param name="allow-nulls">false</param>
<param name="publish-to-lsm">true</param>
</init-params>
<output-structure>
<field name="rain" type="Integer" />
<field name="temperature" type="Double" />
</output-structure>
</processing-class>
<description>weather forecast station</description>
<life-cycle pool-size="10"/>
<addressing>
<predicate key="geographical"></predicate>
</addressing>
<storage history-size="1" />
<streams>
<stream name="input1">
<source alias="source1" sampling-rate="1" storage-size="1">
<address wrapper="http-get">
<predicate key="url">http://192.168.1.100:8080/ForecastService/webresources/forecastservice/forecast/true/csv</predicate>
<predicate key="rate">1000</predicate>
</address>
<query>select * from wrapper</query>
</source>
<query>select * from source1</query>
</stream>
</streams>
OUTPUT
18:16:11.229 [VSensorLoader-Thread0] DEBUG org.openiot.gsn.beans.StreamSource - validate() called
18:16:11.229 [VSensorLoader-Thread0] DEBUG org.openiot.gsn.VSensorLoader - Preparing input streams for: forecastservice
18:16:11.230 [VSensorLoader-Thread0] DEBUG o.o.g.w.general.HttpGetWrapper - AXISWirelessCameraWrapper is now running @1000 Rate.
18:16:11.230 [VSensorLoader-Thread0] DEBUG org.openiot.gsn.VSensorLoader - Wrapper name: Http Receiver -- view name _774699928
18:16:11.230 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.240 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.240 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - The create table statement is : CREATE TABLE _774699928 (PK BIGINT NOT NULL IDENTITY, timed BIGINT NOT NULL, DATA Binary)
18:16:11.242 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - The create index statement is : CREATE UNIQUE INDEX _774699928_INDEX ON _774699928 (timed DESC)
18:16:11.244 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.250 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.251 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Dropping table structure: _sql_view_helper_ With query: Drop table if exists _sql_view_helper_
18:16:11.263 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.264 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - The create table statement is : CREATE TABLE _sql_view_helper_ (PK BIGINT NOT NULL IDENTITY, timed BIGINT NOT NULL, U_ID varchar(17))
18:16:11.264 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - The create index statement is : CREATE INDEX _sql_view_helper__INDEX ON _sql_view_helper_ (timed DESC)
18:16:11.266 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.270 [VSensorLoader-Thread0] DEBUG o.o.g.b.w.TupleBasedSlidingHandler - The original Query : select * from wrapper
18:16:11.271 [VSensorLoader-Thread0] DEBUG o.o.g.b.w.TupleBasedSlidingHandler - The merged query : select * from (select * from _774699928 where timed >= (select distinct(timed) from _774699928 where timed in (select timed from _774699928 order by timed desc limit 1 offset 0 )) order by timed desc ) of the StreamSource source1 of the InputStream: input1
18:16:11.271 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.271 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Creating a view:create view __911689473 AS ( select * from (select * from _774699928 where timed >= (select distinct(timed) from _774699928 where timed in (select timed from _774699928 order by timed desc limit 1 offset 0 )) order by timed desc ) )
18:16:11.274 [VSensorLoader-Thread0] DEBUG o.o.gsn.wrappers.AbstractWrapper - Adding listeners: Stream Source object: Alias: source1 uidS: __911689473 Active source: [http-geturl = http://192.168.1.100:8080/ForecastService/webresources/forecastservice/forecast/true/csv,rate = 1000,]
18:16:11.274 [VSensorLoader-Thread0] DEBUG o.openiot.gsn.storage.StorageManager - Asking a con. to DB: jdbc:h2:file:MyFile => busy: 0, max-size: 8, idle: 1
18:16:11.277 [VSensorLoader-Thread0] ERROR org.openiot.gsn.VSensorLoader - The column : RAIN in the >forecastservice< table is not compatible with type : Integer. The actual type for this table (currently in the database): 2005
org.openiot.gsn.utils.GSNRuntimeException: The column : RAIN in the >forecastservice< table is not compatible with type : Integer. The actual type for this table (currently in the database): 2005
at org.openiot.gsn.storage.StorageManager.tableExists(StorageManager.java:241) ~[classes/:na]
at org.openiot.gsn.storage.StorageManager.tableExists(StorageManager.java:270) ~[classes/:na]
at org.openiot.gsn.VSensorLoader.loadPlugin(VSensorLoader.java:255) ~[classes/:na]
at org.openiot.gsn.VSensorLoader.loadPlugin(VSensorLoader.java:210) ~[classes/:na]
at org.openiot.gsn.VSensorLoader.run(VSensorLoader.java:134) ~[classes/:na]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]