<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to CreateScript</title><link>https://sourceforge.net/p/m2mlabs/wiki/CreateScript/</link><description>Recent changes to CreateScript</description><atom:link href="https://sourceforge.net/p/m2mlabs/wiki/CreateScript/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 23 Sep 2012 13:16:57 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/m2mlabs/wiki/CreateScript/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage CreateScript modified by Jim</title><link>https://sourceforge.net/p/m2mlabs/wiki/CreateScript/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -54,6 +54,7 @@
 Errors:
 
 * 401 UNAUTHORIZED if key is invalid or not admin key
+* 406 NOT ACCEPTABLE if the script can not be compiled
 * 409 CONFLICT if script already exists
 
 Example
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jim</dc:creator><pubDate>Sun, 23 Sep 2012 13:16:57 -0000</pubDate><guid>https://sourceforge.net60adec3a2f3be5f42140edd3f42efc019519ecc1</guid></item><item><title>WikiPage CreateScript modified by Jim</title><link>https://sourceforge.net/p/m2mlabs/wiki/CreateScript/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -24,11 +24,12 @@
     
         public String getDevice (HttpServletRequest request) throws ScriptException;
     
-        public List&lt;SensorData&gt; getSensorData (String apikey, 
-                                               String deviceModel,
-                                               DeviceModelManager deviceModelManager,
-                                               SensorModelManager sensorModelManager,           
-                                               HttpServletRequest request) 
+        public List&lt;SensorData&gt; getSensorData 
+                                    (String apikey, 
+                                     String deviceModel,
+                                     DeviceModelManager deviceModelManager,
+                                     SensorModelManager sensorModelManager,           
+                                     HttpServletRequest request) 
                                 throws ScriptException;
         }
     }
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jim</dc:creator><pubDate>Sun, 23 Sep 2012 12:42:49 -0000</pubDate><guid>https://sourceforge.net18e057f61ac5f377d0d1f4fe236cbf54b81399f2</guid></item><item><title>WikiPage CreateScript modified by Jim</title><link>https://sourceforge.net/p/m2mlabs/wiki/CreateScript/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -4,7 +4,7 @@
 
 There are two kinds of scripts:
 
-* scripts implementing IScriptRunner are called when ever sensor data is received. They must be assigned to a device model in order to be executed
+* scripts implementing IScriptRunner are called when ever sensor data is received. They must be assigned to a device model in order to be executed. They are used to implement application specific sensor data processing like data validation, interpolation, threshold checks or triggers.
 
 ~~~~~~
     public interface IScriptRunner {
@@ -17,7 +17,7 @@
  
 ~~~~~~
 
-* scripts implementing IHttpConnectorScript are assigned to the HttpConnector are are executed automatically when ever the HttpConnector receives sensor data. They are used to transform the received sensor data to the standard Moments representation
+* scripts implementing IHttpConnectorScript are assigned to the HttpConnector and are executed automatically when ever the HttpConnector receives sensor data. They are used to transform the received sensor data to the standard Moments representation
 
 ~~~~~~
     public interface IHttpConnectorScript {
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jim</dc:creator><pubDate>Sun, 23 Sep 2012 12:41:54 -0000</pubDate><guid>https://sourceforge.neta67af59fb7e8510a2b0571b19d55295d8b4e80ca</guid></item><item><title>WikiPage CreateScript modified by Jim</title><link>https://sourceforge.net/p/m2mlabs/wiki/CreateScript/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -1,6 +1,38 @@
 ### Create new Script ###
 
-Creates a new script in the domain of the owner identified by the apikey
+Creates a new script in the domain of the owner identified by the apikey.
+
+There are two kinds of scripts:
+
+* scripts implementing IScriptRunner are called when ever sensor data is received. They must be assigned to a device model in order to be executed
+
+~~~~~~
+    public interface IScriptRunner {
+    
+       public void run(String apikey, 
+                       String deviceName, 
+                       SensorData sensor) throws ScriptException;
+    
+    }
+ 
+~~~~~~
+
+* scripts implementing IHttpConnectorScript are assigned to the HttpConnector are are executed automatically when ever the HttpConnector receives sensor data. They are used to transform the received sensor data to the standard Moments representation
+
+~~~~~~
+    public interface IHttpConnectorScript {
+    
+        public String getDevice (HttpServletRequest request) throws ScriptException;
+    
+        public List&lt;SensorData&gt; getSensorData (String apikey, 
+                                               String deviceModel,
+                                               DeviceModelManager deviceModelManager,
+                                               SensorModelManager sensorModelManager,           
+                                               HttpServletRequest request) 
+                                throws ScriptException;
+        }
+    }
+~~~~~~
 
 Path: cs-ws/resources/admin/script        Method: POST
 
@@ -9,8 +41,6 @@
 * apikey
 
 Data
-
-
 
 ~~~~~~
 &lt;script&gt;
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jim</dc:creator><pubDate>Sun, 23 Sep 2012 12:29:43 -0000</pubDate><guid>https://sourceforge.net0e76b688ff43266300c6f0abe115bbe01d7dac92</guid></item><item><title>WikiPage CreateScript modified by Jim</title><link>https://sourceforge.net/p/m2mlabs/wiki/CreateScript/</link><description>### Create new Script ###

Creates a new script in the domain of the owner identified by the apikey

Path: cs-ws/resources/admin/script        Method: POST

Parameters

* apikey

Data



~~~~~~
&lt;script&gt;
   &lt;code&gt;...&lt;/code&gt;
   &lt;name&gt;...&lt;/name&gt;
   &lt;version&gt;...&lt;/version&gt;
&lt;/script&gt;
~~~~~~

Errors:

* 401 UNAUTHORIZED if key is invalid or not admin key
* 409 CONFLICT if script already exists

Example

~~~~~~
POST http://localhost/cs-ws/resources/admin/script/?apikey=1234 HTTP/1.1
&lt;script&gt;
   &lt;code&gt;import com.m2mlabs.cs.manager.IScriptRunner;
       import com.m2mlabs.cs.model.SensorData;
       class Greeter implements IScriptRunner {
          public void run(String apikey, String deviceName, SensorData sensor) throws       
              ScriptException {println (deviceName) ;
          }
       }
   &lt;/code&gt;
   &lt;name&gt;TestScript3&lt;/name&gt;
   &lt;version&gt;1&lt;/version&gt;
&lt;/script&gt;

HTTP/1.1 200 OK
~~~~~~
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jim</dc:creator><pubDate>Sun, 23 Sep 2012 11:34:09 -0000</pubDate><guid>https://sourceforge.net67589576d3b3f96a907517fa5a612a0af56f6690</guid></item></channel></rss>