[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r541 - in /projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal: ./ .settings/ META-INF/ OSGI-INF/ OSGI-INF/metatype/ bin/ bin/internal/ bin/internal/it/ bin/internal/it/telecomitalia/ bin/internal/it/telecomitalia/device/ bin/internal/it/telecomitalia/device/zgd/ bin/it/ bin/it/telecomitalia/ bin/it/telecomitalia/device/ bin/it/telecomitalia/device/zgd/ bin/it/telecomitalia/internal/ bin/it/telecomitalia/internal/device/ bin/it/telecomitalia/internal/device/zgd/ resources/ src/ src/internal/ src/internal/it/ src/internal/it/telecomitalia/ src/internal/it/telecomitalia/device/ src/internal/it/telecomitalia/device/zgd/ src/it/ src/it/telecomitalia/ src/it/telecomitalia/device/ src/it/telecomitalia/device/zgd/ src/it/telecomitalia/internal/ src/it/telecomitalia/internal/device/ src/it/telecomitalia/internal/device/zgd/

scm-notify at zb4osgi.aaloa.org scm-notify at zb4osgi.aaloa.org
Mon Oct 22 09:27:08 CEST 2012


Author: ennio.grasso
Date: Mon Oct 22 09:27:07 2012
New Revision: 541

Log: (empty)

Added:
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.classpath
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.project
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.jdt.core.prefs
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.pde.core.prefs
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/META-INF/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/META-INF/MANIFEST.MF
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/gal.xml
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/metatype/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/metatype/metatype.xml
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/internal/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/internal/it/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/internal/it/telecomitalia/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/internal/it/telecomitalia/device/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/internal/it/telecomitalia/device/zgd/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/zgd/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/zgd/IGal.class   (with props)
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/zgd/IGalAdmin.class   (with props)
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/Constants.class   (with props)
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/GalProcess.class   (with props)
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/PlatformsUtil.class   (with props)
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/StreamGobbler.class   (with props)
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/build.properties
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/changelog.txt
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/resources/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/resources/config.ini
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/internal/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/internal/it/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/internal/it/telecomitalia/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/internal/it/telecomitalia/device/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/internal/it/telecomitalia/device/zgd/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGal.java
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGalAdmin.java
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/Constants.java
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/GalProcess.java
    projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/PlatformsUtil.java

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.classpath
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.classpath (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.classpath Mon Oct 22 09:27:07 2012
@@ -1,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/OSGi%Minimum-1.2"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.project
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.project (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.project Mon Oct 22 09:27:07 2012
@@ -1,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>it.telecomitalia.osgi.gal</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ds.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.jdt.core.prefs
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.jdt.core.prefs (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.jdt.core.prefs Mon Oct 22 09:27:07 2012
@@ -1,0 +1,7 @@
+#Fri Aug 05 10:40:41 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.pde.core.prefs
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.pde.core.prefs (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/.settings/org.eclipse.pde.core.prefs Mon Oct 22 09:27:07 2012
@@ -1,0 +1,4 @@
+#Fri Aug 05 10:40:41 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/META-INF/MANIFEST.MF
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/META-INF/MANIFEST.MF (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/META-INF/MANIFEST.MF Mon Oct 22 09:27:07 2012
@@ -1,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ZigBee GAL Launcher and Service
+Bundle-SymbolicName: it.telecomitalia.osgi.device.zgd
+Bundle-Version: 1.1.12.qualifier
+Bundle-RequiredExecutionEnvironment: OSGi/Minimum-1.2,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
+Import-Package: org.apache.commons.logging;version="1.1.1",
+ org.osgi.framework,
+ org.osgi.util.tracker
+Export-Package: it.telecomitalia.device.zgd;version="1.2.0"
+Service-Component: OSGI-INF/gal.xml
+Bundle-Vendor: Telecom Italia

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/gal.xml
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/gal.xml (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/gal.xml Mon Oct 22 09:27:07 2012
@@ -1,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" configuration-policy="optional" enabled="true" immediate="true" name="it.telecomitalia.osgi.device.zgd">
+   <implementation class="it.telecomitalia.internal.device.zgd.GalProcess"/>
+   <service>
+      <provide interface="it.telecomitalia.device.zgd.IGalAdmin"/>
+   </service>
+</scr:component>

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/metatype/metatype.xml
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/metatype/metatype.xml (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/OSGI-INF/metatype/metatype.xml Mon Oct 22 09:27:07 2012
@@ -1,0 +1,30 @@
+<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0">
+  	<OCD description="ZigBee Gateway Device" 
+       	name="ZigBee Gateway Device"
+       	id="it.telecomitalia.osgi.device.zgd">
+    	<AD name="dongle.uri"  id="zgd.dongle.uri" required="true" type="String" default=""/>
+    	<AD name="dongle.type"  id="zgd.dongle.type" required="true" type="String" default="freescale">
+    		<Option label="Freescale" value="freescale" />
+    		<Option label="EZSP" value="ezsp" />
+    	</AD>    	
+    	<AD name="zgd.id"  id="zgd.wsnc.id" required="true" type="String" default=""/>
+    	<AD name="log"  id="zgd.log.debug" required="true" type="Boolean" default="false"/>
+    	<AD name="security"  id="zgd.security" required="true" type="Boolean" default="true"/>
+    	<AD name="watchdog"  id="zgd.watchdog" required="true" type="Integer" default="10000"/>    	
+    	<AD name="speed"  id="zgd.dongle.speed" required="true" type="Integer" default="115200">
+    	    <Option label="115200" value="115200" />
+    		<Option label="38400" value="38400" />
+    	</AD>
+    	<AD name="channel"  id="zgd.channel" required="false" type="Integer" default="16"/>
+    	<AD name="autodiscovery"  id="zgd.autodiscovery" required="false" type="Boolean" default="true"/>
+	</OCD>
+
+   	<Designate pid="it.telecomitalia.osgi.device.zgd">
+        <Object ocdref="it.telecomitalia.osgi.device.zgd">
+            <Attribute adref="zgd.security" content="true"/>
+      		<Attribute adref="zgd.watchdog" content="10000"/>
+      		<Attribute adref="zgd.channel" content="16"/>
+    	</Object>
+  	</Designate>
+  
+</metatype:MetaData>

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/zgd/IGal.class
==============================================================================
Binary file - no diff available.

Propchange: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/zgd/IGal.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/zgd/IGalAdmin.class
==============================================================================
Binary file - no diff available.

Propchange: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/device/zgd/IGalAdmin.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/Constants.class
==============================================================================
Binary file - no diff available.

Propchange: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/Constants.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/GalProcess.class
==============================================================================
Binary file - no diff available.

Propchange: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/GalProcess.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/PlatformsUtil.class
==============================================================================
Binary file - no diff available.

Propchange: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/PlatformsUtil.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/StreamGobbler.class
==============================================================================
Binary file - no diff available.

Propchange: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/bin/it/telecomitalia/internal/device/zgd/StreamGobbler.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/build.properties
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/build.properties (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/build.properties Mon Oct 22 09:27:07 2012
@@ -1,0 +1,9 @@
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               gal/,\
+               OSGI-INF/,\
+               resources/,\
+               changelog.txt
+source.. = src/
+bin.excludes = gal/windows/

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/changelog.txt
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/changelog.txt (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/changelog.txt Mon Oct 22 09:27:07 2012
@@ -1,0 +1,49 @@
+This file contains the release notes of the it.telecomitalia.osgi.gal bundle:
+
+Version 1.1.12.qualifier:
+
+*** Bugs:
+	* Works fine on windows an Linux OS
+
+** New Features
+	* Channel mask set to 0 (scan all channels) in config.ini
+	
+	
+
+Bundle Version 1.1.12:
+	set LD_LIBRARY_PATH of extracted gal to '.' 
+	the gal is launched using a relative path.
+	
+Bundle Version 1.1.11:
+	keepAliveThreshold param changed to 90s
+	
+Bundle Version 1.1.10:
+	PANid set to 0xFFFF in config.ini
+	Changed a parameter meaning from keepAliveTimeout to keepAliveNumberOfAttempt.
+	Ported to Felix and Prosyst
+	Autodiscovery is now enabled by default
+
+Bundle Version 1.1.9:
+	Autodiscovery disabled by default
+	
+Bundle Version 1.1.8;
+
+	Features:
+	- Added zgd.autodiscovery property to enable disable autodiscovery
+	  from Equinox config.ini and configuration admin
+	- Stop and start should behave more smootly
+	- Fragment bundle updates are detected (after refresh).
+
+Bundle Version 1.0.4:
+
+	Features:
+	- It is possible to change the zigbee channel from ConfigAdmin
+	  
+Bundle Version 1.0.0:
+
+	Features:
+	- Expose interface IGal when the gal is running. The IGal interface is removed
+	  if the gal crashes or if the bundle is stopped.
+	- The watchdogTimeout permits to restart the Gal if it crashes.
+	- Integrated with the configuration admin service. It is possible to dynamically
+	  reconfigure the gal.

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/resources/config.ini
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/resources/config.ini (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/resources/config.ini Mon Oct 22 09:27:07 2012
@@ -1,0 +1,148 @@
+[main]
+# Hardware platform desired: integration (0), zsdio/EZSP/freescale/MicroSD (1)
+Platform = 1
+
+# Autostart the ZigBee network: 0 to disable (it will wait for a StartGatewayDevice command), 1 to enabled
+autostart = 0
+
+# [Freescale only] Three possible scenario to startup the network:
+#0 - StartupSetMode=0x18 (CommissioningMode) AND StartupControlMode=0x00 (Association) --> To be used the first time, when the network is created
+#1 - StartupSetMode=0x00 (use NVM) AND StartupControlMode=0x04 (SilentStart) --> To be used at running time
+#2 - StartupSetMode=0x18 (CommissioningMode) AND StartupControlMode=0x04 (SilentStart) --> To be used for TC Replacement
+startupMode = 0
+
+# Enable a local registration to device announcement events (1 to enable, 0 to disable)
+localRegToDAnnce = 1
+
+# Specify how long to wait (in seconds) before to start polling each node to verify if they're still alive ('0' to disable)
+keepAliveThreshold = 90
+
+# Once keepAliveThreshold is reached, GAL tries to ping the node for 'keepAliveNumberOfAttempt' before considering it dead
+keepAliveNumberOfAttempt = 3
+
+# Specify in seconds a timeout before to force the gateway to send a ping (MGMT_LQI_Req) to the nodes (0 to disable)
+forcePingTimeout = 200
+
+# Automatic discovery unknown nodes before sending or after receiving a message (1 to enable, 0 to disable)
+autoDiscoveryUnknownNodes = 1
+
+# [Optional] "Callback URI listener" address. It represent the "GW Status Changed event" default URI Listener
+#gwStatusChanged_DefaultURIListener = http://10.192.33.20.:8080/gal/startup
+
+# APS level parameters (required for fragmentation services)
+apscMaxWindowSize = 1
+apsInterframeDelay = 100
+
+# To enable debug messages select "1"  (0 to disable)
+debugEnabled = 0
+
+
+[Debug]
+# Printing levels for class debugging - 0 (DEBUGGING), 1 (TEST), 3 (PRODUCTION)
+# HTTPServer class
+HTTPServerDL = 0 
+# HTTPSessionContext class
+HTTPSessionContextDL = 3
+# RESTClient class
+RESTClientDL = 0 
+# RESTBroker class
+RESTBrokerDL = 0
+# DiscoveryAgent class
+DiscoveryAgentDL = 0
+# ManagementAgent class
+ManagementAgentDL = 0
+# LocalNode class
+LocalNodeDL = 0
+
+
+[DefaultStartupAttributeSet]
+# Device Type (0 =Current device type; 1=Coordinator; 2=Router; 3=End Device)
+DeviceType = 1
+
+# Default Channel Mask [valid range: 11 - 26, or '0' for all channels]
+ChannelMask = 0
+
+# ZigBee Network PANId ('0xFFFF' = generate random value)
+PANId = 0xFFFF
+
+# Extended PAN Id (big-endian order) - Note: Set all zeros for Freescale dongle
+ExtendedPANId = 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+
+# StartupControl (0=Association; 1=Orphan Rejoin; 2=Network Rejoin; 3=Find and Rejoin; 4=Silent Start)
+StartUpControl = 0
+
+# SecurityLevel (0=Disabled, 5=Enabled)
+SecurityLevel = 5
+
+# [Freescale only] MAC Address mode: 0=use manufacture address (stored within the dongle), 1= generate random address
+freescaleMACAddressValue = 0
+
+# Default Network Key - Note: Set all zeros for Freescale dongle
+networkKey = 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+
+# Default Trust Center Link Key - 'ZigBeeAlliance09'
+preconfiguredLinkKey = 0x5a 0x69 0x67 0x42 0x65 0x65 0x41 0x6c 0x6c 0x69 0x61 0x6e 0x63 0x65 0x30 0x39
+
+# Default End Point
+DefaultEndPoint = 0x01
+
+[TCKeyTable]
+#TCKeyTableSize - Zero to disable the TrustCenterLinkKeytable - Note: maximum number of entries is 12 for Ember, 9 for Freescale
+TCKeyTableSize = 0
+
+#Entry n. 00
+IEEEAddress00 = 0x00 0x0d 0x6f 0x00 0x00 0x09 0x99 0x1f
+#TCLinkKey00 = 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
+TCLinkKey00 = 0x5a 0x69 0x67 0x42 0x65 0x65 0x41 0x6c 0x6c 0x69 0x61 0x6e 0x63 0x65 0x30 0x39
+
+#Entry n. 01
+IEEEAddress01 = 0x00 0x0d 0x6f 0x00 0x00 0x09 0x93 0xa1
+TCLinkKey01 = 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x08
+
+#Entry n. 02
+IEEEAddress02 = 0x00 0x0d 0x6f 0x00 0x00 0x18 0x57 0x46
+TCLinkKey02 = 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x09
+
+
+[TC]
+# Insert the Trust Center IEEE Address
+IEEE_ADDRESS = "17161514131201ff"
+# Decide if the local ACL Conf shall be used (INSERT true) or if the WSN-C access is required (INSERT false)
+JOINREQUESTPROCESSING = false
+# Decide if process locally the leave notifications without warning the WSN-C (SELECT true). Otherwise insert false.
+LEAVENOTIFICATIONPROCESSING = true
+# File name containing the Access Control List
+ACLFILENAME = acl.txt
+# The network master key, 16-bytes long
+NETWORKKEY = "11000000000000000000000000000011"
+# The Security Timeout period (expressed in milliseconds)
+APPSECURITYTIMEOUTPERIOD = 9999
+
+
+[RESTBroker]
+# Decide if the Network Root URI can be obtained by appending the net/default' suffix (SELECT 1), or by appending the net/<ExtendedPANId>' suffix (SELECT 0)
+UseDefaultNWKRootURI = 1
+
+# Gateway Descriptor Asynchonous notification period (expressed in seconds), respectively before and after a WSN-C is attached. Note: This is like an "Hello" message to the WSN-C platform address
+HelloMsgNotifyPeriod = 10 
+HelloMsg_WSNCAttached_NotifyPeriod = 1800
+
+[RESTServer]
+# Port server where to receive REST commands
+serverPorts = "9000"
+
+# RESTServer parameters
+ssl = 0
+sslCertFile = "shttpd.pem"
+httpDigestAuth = 0
+httpDigestAuthPwdFile = "pwdfile"
+
+
+[RESTClient]
+# libcurl HTTP option application timeout (in seconds) - Note: for remote connection between GW and IPHA insert a value higher than 1
+httpOptTimeout = 3
+
+
+[PerfomanceTest]
+# Select the txPeriod used during the Performance tests
+txPeriod = 100000

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGal.java
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGal.java (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGal.java Mon Oct 22 09:27:07 2012
@@ -1,0 +1,5 @@
+package it.telecomitalia.device.zgd;
+
+public interface IGal {
+
+}

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGalAdmin.java
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGalAdmin.java (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/device/zgd/IGalAdmin.java Mon Oct 22 09:27:07 2012
@@ -1,0 +1,5 @@
+package it.telecomitalia.device.zgd;
+
+public interface IGalAdmin {
+
+}

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/Constants.java
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/Constants.java (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/Constants.java Mon Oct 22 09:27:07 2012
@@ -1,0 +1,29 @@
+package it.telecomitalia.internal.device.zgd;
+
+public class Constants {
+
+	
+	public static final String INTERNAL_OS_SUNOS = "SunOS"; 
+	public static final String INTERNAL_OS_LINUX = "Linux"; 
+	public static final String INTERNAL_OS_MACOSX = "Mac OS"; 
+	public static final String INTERNAL_OS_AIX = "AIX"; 
+	public static final String INTERNAL_OS_HPUX = "HP-UX"; 
+	public static final String INTERNAL_OS_QNX = "QNX"; 
+	public static final String INTERNAL_OS_OS400 = "OS/400"; 
+	public static final String INTERNAL_OS_OS390 = "OS/390"; 
+	public static final String INTERNAL_OS_ZOS = "z/OS"; 
+
+	public static final String INTERNAL_ARCH_AMD64 = "amd64"; 
+	public static final String INTERNAL_ARCH_I386 = "i386"; 
+	public static final String INTERNAL_ARCH_X86 = "x86";
+	public static final String INTERNAL_ARCH_X86_64 = "x86_64";
+	public static final String INTERNAL_ARCH_ARM = "arm";
+
+	public static final String OS_WIN32 = "win32";
+	public static final String OS_LINUX = "linux";
+	public static final String OS_AIX = "aix";
+	public static final String OS_SOLARIS = "solaris";
+	public static final String OS_HPUX = "hpux";
+	public static final String OS_MACOSX = "macosx";
+	public static final String OS_UNKNOWN = "unknown";
+}

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/GalProcess.java
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/GalProcess.java (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/GalProcess.java Mon Oct 22 09:27:07 2012
@@ -1,0 +1,933 @@
+package it.telecomitalia.internal.device.zgd;
+
+import it.telecomitalia.device.zgd.IGal;
+import it.telecomitalia.device.zgd.IGalAdmin;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.BundleTracker;
+import org.osgi.util.tracker.BundleTrackerCustomizer;
+
+/**
+ * Spawn the gal process and control it
+ */
+class StreamGobbler extends Thread {
+	InputStream is;
+	String type;
+	boolean show;
+
+	private static final Log log = LogFactory.getLog(GalProcess.class);
+
+	StreamGobbler(InputStream is, String type, boolean show) {
+		this.is = is;
+		this.type = type;
+		this.show = show;
+	}
+
+	public void run() {
+		try {
+			InputStreamReader isr = new InputStreamReader(is);
+			BufferedReader br = new BufferedReader(isr);
+			String line = null;
+			while ((line = br.readLine()) != null)
+				if (show)
+					log.debug(type + " >" + line);
+		} catch (IOException ioe) {
+
+		}
+	}
+}
+
+public class GalProcess implements Runnable, IGal, IGalAdmin, BundleTrackerCustomizer {
+
+	public static final String ZGD_WSNC_URL_PROP_NAME = "zgd.wsnc.uri";
+	public static final String DEFAULT_ZGD_WSNC_URL_PROP = "http://163.162.180.176:8080";
+	public static final String ZGD_DONGLE_URI_PROP_NAME = "zgd.dongle.uri";
+	public static final String ZGD_DONGLE_TYPE_PROP_NAME = "zgd.dongle.type";
+	public static final String ZGD_DONGLE_SPEED_PROP_NAME = "zgd.dongle.speed";
+	public static final String ZGD_DEBUG_PROP_NAME = "zgd.log.debug";
+	public static final String ZGD_SECURITY_PROP_NAME = "zgd.security";
+	public static final String ZGD_SECURITY_WATCHDOG_TIME_NAME = "zgd.watchdog";
+	public static final String ZGD_WSNC_ID_PROP_NAME = "zgd.wsnc.id";
+	public static final String PROP_ZGD_PORT = "zgd.port";
+	public static final String PROP_ZGD_CHANNEL = "zgd.channel";
+	public static final String PROP_ZGD_AUTODISCOVERY = "zgd.autodiscovery";
+
+	protected static final String FRAGMENT_BUNDLES_PREFIX = "it.telecomitalia.osgi.zgd";
+
+	private static final Log log = LogFactory.getLog(GalProcess.class);
+
+	Process p = null;
+	private BundleContext bc;
+
+	private boolean logDebug = true;
+
+	// default values
+	private static final String DEFAULT_ZGD_DONGLE_TYPE_PROP = "ezsp";
+	private static final int DEFAULT_ZGD_DONGLE_SPEED_PROP = 115200;
+	private static final boolean DEFAULT_ZGD_SECURITY = true;
+	private static final boolean DEFAULT_ZGD_AUTODISCOVERY = true;
+
+	private int zgdPort = 9000;
+	private URI dongleUri = null;
+	private String dongleType;
+	private int dongleSpeed;
+
+	private boolean security = true;
+	private boolean autoExtract = true;
+
+	String exeName = "gal";
+
+	Object sync = new Object();
+	private int watchdogTime;
+	private String zgdId = null;
+	private int channel;
+	private ServiceRegistration registration = null;
+
+	boolean first = true;
+
+	BundleTracker bundleTracker;
+	private String os;
+	private String arch;
+	private Bundle fragmentBundle;
+	private BundleTracker fragmentsTracker;
+
+	Object registrationLock = new Object();
+	private boolean autodiscovery = false;
+
+	private volatile Thread processThread = null;
+	private boolean useAbsolutePath = false;
+
+	public GalProcess() {
+		log.debug("constructor");
+	}
+
+	protected synchronized void activate(BundleContext bc, Map props) {
+		log.debug("activate");
+		this.bc = bc;
+
+		if (first) {
+			logDebug = getProperty(ZGD_DEBUG_PROP_NAME, false);
+			dongleSpeed = getProperty(ZGD_DONGLE_SPEED_PROP_NAME, DEFAULT_ZGD_DONGLE_SPEED_PROP);
+			dongleType = getProperty(ZGD_DONGLE_TYPE_PROP_NAME, DEFAULT_ZGD_DONGLE_TYPE_PROP);
+			security = getProperty(ZGD_SECURITY_PROP_NAME, DEFAULT_ZGD_SECURITY);
+			channel = getProperty(PROP_ZGD_CHANNEL, 16);
+			autodiscovery = getProperty(PROP_ZGD_AUTODISCOVERY, DEFAULT_ZGD_AUTODISCOVERY);
+			this.zgdId = bc.getProperty(ZGD_WSNC_ID_PROP_NAME);
+			try {
+				dongleUri = new URI(bc.getProperty(ZGD_DONGLE_URI_PROP_NAME));
+			} catch (URISyntaxException e) {
+				log.debug("invalid dongle url received from configuration: " + props.get(ZGD_DONGLE_URI_PROP_NAME));
+			} catch (NullPointerException e) {
+			}
+
+			zgdPort = getProperty(PROP_ZGD_PORT, 9000);
+			watchdogTime = getProperty(ZGD_SECURITY_WATCHDOG_TIME_NAME, 10000);
+			first = false;
+		}
+
+		logDebug = getProperty(props, ZGD_DEBUG_PROP_NAME, logDebug);
+		dongleSpeed = getProperty(props, ZGD_DONGLE_SPEED_PROP_NAME, dongleSpeed);
+		dongleType = getProperty(props, ZGD_DONGLE_TYPE_PROP_NAME, dongleType);
+		security = getProperty(props, ZGD_SECURITY_PROP_NAME, security);
+		channel = getProperty(props, PROP_ZGD_CHANNEL, channel);
+		zgdId = getProperty(props, ZGD_WSNC_ID_PROP_NAME, zgdId);
+		autodiscovery = getProperty(props, PROP_ZGD_AUTODISCOVERY, autodiscovery);
+
+		try {
+			dongleUri = getProperty(props, ZGD_DONGLE_URI_PROP_NAME, dongleUri);
+		} catch (URISyntaxException e) {
+			log.debug("invalid dongle url received from configuration admin: " + props.get(ZGD_DONGLE_URI_PROP_NAME));
+		} catch (NullPointerException e) {
+		}
+		zgdPort = this.getProperty(props, PROP_ZGD_PORT, zgdPort);
+		watchdogTime = getProperty(props, ZGD_SECURITY_WATCHDOG_TIME_NAME, watchdogTime);
+
+		if (logDebug)
+			dumpProperties(props);
+
+		fragmentsTracker = new BundleTracker(bc, Bundle.RESOLVED | Bundle.INSTALLED, this);
+		fragmentsTracker.open();
+	}
+
+	protected synchronized void deactivate(final BundleContext bc) throws Exception {
+		log.debug("deactivate");
+		synchronized (registrationLock) {
+			this.unregister();
+		}
+		this.stopProcess();
+		fragmentsTracker.close();
+	}
+
+	private void startProcess() {
+		processThread = new Thread(this, "Zgd Process and Monitoring Thread");
+		processThread.start();
+	}
+
+	private void stopProcess() {
+		// atomic because pollingThread is volatile
+		Thread tmpThread = processThread;
+
+		processThread = null;
+
+		if (tmpThread != null) {
+			tmpThread.interrupt();
+			try {
+				tmpThread.join();
+			} catch (InterruptedException e) {
+				log.error(e);
+			}
+		}
+
+		if (log != null)
+			log.debug("stopped process");
+	}
+
+	protected void modified(final Map props) {
+		log.debug("modified");
+	}
+
+	private boolean generateGalConfigFile(String path) {
+		InputStream is = null;
+
+		String ps = File.separator;
+
+		// config.ini location in the jar file
+		String configFilenameEntry = ps + "resources" + ps + "config.ini";
+
+		try {
+
+			URL url = bc.getBundle().getEntry(configFilenameEntry);
+			if (url == null) {
+				if (log != null)
+					log.error("unable to open file " + configFilenameEntry);
+				return false;
+			}
+
+			is = url.openStream();
+
+			File outputFile = new File(path + ps + "config.ini");
+
+			BufferedReader br = new BufferedReader(new InputStreamReader(is));
+			BufferedWriter bw = new BufferedWriter(new FileWriter(outputFile));
+
+			String line = null;
+			while ((line = br.readLine()) != null) {
+				if (line.startsWith("gwStatusChanged_DefaultURIListener")) {
+					// replace
+					// bw.write("gwStatusChanged_DefaultURIListener = " +
+					// parent.getWsncUrl() + "/gal/startup");
+				} else if (line.startsWith("SecurityLevel")) {
+					if (security)
+						bw.write("SecurityLevel = 5");
+					else
+						bw.write("SecurityLevel = 0");
+				} else if (line.startsWith("serverPorts")) {
+					bw.write("serverPorts = \"" + zgdPort + "\"");
+				} else if (line.startsWith("ChannelMask")) {
+					bw.write("ChannelMask = " + channel);
+				} else if (line.startsWith("debugEnabled")) {
+					if (logDebug)
+						bw.write("debugEnabled = 1");
+					else
+						bw.write("debugEnabled = 0");
+				} else if (line.startsWith("autostart")) {
+					bw.write("autostart = 0");
+				} else if (line.startsWith("autoDiscoveryUnknownNodes")) {
+					if (autodiscovery)
+						bw.write("autoDiscoveryUnknownNodes = 1");
+					else
+						bw.write("autoDiscoveryUnknownNodes = 0");
+				} else {
+					bw.write(line);
+				}
+				bw.newLine();
+			}
+
+			br.close(); // Close to unlock.
+			bw.close(); // Close to unlock and flush to disk.
+
+			is.close();
+
+			if (logDebug && log != null)
+				log.info("gal config.ini file generated successfully");
+
+		} catch (FileNotFoundException ex) {
+			if (log != null)
+				log.error(ex.getMessage() + " in the specified directory.");
+
+			return false;
+		} catch (IOException e) {
+			if (log != null)
+				log.error(e.getMessage());
+
+			return false;
+		}
+
+		return true;
+	}
+
+	public void run() {
+		log.debug("started processThread");
+		if (processThread == null) {
+			log.debug("stopped process thread before started");
+			return; // stopped before started.
+		}
+
+		String path = null;
+		try {
+			path = retrieveGalPath();
+		} catch (URISyntaxException e) {
+			log.error(e);
+		}
+
+		if (path == null) {
+			log.fatal("no destination path for gal. Errors extracting gal?");
+			return;
+		}
+
+		log.info("gal dir exported to " + path);
+
+		if (log != null)
+			log.debug("osName = '" + getOS() + "', osArch = '" + getArch() + "'");
+		
+		if (getOS().equals("win32") && getArch().equals("x86")) {
+			useAbsolutePath = true;
+			if (dongleUri == null) {
+				try {
+					dongleUri = new URI("zigbee:///dev/ttyS43");
+				} catch (URISyntaxException e) {
+					log.fatal("error in default URI");
+				}
+			}
+			exeName += ".exe";
+		} else if (getOS().equals("linux") && (getArch().equals("arm") || getArch().equals("x86") || getArch().equals("mips"))) {
+			if (dongleUri == null) {
+				try {
+					dongleUri = new URI("zigbee:///dev/ttyUSB0");
+				} catch (URISyntaxException e) {
+					log.fatal("error in default URI");
+				}
+			}
+
+			try {
+				Runtime.getRuntime().exec(new String[] { "chmod", "755", path + File.separator + exeName }).waitFor();
+				log.debug("chmod di " + path + File.separator + exeName);
+			} catch (Throwable e) {
+				// ignore
+			}
+
+		} else {
+			log.error("gal binaries not available for current platform: " + getOS() + ", " + getArch());
+			return;
+		}
+
+		String url = dongleUri.toString();
+
+		url = addParameter(url, "dongle", dongleType);
+		url = addParameter(url, "speed", dongleSpeed + "");
+
+		ArrayList cmd = new ArrayList();
+
+		if (useAbsolutePath ) {
+			cmd.add(path + File.separator + exeName);
+		}
+		else {
+			cmd.add("." + File.separator + exeName);
+		}
+
+		if ((this.zgdId != null) && (zgdId.length() > 0)) {
+			cmd.add("-n");
+			cmd.add(this.zgdId);
+		}
+		cmd.add("-c");
+		if (useAbsolutePath ) {
+			cmd.add(path + File.separator + "config.ini");
+		}
+		else 
+			cmd.add("config.ini");
+		
+		cmd.add(url);
+
+		try {
+			generateGalConfigFile(path);
+		} catch (Exception e) {
+			if (log != null)
+				log.error("Exception generating config.ini file '" + e.getMessage() + "'");
+		}
+
+		String[] cmdArray = new String[cmd.size()];
+		cmd.toArray(cmdArray);
+
+		while (!Thread.currentThread().isInterrupted()) {
+			String cmdline = "";
+			for (int i = 0; i < cmdArray.length; i++) {
+				cmdline += cmdArray[i] + " ";
+			}
+
+			log.debug("exec gal with command line: " + cmdline);
+
+			// pace time to avoid to too close gal startups
+			try {
+				Thread.sleep(2000);
+			} catch (InterruptedException e) {
+				break;
+			}
+			
+			String[] envp = null;
+			
+			if (!useAbsolutePath)
+				envp = new String[] { "LD_LIBRARY_PATH=."};
+			
+			try {
+				if (useAbsolutePath)
+					p = Runtime.getRuntime().exec(cmdArray);
+				else 
+					p = Runtime.getRuntime().exec(cmdArray, envp, new File(path + File.separator));
+			} catch (IOException e) {
+				log.debug("Exception", e);
+				continue;
+			}
+
+			StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(), "ERROR", logDebug);
+			StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(), "OUTPUT", logDebug);
+
+			// kick them off
+			errorGobbler.start();
+			outputGobbler.start();
+
+			synchronized (registrationLock) {
+				this.register();
+			}
+
+			int exitVal;
+
+			try {
+				exitVal = p.waitFor();
+			} catch (InterruptedException e) {
+				break;
+			}
+
+			p = null;
+			errorGobbler = null;
+			outputGobbler = null;
+
+			if (log != null) {
+				switch (exitVal) {
+				case 0:
+					log.debug("gal exited successfully");
+					break;
+
+				case 1:
+					log.error("exit code: adapter not found. The adapter uri was '" + this.dongleUri + "'");
+					break;
+
+				default:
+					log.error("gal exited with exit code = " + exitVal);
+				}
+			}
+
+			synchronized (registrationLock) {
+				unregister();
+			}
+
+			// force restart after 'watchdogTime'
+			if (watchdogTime > 1) {
+				try {
+					Thread.sleep(watchdogTime);
+				} catch (InterruptedException e) {
+					break;
+				}
+			} else {
+				break;
+			}
+		}
+
+		this.unregister();
+		this.kill();
+	}
+
+	private void register() {
+		if (registration == null)
+			registration = bc.registerService(new String[] { IGal.class.getName() }, this, getCurrentConfig());
+	}
+
+	private void unregister() {
+		if (registration != null) {
+			log.debug("unregistering gal");
+			registration.unregister();
+			registration = null;
+		}
+	}
+
+	private Dictionary getCurrentConfig() {
+		Dictionary props = new Hashtable();
+		props.put(PROP_ZGD_PORT, new String(this.zgdPort + ""));
+		return props;
+	}
+
+	protected static String addParameter(String URL, String name, String value) {
+		int qpos = URL.indexOf('?');
+		int hpos = URL.indexOf('#');
+		char sep = qpos == -1 ? '?' : '&';
+		String seg = sep + encodeUrl(name) + '=' + encodeUrl(value);
+		return hpos == -1 ? URL + seg : URL.substring(0, hpos) + seg + URL.substring(hpos);
+	}
+
+	private static String encodeUrl(String name) {
+		return name;
+	}
+
+	private String retrieveGalPath() throws URISyntaxException {
+		String path;
+
+		if (autoExtract) {
+			if (!getOS().equals("win32") && !getOS().equals("linux")) {
+				return null;
+			}
+
+			if (!getArch().equals("x86") && !getArch().equals("arm")) {
+				return null;
+			}
+
+			// ATTTENTION: DO NOT USE File.separator here!!! Works only with "/"
+			path = "resources/zgd/" + getOS() + "/" + getArch();
+
+			// locates the executable into the bundle
+			return this.extractGalBinaries(path);
+		} else {
+			if (getOS().equals("win32") && getArch().equals("x86")) {
+				path = getNativeStorageLocation("cygcurl-4.dll");
+				if (dongleUri == null) {
+					dongleUri = new URI("zigbee:///dev/com8");
+				}
+				exeName += ".exe";
+			} else if (getOS().equals("linux") && (getArch().equals("arm") || getArch().equals("x86"))) {
+				path = getNativeStorageLocation("gal");
+				if (dongleUri == null) {
+					dongleUri = new URI("zigbee:///dev/ttyUSB0");
+				}
+				try {
+					Runtime.getRuntime().exec("chmod +x " + path + exeName);
+				} catch (IOException e) {
+					return null;
+				}
+
+			} else {
+				log.error("gal binaries not available for current platform: " + getOS() + ", " + getArch());
+				return null;
+			}
+		}
+
+		return path;
+	}
+
+	/**
+	 * We try to load a dll that causes an UnsatisfiedLinkError exception. This
+	 * exception contains in the error message the location of the native
+	 * storage area. We exctract the path and return back to the caller. FIXME:
+	 * probably this trick is valid only on the Sun's jdk.
+	 * 
+	 * @param filename
+	 * @return
+	 */
+
+	private String getNativeStorageLocation(String filename) {
+		String path = "";
+
+		if (logDebug && (log != null))
+			log.debug("getNativeStorageLocation = " + filename);
+
+		try {
+			System.loadLibrary(filename);
+		} catch (UnsatisfiedLinkError e) {
+			int index_start = 0;
+			int index_end = 0;
+
+			if (e.getMessage().indexOf("cannot dynamically load executable") > 0) {
+				index_end = e.getMessage().indexOf("(", index_start + 2);
+				if (index_end == -1) {
+					// try with :
+					index_end = e.getMessage().indexOf(":", index_start + 2);
+				}
+			} else {
+				index_end = e.getMessage().indexOf(":", index_start + 2) + 1;
+			}
+
+			path = e.getMessage().substring(index_start, index_end - filename.length() - 1);
+		} catch (Exception e) {
+			log.error(e);
+			return path;
+		}
+		return path + File.separator;
+	}
+
+	/**
+	 * This function copy the whole content of the passed path (that refers to a
+	 * folder that is in the bundle) in the storage area reserved to the bundle,
+	 * by the OSGi framework. The original path is reproduced. If, for instance,
+	 * bundlePath is /gal/windows, all the files in <code>/gal/windows</code>
+	 * are copied under <code>bundle data path/gal/windows</code>
+	 * 
+	 * 
+	 * @param bundleResourcePath
+	 *            path to a folder packaged into the bundle jar
+	 */
+
+	private String alignFiles(String bundleResourcePath) {
+		byte[] buffer = new byte[20480];
+		log.debug("bundleResourcePath is " + bundleResourcePath);
+
+		Enumeration entries = null;
+
+		Dictionary headers = bc.getBundle(0).getHeaders();
+		String vendor = ((String) headers.get("Bundle-Vendor"));
+
+		boolean isEquinox = false;
+		if ((vendor != null) && vendor.startsWith("Eclipse"))
+			isEquinox = true;
+
+		if (isEquinox) {
+			entries = bc.getBundle().findEntries(bundleResourcePath, "*", false);
+		} else {
+			// On Felix it seems that the fragment resources are not MERGED with
+			// the host bundle so we access them by using fragmentBundle
+			if (fragmentBundle != null) {
+				entries = fragmentBundle.findEntries(bundleResourcePath, "*", false);
+			} else {
+				log.fatal("fragmentBundle is unexpectly null!!");
+				return null;
+			}
+		}
+
+		File root = bc.getDataFile(bundleResourcePath);
+
+		if (entries == null) {
+			log.fatal("no entries in bundle resource path '" + bundleResourcePath + "'");
+			return null;
+		}
+
+		while (entries.hasMoreElements()) {
+
+			URL entry = (URL) entries.nextElement();
+			File entryFile = new File(entry.getPath());
+			String path = entryFile.getPath();
+
+			// NOTE: Apache Felix requires that the path specified in
+			// getDataFile is relative. Equinox accepts both relative or
+			// absolute paths.
+
+			// TODO: what about Prosyst?
+			File f = bc.getDataFile("." + File.separator + path);
+
+			if (path.endsWith(".svn")) {
+				continue;
+			}
+
+			f.getParentFile().mkdirs();
+
+			boolean update = needsRefresh(entryFile, f);
+			if (!update) {
+				log.debug("file " + f.getName() + " already up-to-date");
+				continue;
+			}
+
+			try {
+				log.debug("extracting file = " + entry.toString());
+				FileOutputStream fos = new FileOutputStream(f);
+				InputStream is = entry.openStream();
+
+				for (int read = is.read(buffer, 0, buffer.length); read > 0; read = is.read(buffer, 0, buffer.length)) {
+					fos.write(buffer, 0, read);
+				}
+
+				fos.flush();
+				fos.close();
+			} catch (IOException e) {
+				log.error("error extracting file " + path + " " + e.getMessage()
+						+ ". Probably the file is used by another process.");
+				return null;
+			}
+		}
+
+		// TODO: remove those elements from the data area that are not into the
+		// bundle anymore
+
+		return root.getAbsolutePath();
+	}
+
+	private boolean needsRefresh(File origin, File destination) {
+		if (fragmentBundle == null) {
+			return false;
+		}
+		if (!destination.exists()) {
+			return true;
+		}
+		if (fragmentBundle.getLastModified() >= destination.lastModified())
+			return true;
+
+		return false;
+	}
+
+	protected void removeGalBinaries() {
+		File root = bc.getDataFile("/");
+		deleteDirectory(root);
+		log.debug("removed gal binaries");
+	}
+
+	static private boolean deleteDirectory(File path) {
+		if (path.exists()) {
+			File[] files = path.listFiles();
+			for (int i = 0; i < files.length; i++) {
+				if (files[i].isDirectory()) {
+					deleteDirectory(files[i]);
+				} else {
+					files[i].delete();
+				}
+			}
+		}
+		return (path.delete());
+	}
+
+	protected String extractGalBinaries(String bundlePath) {
+		return alignFiles(bundlePath);
+	}
+
+	protected void kill() {
+		if (p != null) {
+			log.debug("killing gal");
+			p.destroy();
+		} else {
+			log.debug("gal is not currently running");
+		}
+	}
+
+	protected int getProperty(String name, int value) {
+		String prop = bc.getProperty(name);
+		if (prop != null) {
+			try {
+				value = Integer.valueOf(prop).intValue();
+			} catch (Exception e) {
+			}
+		}
+		return value;
+	}
+
+	protected String getProperty(String name, String value) {
+		String prop = bc.getProperty(name);
+		if (prop != null) {
+			value = prop;
+		}
+		return value;
+	}
+
+	protected boolean getProperty(String name, boolean value) {
+		String prop = bc.getProperty(name);
+		if (prop != null) {
+			try {
+				value = Boolean.valueOf(prop).booleanValue();
+			} catch (Exception e) {
+			}
+		}
+		return value;
+	}
+
+	protected int getProperty(Map props, String name, int value) {
+		Number prop = null;
+		try {
+			prop = (Number) props.get(name);
+		} catch (Exception e) {
+			log.error("bad property type for property " + name + " expecting Integer");
+			return value;
+		}
+		if (prop != null) {
+			return prop.intValue();
+		}
+		return value;
+	}
+
+	private URI getProperty(Map props, String name, URI url) throws URISyntaxException {
+		String prop = (String) props.get(name);
+		if (prop != null) {
+			if (prop.length() > 0)
+				url = new URI(prop);
+		}
+		return url;
+	}
+
+	protected String getProperty(Map props, String name, String value) {
+		String prop = (String) props.get(name);
+		if (prop != null) {
+			value = prop;
+		}
+		return value;
+	}
+
+	protected boolean getProperty(Map props, String name, boolean value) {
+		Boolean prop = null;
+		try {
+			prop = (Boolean) props.get(name);
+		} catch (Exception e) {
+			log.error("bad property type for property " + name + " expecting Boolean");
+			return value;
+		}
+
+		if (prop != null) {
+			return prop.booleanValue();
+		}
+		return value;
+	}
+
+	protected void dumpProperties(Map map) {
+		if (map.size() == 0) {
+			log.debug("Map: <empty>");
+			return;
+		} else {
+			log.debug("Key\t\t\tValue");
+			log.debug("-----------\t--------------------");
+		}
+
+		Set keys = map.keySet();
+		for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+			Object object = (Object) iterator.next();
+			log.debug(object.toString() + "\t" + map.get(object));
+		}
+	}
+
+	private String getOS() {
+		if (os != null)
+			return os;
+		String osName = System.getProperties().getProperty("os.name"); //$NON-NLS-1$
+		if (osName.regionMatches(true, 0, Constants.OS_WIN32, 0, 3))
+			return Constants.OS_WIN32;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_SUNOS))
+			return Constants.OS_SOLARIS;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_LINUX))
+			return Constants.OS_LINUX;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_AIX))
+			return Constants.OS_AIX;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_HPUX))
+			return Constants.OS_HPUX;
+		if (osName.regionMatches(true, 0, Constants.INTERNAL_OS_MACOSX, 0, Constants.INTERNAL_OS_MACOSX.length()))
+			return Constants.OS_MACOSX;
+		return Constants.OS_UNKNOWN;
+	}
+
+	private String getArch() {
+		if (arch != null)
+			return arch;
+		String name = System.getProperties().getProperty("os.arch");
+		if (name.equalsIgnoreCase(Constants.INTERNAL_ARCH_I386))
+			return Constants.INTERNAL_ARCH_X86;
+		else if (name.equalsIgnoreCase(Constants.INTERNAL_ARCH_AMD64))
+			return Constants.INTERNAL_ARCH_X86_64;
+		else if (name.equalsIgnoreCase(Constants.INTERNAL_ARCH_ARM))
+			return Constants.INTERNAL_ARCH_ARM;
+
+		return name;
+	}
+
+	/**
+	 * Special attention should be taken to handle fragment life cycle. Here is
+	 * what I have discovered:
+	 * 
+	 * 'refresh <host bundle> -> removedBundle[bundleEvent=null] ->
+	 * addingBundle[bundleEvent=null]
+	 * 
+	 * 'refresh <fragment id>' -> removedBundle[bundleEvent=null] ->
+	 * addingBundle[bundleEvent=null]
+	 * 
+	 * In the following cases DO NOT kill or start application but refresh the
+	 * host bundle: 'install <fragment>' -> addingBundle[bundleEvent=INSTALLED]
+	 * 'uninstall <fragment>' -> modifiedBundle[bundleEvent=UNRESOLVED] ->
+	 * removedBundle[bundleEvent=UNINSTALLED] 'update <fragment>' ->
+	 * modifiedBundle[bundleEvent=UNRESOLVED] ->
+	 * modifiedBundle[bundleEvent=UPDATED]
+	 * 
+	 * <normal startup (bundle starting before or after fragment)> ->
+	 * addingBundle[bundleEvent=null]
+	 * 
+	 * So here I start the process on: addingBundle[bundleEvent=null]
+	 * 
+	 * I stop the process on: removedBundle[bundleEvent=null]
+	 */
+
+	public synchronized Object addingBundle(Bundle bundle, BundleEvent bundleEvent) {
+		String expectedFragmentName = FRAGMENT_BUNDLES_PREFIX + "." + PlatformsUtil.getOS() + "." + PlatformsUtil.getArch();
+		if (bundle.getSymbolicName().startsWith(expectedFragmentName)) {
+			if (bundleEvent != null) {
+				log.debug("added fragment " + expectedFragmentName + " bundle event type " + bundleEvent.getType());
+				if (bundleEvent.getType() == BundleEvent.RESOLVED) {
+					this.fragmentBundle = bundle;
+					log.debug("Resolved Fragment " + bundle.getSymbolicName() + " refresh host to apply modifications");
+				} else if (bundleEvent.getType() == BundleEvent.INSTALLED) {
+					this.fragmentBundle = bundle;
+					log.debug("Installed Fragment " + bundle.getSymbolicName() + " refresh host to apply modifications");
+				}
+			} else {
+				log.debug("addingBundle(): detected fragment " + expectedFragmentName + " bundle event type ");
+				this.fragmentBundle = bundle;
+				log.debug("called start()");
+				this.startProcess();
+			}
+			return bundle;
+		}
+		return null;
+	}
+
+	public synchronized void modifiedBundle(Bundle bundle, BundleEvent bundleEvent, Object arg2) {
+		String expectedFragmentName = FRAGMENT_BUNDLES_PREFIX + "." + PlatformsUtil.getOS() + "." + PlatformsUtil.getArch();
+		if (bundle.getSymbolicName().startsWith(expectedFragmentName)) {
+			log.debug("modified fragment " + expectedFragmentName + " event type " + bundleEvent.getType());
+			if (bundleEvent.getType() == BundleEvent.RESOLVED) {
+				log.debug("Resolved Fragment " + bundle.getSymbolicName());
+				this.fragmentBundle = bundle;
+				this.startProcess();
+			} else if (bundleEvent.getType() == BundleEvent.UNRESOLVED) {
+				log.debug("Unresolved Fragment " + bundle.getSymbolicName() + " refresh host to apply modifications");
+			} else if (bundleEvent.getType() == BundleEvent.UPDATED) {
+				log.debug("Updated Fragment " + bundle.getSymbolicName() + " refresh host to apply modifications");
+			}
+		}
+	}
+
+	public synchronized void removedBundle(Bundle bundle, BundleEvent bundleEvent, Object arg2) {
+		String expectedFragmentName = FRAGMENT_BUNDLES_PREFIX + "." + PlatformsUtil.getOS() + "." + PlatformsUtil.getArch();
+		if (bundle.getSymbolicName().startsWith(expectedFragmentName)) {
+			if (bundleEvent != null) {
+				if (bundleEvent.getType() == BundleEvent.UNINSTALLED) {
+					log.debug("Uninstalled Fragment " + bundle.getSymbolicName() + " refresh host to apply modifications");
+					this.fragmentBundle = null;
+					// ---this.stopProcess();
+					// ---this.removeGalBinaries();
+				}
+			} else {
+				log.debug("removedBundle(): detected fragment " + expectedFragmentName + " bundle event type ");
+			}
+		}
+	}
+}

Added: projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/PlatformsUtil.java
==============================================================================
--- projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/PlatformsUtil.java (added)
+++ projects/zb4osgi/sandbox/telecomItalia/initialContribution/jGAL/it.telecomitalia.osgi.gal/src/it/telecomitalia/internal/device/zgd/PlatformsUtil.java Mon Oct 22 09:27:07 2012
@@ -1,0 +1,50 @@
+package it.telecomitalia.internal.device.zgd;
+
+
+
+public class PlatformsUtil {
+	
+	private static String os;
+	private static String arch;
+
+	public static String getOS() {
+		if (os != null)
+			return os;
+		String osName = System.getProperties().getProperty("os.name"); //$NON-NLS-1$
+		if (osName.regionMatches(true, 0, Constants.OS_WIN32, 0, 3))
+			return Constants.OS_WIN32;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_SUNOS))
+			return Constants.OS_SOLARIS;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_LINUX))
+			return Constants.OS_LINUX;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_AIX))
+			return Constants.OS_AIX;
+		if (osName.equalsIgnoreCase(Constants.INTERNAL_OS_HPUX))
+			return Constants.OS_HPUX;
+		if (osName.regionMatches(true, 0, Constants.INTERNAL_OS_MACOSX, 0, Constants.INTERNAL_OS_MACOSX.length()))
+			return Constants.OS_MACOSX;
+		return Constants.OS_UNKNOWN;
+	}
+
+	public static String getArch() {
+		if (arch != null)
+			return arch;
+		String name = System.getProperties().getProperty("os.arch");
+		if (name.equalsIgnoreCase(Constants.INTERNAL_ARCH_I386))
+			return Constants.INTERNAL_ARCH_X86;
+		else if (name.equalsIgnoreCase(Constants.INTERNAL_ARCH_AMD64))
+			return Constants.INTERNAL_ARCH_X86_64;
+		else if (name.equalsIgnoreCase(Constants.INTERNAL_ARCH_ARM))
+			return Constants.INTERNAL_ARCH_ARM;
+
+		return name;
+	}
+
+	public static String replace(String str) {
+		String os = PlatformsUtil.getOS();
+		String arch = PlatformsUtil.getArch();
+		str = str.replaceFirst("%os", os);
+		str = str.replaceFirst("%arch", arch);
+		return str;
+	}
+}




More information about the Commit mailing list