autostart option added on XTEXT and generated json file
diff --git a/ui/org.eclipse.sensinact.studio.view.projectexplorer/src/org/eclipse/sensinact/studio/view/projectexplorer/handler/sna2json/SnaToJsonUtil.java b/ui/org.eclipse.sensinact.studio.view.projectexplorer/src/org/eclipse/sensinact/studio/view/projectexplorer/handler/sna2json/SnaToJsonUtil.java
index 6482bf0..9a692da 100644
--- a/ui/org.eclipse.sensinact.studio.view.projectexplorer/src/org/eclipse/sensinact/studio/view/projectexplorer/handler/sna2json/SnaToJsonUtil.java
+++ b/ui/org.eclipse.sensinact.studio.view.projectexplorer/src/org/eclipse/sensinact/studio/view/projectexplorer/handler/sna2json/SnaToJsonUtil.java
@@ -88,11 +88,16 @@
 	public static SnaParsingResult parseSnaFile(DSL_SENSINACT fileModel, String fileName) throws JSONException {
 
 		JSONArray components = new JSONArray();
+		JSONObject initialize = new JSONObject();
 		JSONObject finalize = new JSONObject();
+		
 		ResourcesDeclarationManager resMgr = new ResourcesDeclarationManager(fileModel.getResources());
 		
+		// initialize : autostart
+		setupInitializeOptions(fileModel, initialize);
+		
 		// set up file structure
-		JSONObject root = initFileStructure(fileName, components, finalize);
+		JSONObject root = initFileStructure(fileName, components, initialize, finalize);
 
 		// CEP
 		for (DSL_CEP_STATEMENT cep : fileModel.getCep()) {
@@ -112,6 +117,17 @@
 		return new SnaParsingResult(root);
 	}
 
+	private static void setupInitializeOptions(DSL_SENSINACT fileModel, JSONObject initialize) throws JSONException {
+		
+		boolean autostart = true; // default value
+		if (fileModel.getAutostart() != null)
+			autostart = fileModel.getAutostart().isActivated();
+		
+		JSONObject object = new JSONObject();
+		object.put("autostart", autostart);
+		initialize.put("options", object);
+	}
+
 	/**
 	 * Parse an ECA statement and updates the JSON component array.
 	 * 
@@ -182,7 +198,7 @@
 	 *            a finalize statement array
 	 * @return the JSON skeleton
 	 */
-	private static JSONObject initFileStructure(String fileName, JSONArray components, JSONObject finalize) {
+	private static JSONObject initFileStructure(String fileName, JSONArray components, JSONObject initialize, JSONObject finalize) {
 		try {
 			JSONObject root = new JSONObject();
 
@@ -197,8 +213,7 @@
 			parameters.put(content);
 
 			// initialize
-			JSONObject initializeResources = new JSONObject();
-			contentValue.put("initialize", initializeResources);
+			contentValue.put("initialize", initialize);
 
 			// application
 			contentValue.put("application", components);
diff --git a/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.ecore b/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.ecore
index 0cba3a1..76374b3 100644
--- a/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.ecore
+++ b/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.ecore
@@ -7,6 +7,8 @@
         containment="true"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="DSL_SENSINACT">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="autostart" eType="#//DSL_FLAG_AUTOSTART"
+        containment="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="resources" upperBound="-1"
         eType="#//DSL_Resource" containment="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="cep" upperBound="-1" eType="#//DSL_CEP_STATEMENT"
@@ -15,6 +17,9 @@
     <eStructuralFeatures xsi:type="ecore:EReference" name="eca" eType="#//DSL_ECA_STATEMENT"
         containment="true"/>
   </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="DSL_FLAG_AUTOSTART">
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="activated" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+  </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="DSL_Resource" eSuperTypes="#//DSL_REF">
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="gatewayID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="deviceID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
diff --git a/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.genmodel b/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.genmodel
index 6058f8a..6a60467 100644
--- a/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.genmodel
+++ b/xtext/org.eclipse.sensinact.studio.language.sensinact/model/generated/Sensinact.genmodel
@@ -10,11 +10,15 @@
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Sensinact.ecore#//Sensinact/eca"/>
     </genClasses>
     <genClasses ecoreClass="Sensinact.ecore#//DSL_SENSINACT">
+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Sensinact.ecore#//DSL_SENSINACT/autostart"/>
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Sensinact.ecore#//DSL_SENSINACT/resources"/>
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Sensinact.ecore#//DSL_SENSINACT/cep"/>
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Sensinact.ecore#//DSL_SENSINACT/on"/>
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Sensinact.ecore#//DSL_SENSINACT/eca"/>
     </genClasses>
+    <genClasses ecoreClass="Sensinact.ecore#//DSL_FLAG_AUTOSTART">
+      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Sensinact.ecore#//DSL_FLAG_AUTOSTART/activated"/>
+    </genClasses>
     <genClasses ecoreClass="Sensinact.ecore#//DSL_Resource">
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Sensinact.ecore#//DSL_Resource/gatewayID"/>
       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Sensinact.ecore#//DSL_Resource/deviceID"/>
diff --git a/xtext/org.eclipse.sensinact.studio.language.sensinact/src/org/eclipse/sensinact/studio/language/Sensinact.xtext b/xtext/org.eclipse.sensinact.studio.language.sensinact/src/org/eclipse/sensinact/studio/language/Sensinact.xtext
index 17e2e2b..6ceb460 100644
--- a/xtext/org.eclipse.sensinact.studio.language.sensinact/src/org/eclipse/sensinact/studio/language/Sensinact.xtext
+++ b/xtext/org.eclipse.sensinact.studio.language.sensinact/src/org/eclipse/sensinact/studio/language/Sensinact.xtext
@@ -15,7 +15,11 @@
 ;
 
 DSL_SENSINACT:
-	(resources+=DSL_Resource)+ (cep+=DSL_CEP_STATEMENT)* on=DSL_On eca=DSL_ECA_STATEMENT  
+	autostart=DSL_FLAG_AUTOSTART? (resources+=DSL_Resource)+ (cep+=DSL_CEP_STATEMENT)* on=DSL_On eca=DSL_ECA_STATEMENT  
+;
+
+DSL_FLAG_AUTOSTART:
+	'option' 'autostart' '=' activated=BOOLEAN
 ;
 
 DSL_Resource:
@@ -61,6 +65,7 @@
 terminal ID : ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|':'|'-')+;
 EXTENDED_ID : ID ('.' ID)*;
 
+
 // ================
 // Basic structures 
 // ================