diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/impl/DriverControllerImpl.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/impl/DriverControllerImpl.java
index f54b4dc..efeaca0 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/impl/DriverControllerImpl.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/impl/DriverControllerImpl.java
@@ -1,147 +1,147 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.controller.impl;
-
-import org.cybergarage.upnp.Device;
-import org.cybergarage.upnp.Service;
-
-import org.apache.felix.upnp.basedriver.Activator;
-import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
-import org.apache.felix.upnp.basedriver.tool.Logger;
-import org.apache.felix.upnp.basedriver.controller.DevicesInfo;
-import org.apache.felix.upnp.basedriver.controller.DriverController;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class DriverControllerImpl implements DriverController, DevicesInfo{
-    private MyCtrlPoint myCtrl;
-    private Logger logger = Activator.logger;
-    
-    public DriverControllerImpl(MyCtrlPoint myCtrl){
-        this.myCtrl = myCtrl;
-        
-    }
-    
-    public void setLogLevel(int n) {
-        logger.setLogLevel(n);
-    }
-
-    public int getLogLevel() {
-        return logger.getLogLevel();
-    }
-
-    public void setCyberDebug(boolean b) {
-        logger.setCyberDebug(b);
-    }
-
-    public boolean getCyberDebug() {
-        return logger.getCyberDebug();
-    }
-
-    public String getLocationURL(String udn) {
-    	if (myCtrl == null){
-    		logger.WARNING("UPnP Importer is disabled. getLocationURL is not available");
-    		return null;
-    	}
-        if (udn == null || udn.equals(""))  throw new IllegalArgumentException("Invalid udn paramenter");
-        Device device = myCtrl.getDevice(udn);
-        if (device == null) {
-        	logger.WARNING("getLocationURL():: No device data available for UDN:"+udn);
-        	return null;
-        }
-        return device.getLocation();
-    }
-    
-    public String getSCPDURL(String udn, String serviceId) {
-    	if (myCtrl == null){
-    		logger.WARNING("UPnP Importer is disabled. getSCPDURL() is not available");
-    		return null;
-    	}
-        if (udn == null || udn.equals("") )  throw new IllegalArgumentException("Invalid udn paramenter");
-        if (serviceId == null || serviceId.equals("") )  throw new IllegalArgumentException("Invalid serviceId paramenter");
-        Device device= myCtrl.getDevice(udn);
-        if (device == null) {
-            logger.WARNING("getSCPDURL():: No device data available for UDN: "+udn);
-            return null;
-        }
-        Service service = device.getService(serviceId);
-        if (service == null) {
-            logger.WARNING("getSCPDURL():: No service data available for serviceId:"+serviceId + " of UDN " + udn);
-            return null;
-        }
-        String scpd = service.getSCPDURL().trim();
-        return resolveRelativeLink(device,scpd);
-    }
-    
-    public String resolveRelativeUrl(String udn, String link) {
-       	if (myCtrl == null){
-    		logger.WARNING("UPnP Importer is disabled. resolveRelativeUrl() is not available");
-    		return null;
-    	}
-       if (udn == null || udn.equals(""))  throw new IllegalArgumentException("Invalid udn paramenter");
-        Device device = myCtrl.getDevice(udn);
-        if (device == null) {
-            logger.WARNING("resolveRelativeUrl():: No device data available for UDN: "+udn);
-            return null;
-        }
-        return resolveRelativeLink(device,link);        
-    }
-
-    private String resolveRelativeLink(Device device, String link) {
-        if ( device == null || link == null) return null;
-        if (link.startsWith("http:"))
-            return link;
-        else {
-            String hostname = "";
-            String location = "";
-            String urlBase = device.getURLBase().trim();
-            //TODO Check if is more important URLBase or location
-            if (urlBase.equals("")){
-                location = device.getLocation().trim();
-                int endHostnameIdx = location.indexOf("/",7);
-                if (endHostnameIdx!=-1)
-                    hostname=location.substring(0,endHostnameIdx);
-                else
-                    hostname = location;
-                if (link.startsWith("/")){
-                    return hostname+link;
-                }else{
-                	//TODO Check for link start with .. or /
-                    return location +link;
-                }
-            }
-            else {
-               return urlBase+link;
-            }             
-        }
-   }
-
-    public void search(String target) {
-       	if (myCtrl == null){
-    		logger.WARNING("UPnP Importer is disabled. resolveRelativeUrl() is not available");
-    		return ;
-    	}
-       myCtrl.search(target);       
-    }
-
-
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.controller.impl;
+
+import org.cybergarage.upnp.Device;
+import org.cybergarage.upnp.Service;
+
+import org.apache.felix.upnp.basedriver.Activator;
+import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
+import org.apache.felix.upnp.basedriver.tool.Logger;
+import org.apache.felix.upnp.basedriver.controller.DevicesInfo;
+import org.apache.felix.upnp.basedriver.controller.DriverController;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class DriverControllerImpl implements DriverController, DevicesInfo{
+    private MyCtrlPoint myCtrl;
+    private Logger logger = Activator.logger;
+    
+    public DriverControllerImpl(MyCtrlPoint myCtrl){
+        this.myCtrl = myCtrl;
+        
+    }
+    
+    public void setLogLevel(int n) {
+        logger.setLogLevel(n);
+    }
+
+    public int getLogLevel() {
+        return logger.getLogLevel();
+    }
+
+    public void setCyberDebug(boolean b) {
+        logger.setCyberDebug(b);
+    }
+
+    public boolean getCyberDebug() {
+        return logger.getCyberDebug();
+    }
+
+    public String getLocationURL(String udn) {
+    	if (myCtrl == null){
+    		logger.WARNING("UPnP Importer is disabled. getLocationURL is not available");
+    		return null;
+    	}
+        if (udn == null || udn.equals(""))  throw new IllegalArgumentException("Invalid udn paramenter");
+        Device device = myCtrl.getDevice(udn);
+        if (device == null) {
+        	logger.WARNING("getLocationURL():: No device data available for UDN:"+udn);
+        	return null;
+        }
+        return device.getLocation();
+    }
+    
+    public String getSCPDURL(String udn, String serviceId) {
+    	if (myCtrl == null){
+    		logger.WARNING("UPnP Importer is disabled. getSCPDURL() is not available");
+    		return null;
+    	}
+        if (udn == null || udn.equals("") )  throw new IllegalArgumentException("Invalid udn paramenter");
+        if (serviceId == null || serviceId.equals("") )  throw new IllegalArgumentException("Invalid serviceId paramenter");
+        Device device= myCtrl.getDevice(udn);
+        if (device == null) {
+            logger.WARNING("getSCPDURL():: No device data available for UDN: "+udn);
+            return null;
+        }
+        Service service = device.getService(serviceId);
+        if (service == null) {
+            logger.WARNING("getSCPDURL():: No service data available for serviceId:"+serviceId + " of UDN " + udn);
+            return null;
+        }
+        String scpd = service.getSCPDURL().trim();
+        return resolveRelativeLink(device,scpd);
+    }
+    
+    public String resolveRelativeUrl(String udn, String link) {
+       	if (myCtrl == null){
+    		logger.WARNING("UPnP Importer is disabled. resolveRelativeUrl() is not available");
+    		return null;
+    	}
+       if (udn == null || udn.equals(""))  throw new IllegalArgumentException("Invalid udn paramenter");
+        Device device = myCtrl.getDevice(udn);
+        if (device == null) {
+            logger.WARNING("resolveRelativeUrl():: No device data available for UDN: "+udn);
+            return null;
+        }
+        return resolveRelativeLink(device,link);        
+    }
+
+    private String resolveRelativeLink(Device device, String link) {
+        if ( device == null || link == null) return null;
+        if (link.startsWith("http:"))
+            return link;
+        else {
+            String hostname = "";
+            String location = "";
+            String urlBase = device.getURLBase().trim();
+            //TODO Check if is more important URLBase or location
+            if (urlBase.equals("")){
+                location = device.getLocation().trim();
+                int endHostnameIdx = location.indexOf("/",7);
+                if (endHostnameIdx!=-1)
+                    hostname=location.substring(0,endHostnameIdx);
+                else
+                    hostname = location;
+                if (link.startsWith("/")){
+                    return hostname+link;
+                }else{
+                	//TODO Check for link start with .. or /
+                    return location +link;
+                }
+            }
+            else {
+               return urlBase+link;
+            }             
+        }
+   }
+
+    public void search(String target) {
+       	if (myCtrl == null){
+    		logger.WARNING("UPnP Importer is disabled. resolveRelativeUrl() is not available");
+    		return ;
+    	}
+       myCtrl.search(target);       
+    }
+
+
+
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/ActionDispatcher.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/ActionDispatcher.java
index f887aef..89c0bbf 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/ActionDispatcher.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/ActionDispatcher.java
@@ -1,47 +1,47 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.export;
-
-import org.cybergarage.upnp.Action;
-import org.cybergarage.upnp.control.ActionListener;
-
-import org.osgi.framework.ServiceReference;
-
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class ActionDispatcher implements ActionListener{
-    /**
-     * 
-     */
-    public ActionDispatcher(ServiceReference sr) {
-        super();
-    }
-
-    /**
-     * @see org.cybergarage.upnp.control.ActionListener#actionControlReceived(org.cybergarage.upnp.Action)
-     */
-    public boolean actionControlReceived(Action action) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.export;
+
+import org.cybergarage.upnp.Action;
+import org.cybergarage.upnp.control.ActionListener;
+
+import org.osgi.framework.ServiceReference;
+
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class ActionDispatcher implements ActionListener{
+    /**
+     * 
+     */
+    public ActionDispatcher(ServiceReference sr) {
+        super();
+    }
+
+    /**
+     * @see org.cybergarage.upnp.control.ActionListener#actionControlReceived(org.cybergarage.upnp.Action)
+     */
+    public boolean actionControlReceived(Action action) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java
index 65e431a..a0334e6 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java
@@ -1,291 +1,291 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.export;
-
-
-import org.cybergarage.upnp.Action;
-import org.cybergarage.upnp.AllowedValueList;
-import org.cybergarage.upnp.AllowedValueRange;
-import org.cybergarage.upnp.Argument;
-import org.cybergarage.upnp.ArgumentList;
-import org.cybergarage.upnp.Device;
-import org.cybergarage.upnp.RootDescription;
-import org.cybergarage.upnp.Service;
-import org.cybergarage.upnp.StateVariable;
-import org.cybergarage.upnp.xml.DeviceData;
-import org.cybergarage.xml.Node;
-
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.basedriver.Activator;
-import org.apache.felix.upnp.basedriver.util.Converter;
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class BuildDevice {
-	
-	private static Node buildRootNode(){
-		Node root = new Node(RootDescription.ROOT_ELEMENT);
-		root.setAttribute("xmlns",RootDescription.ROOT_ELEMENT_NAMESPACE);
-		Node spec = new Node(RootDescription.SPECVERSION_ELEMENT);
-		Node maj =new Node(RootDescription.MAJOR_ELEMENT);
-		maj.setValue("1");
-		Node min =new Node(RootDescription.MINOR_ELEMENT);
-		min.setValue("0");
-		spec.addNode(maj);
-		spec.addNode(min);
-		root.addNode(spec);
-		return root;
-	}
-	
-	private static Device buildRootDeviceNode(Node root,ServiceReference sr){		
-		Node dev = new Node(Device.ELEM_NAME);
-		root.addNode(dev);
-		DeviceData dd = new DeviceData();
-		dd.setDescriptionURI("/gen-desc.xml");
-		dev.setUserData(dd);
-		Device devUPnP = new Device(root,dev);
-
-
-		Object aux = sr.getProperty(UPnPDevice.TYPE);
-		if(aux==null){
-			devUPnP.setDeviceType(null);		
-		}else if(aux instanceof String){
-			devUPnP.setDeviceType((String) aux);
-		}else if(aux instanceof String[]){
-			//The property key UPnP.device.type should be a String
-			String[] v = (String[]) aux;
-			int maxindex=0;
-			int max=Integer.parseInt(v[0].substring(v[0].lastIndexOf(":")+1));
-			int tmp;
-			for (int i = 1; i < v.length; i++) {
-				tmp=Integer.parseInt(v[i].substring(v[i].lastIndexOf(":")+1));				
-				if(max<tmp){
-					max=tmp;
-					maxindex=i;
-				}				
-			}
-			devUPnP.setDeviceType(v[maxindex]);
-		}				
-		
-		devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
-		devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
-		devUPnP.setManufactureURL((String) sr.getProperty(UPnPDevice.MANUFACTURER_URL));
-		devUPnP.setModelDescription((String) sr.getProperty(UPnPDevice.MODEL_DESCRIPTION));
-		devUPnP.setModelName((String) sr.getProperty(UPnPDevice.MODEL_NAME));
-		devUPnP.setModelNumber((String) sr.getProperty(UPnPDevice.MODEL_NUMBER));
-		devUPnP.setModelURL((String) sr.getProperty(UPnPDevice.MODEL_URL));
-		devUPnP.setSerialNumber((String) sr.getProperty(UPnPDevice.SERIAL_NUMBER));
-		devUPnP.setUDN((String) sr.getProperty(UPnPDevice.UDN));
-		devUPnP.setUPC((String) sr.getProperty(UPnPDevice.UPC));
-
-		devUPnP.setLocation("/gen-desc.xml");		
-
-		addServices("",devUPnP,sr);
-		addDevices("",devUPnP,sr);
-		devUPnP.setPresentationURL((String) sr.getProperty(UPnPDevice.PRESENTATION_URL));
-		
-		return devUPnP;
-	}
-	
-	private static void addDevices(String id,Device devUPnP, ServiceReference sr) {
-
-		String[] udns=(String[]) sr.getProperty(UPnPDevice.CHILDREN_UDN);
-		if(udns==null) {
-			return;
-		}
-		for (int i = 0; i < udns.length; i++) {
-			try {
-				ServiceReference[] aux = Activator.bc.getServiceReferences(
-						UPnPDevice.class.getName(),"("+UPnPDevice.UDN+"="+udns[i]+")"
-					);
-				if(aux==null || aux.length == 0)
-					continue;
-				//id=+"/device/"+i;						// twa: wrong in recursion
-				//buildDevice(id,devUPnP,aux[0]);		// twa: wrong in recursion
-				String localId = new StringBuffer(id).append("/device/").append(i).toString();		
-				buildDevice(localId,devUPnP,aux[0]); 	// twa: better
-			} catch (InvalidSyntaxException ignored) {}						
-		}		
-	}
-
-	private static void buildDevice(String id,Device parent, ServiceReference sr) {
-		Node dev = new Node(Device.ELEM_NAME);
-		DeviceData dd = new DeviceData();
-		dd.setDescriptionURI(id+"/gen-desc.xml");
-		dev.setUserData(dd);
-		
-		Device devUPnP = new Device(dev);
-		
-		devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
-		devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
-		devUPnP.setManufactureURL((String) sr.getProperty(UPnPDevice.MANUFACTURER_URL));
-		devUPnP.setModelDescription((String) sr.getProperty(UPnPDevice.MODEL_DESCRIPTION));
-		devUPnP.setModelName((String) sr.getProperty(UPnPDevice.MODEL_NAME));
-		devUPnP.setModelNumber((String) sr.getProperty(UPnPDevice.MODEL_NUMBER));
-		devUPnP.setModelURL((String) sr.getProperty(UPnPDevice.MODEL_URL));
-		devUPnP.setSerialNumber((String) sr.getProperty(UPnPDevice.SERIAL_NUMBER));
-		devUPnP.setUDN((String) sr.getProperty(UPnPDevice.UDN));
-		devUPnP.setUPC((String) sr.getProperty(UPnPDevice.UPC));
-		devUPnP.setLocation(id+"/gen-desc.xml");		
-
-		addServices(id,devUPnP,sr);
-		addDevices(id,devUPnP,sr);
-
-		parent.addDevice(devUPnP); //		twa: essential!!!!!!!
-		devUPnP.setPresentationURL((String) sr.getProperty(UPnPDevice.PRESENTATION_URL));
-		
-	}
-	
-	/**
-	* Method used to create a new Service in CyberLink world without creating the XML
-	*
-	* @param id ServiceId
-	* @param devUPnP the CyberLink device that where the new Service will be created
-	* @param sr ServiceReference to OSGi Device that used as source of the information
-	*              for the creation of the device
-	*/
-	private static void addServices(String id,Device devUPnP, ServiceReference sr) {
-		UPnPDevice devOSGi = (UPnPDevice) Activator.bc.getService(sr);
-
-		if( devOSGi == null) {	//added by twa to prevent a null pointer exception
-			Activator.logger.WARNING("UPnP Device that cotains serviceId="
-					+id+" is deregistered from the framework while is exported");
-			return;
-		}
-
-		UPnPService[] services =  devOSGi.getServices();
-		if(services==null || services.length==0)
-			return;
-		
-		
-		
-		for (int i = 0; i < services.length; i++) {
-			Service ser = new Service();
-			devUPnP.addService(ser);
-			ser.setServiceType(services[i].getType() );
-			ser.setServiceID(services[i].getId());
-			ser.setSCPDURL(id+"/service/"+i+"/gen-desc.xml");
-			ser.setDescriptionURL(id+"/service/"+i+"/gen-desc.xml");
-			ser.setControlURL(id+"/service/"+i+"/ctrl");
-			ser.setEventSubURL(id+"/service/"+i+"/event");
-
-			UPnPAction[] actions = services[i].getActions();
-			for (int j = 0; j < actions.length; j++) {
-                boolean valid=true;
-				Action act = new Action(ser.getServiceNode());
-				act.setName(actions[j].getName());
-				ArgumentList al = new ArgumentList();
-				
-				String[] names=actions[j].getInputArgumentNames();				
-				if(names!=null){
-					for (int k = 0; k < names.length; k++) {
-                        UPnPStateVariable variable = actions[j].getStateVariable(names[k]);
-                        if(variable==null){
-                            /*
-                             * //TODO Create a stict and relaxed behavior of the base driver which 
-                             * export as much it can or export only 100% complaint UPnPDevice service 
-                             */
-                            Activator.logger.WARNING(
-                                "UPnP Device that cotains serviceId="+id+" contains the action "
-                                +actions[j].getName()+" with the Input argument "+names[k]
-                                +" not related to any UPnPStateVariable. Thus this action won't be exported");
-                            valid=false;
-                            break;
-                        }
-                        Argument a = new Argument();
-						a.setDirection(Argument.IN);
-						a.setName(names[k]);
-						a.setRelatedStateVariableName(variable.getName());						
-						al.add(a);						
-					}
-				}
-				names=actions[j].getOutputArgumentNames();
-				if(names!=null && valid){
-					for (int k = 0; k < names.length; k++) {
-                        UPnPStateVariable variable = actions[j].getStateVariable(names[k]);
-                        if(variable==null){
-                            /*
-                             * //TODO Create a stict and relaxed behavior of the base driver which 
-                             * export as much it can or export only 100% complaint UPnPDevice service 
-                             */
-                            Activator.logger.WARNING(
-                                "UPnP Device that cotains serviceId="+id+" contains the action "
-                                +actions[j].getName()+" with the Output argument "+names[k]
-                                +" not related to any UPnPStateVariable. Thus this action won't be exported");                            
-                        }
-						Argument a = new Argument();
-						a.setDirection(Argument.OUT);
-						a.setName(names[k]);
-						a.setRelatedStateVariableName(variable.getName());						
-						al.add(a);						
-					}
-				}
-                if(valid) {
-    				act.setArgumentList(al);
-    				ser.addAction(act);
-                }
-			}			
-			
-			UPnPStateVariable[] vars = services[i].getStateVariables();
-			for (int j = 0; j < vars.length; j++) {
-				StateVariable var = new StateVariable();
-				var.setDataType(vars[j].getUPnPDataType());
-				var.setName(vars[j].getName());
-				var.setSendEvents(vars[j].sendsEvents());
-				String[] values = vars[j].getAllowedValues();
-				if(values!=null){
-					AllowedValueList avl = new AllowedValueList(values);
-					var.setAllowedValueList(avl);
-				}else if(vars[j].getMaximum()!= null){
-					AllowedValueRange avr = new AllowedValueRange(
-							vars[j].getMaximum(),
-							vars[j].getMinimum(),
-							vars[j].getStep()
-						);
-					var.setAllowedValueRange(avr);
-				}
-				if(vars[j].getDefaultValue()!=null)
-					try {
-						var.setDefaultValue(Converter.toString(
-								vars[j].getDefaultValue(),vars[j].getUPnPDataType()
-							));
-					} catch (Exception ignored) {
-					}
-				ser.addStateVariable(var);				
-			}
-						
-			Activator.bc.ungetService(sr);
-		}
-		
-		
-	}
-
-	public static Device createCyberLinkDevice(ServiceReference sr){
-		Node root = buildRootNode();
-		Device devUPnP = buildRootDeviceNode(root,sr);
-		return devUPnP;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.export;
+
+
+import org.cybergarage.upnp.Action;
+import org.cybergarage.upnp.AllowedValueList;
+import org.cybergarage.upnp.AllowedValueRange;
+import org.cybergarage.upnp.Argument;
+import org.cybergarage.upnp.ArgumentList;
+import org.cybergarage.upnp.Device;
+import org.cybergarage.upnp.RootDescription;
+import org.cybergarage.upnp.Service;
+import org.cybergarage.upnp.StateVariable;
+import org.cybergarage.upnp.xml.DeviceData;
+import org.cybergarage.xml.Node;
+
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.basedriver.Activator;
+import org.apache.felix.upnp.basedriver.util.Converter;
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class BuildDevice {
+	
+	private static Node buildRootNode(){
+		Node root = new Node(RootDescription.ROOT_ELEMENT);
+		root.setAttribute("xmlns",RootDescription.ROOT_ELEMENT_NAMESPACE);
+		Node spec = new Node(RootDescription.SPECVERSION_ELEMENT);
+		Node maj =new Node(RootDescription.MAJOR_ELEMENT);
+		maj.setValue("1");
+		Node min =new Node(RootDescription.MINOR_ELEMENT);
+		min.setValue("0");
+		spec.addNode(maj);
+		spec.addNode(min);
+		root.addNode(spec);
+		return root;
+	}
+	
+	private static Device buildRootDeviceNode(Node root,ServiceReference sr){		
+		Node dev = new Node(Device.ELEM_NAME);
+		root.addNode(dev);
+		DeviceData dd = new DeviceData();
+		dd.setDescriptionURI("/gen-desc.xml");
+		dev.setUserData(dd);
+		Device devUPnP = new Device(root,dev);
+
+
+		Object aux = sr.getProperty(UPnPDevice.TYPE);
+		if(aux==null){
+			devUPnP.setDeviceType(null);		
+		}else if(aux instanceof String){
+			devUPnP.setDeviceType((String) aux);
+		}else if(aux instanceof String[]){
+			//The property key UPnP.device.type should be a String
+			String[] v = (String[]) aux;
+			int maxindex=0;
+			int max=Integer.parseInt(v[0].substring(v[0].lastIndexOf(":")+1));
+			int tmp;
+			for (int i = 1; i < v.length; i++) {
+				tmp=Integer.parseInt(v[i].substring(v[i].lastIndexOf(":")+1));				
+				if(max<tmp){
+					max=tmp;
+					maxindex=i;
+				}				
+			}
+			devUPnP.setDeviceType(v[maxindex]);
+		}				
+		
+		devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
+		devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
+		devUPnP.setManufactureURL((String) sr.getProperty(UPnPDevice.MANUFACTURER_URL));
+		devUPnP.setModelDescription((String) sr.getProperty(UPnPDevice.MODEL_DESCRIPTION));
+		devUPnP.setModelName((String) sr.getProperty(UPnPDevice.MODEL_NAME));
+		devUPnP.setModelNumber((String) sr.getProperty(UPnPDevice.MODEL_NUMBER));
+		devUPnP.setModelURL((String) sr.getProperty(UPnPDevice.MODEL_URL));
+		devUPnP.setSerialNumber((String) sr.getProperty(UPnPDevice.SERIAL_NUMBER));
+		devUPnP.setUDN((String) sr.getProperty(UPnPDevice.UDN));
+		devUPnP.setUPC((String) sr.getProperty(UPnPDevice.UPC));
+
+		devUPnP.setLocation("/gen-desc.xml");		
+
+		addServices("",devUPnP,sr);
+		addDevices("",devUPnP,sr);
+		devUPnP.setPresentationURL((String) sr.getProperty(UPnPDevice.PRESENTATION_URL));
+		
+		return devUPnP;
+	}
+	
+	private static void addDevices(String id,Device devUPnP, ServiceReference sr) {
+
+		String[] udns=(String[]) sr.getProperty(UPnPDevice.CHILDREN_UDN);
+		if(udns==null) {
+			return;
+		}
+		for (int i = 0; i < udns.length; i++) {
+			try {
+				ServiceReference[] aux = Activator.bc.getServiceReferences(
+						UPnPDevice.class.getName(),"("+UPnPDevice.UDN+"="+udns[i]+")"
+					);
+				if(aux==null || aux.length == 0)
+					continue;
+				//id=+"/device/"+i;						// twa: wrong in recursion
+				//buildDevice(id,devUPnP,aux[0]);		// twa: wrong in recursion
+				String localId = new StringBuffer(id).append("/device/").append(i).toString();		
+				buildDevice(localId,devUPnP,aux[0]); 	// twa: better
+			} catch (InvalidSyntaxException ignored) {}						
+		}		
+	}
+
+	private static void buildDevice(String id,Device parent, ServiceReference sr) {
+		Node dev = new Node(Device.ELEM_NAME);
+		DeviceData dd = new DeviceData();
+		dd.setDescriptionURI(id+"/gen-desc.xml");
+		dev.setUserData(dd);
+		
+		Device devUPnP = new Device(dev);
+		
+		devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
+		devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
+		devUPnP.setManufactureURL((String) sr.getProperty(UPnPDevice.MANUFACTURER_URL));
+		devUPnP.setModelDescription((String) sr.getProperty(UPnPDevice.MODEL_DESCRIPTION));
+		devUPnP.setModelName((String) sr.getProperty(UPnPDevice.MODEL_NAME));
+		devUPnP.setModelNumber((String) sr.getProperty(UPnPDevice.MODEL_NUMBER));
+		devUPnP.setModelURL((String) sr.getProperty(UPnPDevice.MODEL_URL));
+		devUPnP.setSerialNumber((String) sr.getProperty(UPnPDevice.SERIAL_NUMBER));
+		devUPnP.setUDN((String) sr.getProperty(UPnPDevice.UDN));
+		devUPnP.setUPC((String) sr.getProperty(UPnPDevice.UPC));
+		devUPnP.setLocation(id+"/gen-desc.xml");		
+
+		addServices(id,devUPnP,sr);
+		addDevices(id,devUPnP,sr);
+
+		parent.addDevice(devUPnP); //		twa: essential!!!!!!!
+		devUPnP.setPresentationURL((String) sr.getProperty(UPnPDevice.PRESENTATION_URL));
+		
+	}
+	
+	/**
+	* Method used to create a new Service in CyberLink world without creating the XML
+	*
+	* @param id ServiceId
+	* @param devUPnP the CyberLink device that where the new Service will be created
+	* @param sr ServiceReference to OSGi Device that used as source of the information
+	*              for the creation of the device
+	*/
+	private static void addServices(String id,Device devUPnP, ServiceReference sr) {
+		UPnPDevice devOSGi = (UPnPDevice) Activator.bc.getService(sr);
+
+		if( devOSGi == null) {	//added by twa to prevent a null pointer exception
+			Activator.logger.WARNING("UPnP Device that cotains serviceId="
+					+id+" is deregistered from the framework while is exported");
+			return;
+		}
+
+		UPnPService[] services =  devOSGi.getServices();
+		if(services==null || services.length==0)
+			return;
+		
+		
+		
+		for (int i = 0; i < services.length; i++) {
+			Service ser = new Service();
+			devUPnP.addService(ser);
+			ser.setServiceType(services[i].getType() );
+			ser.setServiceID(services[i].getId());
+			ser.setSCPDURL(id+"/service/"+i+"/gen-desc.xml");
+			ser.setDescriptionURL(id+"/service/"+i+"/gen-desc.xml");
+			ser.setControlURL(id+"/service/"+i+"/ctrl");
+			ser.setEventSubURL(id+"/service/"+i+"/event");
+
+			UPnPAction[] actions = services[i].getActions();
+			for (int j = 0; j < actions.length; j++) {
+                boolean valid=true;
+				Action act = new Action(ser.getServiceNode());
+				act.setName(actions[j].getName());
+				ArgumentList al = new ArgumentList();
+				
+				String[] names=actions[j].getInputArgumentNames();				
+				if(names!=null){
+					for (int k = 0; k < names.length; k++) {
+                        UPnPStateVariable variable = actions[j].getStateVariable(names[k]);
+                        if(variable==null){
+                            /*
+                             * //TODO Create a stict and relaxed behavior of the base driver which 
+                             * export as much it can or export only 100% complaint UPnPDevice service 
+                             */
+                            Activator.logger.WARNING(
+                                "UPnP Device that cotains serviceId="+id+" contains the action "
+                                +actions[j].getName()+" with the Input argument "+names[k]
+                                +" not related to any UPnPStateVariable. Thus this action won't be exported");
+                            valid=false;
+                            break;
+                        }
+                        Argument a = new Argument();
+						a.setDirection(Argument.IN);
+						a.setName(names[k]);
+						a.setRelatedStateVariableName(variable.getName());						
+						al.add(a);						
+					}
+				}
+				names=actions[j].getOutputArgumentNames();
+				if(names!=null && valid){
+					for (int k = 0; k < names.length; k++) {
+                        UPnPStateVariable variable = actions[j].getStateVariable(names[k]);
+                        if(variable==null){
+                            /*
+                             * //TODO Create a stict and relaxed behavior of the base driver which 
+                             * export as much it can or export only 100% complaint UPnPDevice service 
+                             */
+                            Activator.logger.WARNING(
+                                "UPnP Device that cotains serviceId="+id+" contains the action "
+                                +actions[j].getName()+" with the Output argument "+names[k]
+                                +" not related to any UPnPStateVariable. Thus this action won't be exported");                            
+                        }
+						Argument a = new Argument();
+						a.setDirection(Argument.OUT);
+						a.setName(names[k]);
+						a.setRelatedStateVariableName(variable.getName());						
+						al.add(a);						
+					}
+				}
+                if(valid) {
+    				act.setArgumentList(al);
+    				ser.addAction(act);
+                }
+			}			
+			
+			UPnPStateVariable[] vars = services[i].getStateVariables();
+			for (int j = 0; j < vars.length; j++) {
+				StateVariable var = new StateVariable();
+				var.setDataType(vars[j].getUPnPDataType());
+				var.setName(vars[j].getName());
+				var.setSendEvents(vars[j].sendsEvents());
+				String[] values = vars[j].getAllowedValues();
+				if(values!=null){
+					AllowedValueList avl = new AllowedValueList(values);
+					var.setAllowedValueList(avl);
+				}else if(vars[j].getMaximum()!= null){
+					AllowedValueRange avr = new AllowedValueRange(
+							vars[j].getMaximum(),
+							vars[j].getMinimum(),
+							vars[j].getStep()
+						);
+					var.setAllowedValueRange(avr);
+				}
+				if(vars[j].getDefaultValue()!=null)
+					try {
+						var.setDefaultValue(Converter.toString(
+								vars[j].getDefaultValue(),vars[j].getUPnPDataType()
+							));
+					} catch (Exception ignored) {
+					}
+				ser.addStateVariable(var);				
+			}
+						
+			Activator.bc.ungetService(sr);
+		}
+		
+		
+	}
+
+	public static Device createCyberLinkDevice(ServiceReference sr){
+		Node root = buildRootNode();
+		Device devUPnP = buildRootDeviceNode(root,sr);
+		return devUPnP;
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/DeviceNode.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/DeviceNode.java
index 95429ae..71e8d81 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/DeviceNode.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/DeviceNode.java
@@ -1,183 +1,183 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.export;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.upnp.UPnPDevice;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class DeviceNode {
-	
-	private ServiceReference sr;
-	private boolean isRootNode;
-	private String udn ;
-	private boolean hasChild;
-	private int numberOfSons;
-	private ArrayList children;
-	private DeviceNode parent;
-	
-	public DeviceNode(ServiceReference sr){
-		//PRE: argument is always UPnPDevice service reference
-		if (sr == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode constructor");
-		this.sr = sr;
-		udn = (String) sr.getProperty(UPnPDevice.UDN);
-		parent=null;
-		isRootNode = (sr.getProperty(UPnPDevice.PARENT_UDN) == null);
-		String[] sons = ((String[]) sr.getProperty(UPnPDevice.CHILDREN_UDN));
-		hasChild = (sons != null);
-		if (hasChild) {
-			children = new ArrayList();
-			numberOfSons = sons.length;
-		}
-	}
-	
-	public ServiceReference getReference(){
-		return sr;
-	}
-	public UPnPDevice getDevice(BundleContext ctx){
-		return (UPnPDevice)ctx.getService(sr);
-	}
-	
-	public void attach(DeviceNode node){
-		if (node == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.attach() method");
-		node.parent = this;
-		children.add(node);
-	}
-	
-	public DeviceNode dethatch(String name){
-		DeviceNode dn = this.search(name);
-		if(dn==null) 
-			return null;
-		
-		if(dn.parent!=null){
-			Iterator list = dn.parent.children.iterator();
-			while (list.hasNext()) {
-				DeviceNode x = (DeviceNode) list.next();
-				if(x.udn.equals(name)){
-					list.remove();
-					break;
-				}
-			}
-		}
-		dn.parent=null;
-		return dn;
-	}
-	
-	public Collection getAllChildren(){
-		if((this.children==null)||(this.children.size()==0)) 
-			return null;
-		
-		Vector v = new Vector(this.children);
-		Iterator list = this.children.iterator();
-		while (list.hasNext()) {
-			DeviceNode x = (DeviceNode) list.next();
-			Collection c = x.getAllChildren();
-			if(c==null) continue;
-			v.addAll(c);
-		}
-		return v;
-	}
-
-	public Collection getChildren(){
-		if((this.children==null)||(this.children.size()==0)) 
-			return null;
-		return this.children;
-	}	
-	
-	/**
-	 * @param name <code>String</code> that contain the UDN to look for
-	 * @return return a <code>DeviceNode</code> that have the UDN equals to name and <br>
-	 * 		if there is any <code>DeviceNode</code> with the proper UDN value return <code>null</code>
-	 */
-	public DeviceNode search(String name){
-		if (name == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.search() method");
-		if (name.equals(udn))
-			return this;
-		else if (hasChild){
-			Iterator list = children.iterator();
-			while (list.hasNext()){
-				DeviceNode child = (DeviceNode)list.next();
-				DeviceNode node = child.search(name);
-				if (node != null) return node;				
-			}
-		}
-		return null;
-	}
-	
-	/**
-	 * 
-	 * @param udn
-	 * @return <code>true</code> if and only if this <code>DeviceNode</code>
-	 * 		contains a DeviceNode with UDN equals to passed argument or if
-	 * 		its USN is equal to passed argument
-	 */
-	public boolean contains(String udn){
-		return this.search(udn)!=null;
-	}
-	
-	public boolean isComplete(){
-		if (! hasChild) return true;
-		if (numberOfSons != children.size())return false;
-		Iterator list = children.iterator();
-		while (list.hasNext()){
-			DeviceNode child = (DeviceNode)list.next();
-			if (! child.isComplete()) return false;
-		}
-		return true;
-	}
-	
-	public DeviceNode isAttachable(DeviceNode node){
-		if (node == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.isAttachable() method");
-		String parentUDN=(String) node.getReference().getProperty(UPnPDevice.PARENT_UDN);
-		if(parentUDN==null) return null;
-		return search(parentUDN);		
-	}
-		
-	public boolean isRoot(){
-		return isRootNode;		
-	}
-	
-	public boolean equals(String udn){
-		return this.udn.equals(udn);
-	}
-	
-	public String toString(){
-		return udn;
-	}
-
-	/**
-	 * @return true if and only 
-	 * 		if the Device doesn't have embedded Device
-	 */
-	public boolean isLeaf() {
-		return !hasChild;
-	}		
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.export;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.upnp.UPnPDevice;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class DeviceNode {
+	
+	private ServiceReference sr;
+	private boolean isRootNode;
+	private String udn ;
+	private boolean hasChild;
+	private int numberOfSons;
+	private ArrayList children;
+	private DeviceNode parent;
+	
+	public DeviceNode(ServiceReference sr){
+		//PRE: argument is always UPnPDevice service reference
+		if (sr == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode constructor");
+		this.sr = sr;
+		udn = (String) sr.getProperty(UPnPDevice.UDN);
+		parent=null;
+		isRootNode = (sr.getProperty(UPnPDevice.PARENT_UDN) == null);
+		String[] sons = ((String[]) sr.getProperty(UPnPDevice.CHILDREN_UDN));
+		hasChild = (sons != null);
+		if (hasChild) {
+			children = new ArrayList();
+			numberOfSons = sons.length;
+		}
+	}
+	
+	public ServiceReference getReference(){
+		return sr;
+	}
+	public UPnPDevice getDevice(BundleContext ctx){
+		return (UPnPDevice)ctx.getService(sr);
+	}
+	
+	public void attach(DeviceNode node){
+		if (node == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.attach() method");
+		node.parent = this;
+		children.add(node);
+	}
+	
+	public DeviceNode dethatch(String name){
+		DeviceNode dn = this.search(name);
+		if(dn==null) 
+			return null;
+		
+		if(dn.parent!=null){
+			Iterator list = dn.parent.children.iterator();
+			while (list.hasNext()) {
+				DeviceNode x = (DeviceNode) list.next();
+				if(x.udn.equals(name)){
+					list.remove();
+					break;
+				}
+			}
+		}
+		dn.parent=null;
+		return dn;
+	}
+	
+	public Collection getAllChildren(){
+		if((this.children==null)||(this.children.size()==0)) 
+			return null;
+		
+		Vector v = new Vector(this.children);
+		Iterator list = this.children.iterator();
+		while (list.hasNext()) {
+			DeviceNode x = (DeviceNode) list.next();
+			Collection c = x.getAllChildren();
+			if(c==null) continue;
+			v.addAll(c);
+		}
+		return v;
+	}
+
+	public Collection getChildren(){
+		if((this.children==null)||(this.children.size()==0)) 
+			return null;
+		return this.children;
+	}	
+	
+	/**
+	 * @param name <code>String</code> that contain the UDN to look for
+	 * @return return a <code>DeviceNode</code> that have the UDN equals to name and <br>
+	 * 		if there is any <code>DeviceNode</code> with the proper UDN value return <code>null</code>
+	 */
+	public DeviceNode search(String name){
+		if (name == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.search() method");
+		if (name.equals(udn))
+			return this;
+		else if (hasChild){
+			Iterator list = children.iterator();
+			while (list.hasNext()){
+				DeviceNode child = (DeviceNode)list.next();
+				DeviceNode node = child.search(name);
+				if (node != null) return node;				
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * 
+	 * @param udn
+	 * @return <code>true</code> if and only if this <code>DeviceNode</code>
+	 * 		contains a DeviceNode with UDN equals to passed argument or if
+	 * 		its USN is equal to passed argument
+	 */
+	public boolean contains(String udn){
+		return this.search(udn)!=null;
+	}
+	
+	public boolean isComplete(){
+		if (! hasChild) return true;
+		if (numberOfSons != children.size())return false;
+		Iterator list = children.iterator();
+		while (list.hasNext()){
+			DeviceNode child = (DeviceNode)list.next();
+			if (! child.isComplete()) return false;
+		}
+		return true;
+	}
+	
+	public DeviceNode isAttachable(DeviceNode node){
+		if (node == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.isAttachable() method");
+		String parentUDN=(String) node.getReference().getProperty(UPnPDevice.PARENT_UDN);
+		if(parentUDN==null) return null;
+		return search(parentUDN);		
+	}
+		
+	public boolean isRoot(){
+		return isRootNode;		
+	}
+	
+	public boolean equals(String udn){
+		return this.udn.equals(udn);
+	}
+	
+	public String toString(){
+		return udn;
+	}
+
+	/**
+	 * @return true if and only 
+	 * 		if the Device doesn't have embedded Device
+	 */
+	public boolean isLeaf() {
+		return !hasChild;
+	}		
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/MyCtrlPoint.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/MyCtrlPoint.java
index a1dffb2..aab6986 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/MyCtrlPoint.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/MyCtrlPoint.java
@@ -1,917 +1,917 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core;
-
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.cybergarage.http.HTTPRequest;
-import org.cybergarage.upnp.ControlPoint;
-import org.cybergarage.upnp.Device;
-import org.cybergarage.upnp.DeviceList;
-import org.cybergarage.upnp.Service;
-import org.cybergarage.upnp.ServiceList;
-import org.cybergarage.upnp.ServiceStateTable;
-import org.cybergarage.upnp.StateVariable;
-import org.cybergarage.upnp.device.NotifyListener;
-import org.cybergarage.upnp.device.SearchResponseListener;
-import org.cybergarage.upnp.event.NotifyRequest;
-import org.cybergarage.upnp.event.Property;
-import org.cybergarage.upnp.event.PropertyList;
-import org.cybergarage.upnp.ssdp.SSDPPacket;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.basedriver.Activator;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerModified;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerUnRegistration;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.NotifierQueue;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue;
-import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPDeviceImpl;
-import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPServiceImpl;
-import org.apache.felix.upnp.basedriver.importer.util.ParseUSN;
-import org.apache.felix.upnp.basedriver.util.Converter;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class MyCtrlPoint extends ControlPoint
-		implements
-			NotifyListener,
-			SearchResponseListener,
-			ServiceListener
-{
-	private BundleContext context;   
-    private Hashtable devices;//key UDN value OsgideviceInfo(Osgi)
-	private SubscriptionQueue subQueue;
-	private NotifierQueue notifierQueue;
-    
-    private final String UPNP_EVENT_LISTENER_FLTR =
-        "(" + Constants.OBJECTCLASS + "=" + UPnPEventListener.class.getName() + ")";
-    private final String UPNP_DEVICE_FLTR =
-        "(" + Constants.OBJECTCLASS + "=" + UPnPDevice.class.getName() + ")";
-    private final String EXPORT_FLTR =
-        "(" + UPnPDevice.UPNP_EXPORT + "=*" + ")";
-    private final String IMPORT_FLTR =
-        "(" + org.apache.felix.upnp.basedriver.util.Constants.UPNP_IMPORT + "=*" + ")";
-
-    
-    public MyCtrlPoint(BundleContext context, SubscriptionQueue subQueue,
-			NotifierQueue notifierQueue) {
-		super();
-		this.context = context;
-        devices = new Hashtable();
-		addNotifyListener(this);
-		addSearchResponseListener(this);
-		try {
-			context.addServiceListener(this, UPNP_EVENT_LISTENER_FLTR);
-		} catch (InvalidSyntaxException e) {
-			e.printStackTrace();
-		}
-		this.subQueue = subQueue;
-		this.notifierQueue = notifierQueue;
-	}
-
-	public void httpRequestRecieved(HTTPRequest httpReq) {
-        Activator.logger.DEBUG("[Importer] httpRequestRecieved event");
-        Activator.logger.PACKET(httpReq.toString());
-
-        if (httpReq.isNotifyRequest() == true) {
-            Activator.logger.DEBUG("[Importer] Notify Request");
-			NotifyRequest notifyReq = new NotifyRequest(httpReq);
-			String uuid = notifyReq.getSID();
-			long seq = notifyReq.getSEQ();
-			PropertyList props = notifyReq.getPropertyList();
-//			int propCnt = props.size();
-//			Hashtable hash = new Hashtable();
-//			for (int n = 0; n < propCnt; n++) {
-//				Property prop = props.getProperty(n);
-//				String varName = prop.getName();
-//				String varValue = prop.getValue();
-//				hash.put(varName, varValue);
-//			}
-            newEventArrived(uuid, seq, props);
-			httpReq.returnOK();
-			return;
-		}
-
-        Activator.logger.DEBUG("BAD Request");
-		httpReq.returnBadRequest();
-
-	}
-
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.cybergarage.upnp.ControlPoint#removeExpiredDevices()
-	 *  
-	 */
-	public void removeExpiredDevices() {
-		DeviceList devList = getDeviceList();
-		int devCnt = devList.size();
-		for (int n = 0; n < devCnt; n++) {
-			Device dev = devList.getDevice(n);
-			if (dev.isExpired() == true) {
-                Activator.logger.DEBUG("[Importer] Expired device:"+ dev.getFriendlyName());
-				removeDevice(dev);
-				removeOSGiExpireDevice(dev);
-			}
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.cybergarage.upnp.device.NotifyListener#deviceNotifyReceived(org.cybergarage.upnp.ssdp.SSDPPacket)
-	 */
-	public void deviceNotifyReceived(SSDPPacket ssdpPacket) {
-        Activator.logger.DEBUG("[Importer] deviceNotifyReceived");
-        Activator.logger.PACKET(ssdpPacket.toString());
-		/*
-		 * if the packet is 
-		 * 		NOTIFY or ISALIVE or *new* ROOT	then create and register the UPnPDevice and 
-		 * 										all the embeeded device too
-		 * 		DEVICE or SERVICE	then if they already exist in OSGi do nothing otherwise I'll create and 
-		 * 							register all the UPnPDevice need starting from the root device
-		 * 		*root* BYEBYE		then I'll unregister it and all its children from OSGi Framework 
-		 * 		*service* BYEBYE	then I'll re-register the UPnPDevice that contain the service with the updated
-		 * 							properties 
-		 * 		*device* BYEBYE		then I'll re-register the UPnPDevice that contain the device with the updated
-		 * 							properties and also unregister the UPnPDevice that has left
-		 */
-		String usn = ssdpPacket.getUSN();
-		ParseUSN parseUSN = new ParseUSN(usn);
-		String udn = parseUSN.getUDN();
-        
-		ServiceReference[] refs = null;
-		String filter = "(&" + UPNP_DEVICE_FLTR + EXPORT_FLTR+ ")";
-		try {
-			refs = context.getServiceReferences(UPnPDevice.class.getName(),	filter);
-		} catch (InvalidSyntaxException e) {
-			e.printStackTrace();
-		}
-		if (refs != null) {
-			for (int i = 0; i < refs.length; i++) {
-				UPnPDevice dev = (UPnPDevice) context.getService(refs[i]);
-				Dictionary dic = dev.getDescriptions(null);
-				if (((String) dic.get(UPnPDevice.UDN)).equals(udn)) {
-					return;
-				}
-			}
-		}
-
-		if (ssdpPacket.isAlive()) {
-			
-            Activator.logger.DEBUG("[Importer] ssdpPacket.isAlive");
-			if (devices.containsKey(udn)) {
-                Activator.logger.DEBUG("[Importer] Device already discovered");
-				if (parseUSN.isService()) {
-                    doServiceUpdating(udn,parseUSN.getServiceType());
-				}
-			} else {
-                doDeviceRegistration(udn);
-			}
-
-		} else if (ssdpPacket.isByeBye()) {
-            Activator.logger.DEBUG("[Importer] ssdpPacket.isByeBye");
-
-            synchronized (devices) {		
-
-				if (devices.containsKey(udn)) {
-					if (parseUSN.isDevice()) {
-	                    Activator.logger.DEBUG("[Importer] parseUSN.isDevice ...unregistering all the children devices ");
-	                    
-						//unregistering all the children devices 
-						UPnPDeviceImpl dev = ((OSGiDeviceInfo) devices.get(udn)).getOSGiDevice();
-						removeOSGiandUPnPDeviceHierarchy(dev);
-	
-					} else if (parseUSN.isService()) {
-	                    Activator.logger.DEBUG("[Importer] parseUSN.isService ...registering modified device again ");
-						/* 
-						 * I have to unregister the UPnPDevice and register it again 
-						 * with the updated properties  
-						 */
-						UPnPDeviceImpl device = 
-	                        ((OSGiDeviceInfo) devices.get(udn)).getOSGiDevice();
-						ServiceRegistration registar = 
-	                        ((OSGiDeviceInfo) devices.get(udn)).getRegistration();
-						String[] oldServicesID = 
-	                        (String[]) (device.getDescriptions(null).get(UPnPService.ID));
-						String[] oldServiceType = 
-	                        (String[]) (device.getDescriptions(null).get(UPnPService.TYPE));
-	                    
-						Device cyberDevice = findDeviceCtrl(this, udn);
-						Vector vec = new Vector();
-						for (int i = 0; i < oldServiceType.length; i++) {
-							Service ser = cyberDevice.getService(oldServicesID[i]);
-							if (!(ser.getServiceType().equals(parseUSN.getServiceType()))) 
-	                        {
-								vec.add(oldServicesID[i]);
-							}
-						}
-	
-	                    //new serviceID
-						String[] actualServicesID = new String[vec.size()];
-						actualServicesID = (String[]) vec.toArray(new String[]{});
-	
-	                    //new serviceType
-						String[] actualServiceType = new String[oldServiceType.length - 1];
-						vec.clear();
-						for (int i = 0; i < oldServiceType.length; i++) {
-							if (!(oldServiceType[i].equals(parseUSN.getServiceType()))) 
-	                        {
-								vec.add(oldServiceType[i]);
-							}
-						}
-						actualServiceType = (String[]) vec.toArray(new String[]{});
-	
-	                    //unrigistering and registering again with the new properties
-						unregisterUPnPDevice(registar);
-						device.setProperty(UPnPService.ID, actualServicesID);
-						device.setProperty(UPnPService.TYPE, actualServiceType);
-						registerUPnPDevice(null, device, device.getDescriptions(null));
-						searchForListener(cyberDevice);
-					}
-				}
-				
-			}//synchronized(devices)
-		} else {
-			/*
-			 * if it is a service means that it has deleted when the 
-			 * owner was unregister so I can skip this bye-bye
-			 * 
-			 * //TODO Understand the comment
-			 *
-			 */
-		}
-	}
-    
-	public synchronized void removeOSGiandUPnPDeviceHierarchy(final UPnPDeviceImpl dev) 
-    {
-		/*
-		 * remove all the UPnPDevice from the struct of local device recursively
-		 */
-		final String udn = (String) dev.getDescriptions(null).get(UPnPDevice.UDN);
-		
-		if(devices.containsKey(udn) == false){
-			Activator.logger.INFO("Device "+dev.getDescriptions(null).get(UPnPDevice.FRIENDLY_NAME)+"("+udn+") already removed");
-			return;
-		}		
-		
-		String[] childrenUDN = (String[]) dev.getDescriptions(null).get(
-				UPnPDevice.CHILDREN_UDN);
-
-		if (childrenUDN == null) {
-			//no children			
-			unregisterUPnPDevice(((OSGiDeviceInfo) devices.get(udn)).getRegistration());
-			Activator.logger.INFO("Device "+dev.getDescriptions(null).get(UPnPDevice.FRIENDLY_NAME)+"("+udn+") deleted");
-			devices.remove(udn);
-			return;
-		} else {
-			for (int i = 0; i < childrenUDN.length; i++) {
-				if (devices.get(childrenUDN[i]) != null) {
-					removeOSGiandUPnPDeviceHierarchy(((OSGiDeviceInfo) devices.get(childrenUDN[i])).getOSGiDevice());
-				}
-			}
-			unregisterUPnPDevice(((OSGiDeviceInfo) devices.get(udn)).getRegistration());
-			Activator.logger.INFO("Device "+dev.getDescriptions(null).get(UPnPDevice.FRIENDLY_NAME)+"("+udn+") deleted");
-			devices.remove(udn);
-		}
-	}
-
-	public synchronized void removeOSGiExpireDevice(Device dev) {
-		/*
-		 * unregistering root device with all its children device from OSGi 
-		 * deleting root device and all its children from struct that conatin 
-		 * a list of local device
-		 */
-		removeOSGiandUPnPDeviceHierarchy(((OSGiDeviceInfo) devices.get(dev
-				.getUDN())).getOSGiDevice());
-	}
-
-	public void registerUPnPDevice(Device dev, UPnPDeviceImpl upnpDev,
-			Dictionary prop) {
-		/*
-		 * registering the new Device as OSGi UPnPDevice and then add 
-		 * ServiceRegistration and UPnPDevice reference to the hashtable
-		 * that contains local devices
-		 */
-		if (prop == null && upnpDev == null) {
-			UPnPDeviceImpl newDevice = new UPnPDeviceImpl(dev, context);
-			ServiceRegistration registration = 
-                context.registerService(UPnPDevice.class.getName(), 
-                                        newDevice, 
-                                        newDevice.getDescriptions(null));
-			OSGiDeviceInfo deviceInfo = 
-                new OSGiDeviceInfo(newDevice,registration);
-            
-            String udn = (String) ((newDevice.getDescriptions(null)).get(UPnPDevice.UDN));
-			devices.put(udn, deviceInfo);
-		} else {
-			ServiceRegistration registration = 
-                context.registerService(UPnPDevice.class.getName(), upnpDev, prop);
-			OSGiDeviceInfo deviceInfo = 
-                new OSGiDeviceInfo(upnpDev,	registration);
-			devices.put(upnpDev.getDescriptions(null).get(UPnPDevice.UDN),deviceInfo);
-		}
-	}
-    
-    
-	public void unregisterUPnPDevice(ServiceRegistration registration) {
-		registration.unregister();
-
-	}
-
-	public Device findDeviceCtrl(ControlPoint ctrl, String udn) {
-		/* 
-		 * this return the device looking in all the struct
-		 */
-		
-		DeviceList devList = getDeviceList();
-		Device dev = null;
-		int i = 0;
-		while (i < devList.size() && (dev == null)) {
-			if (devList.getDevice(i).getUDN().equals(udn)) {
-				dev = devList.getDevice(i);
-				return dev;
-			}
-			dev = findDevice(udn, devList.getDevice(i));
-			i++;	
-		}
-		return dev;
-	}
-    
-	public Device findDevice(String udn, Device dev) {
-		/*
-		 * look for the device if it exist, starting from the root on
-		 * cyberlink struct
-		 */
-		DeviceList devList = dev.getDeviceList();
-		Device aux = null;
-		for (int i = 0; i < devList.size(); i++) {
-			if (devList.getDevice(i).getUDN().equals(udn)) {
-				return devList.getDevice(i);
-			} else {
-				if((aux = findDevice(udn, devList.getDevice(i))) != null)
-					return aux;
-			}
-		}
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.cybergarage.upnp.device.SearchResponseListener#deviceSearchResponseReceived(org.cybergarage.upnp.ssdp.SSDPPacket)
-	 */
-	public void deviceSearchResponseReceived(SSDPPacket ssdpPacket) {
-        Activator.logger.DEBUG("[Importer] deviceSearchResponseReceived");
-        Activator.logger.PACKET(ssdpPacket.toString());
-
-		String usn = ssdpPacket.getUSN();
-		ParseUSN parseUSN = new ParseUSN(usn);
-		String udn = parseUSN.getUDN();
-
-		ServiceReference[] refs = null;
-        
-        String filter = "(&" + UPNP_DEVICE_FLTR + EXPORT_FLTR + ")";
-       
-		try {
-			refs = context.getServiceReferences(UPnPDevice.class.getName(),
-					filter);
-		} catch (InvalidSyntaxException e) {
-			e.printStackTrace();
-		}
-        
-		if (refs != null) {
-			for (int i = 0; i < refs.length; i++) {
-				UPnPDevice dev = (UPnPDevice) context.getService(refs[i]);
-				Dictionary dic = dev.getDescriptions(null);
-				if (((String) dic.get(UPnPDevice.UDN)).equals(udn)) {
-					return;
-				}
-			}
-		}
-
-		if (devices.containsKey(udn)) {			
-            Activator.logger.DEBUG("[Importer] Device already discovered");
-			/*
-			 * Exist the registered device either in OSGi and 
-			 * hashtable of local device
-			 */
-			if (parseUSN.isService()) {
-                doServiceUpdating(udn,parseUSN.getServiceType());
-			}
-		} else {
-            doDeviceRegistration(udn);
-		}
-
-	}
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
-	 */
-	public void serviceChanged(ServiceEvent event) {
-        Activator.logger.DEBUG("[Importer] serviceChanged");
-        Activator.logger.DEBUG("Event::"+event.toString());
-
-		if (event.getType() == ServiceEvent.REGISTERED) {
-			/* check new listener registration */
-			ServiceReference serRef = event.getServiceReference();
-			Object obj = serRef.getProperty(UPnPEventListener.UPNP_FILTER);
-			/* obtain interested devices for the listener */
-			ServiceReference[] devicesRefs = null;
-			if (obj != null) {
-				Filter filter = (Filter) obj;
-				String filtra = filter.toString();
-				/*
-				 * Avoid to implement the notification for device 
-				 * that are not been created by BaseDriver
-				 */ 
-				String newfilter = "(&" + filtra +  IMPORT_FLTR + ")";
-                //String newfilter = "(&" + filtra + "(!" + EXPORT_FLTR + ")" + ")";
-				//System.out.println(newfilter);
-				try {
-					devicesRefs = context.getServiceReferences(UPnPDevice.class
-							.getName(), newfilter);
-				} catch (InvalidSyntaxException e) {
-					e.printStackTrace();
-				}
-
-				if (devicesRefs != null) {/*
-										   * 
-										   * only if there is a compatibile device
-										   */
-					Dictionary dic = new Hashtable();
-					for (int i = 0; i < devicesRefs.length; i++) {
-						UPnPDevice device = (UPnPDevice) context.getService(devicesRefs[i]);
-						dic.put(UPnPDevice.ID, device.getDescriptions(null).get(UPnPDevice.UDN));
-						dic.put(UPnPDevice.TYPE, device.getDescriptions(null).get(UPnPDevice.TYPE));
-						UPnPService[] services = device.getServices();
-						if (services != null) {
-							for (int j = 0; j < services.length; j++) {
-								dic.put(UPnPService.ID, services[j].getId());
-								dic.put(UPnPService.TYPE, services[j].getType());
-								//TODO add method boolean serviceEvented() so we can remove the below cycle
-								UPnPStateVariable[] stateVars = services[j].getStateVariables();
-								boolean hasEventedVars = false;
-								for (int k = 0; k < stateVars.length && ! hasEventedVars; k++) {
-									hasEventedVars = stateVars[k].sendsEvents();
-									if (hasEventedVars) {
-										if(filter.match(dic)){
-											UPnPEventListener listener = 
-		                                        (UPnPEventListener) context.getService(serRef);
-											FirstMessage msg = new FirstMessage(
-													((UPnPServiceImpl) services[j]).getCyberService(),
-													listener);
-											subQueue.enqueue(msg);											
-										}
-									}
-								}
-							}
-						}
-                        context.ungetService(devicesRefs[i]);
-					}
-				}
-			} else {/* obj==null (interested in all devices) */
-				try {
-					String newfilter = "(!" + EXPORT_FLTR+ ")";
-					devicesRefs = context.getServiceReferences(UPnPDevice.class.getName(), newfilter);
-				} catch (InvalidSyntaxException e) {
-					e.printStackTrace();
-				}
-				if (devicesRefs != null) {/*
-										   * 
-										   * only if there is a device
-										   */
-
-					for (int i = 0; i < devicesRefs.length; i++) {
-						UPnPDevice device = (UPnPDevice) context
-								.getService(devicesRefs[i]);
-						UPnPService[] services = device.getServices();
-						if (services != null) {
-							for (int j = 0; j < services.length; j++) {
-								UPnPStateVariable[] stateVars = services[j]
-										.getStateVariables();
-								boolean bool = false;								
-								for (int k = 0; k < stateVars.length; k++) {
-									bool = stateVars[k].sendsEvents();
-									if (bool) {
-										break;
-									}
-								}
-								if (bool) {
-									UPnPEventListener listener = 
-                                        (UPnPEventListener) context.getService(serRef);
-									FirstMessage msg = new FirstMessage(
-											((UPnPServiceImpl) services[j]).getCyberService(),
-											listener);
-									subQueue.enqueue(msg);
-								}
-							}
-						}
-                        context.ungetService(devicesRefs[i]);
-					}
-				}
-			}
-
-		} else if (event.getType() == ServiceEvent.MODIFIED) {
-			Vector newServices = new Vector();
-			ServiceReference serRef = event.getServiceReference();
-			Filter filter = (Filter) serRef.getProperty(UPnPEventListener.UPNP_FILTER);
-			UPnPEventListener listener = (UPnPEventListener) context.getService(serRef);
-			ServiceReference[] devicesRefs = null;
-
-			if (filter != null) {
-				try {
-					String filtra = filter.toString();
-                    String newfilter = "(&" + filtra + "(!" + EXPORT_FLTR + ")" + ")";
-					devicesRefs = context.getServiceReferences(UPnPDevice.class.getName(), newfilter);
-				} catch (InvalidSyntaxException e) {
-					e.printStackTrace();
-				}
-				if (devicesRefs != null) {/*
-										   * 
-										   * only if there is a compatibile device
-										   */
-					Dictionary dic = new Hashtable();
-					/* 
-					 * look for the service that match
-					 */
-					for (int i = 0; i < devicesRefs.length; i++) {
-						UPnPDevice device = (UPnPDevice) context
-								.getService(devicesRefs[i]);
-						dic.put(UPnPDevice.ID, device.getDescriptions(null)
-								.get(UPnPDevice.UDN));
-						dic.put(UPnPDevice.TYPE, device.getDescriptions(null)
-								.get(UPnPDevice.TYPE));
-						UPnPService[] services = device.getServices();
-
-						if (services != null) {
-							for (int j = 0; j < services.length; j++) {
-								dic.put(UPnPService.ID, services[j].getId());
-								dic.put(UPnPService.TYPE, services[j].getType());
-
-								UPnPStateVariable[] stateVars = services[j]
-										.getStateVariables();
-								boolean hasEventedVars = false;
-								for (int k = 0; k < stateVars.length; k++) {
-									hasEventedVars = stateVars[k].sendsEvents();
-									if (hasEventedVars) {
-										break;
-									}
-								}
-								if (!hasEventedVars) {
-									continue;
-								}
-
-								boolean bool = filter.match(dic);
-								if (bool) {
-									newServices
-											.add(((UPnPServiceImpl) services[j])
-													.getCyberService());
-								}
-							}//for services
-						}//services ==null
-						context.ungetService(devicesRefs[i]);
-					}//for devicesRefs
-					ListenerModified msg = new ListenerModified(newServices,
-							listener);
-					subQueue.enqueue(msg);
-				}//devicesrefs !=null
-			} else {//interrested in all devices
-				try {
-
-					String newfilter = "(!(" + UPnPDevice.UPNP_EXPORT + "=*"
-							+ ")" + ")";
-					devicesRefs = context.getServiceReferences(UPnPDevice.class
-							.getName(), newfilter);
-				} catch (InvalidSyntaxException e) {
-					e.printStackTrace();
-				}
-				if (devicesRefs != null) {/*
-										   * only if there is a device
-										   */
-
-					for (int i = 0; i < devicesRefs.length; i++) {
-						UPnPDevice device = (UPnPDevice) context
-								.getService(devicesRefs[i]);
-						UPnPService[] services = device.getServices();
-						if (services != null) {
-							for (int j = 0; j < services.length; j++) {
-								UPnPStateVariable[] stateVars = services[j]
-										.getStateVariables();
-								boolean hasEventedVars = false;
-								for (int k = 0; k < stateVars.length; k++) {
-									hasEventedVars = stateVars[k].sendsEvents();
-									if (hasEventedVars) {
-										break;
-									}
-								}
-								if (hasEventedVars) {
-									newServices
-											.add(((UPnPServiceImpl) services[j])
-													.getCyberService());
-								}//hasEventedvars
-							}//for services
-						}//services !=null
-                        context.ungetService(devicesRefs[i]);
-					}//for devicesRefs
-					subQueue
-							.enqueue(new ListenerModified(newServices, listener));
-				}//devicesRefs !=null
-
-			}
-
-		} else if (event.getType() == ServiceEvent.UNREGISTERING) {
-			UPnPEventListener listener = (UPnPEventListener) context
-					.getService(event.getServiceReference());
-			if (listener != null) {
-				ListenerUnRegistration msg = new ListenerUnRegistration(
-						listener);
-				subQueue.enqueue(msg);
-			}
-			context.ungetService(event.getServiceReference());
-		}
-	} /*
-	   * (non-Javadoc)
-	   * 
-	   * @see org.cybergarage.upnp.event.EventListener#eventNotifyReceived(java.lang.String,
-	   *      long, java.lang.String, java.lang.String)
-	   */
-	/*
-	 * public void eventNotifyReceived(String uuid, long seq, String varName,
-	 * String value) { // TODO Auto-generated method stub StateChanged msg = new
-	 * StateChanged(uuid, varName, value,seq);,serviceFromSid(uuid)
-	 * notifierQueue.enqueue(msg); }
-	 */
-
-	public Service serviceFromSid(String sid) {
-		Enumeration e = devices.elements();
-		Service cyberService = null;
-		while (e.hasMoreElements()) {
-			OSGiDeviceInfo deviceinfo = (OSGiDeviceInfo) e.nextElement();
-			UPnPDevice device = deviceinfo.getOSGiDevice();
-			UPnPService[] services = (UPnPService[]) device.getServices();
-			UPnPServiceImpl[] servicesImpl = new UPnPServiceImpl[services.length];
-			for (int i = 0; i < servicesImpl.length; i++) {
-				servicesImpl[i] = (UPnPServiceImpl) services[i];
-			}
-			for (int i = 0; i < servicesImpl.length; i++) {
-				cyberService = servicesImpl[i].getCyberService();
-				boolean bool = cyberService.isSubscribed();
-				if (bool) {
-					if (cyberService.getSID().equals(sid)) {
-						return cyberService;
-					}
-				}
-			}
-		}
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.felix.upnpbase.importer.MyEventListener#newEventArrived(java.lang.String,
-	 *      long, java.util.Dictionary)
-	 */
-	public void newEventArrived(String uuid, long seq, PropertyList props) {
-        Activator.logger.DEBUG("[Importer] newEventArrived");
-		Service service = serviceFromSid(uuid);
-		if (service != null) {
-            int size = props.size();
-            Hashtable hash = new Hashtable();
-            for (int i = 0; i < size; i++) {
-                Property prop = props.getProperty(i);
-                String varName = prop.getName();
-                String varValue = prop.getValue();
-                String upnpType = service.getStateVariable(varName).getDataType();
-                Object valueObj;
-                try {
-                    valueObj = Converter.parseString(varValue,upnpType);
-                } catch (Exception e) {
-                    Activator.logger.ERROR("[Importer] Bad data value in Notify event: "
-                            +"var name="+varName +" value="+varValue +" type="+upnpType + "\n"+e);
-                    return;
-                }
-                hash.put(varName, valueObj);
-            }
-           
-			Device device = service.getDevice();
-			StateChanged msg = new StateChanged(uuid, seq, hash, device, service);
-			notifierQueue.enqueue(msg);
-		}
-	}
-    
-    public void doServiceUpdating(String udn,String serviceType){
-        Activator.logger.DEBUG("[Importer] check for service updating");
-        OSGiDeviceInfo deviceinfo = (OSGiDeviceInfo) devices.get(udn);
-        UPnPDeviceImpl device = deviceinfo.getOSGiDevice();
-        boolean isSerPresent = device.existServiceType(serviceType);
-        if (!isSerPresent) {
-            /*
-             * The serivice doesn't exist so it's new.
-             * Find the udn of owner device and re-register the owner
-             */
-            ServiceRegistration registar = 
-                ((OSGiDeviceInfo) devices.remove(udn)).getRegistration();
-            String[] oldServicesID = 
-                (String[]) device.getDescriptions(null).get(UPnPServiceImpl.ID);
-            String[] oldServicesType = 
-                (String[]) device.getDescriptions(null).get(UPnPServiceImpl.TYPE);
-            
-            //to handle multiple instance of a serivice of the same type
-            Device cyberDevice = findDeviceCtrl(this, udn);
-            ServiceList serviceList = cyberDevice.getServiceList();
-            ArrayList newServicesID = new ArrayList();
-
-            for (int i = 0; i < serviceList.size(); i++) {
-                if (serviceList.getService(i).getServiceType()
-                        .equals(serviceType)) 
-                {
-                    newServicesID.add(serviceList.getService(i).getServiceID());
-                }
-            }
-            
-            //adding the new servicesID 
-            String[] currentServicesID = 
-                new String[(oldServicesID.length + newServicesID.size())];
-            int endOld = 1;
-            for (int i = 0; i < oldServicesID.length; i++) {
-                currentServicesID[i] = oldServicesID[i];
-                endOld++;
-            }
-            int j = 0;
-            for (; endOld < currentServicesID.length; endOld++) {
-                currentServicesID[endOld] = (String) newServicesID.get(j);
-                j++;
-            }
-            
-            //adding the new ServiceType
-            String[] currentServicesType = new String[oldServicesType.length + 1];
-            for (int i = 0; i < oldServicesType.length; i++) {
-                currentServicesType[i] = oldServicesType[i];
-            }
-            currentServicesType[currentServicesType.length - 1] = serviceType;
-            
-            
-            // unregistring the OSGi Device
-            // and setting new properties
-            unregisterUPnPDevice(registar);
-            device.setProperty(UPnPService.ID, currentServicesID);
-            device.setProperty(UPnPServiceImpl.TYPE,currentServicesType);
-            
-            //registering the service with the updated properties
-            //TODO Check if null to the first paramaters is correct or it requires the reference to the cyberdomo upnp device
-            registerUPnPDevice(null, device, device.getDescriptions(null));
-            searchForListener(cyberDevice);
-        }   
-    }
-    
-    public void doDeviceRegistration(String udn,boolean checkDouble){
-    	if(checkDouble){    		
-    		try {
-    			ServiceReference[] refs =
-    				Activator.bc.getServiceReferences(
-						UPnPDevice.class.getName(),
-						"(" + UPnPDevice.UDN + "=" + udn + ")"
-    				);
-    			if(refs!=null)
-    				return;
-			} catch (InvalidSyntaxException ignored) {
-			}
-    	}
-    	doDeviceRegistration(udn);
-    }
-    
-    public synchronized void doDeviceRegistration(String udn){
-        /*
-         * registering the new device either if it is new root device or
-         * a new embedded device 
-         */
-        Device dev = findDeviceCtrl(this, udn);
-        if (dev == null) {
-        	/*
-        	 * In this case the UPnP SDK notifies us that a ssdp:alive has arrived,
-        	 * but,  because the no root device ssdp:alive packet has recieved by the UPnP SDK
-        	 * no Device is present in the UPnP SDK device list. 
-        	 */
-            Activator.logger.INFO("Cyberlink notified packet from UDN:" +udn+ ", but Device instance doesn't exist in Cyberlink structs! It will be Ignored");            
-        }else if(devices.containsKey(udn) == false) {
-            Activator.logger.INFO("[Importer] registering UPnPDevice:"+dev.getFriendlyName()+"("+dev.getUDN()+")" );
-            registerUPnPDevice(dev, null, null);
-            searchForListener(dev);
-            /*
-             * now we can register all the device embedded device and service without
-             * recieving the NOTIFY 
-             */
-            //XXX Think about this choice
-            for (Iterator i = dev.getDeviceList().iterator(); i.hasNext();) {
-				Device d = (Device) i.next();
-				doDeviceRegistration(d.getUDN(),true);
-			}
-        }else if(devices.containsKey(udn) == true) {
-        	Activator.logger.INFO("[Importer] UPnPDevice UDN::"+dev.getFriendlyName()+"("+dev.getUDN()+") already registered Skipping");
-        }
-    }
-    
-	public void searchForListener(Device device) {
-        Activator.logger.DEBUG("[Importer] searching for UPnPEventListener");
-		ServiceReference[] listeners = null;
-		try {
-			listeners = context.getServiceReferences(UPnPEventListener.class.getName(), null);
-		} catch (InvalidSyntaxException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		if (listeners != null) {
-			String deviceID = device.getUDN();
-			String serviceID;
-			String deviceType = device.getDeviceType();
-			String serviceType;
-			Hashtable hash = new Hashtable();
-			hash.put(UPnPDevice.ID, deviceID);
-			hash.put(UPnPDevice.TYPE, deviceType);
-			ServiceList services = device.getServiceList();
-			Vector eventedSers = new Vector();
-
-			for (int i = 0; i < services.size(); i++) {
-				Service service = (Service) services.elementAt(i);
-				ServiceStateTable vars = service.getServiceStateTable();
-				for (int j = 0; j < vars.size(); j++) {
-					StateVariable var = (StateVariable) vars.elementAt(j);
-					if (var.isSendEvents()) {
-						eventedSers.add(service);
-						break;
-					}
-				}
-			}
-
-			for (int i = 0; i < listeners.length; i++) {
-				UPnPEventListener listener = (UPnPEventListener) context
-						.getService(listeners[i]);
-				Filter filter = (Filter) listeners[i]
-						.getProperty(UPnPEventListener.UPNP_FILTER);
-				if (filter == null) {
-					for (int j = 0; j < eventedSers.size(); j++) {
-						Service ser = (Service) eventedSers.elementAt(j);
-						subQueue.enqueue(new FirstMessage(ser, listener));
-					}
-				} else {
-					for (int j = 0; j < eventedSers.size(); j++) {
-						Service ser = (Service) eventedSers.elementAt(j);
-						serviceID = ser.getServiceID();
-						serviceType = ser.getServiceType();
-						hash.put(UPnPService.ID, serviceID);
-						hash.put(UPnPService.TYPE, serviceType);
-						boolean bool = filter.match(hash);
-						if (bool) {
-							subQueue.enqueue(new FirstMessage(ser, listener));
-						}
-
-					}
-				}
-
-			}
-
-		}
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core;
+
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.cybergarage.http.HTTPRequest;
+import org.cybergarage.upnp.ControlPoint;
+import org.cybergarage.upnp.Device;
+import org.cybergarage.upnp.DeviceList;
+import org.cybergarage.upnp.Service;
+import org.cybergarage.upnp.ServiceList;
+import org.cybergarage.upnp.ServiceStateTable;
+import org.cybergarage.upnp.StateVariable;
+import org.cybergarage.upnp.device.NotifyListener;
+import org.cybergarage.upnp.device.SearchResponseListener;
+import org.cybergarage.upnp.event.NotifyRequest;
+import org.cybergarage.upnp.event.Property;
+import org.cybergarage.upnp.event.PropertyList;
+import org.cybergarage.upnp.ssdp.SSDPPacket;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.basedriver.Activator;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerModified;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerUnRegistration;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.NotifierQueue;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue;
+import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPDeviceImpl;
+import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPServiceImpl;
+import org.apache.felix.upnp.basedriver.importer.util.ParseUSN;
+import org.apache.felix.upnp.basedriver.util.Converter;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class MyCtrlPoint extends ControlPoint
+		implements
+			NotifyListener,
+			SearchResponseListener,
+			ServiceListener
+{
+	private BundleContext context;   
+    private Hashtable devices;//key UDN value OsgideviceInfo(Osgi)
+	private SubscriptionQueue subQueue;
+	private NotifierQueue notifierQueue;
+    
+    private final String UPNP_EVENT_LISTENER_FLTR =
+        "(" + Constants.OBJECTCLASS + "=" + UPnPEventListener.class.getName() + ")";
+    private final String UPNP_DEVICE_FLTR =
+        "(" + Constants.OBJECTCLASS + "=" + UPnPDevice.class.getName() + ")";
+    private final String EXPORT_FLTR =
+        "(" + UPnPDevice.UPNP_EXPORT + "=*" + ")";
+    private final String IMPORT_FLTR =
+        "(" + org.apache.felix.upnp.basedriver.util.Constants.UPNP_IMPORT + "=*" + ")";
+
+    
+    public MyCtrlPoint(BundleContext context, SubscriptionQueue subQueue,
+			NotifierQueue notifierQueue) {
+		super();
+		this.context = context;
+        devices = new Hashtable();
+		addNotifyListener(this);
+		addSearchResponseListener(this);
+		try {
+			context.addServiceListener(this, UPNP_EVENT_LISTENER_FLTR);
+		} catch (InvalidSyntaxException e) {
+			e.printStackTrace();
+		}
+		this.subQueue = subQueue;
+		this.notifierQueue = notifierQueue;
+	}
+
+	public void httpRequestRecieved(HTTPRequest httpReq) {
+        Activator.logger.DEBUG("[Importer] httpRequestRecieved event");
+        Activator.logger.PACKET(httpReq.toString());
+
+        if (httpReq.isNotifyRequest() == true) {
+            Activator.logger.DEBUG("[Importer] Notify Request");
+			NotifyRequest notifyReq = new NotifyRequest(httpReq);
+			String uuid = notifyReq.getSID();
+			long seq = notifyReq.getSEQ();
+			PropertyList props = notifyReq.getPropertyList();
+//			int propCnt = props.size();
+//			Hashtable hash = new Hashtable();
+//			for (int n = 0; n < propCnt; n++) {
+//				Property prop = props.getProperty(n);
+//				String varName = prop.getName();
+//				String varValue = prop.getValue();
+//				hash.put(varName, varValue);
+//			}
+            newEventArrived(uuid, seq, props);
+			httpReq.returnOK();
+			return;
+		}
+
+        Activator.logger.DEBUG("BAD Request");
+		httpReq.returnBadRequest();
+
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.cybergarage.upnp.ControlPoint#removeExpiredDevices()
+	 *  
+	 */
+	public void removeExpiredDevices() {
+		DeviceList devList = getDeviceList();
+		int devCnt = devList.size();
+		for (int n = 0; n < devCnt; n++) {
+			Device dev = devList.getDevice(n);
+			if (dev.isExpired() == true) {
+                Activator.logger.DEBUG("[Importer] Expired device:"+ dev.getFriendlyName());
+				removeDevice(dev);
+				removeOSGiExpireDevice(dev);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.cybergarage.upnp.device.NotifyListener#deviceNotifyReceived(org.cybergarage.upnp.ssdp.SSDPPacket)
+	 */
+	public void deviceNotifyReceived(SSDPPacket ssdpPacket) {
+        Activator.logger.DEBUG("[Importer] deviceNotifyReceived");
+        Activator.logger.PACKET(ssdpPacket.toString());
+		/*
+		 * if the packet is 
+		 * 		NOTIFY or ISALIVE or *new* ROOT	then create and register the UPnPDevice and 
+		 * 										all the embeeded device too
+		 * 		DEVICE or SERVICE	then if they already exist in OSGi do nothing otherwise I'll create and 
+		 * 							register all the UPnPDevice need starting from the root device
+		 * 		*root* BYEBYE		then I'll unregister it and all its children from OSGi Framework 
+		 * 		*service* BYEBYE	then I'll re-register the UPnPDevice that contain the service with the updated
+		 * 							properties 
+		 * 		*device* BYEBYE		then I'll re-register the UPnPDevice that contain the device with the updated
+		 * 							properties and also unregister the UPnPDevice that has left
+		 */
+		String usn = ssdpPacket.getUSN();
+		ParseUSN parseUSN = new ParseUSN(usn);
+		String udn = parseUSN.getUDN();
+        
+		ServiceReference[] refs = null;
+		String filter = "(&" + UPNP_DEVICE_FLTR + EXPORT_FLTR+ ")";
+		try {
+			refs = context.getServiceReferences(UPnPDevice.class.getName(),	filter);
+		} catch (InvalidSyntaxException e) {
+			e.printStackTrace();
+		}
+		if (refs != null) {
+			for (int i = 0; i < refs.length; i++) {
+				UPnPDevice dev = (UPnPDevice) context.getService(refs[i]);
+				Dictionary dic = dev.getDescriptions(null);
+				if (((String) dic.get(UPnPDevice.UDN)).equals(udn)) {
+					return;
+				}
+			}
+		}
+
+		if (ssdpPacket.isAlive()) {
+			
+            Activator.logger.DEBUG("[Importer] ssdpPacket.isAlive");
+			if (devices.containsKey(udn)) {
+                Activator.logger.DEBUG("[Importer] Device already discovered");
+				if (parseUSN.isService()) {
+                    doServiceUpdating(udn,parseUSN.getServiceType());
+				}
+			} else {
+                doDeviceRegistration(udn);
+			}
+
+		} else if (ssdpPacket.isByeBye()) {
+            Activator.logger.DEBUG("[Importer] ssdpPacket.isByeBye");
+
+            synchronized (devices) {		
+
+				if (devices.containsKey(udn)) {
+					if (parseUSN.isDevice()) {
+	                    Activator.logger.DEBUG("[Importer] parseUSN.isDevice ...unregistering all the children devices ");
+	                    
+						//unregistering all the children devices 
+						UPnPDeviceImpl dev = ((OSGiDeviceInfo) devices.get(udn)).getOSGiDevice();
+						removeOSGiandUPnPDeviceHierarchy(dev);
+	
+					} else if (parseUSN.isService()) {
+	                    Activator.logger.DEBUG("[Importer] parseUSN.isService ...registering modified device again ");
+						/* 
+						 * I have to unregister the UPnPDevice and register it again 
+						 * with the updated properties  
+						 */
+						UPnPDeviceImpl device = 
+	                        ((OSGiDeviceInfo) devices.get(udn)).getOSGiDevice();
+						ServiceRegistration registar = 
+	                        ((OSGiDeviceInfo) devices.get(udn)).getRegistration();
+						String[] oldServicesID = 
+	                        (String[]) (device.getDescriptions(null).get(UPnPService.ID));
+						String[] oldServiceType = 
+	                        (String[]) (device.getDescriptions(null).get(UPnPService.TYPE));
+	                    
+						Device cyberDevice = findDeviceCtrl(this, udn);
+						Vector vec = new Vector();
+						for (int i = 0; i < oldServiceType.length; i++) {
+							Service ser = cyberDevice.getService(oldServicesID[i]);
+							if (!(ser.getServiceType().equals(parseUSN.getServiceType()))) 
+	                        {
+								vec.add(oldServicesID[i]);
+							}
+						}
+	
+	                    //new serviceID
+						String[] actualServicesID = new String[vec.size()];
+						actualServicesID = (String[]) vec.toArray(new String[]{});
+	
+	                    //new serviceType
+						String[] actualServiceType = new String[oldServiceType.length - 1];
+						vec.clear();
+						for (int i = 0; i < oldServiceType.length; i++) {
+							if (!(oldServiceType[i].equals(parseUSN.getServiceType()))) 
+	                        {
+								vec.add(oldServiceType[i]);
+							}
+						}
+						actualServiceType = (String[]) vec.toArray(new String[]{});
+	
+	                    //unrigistering and registering again with the new properties
+						unregisterUPnPDevice(registar);
+						device.setProperty(UPnPService.ID, actualServicesID);
+						device.setProperty(UPnPService.TYPE, actualServiceType);
+						registerUPnPDevice(null, device, device.getDescriptions(null));
+						searchForListener(cyberDevice);
+					}
+				}
+				
+			}//synchronized(devices)
+		} else {
+			/*
+			 * if it is a service means that it has deleted when the 
+			 * owner was unregister so I can skip this bye-bye
+			 * 
+			 * //TODO Understand the comment
+			 *
+			 */
+		}
+	}
+    
+	public synchronized void removeOSGiandUPnPDeviceHierarchy(final UPnPDeviceImpl dev) 
+    {
+		/*
+		 * remove all the UPnPDevice from the struct of local device recursively
+		 */
+		final String udn = (String) dev.getDescriptions(null).get(UPnPDevice.UDN);
+		
+		if(devices.containsKey(udn) == false){
+			Activator.logger.INFO("Device "+dev.getDescriptions(null).get(UPnPDevice.FRIENDLY_NAME)+"("+udn+") already removed");
+			return;
+		}		
+		
+		String[] childrenUDN = (String[]) dev.getDescriptions(null).get(
+				UPnPDevice.CHILDREN_UDN);
+
+		if (childrenUDN == null) {
+			//no children			
+			unregisterUPnPDevice(((OSGiDeviceInfo) devices.get(udn)).getRegistration());
+			Activator.logger.INFO("Device "+dev.getDescriptions(null).get(UPnPDevice.FRIENDLY_NAME)+"("+udn+") deleted");
+			devices.remove(udn);
+			return;
+		} else {
+			for (int i = 0; i < childrenUDN.length; i++) {
+				if (devices.get(childrenUDN[i]) != null) {
+					removeOSGiandUPnPDeviceHierarchy(((OSGiDeviceInfo) devices.get(childrenUDN[i])).getOSGiDevice());
+				}
+			}
+			unregisterUPnPDevice(((OSGiDeviceInfo) devices.get(udn)).getRegistration());
+			Activator.logger.INFO("Device "+dev.getDescriptions(null).get(UPnPDevice.FRIENDLY_NAME)+"("+udn+") deleted");
+			devices.remove(udn);
+		}
+	}
+
+	public synchronized void removeOSGiExpireDevice(Device dev) {
+		/*
+		 * unregistering root device with all its children device from OSGi 
+		 * deleting root device and all its children from struct that conatin 
+		 * a list of local device
+		 */
+		removeOSGiandUPnPDeviceHierarchy(((OSGiDeviceInfo) devices.get(dev
+				.getUDN())).getOSGiDevice());
+	}
+
+	public void registerUPnPDevice(Device dev, UPnPDeviceImpl upnpDev,
+			Dictionary prop) {
+		/*
+		 * registering the new Device as OSGi UPnPDevice and then add 
+		 * ServiceRegistration and UPnPDevice reference to the hashtable
+		 * that contains local devices
+		 */
+		if (prop == null && upnpDev == null) {
+			UPnPDeviceImpl newDevice = new UPnPDeviceImpl(dev, context);
+			ServiceRegistration registration = 
+                context.registerService(UPnPDevice.class.getName(), 
+                                        newDevice, 
+                                        newDevice.getDescriptions(null));
+			OSGiDeviceInfo deviceInfo = 
+                new OSGiDeviceInfo(newDevice,registration);
+            
+            String udn = (String) ((newDevice.getDescriptions(null)).get(UPnPDevice.UDN));
+			devices.put(udn, deviceInfo);
+		} else {
+			ServiceRegistration registration = 
+                context.registerService(UPnPDevice.class.getName(), upnpDev, prop);
+			OSGiDeviceInfo deviceInfo = 
+                new OSGiDeviceInfo(upnpDev,	registration);
+			devices.put(upnpDev.getDescriptions(null).get(UPnPDevice.UDN),deviceInfo);
+		}
+	}
+    
+    
+	public void unregisterUPnPDevice(ServiceRegistration registration) {
+		registration.unregister();
+
+	}
+
+	public Device findDeviceCtrl(ControlPoint ctrl, String udn) {
+		/* 
+		 * this return the device looking in all the struct
+		 */
+		
+		DeviceList devList = getDeviceList();
+		Device dev = null;
+		int i = 0;
+		while (i < devList.size() && (dev == null)) {
+			if (devList.getDevice(i).getUDN().equals(udn)) {
+				dev = devList.getDevice(i);
+				return dev;
+			}
+			dev = findDevice(udn, devList.getDevice(i));
+			i++;	
+		}
+		return dev;
+	}
+    
+	public Device findDevice(String udn, Device dev) {
+		/*
+		 * look for the device if it exist, starting from the root on
+		 * cyberlink struct
+		 */
+		DeviceList devList = dev.getDeviceList();
+		Device aux = null;
+		for (int i = 0; i < devList.size(); i++) {
+			if (devList.getDevice(i).getUDN().equals(udn)) {
+				return devList.getDevice(i);
+			} else {
+				if((aux = findDevice(udn, devList.getDevice(i))) != null)
+					return aux;
+			}
+		}
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.cybergarage.upnp.device.SearchResponseListener#deviceSearchResponseReceived(org.cybergarage.upnp.ssdp.SSDPPacket)
+	 */
+	public void deviceSearchResponseReceived(SSDPPacket ssdpPacket) {
+        Activator.logger.DEBUG("[Importer] deviceSearchResponseReceived");
+        Activator.logger.PACKET(ssdpPacket.toString());
+
+		String usn = ssdpPacket.getUSN();
+		ParseUSN parseUSN = new ParseUSN(usn);
+		String udn = parseUSN.getUDN();
+
+		ServiceReference[] refs = null;
+        
+        String filter = "(&" + UPNP_DEVICE_FLTR + EXPORT_FLTR + ")";
+       
+		try {
+			refs = context.getServiceReferences(UPnPDevice.class.getName(),
+					filter);
+		} catch (InvalidSyntaxException e) {
+			e.printStackTrace();
+		}
+        
+		if (refs != null) {
+			for (int i = 0; i < refs.length; i++) {
+				UPnPDevice dev = (UPnPDevice) context.getService(refs[i]);
+				Dictionary dic = dev.getDescriptions(null);
+				if (((String) dic.get(UPnPDevice.UDN)).equals(udn)) {
+					return;
+				}
+			}
+		}
+
+		if (devices.containsKey(udn)) {			
+            Activator.logger.DEBUG("[Importer] Device already discovered");
+			/*
+			 * Exist the registered device either in OSGi and 
+			 * hashtable of local device
+			 */
+			if (parseUSN.isService()) {
+                doServiceUpdating(udn,parseUSN.getServiceType());
+			}
+		} else {
+            doDeviceRegistration(udn);
+		}
+
+	}
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
+	 */
+	public void serviceChanged(ServiceEvent event) {
+        Activator.logger.DEBUG("[Importer] serviceChanged");
+        Activator.logger.DEBUG("Event::"+event.toString());
+
+		if (event.getType() == ServiceEvent.REGISTERED) {
+			/* check new listener registration */
+			ServiceReference serRef = event.getServiceReference();
+			Object obj = serRef.getProperty(UPnPEventListener.UPNP_FILTER);
+			/* obtain interested devices for the listener */
+			ServiceReference[] devicesRefs = null;
+			if (obj != null) {
+				Filter filter = (Filter) obj;
+				String filtra = filter.toString();
+				/*
+				 * Avoid to implement the notification for device 
+				 * that are not been created by BaseDriver
+				 */ 
+				String newfilter = "(&" + filtra +  IMPORT_FLTR + ")";
+                //String newfilter = "(&" + filtra + "(!" + EXPORT_FLTR + ")" + ")";
+				//System.out.println(newfilter);
+				try {
+					devicesRefs = context.getServiceReferences(UPnPDevice.class
+							.getName(), newfilter);
+				} catch (InvalidSyntaxException e) {
+					e.printStackTrace();
+				}
+
+				if (devicesRefs != null) {/*
+										   * 
+										   * only if there is a compatibile device
+										   */
+					Dictionary dic = new Hashtable();
+					for (int i = 0; i < devicesRefs.length; i++) {
+						UPnPDevice device = (UPnPDevice) context.getService(devicesRefs[i]);
+						dic.put(UPnPDevice.ID, device.getDescriptions(null).get(UPnPDevice.UDN));
+						dic.put(UPnPDevice.TYPE, device.getDescriptions(null).get(UPnPDevice.TYPE));
+						UPnPService[] services = device.getServices();
+						if (services != null) {
+							for (int j = 0; j < services.length; j++) {
+								dic.put(UPnPService.ID, services[j].getId());
+								dic.put(UPnPService.TYPE, services[j].getType());
+								//TODO add method boolean serviceEvented() so we can remove the below cycle
+								UPnPStateVariable[] stateVars = services[j].getStateVariables();
+								boolean hasEventedVars = false;
+								for (int k = 0; k < stateVars.length && ! hasEventedVars; k++) {
+									hasEventedVars = stateVars[k].sendsEvents();
+									if (hasEventedVars) {
+										if(filter.match(dic)){
+											UPnPEventListener listener = 
+		                                        (UPnPEventListener) context.getService(serRef);
+											FirstMessage msg = new FirstMessage(
+													((UPnPServiceImpl) services[j]).getCyberService(),
+													listener);
+											subQueue.enqueue(msg);											
+										}
+									}
+								}
+							}
+						}
+                        context.ungetService(devicesRefs[i]);
+					}
+				}
+			} else {/* obj==null (interested in all devices) */
+				try {
+					String newfilter = "(!" + EXPORT_FLTR+ ")";
+					devicesRefs = context.getServiceReferences(UPnPDevice.class.getName(), newfilter);
+				} catch (InvalidSyntaxException e) {
+					e.printStackTrace();
+				}
+				if (devicesRefs != null) {/*
+										   * 
+										   * only if there is a device
+										   */
+
+					for (int i = 0; i < devicesRefs.length; i++) {
+						UPnPDevice device = (UPnPDevice) context
+								.getService(devicesRefs[i]);
+						UPnPService[] services = device.getServices();
+						if (services != null) {
+							for (int j = 0; j < services.length; j++) {
+								UPnPStateVariable[] stateVars = services[j]
+										.getStateVariables();
+								boolean bool = false;								
+								for (int k = 0; k < stateVars.length; k++) {
+									bool = stateVars[k].sendsEvents();
+									if (bool) {
+										break;
+									}
+								}
+								if (bool) {
+									UPnPEventListener listener = 
+                                        (UPnPEventListener) context.getService(serRef);
+									FirstMessage msg = new FirstMessage(
+											((UPnPServiceImpl) services[j]).getCyberService(),
+											listener);
+									subQueue.enqueue(msg);
+								}
+							}
+						}
+                        context.ungetService(devicesRefs[i]);
+					}
+				}
+			}
+
+		} else if (event.getType() == ServiceEvent.MODIFIED) {
+			Vector newServices = new Vector();
+			ServiceReference serRef = event.getServiceReference();
+			Filter filter = (Filter) serRef.getProperty(UPnPEventListener.UPNP_FILTER);
+			UPnPEventListener listener = (UPnPEventListener) context.getService(serRef);
+			ServiceReference[] devicesRefs = null;
+
+			if (filter != null) {
+				try {
+					String filtra = filter.toString();
+                    String newfilter = "(&" + filtra + "(!" + EXPORT_FLTR + ")" + ")";
+					devicesRefs = context.getServiceReferences(UPnPDevice.class.getName(), newfilter);
+				} catch (InvalidSyntaxException e) {
+					e.printStackTrace();
+				}
+				if (devicesRefs != null) {/*
+										   * 
+										   * only if there is a compatibile device
+										   */
+					Dictionary dic = new Hashtable();
+					/* 
+					 * look for the service that match
+					 */
+					for (int i = 0; i < devicesRefs.length; i++) {
+						UPnPDevice device = (UPnPDevice) context
+								.getService(devicesRefs[i]);
+						dic.put(UPnPDevice.ID, device.getDescriptions(null)
+								.get(UPnPDevice.UDN));
+						dic.put(UPnPDevice.TYPE, device.getDescriptions(null)
+								.get(UPnPDevice.TYPE));
+						UPnPService[] services = device.getServices();
+
+						if (services != null) {
+							for (int j = 0; j < services.length; j++) {
+								dic.put(UPnPService.ID, services[j].getId());
+								dic.put(UPnPService.TYPE, services[j].getType());
+
+								UPnPStateVariable[] stateVars = services[j]
+										.getStateVariables();
+								boolean hasEventedVars = false;
+								for (int k = 0; k < stateVars.length; k++) {
+									hasEventedVars = stateVars[k].sendsEvents();
+									if (hasEventedVars) {
+										break;
+									}
+								}
+								if (!hasEventedVars) {
+									continue;
+								}
+
+								boolean bool = filter.match(dic);
+								if (bool) {
+									newServices
+											.add(((UPnPServiceImpl) services[j])
+													.getCyberService());
+								}
+							}//for services
+						}//services ==null
+						context.ungetService(devicesRefs[i]);
+					}//for devicesRefs
+					ListenerModified msg = new ListenerModified(newServices,
+							listener);
+					subQueue.enqueue(msg);
+				}//devicesrefs !=null
+			} else {//interrested in all devices
+				try {
+
+					String newfilter = "(!(" + UPnPDevice.UPNP_EXPORT + "=*"
+							+ ")" + ")";
+					devicesRefs = context.getServiceReferences(UPnPDevice.class
+							.getName(), newfilter);
+				} catch (InvalidSyntaxException e) {
+					e.printStackTrace();
+				}
+				if (devicesRefs != null) {/*
+										   * only if there is a device
+										   */
+
+					for (int i = 0; i < devicesRefs.length; i++) {
+						UPnPDevice device = (UPnPDevice) context
+								.getService(devicesRefs[i]);
+						UPnPService[] services = device.getServices();
+						if (services != null) {
+							for (int j = 0; j < services.length; j++) {
+								UPnPStateVariable[] stateVars = services[j]
+										.getStateVariables();
+								boolean hasEventedVars = false;
+								for (int k = 0; k < stateVars.length; k++) {
+									hasEventedVars = stateVars[k].sendsEvents();
+									if (hasEventedVars) {
+										break;
+									}
+								}
+								if (hasEventedVars) {
+									newServices
+											.add(((UPnPServiceImpl) services[j])
+													.getCyberService());
+								}//hasEventedvars
+							}//for services
+						}//services !=null
+                        context.ungetService(devicesRefs[i]);
+					}//for devicesRefs
+					subQueue
+							.enqueue(new ListenerModified(newServices, listener));
+				}//devicesRefs !=null
+
+			}
+
+		} else if (event.getType() == ServiceEvent.UNREGISTERING) {
+			UPnPEventListener listener = (UPnPEventListener) context
+					.getService(event.getServiceReference());
+			if (listener != null) {
+				ListenerUnRegistration msg = new ListenerUnRegistration(
+						listener);
+				subQueue.enqueue(msg);
+			}
+			context.ungetService(event.getServiceReference());
+		}
+	} /*
+	   * (non-Javadoc)
+	   * 
+	   * @see org.cybergarage.upnp.event.EventListener#eventNotifyReceived(java.lang.String,
+	   *      long, java.lang.String, java.lang.String)
+	   */
+	/*
+	 * public void eventNotifyReceived(String uuid, long seq, String varName,
+	 * String value) { // TODO Auto-generated method stub StateChanged msg = new
+	 * StateChanged(uuid, varName, value,seq);,serviceFromSid(uuid)
+	 * notifierQueue.enqueue(msg); }
+	 */
+
+	public Service serviceFromSid(String sid) {
+		Enumeration e = devices.elements();
+		Service cyberService = null;
+		while (e.hasMoreElements()) {
+			OSGiDeviceInfo deviceinfo = (OSGiDeviceInfo) e.nextElement();
+			UPnPDevice device = deviceinfo.getOSGiDevice();
+			UPnPService[] services = (UPnPService[]) device.getServices();
+			UPnPServiceImpl[] servicesImpl = new UPnPServiceImpl[services.length];
+			for (int i = 0; i < servicesImpl.length; i++) {
+				servicesImpl[i] = (UPnPServiceImpl) services[i];
+			}
+			for (int i = 0; i < servicesImpl.length; i++) {
+				cyberService = servicesImpl[i].getCyberService();
+				boolean bool = cyberService.isSubscribed();
+				if (bool) {
+					if (cyberService.getSID().equals(sid)) {
+						return cyberService;
+					}
+				}
+			}
+		}
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.felix.upnpbase.importer.MyEventListener#newEventArrived(java.lang.String,
+	 *      long, java.util.Dictionary)
+	 */
+	public void newEventArrived(String uuid, long seq, PropertyList props) {
+        Activator.logger.DEBUG("[Importer] newEventArrived");
+		Service service = serviceFromSid(uuid);
+		if (service != null) {
+            int size = props.size();
+            Hashtable hash = new Hashtable();
+            for (int i = 0; i < size; i++) {
+                Property prop = props.getProperty(i);
+                String varName = prop.getName();
+                String varValue = prop.getValue();
+                String upnpType = service.getStateVariable(varName).getDataType();
+                Object valueObj;
+                try {
+                    valueObj = Converter.parseString(varValue,upnpType);
+                } catch (Exception e) {
+                    Activator.logger.ERROR("[Importer] Bad data value in Notify event: "
+                            +"var name="+varName +" value="+varValue +" type="+upnpType + "\n"+e);
+                    return;
+                }
+                hash.put(varName, valueObj);
+            }
+           
+			Device device = service.getDevice();
+			StateChanged msg = new StateChanged(uuid, seq, hash, device, service);
+			notifierQueue.enqueue(msg);
+		}
+	}
+    
+    public void doServiceUpdating(String udn,String serviceType){
+        Activator.logger.DEBUG("[Importer] check for service updating");
+        OSGiDeviceInfo deviceinfo = (OSGiDeviceInfo) devices.get(udn);
+        UPnPDeviceImpl device = deviceinfo.getOSGiDevice();
+        boolean isSerPresent = device.existServiceType(serviceType);
+        if (!isSerPresent) {
+            /*
+             * The serivice doesn't exist so it's new.
+             * Find the udn of owner device and re-register the owner
+             */
+            ServiceRegistration registar = 
+                ((OSGiDeviceInfo) devices.remove(udn)).getRegistration();
+            String[] oldServicesID = 
+                (String[]) device.getDescriptions(null).get(UPnPServiceImpl.ID);
+            String[] oldServicesType = 
+                (String[]) device.getDescriptions(null).get(UPnPServiceImpl.TYPE);
+            
+            //to handle multiple instance of a serivice of the same type
+            Device cyberDevice = findDeviceCtrl(this, udn);
+            ServiceList serviceList = cyberDevice.getServiceList();
+            ArrayList newServicesID = new ArrayList();
+
+            for (int i = 0; i < serviceList.size(); i++) {
+                if (serviceList.getService(i).getServiceType()
+                        .equals(serviceType)) 
+                {
+                    newServicesID.add(serviceList.getService(i).getServiceID());
+                }
+            }
+            
+            //adding the new servicesID 
+            String[] currentServicesID = 
+                new String[(oldServicesID.length + newServicesID.size())];
+            int endOld = 1;
+            for (int i = 0; i < oldServicesID.length; i++) {
+                currentServicesID[i] = oldServicesID[i];
+                endOld++;
+            }
+            int j = 0;
+            for (; endOld < currentServicesID.length; endOld++) {
+                currentServicesID[endOld] = (String) newServicesID.get(j);
+                j++;
+            }
+            
+            //adding the new ServiceType
+            String[] currentServicesType = new String[oldServicesType.length + 1];
+            for (int i = 0; i < oldServicesType.length; i++) {
+                currentServicesType[i] = oldServicesType[i];
+            }
+            currentServicesType[currentServicesType.length - 1] = serviceType;
+            
+            
+            // unregistring the OSGi Device
+            // and setting new properties
+            unregisterUPnPDevice(registar);
+            device.setProperty(UPnPService.ID, currentServicesID);
+            device.setProperty(UPnPServiceImpl.TYPE,currentServicesType);
+            
+            //registering the service with the updated properties
+            //TODO Check if null to the first paramaters is correct or it requires the reference to the cyberdomo upnp device
+            registerUPnPDevice(null, device, device.getDescriptions(null));
+            searchForListener(cyberDevice);
+        }   
+    }
+    
+    public void doDeviceRegistration(String udn,boolean checkDouble){
+    	if(checkDouble){    		
+    		try {
+    			ServiceReference[] refs =
+    				Activator.bc.getServiceReferences(
+						UPnPDevice.class.getName(),
+						"(" + UPnPDevice.UDN + "=" + udn + ")"
+    				);
+    			if(refs!=null)
+    				return;
+			} catch (InvalidSyntaxException ignored) {
+			}
+    	}
+    	doDeviceRegistration(udn);
+    }
+    
+    public synchronized void doDeviceRegistration(String udn){
+        /*
+         * registering the new device either if it is new root device or
+         * a new embedded device 
+         */
+        Device dev = findDeviceCtrl(this, udn);
+        if (dev == null) {
+        	/*
+        	 * In this case the UPnP SDK notifies us that a ssdp:alive has arrived,
+        	 * but,  because the no root device ssdp:alive packet has recieved by the UPnP SDK
+        	 * no Device is present in the UPnP SDK device list. 
+        	 */
+            Activator.logger.INFO("Cyberlink notified packet from UDN:" +udn+ ", but Device instance doesn't exist in Cyberlink structs! It will be Ignored");            
+        }else if(devices.containsKey(udn) == false) {
+            Activator.logger.INFO("[Importer] registering UPnPDevice:"+dev.getFriendlyName()+"("+dev.getUDN()+")" );
+            registerUPnPDevice(dev, null, null);
+            searchForListener(dev);
+            /*
+             * now we can register all the device embedded device and service without
+             * recieving the NOTIFY 
+             */
+            //XXX Think about this choice
+            for (Iterator i = dev.getDeviceList().iterator(); i.hasNext();) {
+				Device d = (Device) i.next();
+				doDeviceRegistration(d.getUDN(),true);
+			}
+        }else if(devices.containsKey(udn) == true) {
+        	Activator.logger.INFO("[Importer] UPnPDevice UDN::"+dev.getFriendlyName()+"("+dev.getUDN()+") already registered Skipping");
+        }
+    }
+    
+	public void searchForListener(Device device) {
+        Activator.logger.DEBUG("[Importer] searching for UPnPEventListener");
+		ServiceReference[] listeners = null;
+		try {
+			listeners = context.getServiceReferences(UPnPEventListener.class.getName(), null);
+		} catch (InvalidSyntaxException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		if (listeners != null) {
+			String deviceID = device.getUDN();
+			String serviceID;
+			String deviceType = device.getDeviceType();
+			String serviceType;
+			Hashtable hash = new Hashtable();
+			hash.put(UPnPDevice.ID, deviceID);
+			hash.put(UPnPDevice.TYPE, deviceType);
+			ServiceList services = device.getServiceList();
+			Vector eventedSers = new Vector();
+
+			for (int i = 0; i < services.size(); i++) {
+				Service service = (Service) services.elementAt(i);
+				ServiceStateTable vars = service.getServiceStateTable();
+				for (int j = 0; j < vars.size(); j++) {
+					StateVariable var = (StateVariable) vars.elementAt(j);
+					if (var.isSendEvents()) {
+						eventedSers.add(service);
+						break;
+					}
+				}
+			}
+
+			for (int i = 0; i < listeners.length; i++) {
+				UPnPEventListener listener = (UPnPEventListener) context
+						.getService(listeners[i]);
+				Filter filter = (Filter) listeners[i]
+						.getProperty(UPnPEventListener.UPNP_FILTER);
+				if (filter == null) {
+					for (int j = 0; j < eventedSers.size(); j++) {
+						Service ser = (Service) eventedSers.elementAt(j);
+						subQueue.enqueue(new FirstMessage(ser, listener));
+					}
+				} else {
+					for (int j = 0; j < eventedSers.size(); j++) {
+						Service ser = (Service) eventedSers.elementAt(j);
+						serviceID = ser.getServiceID();
+						serviceType = ser.getServiceType();
+						hash.put(UPnPService.ID, serviceID);
+						hash.put(UPnPService.TYPE, serviceType);
+						boolean bool = filter.match(hash);
+						if (bool) {
+							subQueue.enqueue(new FirstMessage(ser, listener));
+						}
+
+					}
+				}
+
+			}
+
+		}
+	}
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/OSGiDeviceInfo.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/OSGiDeviceInfo.java
index 3003ea3..0bd8886 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/OSGiDeviceInfo.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/OSGiDeviceInfo.java
@@ -1,49 +1,49 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core;
-
-
-import org.osgi.framework.ServiceRegistration;
-
-import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPDeviceImpl;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class OSGiDeviceInfo {
-	private UPnPDeviceImpl osgidevice;
-	private ServiceRegistration registration;
-	
-	/**
-	 * @param osgidevice UPnPDeviceImpl a Service
-	 * @param registration Serviceregistration of the UPnPDevice service
-	 */
-	public OSGiDeviceInfo(UPnPDeviceImpl osgidevice,
-			ServiceRegistration registration) {
-		this.osgidevice = osgidevice;
-		this.registration = registration;
-	}
-	public UPnPDeviceImpl getOSGiDevice(){
-		return osgidevice;
-	}
-	public ServiceRegistration getRegistration(){
-		return registration;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core;
+
+
+import org.osgi.framework.ServiceRegistration;
+
+import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPDeviceImpl;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class OSGiDeviceInfo {
+	private UPnPDeviceImpl osgidevice;
+	private ServiceRegistration registration;
+	
+	/**
+	 * @param osgidevice UPnPDeviceImpl a Service
+	 * @param registration Serviceregistration of the UPnPDevice service
+	 */
+	public OSGiDeviceInfo(UPnPDeviceImpl osgidevice,
+			ServiceRegistration registration) {
+		this.osgidevice = osgidevice;
+		this.registration = registration;
+	}
+	public UPnPDeviceImpl getOSGiDevice(){
+		return osgidevice;
+	}
+	public ServiceRegistration getRegistration(){
+		return registration;
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/FirstMessage.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/FirstMessage.java
index 140b15e..5f679c4 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/FirstMessage.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/FirstMessage.java
@@ -1,69 +1,69 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.message;
-
-import org.cybergarage.upnp.Device;
-import org.cybergarage.upnp.Service;
-
-import org.osgi.service.upnp.UPnPEventListener;
-
-/**
- * This class rappresent a message that is equeued for the Suscriber.<br>
- * This is message is related to a registration of listener for a 
- * CyberLink Service during the registering of the UPnP Event Listener
- * 
- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
- 
-
-public class FirstMessage {
-	private Service service;
-	private UPnPEventListener listener;
-	private String sid;
-	private Device device;
-
-	public FirstMessage(Service service, UPnPEventListener listener) {
-		this.service = service;
-		this.listener = listener;
-		this.sid = "";
-		this.device = service.getDevice();
-	}
-	public Service getService() {
-		return service;
-	}
-	public UPnPEventListener getListener() {
-		return listener;
-	}
-	public void setSid(String sid) {
-		this.sid = sid;
-	}
-	public String getSid() {
-		return sid;
-	}
-	public Device getDevice() {
-		return device;
-	}
-	public String getDeviceID(){
-		return device.getUDN();
-	}
-	public String getServiceID(){
-		return service.getServiceID();	
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.message;
+
+import org.cybergarage.upnp.Device;
+import org.cybergarage.upnp.Service;
+
+import org.osgi.service.upnp.UPnPEventListener;
+
+/**
+ * This class rappresent a message that is equeued for the Suscriber.<br>
+ * This is message is related to a registration of listener for a 
+ * CyberLink Service during the registering of the UPnP Event Listener
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+ 
+
+public class FirstMessage {
+	private Service service;
+	private UPnPEventListener listener;
+	private String sid;
+	private Device device;
+
+	public FirstMessage(Service service, UPnPEventListener listener) {
+		this.service = service;
+		this.listener = listener;
+		this.sid = "";
+		this.device = service.getDevice();
+	}
+	public Service getService() {
+		return service;
+	}
+	public UPnPEventListener getListener() {
+		return listener;
+	}
+	public void setSid(String sid) {
+		this.sid = sid;
+	}
+	public String getSid() {
+		return sid;
+	}
+	public Device getDevice() {
+		return device;
+	}
+	public String getDeviceID(){
+		return device.getUDN();
+	}
+	public String getServiceID(){
+		return service.getServiceID();	
+	}
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerModified.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerModified.java
index cf197bb..be5a1ff 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerModified.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerModified.java
@@ -1,45 +1,45 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.message;
-
-import java.util.Vector;
-
-import org.osgi.service.upnp.UPnPEventListener;
-
-/**
- * Message that is euqueued for Suscriber, only when a UPnPEventListener changes 
- * his properties
- *  
- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class ListenerModified {
-	private Vector newServices;
-	private UPnPEventListener listener;
-	public ListenerModified(Vector newServices,UPnPEventListener listener){
-		this.newServices=newServices;
-		this.listener=listener;
-	}
-	public UPnPEventListener getListener(){
-		return listener;
-	}
-	public Vector getNewServices(){
-		return newServices;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.message;
+
+import java.util.Vector;
+
+import org.osgi.service.upnp.UPnPEventListener;
+
+/**
+ * Message that is euqueued for Suscriber, only when a UPnPEventListener changes 
+ * his properties
+ *  
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class ListenerModified {
+	private Vector newServices;
+	private UPnPEventListener listener;
+	public ListenerModified(Vector newServices,UPnPEventListener listener){
+		this.newServices=newServices;
+		this.listener=listener;
+	}
+	public UPnPEventListener getListener(){
+		return listener;
+	}
+	public Vector getNewServices(){
+		return newServices;
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerUnRegistration.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerUnRegistration.java
index ad34f69..ea36439 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerUnRegistration.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/ListenerUnRegistration.java
@@ -1,39 +1,39 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.message;
-
-import org.osgi.service.upnp.UPnPEventListener;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class ListenerUnRegistration {
-	private UPnPEventListener listener;
-	/**
-	 * @param listener
-	 */
-	public ListenerUnRegistration(UPnPEventListener listener) {
-		super();
-		this.listener = listener;
-	}
-	public UPnPEventListener getListener() {
-		return listener;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.message;
+
+import org.osgi.service.upnp.UPnPEventListener;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class ListenerUnRegistration {
+	private UPnPEventListener listener;
+	/**
+	 * @param listener
+	 */
+	public ListenerUnRegistration(UPnPEventListener listener) {
+		super();
+		this.listener = listener;
+	}
+	public UPnPEventListener getListener() {
+		return listener;
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/SidExipired.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/SidExipired.java
index a8b5ff7..ab0cfa5 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/SidExipired.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/SidExipired.java
@@ -1,44 +1,44 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.message;
-
-import org.cybergarage.upnp.Service;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class SidExipired {
-private String sid;
-private Service service;
-/**
-	 * @param sid
-	 */
-	public SidExipired(String sid,Service service) {
-		super();
-		this.sid = sid;
-		this.service=service;
-	}
-	public String getSid(){
-		return sid;
-	}
-	public Service getService(){
-		return service;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.message;
+
+import org.cybergarage.upnp.Service;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class SidExipired {
+private String sid;
+private Service service;
+/**
+	 * @param sid
+	 */
+	public SidExipired(String sid,Service service) {
+		super();
+		this.sid = sid;
+		this.service=service;
+	}
+	public String getSid(){
+		return sid;
+	}
+	public Service getService(){
+		return service;
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/StateChanged.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/StateChanged.java
index 9e0bfff..e29a76c 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/StateChanged.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/message/StateChanged.java
@@ -1,80 +1,80 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.message;
-
-import java.util.Dictionary;
-
-import org.cybergarage.upnp.Device;
-import org.cybergarage.upnp.Service;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class StateChanged {
-	private String sid;
-	private Dictionary dic;
-	private long seq;
-	private Service service;
-	private Device device;
-	/**
-	 * @param sid
-	 * @param dic
-	 * @param varName
-	 * @param varValue
-	 */
-	public StateChanged(String sid, long seq, Dictionary dic, Device device,
-			Service service) {
-		super();
-		this.sid = sid;
-		/*
-		 * this.varName = varName; this.varValue = varValue;
-		 */
-		this.dic = dic;
-		/* dic.put(this.varName, this.varValue); */
-		//this.service=service;
-		this.seq = seq;
-		this.device = device;
-		this.service = service;
-	}
-
-	public Dictionary getDictionary() {
-		return dic;
-	}
-	public String getSid() {
-		return sid;
-	}
-	/*
-	 * public String getVarName() { return varName; } public String
-	 * getVarValue() { return varValue; }
-	 */
-	public long getSeq() {
-		return seq;
-	}
-	/*
-	 * public Service getService(){ return service; }
-	 *  
-	 */
-	public String getDeviceID() {
-		return device.getUDN();
-	}
-	public String getServiceID() {
-		return service.getServiceID();
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.message;
+
+import java.util.Dictionary;
+
+import org.cybergarage.upnp.Device;
+import org.cybergarage.upnp.Service;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class StateChanged {
+	private String sid;
+	private Dictionary dic;
+	private long seq;
+	private Service service;
+	private Device device;
+	/**
+	 * @param sid
+	 * @param dic
+	 * @param varName
+	 * @param varValue
+	 */
+	public StateChanged(String sid, long seq, Dictionary dic, Device device,
+			Service service) {
+		super();
+		this.sid = sid;
+		/*
+		 * this.varName = varName; this.varValue = varValue;
+		 */
+		this.dic = dic;
+		/* dic.put(this.varName, this.varValue); */
+		//this.service=service;
+		this.seq = seq;
+		this.device = device;
+		this.service = service;
+	}
+
+	public Dictionary getDictionary() {
+		return dic;
+	}
+	public String getSid() {
+		return sid;
+	}
+	/*
+	 * public String getVarName() { return varName; } public String
+	 * getVarValue() { return varValue; }
+	 */
+	public long getSeq() {
+		return seq;
+	}
+	/*
+	 * public Service getService(){ return service; }
+	 *  
+	 */
+	public String getDeviceID() {
+		return device.getUDN();
+	}
+	public String getServiceID() {
+		return service.getServiceID();
+	}
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Listener2Sids.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Listener2Sids.java
index f721797..f5cddfa 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Listener2Sids.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Listener2Sids.java
@@ -1,58 +1,58 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.osgi.service.upnp.UPnPEventListener;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class Listener2Sids {
-	private Hashtable listenerSid;
-    
-	public Listener2Sids() {
-		this.listenerSid = new Hashtable();
-	}
-    
-	public void put(UPnPEventListener listener, String sid) {
-		if (!listenerSid.containsKey(listener)) {
-			Vector vec = new Vector();
-			vec.add(sid);
-			listenerSid.put(listener, vec);
-		} else {
-			Vector vec = (Vector) listenerSid.get(listener);
-			if (!vec.contains(sid)) {
-				vec.add(sid);
-			}
-		}
-	}
-    
-	public final void remove(UPnPEventListener listener) {
-		listenerSid.remove(listener);
-	}
-
-	public final Vector get(UPnPEventListener listener) {
-		return ((Vector) listenerSid.get(listener));
-	}
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.osgi.service.upnp.UPnPEventListener;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class Listener2Sids {
+	private Hashtable listenerSid;
+    
+	public Listener2Sids() {
+		this.listenerSid = new Hashtable();
+	}
+    
+	public void put(UPnPEventListener listener, String sid) {
+		if (!listenerSid.containsKey(listener)) {
+			Vector vec = new Vector();
+			vec.add(sid);
+			listenerSid.put(listener, vec);
+		} else {
+			Vector vec = (Vector) listenerSid.get(listener);
+			if (!vec.contains(sid)) {
+				vec.add(sid);
+			}
+		}
+	}
+    
+	public final void remove(UPnPEventListener listener) {
+		listenerSid.remove(listener);
+	}
+
+	public final Vector get(UPnPEventListener listener) {
+		return ((Vector) listenerSid.get(listener));
+	}
+}
+
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Monitor.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Monitor.java
index ae08a49..095a473 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Monitor.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Monitor.java
@@ -1,234 +1,234 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.cybergarage.upnp.Service;
-
-import org.osgi.service.upnp.UPnPEventListener;
-
-import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerModified;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class Monitor {
-	private Hashtable sidStateVars;
-	private SidsListenersMaps sidListSid;
-
-	public Monitor() {
-		this.sidListSid = new SidsListenersMaps();
-		this.sidStateVars = new Hashtable();
-	}
-
-	public synchronized void putStateVars(String sid, StateVarsToNotify vars) {
-		sidStateVars.put(sid, vars);
-		Vector listeners = (Vector) sidListSid.getListenersFromSid(sid);
-		if (listeners != null) {
-			sidListSid.updateListeners(sid, vars.getDeviceID(), vars.getServiceID(), vars.getDictionary());
-			sidListSid.setAlreadyFirst(sid,true);
-		} else {
-			sidListSid.setAlreadyFirst(sid, false);
-		}
-	}
-	public synchronized void updateStateVars(String sid, Dictionary dic) {
-		StateVarsToNotify vars = (StateVarsToNotify) sidStateVars.get(sid);
-		if (vars != null) {
-			vars.updateDic(dic);
-			if (sidListSid.getAlreadyFirst(sid)) {
-			    /*
-			     * Sends only the changed StateVariable
-			     */
-				sidListSid.updateListeners(sid, 
-				        vars.getDeviceID(), vars.getServiceID(), 
-				        dic);
-			} else {
-			    /*
-			     * Sends the sholw StateVariable for the service 
-			     */
-				boolean bool = sidListSid.updateListeners(sid, 
-				        vars.getDeviceID(), vars.getServiceID(), 
-				        vars.getDictionary());
-				if (bool) {
-					sidListSid.setAlreadyFirst(sid,true);
-				}
-			}
-		}
-	}
-    
-/*    
-    public synchronized StateVarsToNotify getStateVars(String sid) {
-        return (StateVarsToNotify) sidStateVars.get(sid);
-    }
-    public synchronized void removeStateVars(String sid) {
-        sidStateVars.remove(sid);
-    }
-*/
-	public synchronized void addListener(String sid, UPnPEventListener listener) {
-		StateVarsToNotify vars = (StateVarsToNotify) sidStateVars.get(sid);
-		if (vars != null) {
-		    /*
-		     * Notify the listener whit the whole StateVariables and then
-		     * the next time you send only the changed StateVariables
-		     */
-            listener.notifyUPnPEvent(vars.getDeviceID(), 
-                    vars.getServiceID(),vars.getDictionary());
-        }
-		sidListSid.putSid2Listeners(sid, listener);
-		sidListSid.putListener2Sids(listener, sid);
-	}
-
-	/**
-	 * Delete the reference to the listener from the stuctures sid2Listeners and listener2Sids.
-	 * Also if no more listner are listening for a UPnP Service that UPnP Service is unscribed.
-	 * 
-	 * @param listener The listener to delete
-	 * @param ctrl Needed for reference
-	 */
-	public synchronized void delListener(UPnPEventListener listener,
-			MyCtrlPoint ctrl/*##renew, SidRenewer sidRenewer*/) {
-        
-        //francesco-renew
-        // State variable clean up -- todo?
-        
-		Vector sids = sidListSid.getSidsFromListener(listener);
-		if (sids != null) {
-		    Iterator i = sids.iterator();
-			while(i.hasNext()){
-			    String sid = (String) i.next();
-				Vector listeners = 
-                    sidListSid.getListenersFromSid(sid);
-				listeners.remove(listener);
-				if (listeners.size() == 0) {
-					Service service = 
-                        ctrl.serviceFromSid(sid);
-					//##renew  Renewer renewer = sidRenewer.get((String) sids.elementAt(i));
-					//##renew  renewer.stop();
-					if (service != null) {
-						boolean ok = ctrl.unsubscribe(service);
-						if (!ok) {
-						    //TODO Log?s
-							service.clearSID();
-						}
-					}
-					sidListSid.setAlreadyFirst(sid,false);
-					sidStateVars.remove(sid);
-					i.remove();
-				}
-			}
-			sidListSid.removeListenerKey(listener);			
-		}
-	}
-
-	public synchronized void updateListener(ListenerModified msg,
-			SubscriptionQueue subqueue, MyCtrlPoint ctrl/*##renew, SidRenewer sidRenewer*/) {
-		UPnPEventListener listener = msg.getListener();
-		Vector newServices = msg.getNewServices();
-		Vector subscribed = new Vector();
-		Vector notSubscribed = new Vector();
-		
-		for (int i = 0; i < newServices.size(); i++) {
-			Service ser = (Service) newServices.elementAt(i);
-			if (ser.isSubscribed()) {
-				subscribed.add(ser);
-			} else {
-				notSubscribed.add(ser);
-			}
-		}
-		
-
-		Vector oldSids = sidListSid.getSidsFromListener(listener);
-        // francesco-renew
-        // check subscribed services
-		if(oldSids==null) return;
-		
-		for (int i = 0; i < notSubscribed.size(); i++) {
-			Service ser = (Service) notSubscribed.elementAt(i);
-			subqueue.enqueue(new FirstMessage(ser, listener));
-		}
-		
-		for (int i = 0; i < oldSids.size(); i++) {
-			String oldSid = (String) oldSids.elementAt(i);
-			if (!subscribed.contains(oldSid)) {
-                // francesco-renew
-                // to check -- Listner removal from sid2Listener
-                				
-				unsubscribeListenerForSid(oldSid,listener,ctrl);
-			}
-		}
-
-	}
-    
-	/**
-	 * Unregister the listener as UPnPListener for the UPnPService with
-	 * the spicfied SID
-	 * 
-     * @param sid
-     * @param listener
-     * @param ctrl
-     */
-    private void unsubscribeListenerForSid(String sid, UPnPEventListener listener, MyCtrlPoint ctrl) {
-        Vector listeners = sidListSid.getListenersFromSid(sid);
-        listeners.remove(listener);
-        if(listeners.size()==0){
-			Service service = ctrl.serviceFromSid(sid);
-			if (service != null) {
-				boolean ok = ctrl.unsubscribe(service);
-				if (!ok) {
-				    //TODO Log?
-					service.clearSID();
-				}
-			}
-			sidListSid.setAlreadyFirst(sid,false);
-			sidStateVars.remove(sid);
-		}
-        Vector sids = sidListSid.getSidsFromListener(listener);
-        sids.remove(sid);
-        if(sids.size()==0){
-            sidListSid.removeListenerKey(listener);
-        }
-    }
-
-    public synchronized void delSid(String sid) {
-		Vector listeners = sidListSid.getListenersFromSid(sid);
-		if(listeners==null)return;
-		for (int i = 0; i < listeners.size(); i++) {
-			Vector sids = sidListSid.getSidsFromListener((UPnPEventListener) listeners
-					.elementAt(i));
-			sids.remove(sid);
-		}
-		sidListSid.removeSidKey(sid);
-	}
-
-	public synchronized void clearAll(String sid, Service service) {
-		service.clearSID();
-		delSid(sid);
-		sidStateVars.remove(sid);
-	}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.cybergarage.upnp.Service;
+
+import org.osgi.service.upnp.UPnPEventListener;
+
+import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerModified;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class Monitor {
+	private Hashtable sidStateVars;
+	private SidsListenersMaps sidListSid;
+
+	public Monitor() {
+		this.sidListSid = new SidsListenersMaps();
+		this.sidStateVars = new Hashtable();
+	}
+
+	public synchronized void putStateVars(String sid, StateVarsToNotify vars) {
+		sidStateVars.put(sid, vars);
+		Vector listeners = (Vector) sidListSid.getListenersFromSid(sid);
+		if (listeners != null) {
+			sidListSid.updateListeners(sid, vars.getDeviceID(), vars.getServiceID(), vars.getDictionary());
+			sidListSid.setAlreadyFirst(sid,true);
+		} else {
+			sidListSid.setAlreadyFirst(sid, false);
+		}
+	}
+	public synchronized void updateStateVars(String sid, Dictionary dic) {
+		StateVarsToNotify vars = (StateVarsToNotify) sidStateVars.get(sid);
+		if (vars != null) {
+			vars.updateDic(dic);
+			if (sidListSid.getAlreadyFirst(sid)) {
+			    /*
+			     * Sends only the changed StateVariable
+			     */
+				sidListSid.updateListeners(sid, 
+				        vars.getDeviceID(), vars.getServiceID(), 
+				        dic);
+			} else {
+			    /*
+			     * Sends the sholw StateVariable for the service 
+			     */
+				boolean bool = sidListSid.updateListeners(sid, 
+				        vars.getDeviceID(), vars.getServiceID(), 
+				        vars.getDictionary());
+				if (bool) {
+					sidListSid.setAlreadyFirst(sid,true);
+				}
+			}
+		}
+	}
+    
+/*    
+    public synchronized StateVarsToNotify getStateVars(String sid) {
+        return (StateVarsToNotify) sidStateVars.get(sid);
+    }
+    public synchronized void removeStateVars(String sid) {
+        sidStateVars.remove(sid);
+    }
+*/
+	public synchronized void addListener(String sid, UPnPEventListener listener) {
+		StateVarsToNotify vars = (StateVarsToNotify) sidStateVars.get(sid);
+		if (vars != null) {
+		    /*
+		     * Notify the listener whit the whole StateVariables and then
+		     * the next time you send only the changed StateVariables
+		     */
+            listener.notifyUPnPEvent(vars.getDeviceID(), 
+                    vars.getServiceID(),vars.getDictionary());
+        }
+		sidListSid.putSid2Listeners(sid, listener);
+		sidListSid.putListener2Sids(listener, sid);
+	}
+
+	/**
+	 * Delete the reference to the listener from the stuctures sid2Listeners and listener2Sids.
+	 * Also if no more listner are listening for a UPnP Service that UPnP Service is unscribed.
+	 * 
+	 * @param listener The listener to delete
+	 * @param ctrl Needed for reference
+	 */
+	public synchronized void delListener(UPnPEventListener listener,
+			MyCtrlPoint ctrl/*##renew, SidRenewer sidRenewer*/) {
+        
+        //francesco-renew
+        // State variable clean up -- todo?
+        
+		Vector sids = sidListSid.getSidsFromListener(listener);
+		if (sids != null) {
+		    Iterator i = sids.iterator();
+			while(i.hasNext()){
+			    String sid = (String) i.next();
+				Vector listeners = 
+                    sidListSid.getListenersFromSid(sid);
+				listeners.remove(listener);
+				if (listeners.size() == 0) {
+					Service service = 
+                        ctrl.serviceFromSid(sid);
+					//##renew  Renewer renewer = sidRenewer.get((String) sids.elementAt(i));
+					//##renew  renewer.stop();
+					if (service != null) {
+						boolean ok = ctrl.unsubscribe(service);
+						if (!ok) {
+						    //TODO Log?s
+							service.clearSID();
+						}
+					}
+					sidListSid.setAlreadyFirst(sid,false);
+					sidStateVars.remove(sid);
+					i.remove();
+				}
+			}
+			sidListSid.removeListenerKey(listener);			
+		}
+	}
+
+	public synchronized void updateListener(ListenerModified msg,
+			SubscriptionQueue subqueue, MyCtrlPoint ctrl/*##renew, SidRenewer sidRenewer*/) {
+		UPnPEventListener listener = msg.getListener();
+		Vector newServices = msg.getNewServices();
+		Vector subscribed = new Vector();
+		Vector notSubscribed = new Vector();
+		
+		for (int i = 0; i < newServices.size(); i++) {
+			Service ser = (Service) newServices.elementAt(i);
+			if (ser.isSubscribed()) {
+				subscribed.add(ser);
+			} else {
+				notSubscribed.add(ser);
+			}
+		}
+		
+
+		Vector oldSids = sidListSid.getSidsFromListener(listener);
+        // francesco-renew
+        // check subscribed services
+		if(oldSids==null) return;
+		
+		for (int i = 0; i < notSubscribed.size(); i++) {
+			Service ser = (Service) notSubscribed.elementAt(i);
+			subqueue.enqueue(new FirstMessage(ser, listener));
+		}
+		
+		for (int i = 0; i < oldSids.size(); i++) {
+			String oldSid = (String) oldSids.elementAt(i);
+			if (!subscribed.contains(oldSid)) {
+                // francesco-renew
+                // to check -- Listner removal from sid2Listener
+                				
+				unsubscribeListenerForSid(oldSid,listener,ctrl);
+			}
+		}
+
+	}
+    
+	/**
+	 * Unregister the listener as UPnPListener for the UPnPService with
+	 * the spicfied SID
+	 * 
+     * @param sid
+     * @param listener
+     * @param ctrl
+     */
+    private void unsubscribeListenerForSid(String sid, UPnPEventListener listener, MyCtrlPoint ctrl) {
+        Vector listeners = sidListSid.getListenersFromSid(sid);
+        listeners.remove(listener);
+        if(listeners.size()==0){
+			Service service = ctrl.serviceFromSid(sid);
+			if (service != null) {
+				boolean ok = ctrl.unsubscribe(service);
+				if (!ok) {
+				    //TODO Log?
+					service.clearSID();
+				}
+			}
+			sidListSid.setAlreadyFirst(sid,false);
+			sidStateVars.remove(sid);
+		}
+        Vector sids = sidListSid.getSidsFromListener(listener);
+        sids.remove(sid);
+        if(sids.size()==0){
+            sidListSid.removeListenerKey(listener);
+        }
+    }
+
+    public synchronized void delSid(String sid) {
+		Vector listeners = sidListSid.getListenersFromSid(sid);
+		if(listeners==null)return;
+		for (int i = 0; i < listeners.size(); i++) {
+			Vector sids = sidListSid.getSidsFromListener((UPnPEventListener) listeners
+					.elementAt(i));
+			sids.remove(sid);
+		}
+		sidListSid.removeSidKey(sid);
+	}
+
+	public synchronized void clearAll(String sid, Service service) {
+		service.clearSID();
+		delSid(sid);
+		sidStateVars.remove(sid);
+	}
+
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/NotifierQueue.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/NotifierQueue.java
index c881509..dcf17cd 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/NotifierQueue.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/NotifierQueue.java
@@ -1,62 +1,62 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-import java.util.Vector;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class NotifierQueue {
-	private Vector queue;
-	private boolean running = true;
-	
-	public NotifierQueue(){
-		queue=new Vector();
-	}
-	
-	public synchronized void enqueue(Object obj){
-		queue.add(obj);
-		if(queue.size() == 1){
-			notify();
-		}
-		
-	}
-	
-	public synchronized Object dequeue(){
-		while(queue.size()==0 && running){
-			try {
-				wait();
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-		}
-		if (running)
-			return queue.remove(0);
-		else
-			return null;
-	}
-
-	public synchronized void close() {
-		running  = false;
-		notify();		
-	}
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+import java.util.Vector;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class NotifierQueue {
+	private Vector queue;
+	private boolean running = true;
+	
+	public NotifierQueue(){
+		queue=new Vector();
+	}
+	
+	public synchronized void enqueue(Object obj){
+		queue.add(obj);
+		if(queue.size() == 1){
+			notify();
+		}
+		
+	}
+	
+	public synchronized Object dequeue(){
+		while(queue.size()==0 && running){
+			try {
+				wait();
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+		}
+		if (running)
+			return queue.remove(0);
+		else
+			return null;
+	}
+
+	public synchronized void close() {
+		running  = false;
+		notify();		
+	}
+
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Sid2Listeners.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Sid2Listeners.java
index f6dfd85..5badc82 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Sid2Listeners.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/Sid2Listeners.java
@@ -1,85 +1,85 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.osgi.service.upnp.UPnPEventListener;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class Sid2Listeners {
-	private Hashtable sidListener;
-	private Hashtable alreadyfirst;
-    
-	public Sid2Listeners() {
-		this.sidListener = new Hashtable();
-		this.alreadyfirst = new Hashtable();
-	}
-    
-	public void put(String sid, UPnPEventListener listener) {
-		if (!sidListener.containsKey(sid)) {
-			Vector vec = new Vector();
-			vec.add(listener);
-			sidListener.put(sid, vec);
-		} else {
-			Vector vec = (Vector) sidListener.get(sid);
-			if (!vec.contains(listener)) {
-				vec.add(listener);
-			}
-		}
-	}
-
-	public final void remove(String sid) {
-		sidListener.remove(sid);
-	}
-
-	public final Vector get(String sid) {
-		return ((Vector) sidListener.get(sid));
-	}
-
-    /**
-	 * @param sid
-	 * @param dictionary
-	 */
-	public boolean updateListeners(String sid, String deviceID,String serviceID, Dictionary dictionary) {
-        
-		Vector listeners = (Vector) sidListener.get(sid);
-		if (listeners != null) {
-			for (int i = 0; i < listeners.size(); i++) {
-				UPnPEventListener listener = (UPnPEventListener) listeners.elementAt(i);
-				listener.notifyUPnPEvent(deviceID, serviceID, dictionary);
-			}
-			return true;
-		}
-		return false;
-	}
-    
-	public boolean getAlreadyFirst(String sid) {
-		return ((Boolean) alreadyfirst.get(sid)).booleanValue();
-	}
-
-    public void setAlreadyFirst(String sid, boolean bool) {
-		alreadyfirst.put(sid, new Boolean(bool));
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.osgi.service.upnp.UPnPEventListener;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class Sid2Listeners {
+	private Hashtable sidListener;
+	private Hashtable alreadyfirst;
+    
+	public Sid2Listeners() {
+		this.sidListener = new Hashtable();
+		this.alreadyfirst = new Hashtable();
+	}
+    
+	public void put(String sid, UPnPEventListener listener) {
+		if (!sidListener.containsKey(sid)) {
+			Vector vec = new Vector();
+			vec.add(listener);
+			sidListener.put(sid, vec);
+		} else {
+			Vector vec = (Vector) sidListener.get(sid);
+			if (!vec.contains(listener)) {
+				vec.add(listener);
+			}
+		}
+	}
+
+	public final void remove(String sid) {
+		sidListener.remove(sid);
+	}
+
+	public final Vector get(String sid) {
+		return ((Vector) sidListener.get(sid));
+	}
+
+    /**
+	 * @param sid
+	 * @param dictionary
+	 */
+	public boolean updateListeners(String sid, String deviceID,String serviceID, Dictionary dictionary) {
+        
+		Vector listeners = (Vector) sidListener.get(sid);
+		if (listeners != null) {
+			for (int i = 0; i < listeners.size(); i++) {
+				UPnPEventListener listener = (UPnPEventListener) listeners.elementAt(i);
+				listener.notifyUPnPEvent(deviceID, serviceID, dictionary);
+			}
+			return true;
+		}
+		return false;
+	}
+    
+	public boolean getAlreadyFirst(String sid) {
+		return ((Boolean) alreadyfirst.get(sid)).booleanValue();
+	}
+
+    public void setAlreadyFirst(String sid, boolean bool) {
+		alreadyfirst.put(sid, new Boolean(bool));
+	}
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidRenewer.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidRenewer.java
index 7644656..afcc0c9 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidRenewer.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidRenewer.java
@@ -1,50 +1,50 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-
-import java.util.Hashtable;
-
-import org.apache.felix.upnp.basedriver.importer.core.event.thread.Renewer;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class SidRenewer {
-private Hashtable hash;
-
-	/**
-	 * @param hash
-	 */
-	public SidRenewer() {
-		super();
-		this.hash = new Hashtable();
-	}
-
-	public synchronized void put(String sid, Renewer renewer){
-		hash.put(sid,renewer);
-	}
-	public synchronized Renewer get(String sid){
-		return (Renewer)hash.get(sid);
-	}
-	public synchronized void remove(String sid){
-		hash.remove(sid);
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+
+import java.util.Hashtable;
+
+import org.apache.felix.upnp.basedriver.importer.core.event.thread.Renewer;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class SidRenewer {
+private Hashtable hash;
+
+	/**
+	 * @param hash
+	 */
+	public SidRenewer() {
+		super();
+		this.hash = new Hashtable();
+	}
+
+	public synchronized void put(String sid, Renewer renewer){
+		hash.put(sid,renewer);
+	}
+	public synchronized Renewer get(String sid){
+		return (Renewer)hash.get(sid);
+	}
+	public synchronized void remove(String sid){
+		hash.remove(sid);
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidsListenersMaps.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidsListenersMaps.java
index fb81d1f..1320287 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidsListenersMaps.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SidsListenersMaps.java
@@ -1,76 +1,76 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-import java.util.Dictionary;
-import java.util.Vector;
-
-import org.osgi.service.upnp.UPnPEventListener;
-
-/**
- * This class contain two table:
- *  - sid2listener: have SID of Suscribed Service as key and a Vector of UPnPEventListener as value
- *  - listener2sids: have an UPnPEventListener as kay and a Vector of SID of Scriscrobed Service 
- * 
- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class SidsListenersMaps {
-	private Sid2Listeners sid2Listeners;
-	private Listener2Sids listeners2Sids;
-	
-	public SidsListenersMaps(){
-		sid2Listeners=new Sid2Listeners();
-		listeners2Sids=new Listener2Sids();
-	}
-    
-    
-	/////////////////// Sid to Listeners //////////////////////////////////
-	public final void putSid2Listeners(String sid, UPnPEventListener listener) {
-		sid2Listeners.put(sid,listener);
-	}
-    public final Vector getListenersFromSid(String sid) {
-        return sid2Listeners.get(sid);
-    }
-    public final void removeSidKey(String sid) {
-        sid2Listeners.remove(sid);
-    }
-	public final boolean updateListeners(String sid, String deviceID, String serviceID,Dictionary dictionary){
-		return sid2Listeners.updateListeners(sid,deviceID,serviceID,dictionary);
-	}
-	public final boolean getAlreadyFirst(String sid) {
-		return sid2Listeners.getAlreadyFirst(sid);
-	}
-	public final void setAlreadyFirst(String sid, boolean bool) {
-		sid2Listeners.setAlreadyFirst(sid,bool);
-	}
-    
-    
-    
-    /////////////////// Listener to Sids //////////////////////////////////
-	public final void putListener2Sids(UPnPEventListener listener,String sid) {
-		listeners2Sids.put(listener,sid);
-	}
-	public final Vector getSidsFromListener(UPnPEventListener listener){
-		return listeners2Sids.get(listener);
-	}
-	public final void removeListenerKey(UPnPEventListener listener){
-		listeners2Sids.remove(listener);
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+import java.util.Dictionary;
+import java.util.Vector;
+
+import org.osgi.service.upnp.UPnPEventListener;
+
+/**
+ * This class contain two table:
+ *  - sid2listener: have SID of Suscribed Service as key and a Vector of UPnPEventListener as value
+ *  - listener2sids: have an UPnPEventListener as kay and a Vector of SID of Scriscrobed Service 
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class SidsListenersMaps {
+	private Sid2Listeners sid2Listeners;
+	private Listener2Sids listeners2Sids;
+	
+	public SidsListenersMaps(){
+		sid2Listeners=new Sid2Listeners();
+		listeners2Sids=new Listener2Sids();
+	}
+    
+    
+	/////////////////// Sid to Listeners //////////////////////////////////
+	public final void putSid2Listeners(String sid, UPnPEventListener listener) {
+		sid2Listeners.put(sid,listener);
+	}
+    public final Vector getListenersFromSid(String sid) {
+        return sid2Listeners.get(sid);
+    }
+    public final void removeSidKey(String sid) {
+        sid2Listeners.remove(sid);
+    }
+	public final boolean updateListeners(String sid, String deviceID, String serviceID,Dictionary dictionary){
+		return sid2Listeners.updateListeners(sid,deviceID,serviceID,dictionary);
+	}
+	public final boolean getAlreadyFirst(String sid) {
+		return sid2Listeners.getAlreadyFirst(sid);
+	}
+	public final void setAlreadyFirst(String sid, boolean bool) {
+		sid2Listeners.setAlreadyFirst(sid,bool);
+	}
+    
+    
+    
+    /////////////////// Listener to Sids //////////////////////////////////
+	public final void putListener2Sids(UPnPEventListener listener,String sid) {
+		listeners2Sids.put(listener,sid);
+	}
+	public final Vector getSidsFromListener(UPnPEventListener listener){
+		return listeners2Sids.get(listener);
+	}
+	public final void removeListenerKey(UPnPEventListener listener){
+		listeners2Sids.remove(listener);
+	}
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/StateVarsToNotify.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/StateVarsToNotify.java
index 48af2f3..de40a2b 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/StateVarsToNotify.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/StateVarsToNotify.java
@@ -1,68 +1,68 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class StateVarsToNotify {
-	private Dictionary stateVars;
-	private String sid;
-	private String deviceID;
-	private String serviceID;
-    
-    //public StateVarsToNotify(String sid, String deviceID, String serviceID,Dictionary dic) {
-    public StateVarsToNotify(StateChanged msg) {
-		this.stateVars= msg.getDictionary();
-		this.sid = msg.getSid();
-		this.deviceID = msg.getDeviceID();
-		this.serviceID = msg.getServiceID();
-	}
-
-
-	public synchronized Dictionary getDictionary() {
-			return stateVars;
-	}
-    public synchronized String getSid() {
-		return sid;
-	}
-	public synchronized String getDeviceID() {
-		return deviceID;
-	}
-	public synchronized String getServiceID() {
-		return serviceID;
-	}
-    
-    
-	public void updateDic(Dictionary dic){
-		Enumeration e=dic.keys();
-		while(e.hasMoreElements()){
-			String varName=(String)e.nextElement();
-			Object varValue=dic.get(varName);
-			stateVars.put(varName,varValue);
-		}
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class StateVarsToNotify {
+	private Dictionary stateVars;
+	private String sid;
+	private String deviceID;
+	private String serviceID;
+    
+    //public StateVarsToNotify(String sid, String deviceID, String serviceID,Dictionary dic) {
+    public StateVarsToNotify(StateChanged msg) {
+		this.stateVars= msg.getDictionary();
+		this.sid = msg.getSid();
+		this.deviceID = msg.getDeviceID();
+		this.serviceID = msg.getServiceID();
+	}
+
+
+	public synchronized Dictionary getDictionary() {
+			return stateVars;
+	}
+    public synchronized String getSid() {
+		return sid;
+	}
+	public synchronized String getDeviceID() {
+		return deviceID;
+	}
+	public synchronized String getServiceID() {
+		return serviceID;
+	}
+    
+    
+	public void updateDic(Dictionary dic){
+		Enumeration e=dic.keys();
+		while(e.hasMoreElements()){
+			String varName=(String)e.nextElement();
+			Object varValue=dic.get(varName);
+			stateVars.put(varName,varValue);
+		}
+	}
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SubscriptionQueue.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SubscriptionQueue.java
index 6a043d0..49e272f 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SubscriptionQueue.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/structs/SubscriptionQueue.java
@@ -1,63 +1,63 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.structs;
-
-import java.util.Vector;
-
-
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class SubscriptionQueue {
-	private Vector queue;
-	private boolean running = true;
-	
-	public SubscriptionQueue(){
-		queue=new Vector();
-	}
-	public synchronized void enqueue(Object obj){
-		queue.add(obj);
-		if(queue.size()==1){
-			notify();
-		}
-	}
-	public synchronized Object dequeue(){
-		while(queue.size()==0 && running){
-			try {
-				wait();
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-		if (running)
-			return queue.remove(0); 
-		else		
-			return null;
-	}
-	
-	public synchronized void close() {
-		running  = false;
-		notify();		
-	}	
-	
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.structs;
+
+import java.util.Vector;
+
+
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class SubscriptionQueue {
+	private Vector queue;
+	private boolean running = true;
+	
+	public SubscriptionQueue(){
+		queue=new Vector();
+	}
+	public synchronized void enqueue(Object obj){
+		queue.add(obj);
+		if(queue.size()==1){
+			notify();
+		}
+	}
+	public synchronized Object dequeue(){
+		while(queue.size()==0 && running){
+			try {
+				wait();
+			} catch (InterruptedException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		if (running)
+			return queue.remove(0); 
+		else		
+			return null;
+	}
+	
+	public synchronized void close() {
+		running  = false;
+		notify();		
+	}	
+	
+
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Notifier.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Notifier.java
index f976d50..295f1d8 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Notifier.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Notifier.java
@@ -1,64 +1,64 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.thread;
-
-import org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.Monitor;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.NotifierQueue;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.StateVarsToNotify;
-
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class Notifier extends Thread {
-
-	private NotifierQueue notifierQueue;
-	private Monitor monitor;
-	private boolean running = true;
-
-    public Notifier(NotifierQueue notifierQueue,Monitor monitor) {
-		super("upnp.basedriver.Notifier");
-		this.notifierQueue = notifierQueue;
-		this.monitor = monitor;
-		
-	}
-
-	public void run() {
-		while (running) {
-            StateChanged msg = (StateChanged) notifierQueue.dequeue();
-            if (running) {
-				StateVarsToNotify vars = null;
-				if (msg.getSeq() == 0) {
-					vars = new StateVarsToNotify(msg);
-					monitor.putStateVars(msg.getSid(),vars);
-				} else {
-					monitor.updateStateVars(msg.getSid(),msg.getDictionary());
-				}
-            }
-		}
-	}
-
-	public void close() {
-		running  = false;
-		notifierQueue.close();
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.thread;
+
+import org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.Monitor;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.NotifierQueue;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.StateVarsToNotify;
+
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class Notifier extends Thread {
+
+	private NotifierQueue notifierQueue;
+	private Monitor monitor;
+	private boolean running = true;
+
+    public Notifier(NotifierQueue notifierQueue,Monitor monitor) {
+		super("upnp.basedriver.Notifier");
+		this.notifierQueue = notifierQueue;
+		this.monitor = monitor;
+		
+	}
+
+	public void run() {
+		while (running) {
+            StateChanged msg = (StateChanged) notifierQueue.dequeue();
+            if (running) {
+				StateVarsToNotify vars = null;
+				if (msg.getSeq() == 0) {
+					vars = new StateVarsToNotify(msg);
+					monitor.putStateVars(msg.getSid(),vars);
+				} else {
+					monitor.updateStateVars(msg.getSid(),msg.getDictionary());
+				}
+            }
+		}
+	}
+
+	public void close() {
+		running  = false;
+		notifierQueue.close();
+	}
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Renewer.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Renewer.java
index 563bb98..b605943 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Renewer.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/Renewer.java
@@ -1,83 +1,83 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.thread;
-
-
-import org.cybergarage.upnp.Service;
-
-import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.SidExipired;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class Renewer extends Thread {
-	private long timeout;
-	private String sid;
-	private Service service;
-	private MyCtrlPoint ctrl;
-	private boolean bool;
-	private SubscriptionQueue subqueue;
-	private final long time_before_renew=60000;
-	/**
-	 * *
-	 * 
-	 * @param timeout
-	 * @param sid
-	 * @param service
-	 */
-    public Renewer(long timeout, String sid, Service service,
-            MyCtrlPoint ctrl,SubscriptionQueue subqueue) {
-		super("ReNewal" + sid);
-		if (timeout - time_before_renew > 0) {
-			this.timeout = timeout - time_before_renew;
-		} else {
-			this.timeout = timeout;
-		}
-		this.sid = sid;
-		this.service = service;
-		this.ctrl = ctrl;
-		bool = true;
-		this.subqueue=subqueue;
-	}
-	public void run() {
-		while (bool) {
-			try {
-				sleep(timeout);
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			boolean ok = ctrl.subscribe(service, sid, 180000);
-			if (ok) {//renew ok
-				if (service.getTimeout() - time_before_renew > 0) {
-					timeout = service.getTimeout() - time_before_renew;
-				} else {
-					timeout = service.getTimeout();
-				}
-			} else {//renew not ok
-				bool=false;
-				subqueue.enqueue(new SidExipired(sid,service));
-			}
-		}
-	}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.thread;
+
+
+import org.cybergarage.upnp.Service;
+
+import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.SidExipired;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class Renewer extends Thread {
+	private long timeout;
+	private String sid;
+	private Service service;
+	private MyCtrlPoint ctrl;
+	private boolean bool;
+	private SubscriptionQueue subqueue;
+	private final long time_before_renew=60000;
+	/**
+	 * *
+	 * 
+	 * @param timeout
+	 * @param sid
+	 * @param service
+	 */
+    public Renewer(long timeout, String sid, Service service,
+            MyCtrlPoint ctrl,SubscriptionQueue subqueue) {
+		super("ReNewal" + sid);
+		if (timeout - time_before_renew > 0) {
+			this.timeout = timeout - time_before_renew;
+		} else {
+			this.timeout = timeout;
+		}
+		this.sid = sid;
+		this.service = service;
+		this.ctrl = ctrl;
+		bool = true;
+		this.subqueue=subqueue;
+	}
+	public void run() {
+		while (bool) {
+			try {
+				sleep(timeout);
+			} catch (InterruptedException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			boolean ok = ctrl.subscribe(service, sid, 180000);
+			if (ok) {//renew ok
+				if (service.getTimeout() - time_before_renew > 0) {
+					timeout = service.getTimeout() - time_before_renew;
+				} else {
+					timeout = service.getTimeout();
+				}
+			} else {//renew not ok
+				bool=false;
+				subqueue.enqueue(new SidExipired(sid,service));
+			}
+		}
+	}
+
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/SubScriber.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/SubScriber.java
index 82d0bff..0829867 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/SubScriber.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/event/thread/SubScriber.java
@@ -1,92 +1,92 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.event.thread;
-
-
-import org.cybergarage.upnp.Service;
-
-import org.osgi.service.log.LogService;
-
-import org.apache.felix.upnp.basedriver.Activator;
-import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerModified;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerUnRegistration;
-import org.apache.felix.upnp.basedriver.importer.core.event.message.SidExipired;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.Monitor;
-import org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class SubScriber extends Thread {
-
-	private MyCtrlPoint ctrl;
-	private SubscriptionQueue subQueue;
-    private boolean running = true;
-	private Monitor monitor;
-
-    
-    public SubScriber(MyCtrlPoint ctrl, SubscriptionQueue subQueue, Monitor monitor) {
-		super("upnp.basedriver.Subscriber");
-		this.ctrl = ctrl;
-		this.subQueue = subQueue;
-		this.monitor=monitor;
-		
-	}
-
-	public void run() {
-		while (running) {
-			Object msg = subQueue.dequeue();
-			if (running) {
-				if (msg instanceof FirstMessage) {
-					FirstMessage firstmsg = (FirstMessage) msg;
-					Service service = firstmsg.getService();
-					if (!service.isSubscribed()) {//is not subscribe
-						boolean ok = ctrl.subscribe(service,120000);
-						String sid = "";
-						if (ok) {//subcribe ok	                        
-							sid = service.getSID();
-							firstmsg.setSid(sid);                        
-							monitor.addListener(sid,firstmsg.getListener());						
-						} else {//subscribe not ok
-							Activator.logger.log(LogService.LOG_ERROR,"Sucribe failed");
-						}
-					} else {// already subscribe
-						monitor.addListener(service.getSID(),firstmsg.getListener());
-					}
-				} else if (msg instanceof ListenerModified) {
-					monitor.updateListener((ListenerModified)msg,subQueue,ctrl);
-				} else if (msg instanceof ListenerUnRegistration) {
-					ListenerUnRegistration unreg=(ListenerUnRegistration)msg;
-					monitor.delListener(unreg.getListener(),ctrl);
-				} else if(msg instanceof SidExipired){
-				    Activator.logger.WARNING("[Importer] Please report the bug. Used code - should be checked and removed");
-				}
-			}
-		}
-	}
-
-	public void close() {
-		running  = false;	
-		subQueue.close();
-	}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.event.thread;
+
+
+import org.cybergarage.upnp.Service;
+
+import org.osgi.service.log.LogService;
+
+import org.apache.felix.upnp.basedriver.Activator;
+import org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerModified;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.ListenerUnRegistration;
+import org.apache.felix.upnp.basedriver.importer.core.event.message.SidExipired;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.Monitor;
+import org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class SubScriber extends Thread {
+
+	private MyCtrlPoint ctrl;
+	private SubscriptionQueue subQueue;
+    private boolean running = true;
+	private Monitor monitor;
+
+    
+    public SubScriber(MyCtrlPoint ctrl, SubscriptionQueue subQueue, Monitor monitor) {
+		super("upnp.basedriver.Subscriber");
+		this.ctrl = ctrl;
+		this.subQueue = subQueue;
+		this.monitor=monitor;
+		
+	}
+
+	public void run() {
+		while (running) {
+			Object msg = subQueue.dequeue();
+			if (running) {
+				if (msg instanceof FirstMessage) {
+					FirstMessage firstmsg = (FirstMessage) msg;
+					Service service = firstmsg.getService();
+					if (!service.isSubscribed()) {//is not subscribe
+						boolean ok = ctrl.subscribe(service,120000);
+						String sid = "";
+						if (ok) {//subcribe ok	                        
+							sid = service.getSID();
+							firstmsg.setSid(sid);                        
+							monitor.addListener(sid,firstmsg.getListener());						
+						} else {//subscribe not ok
+							Activator.logger.log(LogService.LOG_ERROR,"Sucribe failed");
+						}
+					} else {// already subscribe
+						monitor.addListener(service.getSID(),firstmsg.getListener());
+					}
+				} else if (msg instanceof ListenerModified) {
+					monitor.updateListener((ListenerModified)msg,subQueue,ctrl);
+				} else if (msg instanceof ListenerUnRegistration) {
+					ListenerUnRegistration unreg=(ListenerUnRegistration)msg;
+					monitor.delListener(unreg.getListener(),ctrl);
+				} else if(msg instanceof SidExipired){
+				    Activator.logger.WARNING("[Importer] Please report the bug. Used code - should be checked and removed");
+				}
+			}
+		}
+	}
+
+	public void close() {
+		running  = false;	
+		subQueue.close();
+	}
+
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java
index 33b2837..4d63eb6 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java
@@ -1,174 +1,174 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.upnp;
-
-
-import java.util.Dictionary;
-import java.util.Properties;
-
-import org.cybergarage.upnp.Action;
-import org.cybergarage.upnp.Argument;
-import org.cybergarage.upnp.ArgumentList;
-import org.cybergarage.upnp.UPnPStatus;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPException;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.basedriver.util.Converter;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPActionImpl implements UPnPAction {
-
-	private Action act;	
-	private UPnPServiceImpl actsFather;
-	/**
-	 * @param act
-	 */
-	public UPnPActionImpl(Action act,UPnPServiceImpl ser) {
-		// TODO to check
-		this.act=act;
-		actsFather=ser;	
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		// TODO to check
-		return act.getName();
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-	/*	 TODO should I to parse again the xml?
-		 */
-		
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		// TODO to check
-		ArgumentList argsList=act.getInputArgumentList();
-		if(argsList.size()==0){
-			return null;
-		}
-		String [] inputArgs=new String[argsList.size()]; 
-		for(int i=0;i<argsList.size();i++){
-			inputArgs[i]=argsList.getArgument(i).getName();
-		}
-		return inputArgs;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		// TODO to check
-		ArgumentList argsList=act.getOutputArgumentList();
-		if(argsList.size()==0){
-			return null;
-		}
-		String [] outArgs=new String[argsList.size()]; 
-		for(int i=0;i<argsList.size();i++){
-			outArgs[i]=argsList.getArgument(i).getName();
-		}
-		return outArgs;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		/*
-		
-		check if the way to obtain the UPnPStateVariabile is not too bad
-		
-		*/
-		Argument arg=act.getArgument(argumentName);
-		if(arg==null){
-			return null;
-		}
-		String varName=arg.getRelatedStateVariableName();
-		return actsFather.getStateVariable(varName);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		/*TODO 
-		check if I have understood wath this method should do
-		*/
-		/*
-		 * I look for argument and value and then I add them to ArgumentList
-		 */
-		ArgumentList argsList=new ArgumentList();
-		argsList= act.getInputArgumentList();
-	
-		for(int i=0;i<argsList.size();i++){
-			/*			
-			 * I assert that .getArgument(i) will return to me an Argument with only the name of the
-			 * Argument and not it's value. I'll set the associated value by myself and
-			 * Also I assert that the Argument are ordered
-			 */
-			Argument argument=argsList.getArgument(i);
-			String argumentName=argument.getName();
-			//String relateVar=argument.getRelatedStateVariableName();
-			UPnPStateVariable stateVar=this.getStateVariable(argumentName);
-			String upnpType=stateVar.getUPnPDataType();
-			/*Class javaClass=stateVar.getJavaDataType();*/
-			//setting the value related to the input argument
-			argument.setValue(Converter.toString(args.get(argumentName),upnpType));
-		}
-		act.setInArgumentValues(argsList); 
-		if(act.postControlAction()==true){
-			//TODO check what happen if I don't have any output argument
-			Properties outDic=new Properties();
-			ArgumentList outArgs=act.getOutputArgumentList();
-			if(outArgs.size()==0){
-				return null;
-			}
-			for(int i=0;i<outArgs.size();i++){
-				Argument argument=outArgs.getArgument(i);
-				String argumentName=outArgs.getArgument(i).getName();
-				//String relateVar=argument.getRelatedStateVariableName();
-				UPnPStateVariable stateVar=getStateVariable(argumentName);
-				//String javaType=stateVar.getJavaDataType().getName(); 
-				//TODO rember to catch number exception
-				String upnpType=stateVar.getUPnPDataType();
-				outDic.put(argumentName,Converter.parseString(argument.getValue(),upnpType));
-			}
-			return outDic;
-		}else{
-            UPnPStatus controlStatus = act.getControlStatus();
-            throw new UPnPException(controlStatus.getCode(),controlStatus.getDescription());
-		}
-
-	}
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.upnp;
+
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.cybergarage.upnp.Action;
+import org.cybergarage.upnp.Argument;
+import org.cybergarage.upnp.ArgumentList;
+import org.cybergarage.upnp.UPnPStatus;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPException;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.basedriver.util.Converter;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPActionImpl implements UPnPAction {
+
+	private Action act;	
+	private UPnPServiceImpl actsFather;
+	/**
+	 * @param act
+	 */
+	public UPnPActionImpl(Action act,UPnPServiceImpl ser) {
+		// TODO to check
+		this.act=act;
+		actsFather=ser;	
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		// TODO to check
+		return act.getName();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+	/*	 TODO should I to parse again the xml?
+		 */
+		
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		// TODO to check
+		ArgumentList argsList=act.getInputArgumentList();
+		if(argsList.size()==0){
+			return null;
+		}
+		String [] inputArgs=new String[argsList.size()]; 
+		for(int i=0;i<argsList.size();i++){
+			inputArgs[i]=argsList.getArgument(i).getName();
+		}
+		return inputArgs;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		// TODO to check
+		ArgumentList argsList=act.getOutputArgumentList();
+		if(argsList.size()==0){
+			return null;
+		}
+		String [] outArgs=new String[argsList.size()]; 
+		for(int i=0;i<argsList.size();i++){
+			outArgs[i]=argsList.getArgument(i).getName();
+		}
+		return outArgs;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		/*
+		
+		check if the way to obtain the UPnPStateVariabile is not too bad
+		
+		*/
+		Argument arg=act.getArgument(argumentName);
+		if(arg==null){
+			return null;
+		}
+		String varName=arg.getRelatedStateVariableName();
+		return actsFather.getStateVariable(varName);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		/*TODO 
+		check if I have understood wath this method should do
+		*/
+		/*
+		 * I look for argument and value and then I add them to ArgumentList
+		 */
+		ArgumentList argsList=new ArgumentList();
+		argsList= act.getInputArgumentList();
+	
+		for(int i=0;i<argsList.size();i++){
+			/*			
+			 * I assert that .getArgument(i) will return to me an Argument with only the name of the
+			 * Argument and not it's value. I'll set the associated value by myself and
+			 * Also I assert that the Argument are ordered
+			 */
+			Argument argument=argsList.getArgument(i);
+			String argumentName=argument.getName();
+			//String relateVar=argument.getRelatedStateVariableName();
+			UPnPStateVariable stateVar=this.getStateVariable(argumentName);
+			String upnpType=stateVar.getUPnPDataType();
+			/*Class javaClass=stateVar.getJavaDataType();*/
+			//setting the value related to the input argument
+			argument.setValue(Converter.toString(args.get(argumentName),upnpType));
+		}
+		act.setInArgumentValues(argsList); 
+		if(act.postControlAction()==true){
+			//TODO check what happen if I don't have any output argument
+			Properties outDic=new Properties();
+			ArgumentList outArgs=act.getOutputArgumentList();
+			if(outArgs.size()==0){
+				return null;
+			}
+			for(int i=0;i<outArgs.size();i++){
+				Argument argument=outArgs.getArgument(i);
+				String argumentName=outArgs.getArgument(i).getName();
+				//String relateVar=argument.getRelatedStateVariableName();
+				UPnPStateVariable stateVar=getStateVariable(argumentName);
+				//String javaType=stateVar.getJavaDataType().getName(); 
+				//TODO rember to catch number exception
+				String upnpType=stateVar.getUPnPDataType();
+				outDic.put(argumentName,Converter.parseString(argument.getValue(),upnpType));
+			}
+			return outDic;
+		}else{
+            UPnPStatus controlStatus = act.getControlStatus();
+            throw new UPnPException(controlStatus.getCode(),controlStatus.getDescription());
+		}
+
+	}
+
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java
index 7fd1fe0..c4e1dc7 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java
@@ -1,144 +1,144 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.upnp;
-
-
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.cybergarage.upnp.Device;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPIcon;
-import org.osgi.service.upnp.UPnPService;
-
-import org.apache.felix.upnp.basedriver.importer.util.DeviceSetup;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPDeviceImpl implements UPnPDevice {
-
-	/**
-	 * <code>properties</code> Dictionary that contains Device properties
-	 */
-	private Dictionary properties;
-	private Vector icons;
-	private Hashtable services;
-	/**
-	 * @param dev
-	 *            Device the cyberLink Device used to rappresent the real UPnP
-	 *            Device
-	 */
-	public UPnPDeviceImpl(Device dev, BundleContext context) {
-		properties = new Hashtable();
-		this.services=new Hashtable();
-		this.icons=new Vector();
-		DeviceSetup.deviceSetup(properties,dev,icons,services);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
-	 */
-	public UPnPService getService(String serviceId) {
-		return (UPnPServiceImpl) services.get(serviceId);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
-	 */
-	public UPnPService[] getServices() {
-		Enumeration e = services.elements();
-		if (e == null) {
-			//TODO should I return null or an empty array? The specification seems to said to return null
-			return null;
-		}
-		UPnPService[] uPnPser = new UPnPService[services.size()];
-		int i = 0;
-		while (e.hasMoreElements()) {
-			uPnPser[i] = (UPnPServiceImpl) e.nextElement();
-			i++;
-		}
-		return uPnPser;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
-	 */
-	public UPnPIcon[] getIcons(String locale) {
-		if (locale != null) {
-			return null;
-		}
-		if(icons.size()==0){
-			return null;
-		}
-		return (UPnPIcon[]) icons.toArray(new UPnPIcon[]{});
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
-	 */
-
-	public Dictionary getDescriptions(String locale) {
-		//TODO Sent the right localized version of Description if are available
-		if (locale != null) {
-			return null;
-		}
-		return properties;
-	}
-
-	/**
-	 * @param serviceType
-	 * @return true if device contains the serviceType
-	 */
-	public boolean existServiceType(String serviceType) {
-		String[] services = (String[]) properties.get(UPnPService.TYPE);
-		if (services != null) {
-			for (int i = 0; i < services.length; i++) {
-				if (services[i].equals(serviceType)) {
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * @param property
-	 * @param obj
-	 */
-	public void setProperty(String property, Object obj) {
-		properties.remove(property);
-		properties.put(property, obj);
-
-	}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.upnp;
+
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.cybergarage.upnp.Device;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPIcon;
+import org.osgi.service.upnp.UPnPService;
+
+import org.apache.felix.upnp.basedriver.importer.util.DeviceSetup;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPDeviceImpl implements UPnPDevice {
+
+	/**
+	 * <code>properties</code> Dictionary that contains Device properties
+	 */
+	private Dictionary properties;
+	private Vector icons;
+	private Hashtable services;
+	/**
+	 * @param dev
+	 *            Device the cyberLink Device used to rappresent the real UPnP
+	 *            Device
+	 */
+	public UPnPDeviceImpl(Device dev, BundleContext context) {
+		properties = new Hashtable();
+		this.services=new Hashtable();
+		this.icons=new Vector();
+		DeviceSetup.deviceSetup(properties,dev,icons,services);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
+	 */
+	public UPnPService getService(String serviceId) {
+		return (UPnPServiceImpl) services.get(serviceId);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
+	 */
+	public UPnPService[] getServices() {
+		Enumeration e = services.elements();
+		if (e == null) {
+			//TODO should I return null or an empty array? The specification seems to said to return null
+			return null;
+		}
+		UPnPService[] uPnPser = new UPnPService[services.size()];
+		int i = 0;
+		while (e.hasMoreElements()) {
+			uPnPser[i] = (UPnPServiceImpl) e.nextElement();
+			i++;
+		}
+		return uPnPser;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
+	 */
+	public UPnPIcon[] getIcons(String locale) {
+		if (locale != null) {
+			return null;
+		}
+		if(icons.size()==0){
+			return null;
+		}
+		return (UPnPIcon[]) icons.toArray(new UPnPIcon[]{});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
+	 */
+
+	public Dictionary getDescriptions(String locale) {
+		//TODO Sent the right localized version of Description if are available
+		if (locale != null) {
+			return null;
+		}
+		return properties;
+	}
+
+	/**
+	 * @param serviceType
+	 * @return true if device contains the serviceType
+	 */
+	public boolean existServiceType(String serviceType) {
+		String[] services = (String[]) properties.get(UPnPService.TYPE);
+		if (services != null) {
+			for (int i = 0; i < services.length; i++) {
+				if (services[i].equals(serviceType)) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @param property
+	 * @param obj
+	 */
+	public void setProperty(String property, Object obj) {
+		properties.remove(property);
+		properties.put(property, obj);
+
+	}
+
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java
index dba0d8a..fcce8a0 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java
@@ -1,105 +1,105 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.upnp;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.cybergarage.upnp.Icon;
-
-import org.osgi.service.upnp.UPnPIcon;
-
-import org.apache.felix.upnp.basedriver.importer.util.HTTPRequestForIcon;
-import org.apache.felix.upnp.basedriver.importer.util.ParseLocation;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPIconImpl implements UPnPIcon {
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
-	 */
-	private Icon icon;
-	private org.cybergarage.upnp.Device cyberdev;
-	public UPnPIconImpl(Icon cybericon,org.cybergarage.upnp.Device cyberdev){
-		this.icon=cybericon;
-		this.cyberdev=cyberdev;
-	}
-	public String getMimeType() {
-		// TODO to check
-		return icon.getMimeType();
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
-	 */
-	public int getWidth() {
-		String width=icon.getWidth();
-		if(width.length()==0){
-			return -1;
-		}
-		return Integer.parseInt(width);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
-	 */
-	public int getHeight() {
-		String higth=icon.getHeight();
-		if(higth.length()==0){
-			return -1;
-		}
-		return Integer.parseInt(higth);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
-	 */
-	public int getSize() {
-		// TODO Auto-generated method stub
-		return -1;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
-	 */
-	public int getDepth() {
-		String depth=icon.getDepth();
-		if(depth.length()==0){
-			return -1;
-		}
-		return Integer.parseInt(depth);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
-	 */
-	public InputStream getInputStream() throws IOException {
-		String urlString=ParseLocation.getUrlBase(cyberdev.getLocation())+icon.getURL();
-		URL url=new URL(urlString);
-		HTTPRequestForIcon requestor=new HTTPRequestForIcon(url);
-		
-		return requestor.getInputStream();
-	}
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.upnp;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.cybergarage.upnp.Icon;
+
+import org.osgi.service.upnp.UPnPIcon;
+
+import org.apache.felix.upnp.basedriver.importer.util.HTTPRequestForIcon;
+import org.apache.felix.upnp.basedriver.importer.util.ParseLocation;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPIconImpl implements UPnPIcon {
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
+	 */
+	private Icon icon;
+	private org.cybergarage.upnp.Device cyberdev;
+	public UPnPIconImpl(Icon cybericon,org.cybergarage.upnp.Device cyberdev){
+		this.icon=cybericon;
+		this.cyberdev=cyberdev;
+	}
+	public String getMimeType() {
+		// TODO to check
+		return icon.getMimeType();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
+	 */
+	public int getWidth() {
+		String width=icon.getWidth();
+		if(width.length()==0){
+			return -1;
+		}
+		return Integer.parseInt(width);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
+	 */
+	public int getHeight() {
+		String higth=icon.getHeight();
+		if(higth.length()==0){
+			return -1;
+		}
+		return Integer.parseInt(higth);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
+	 */
+	public int getSize() {
+		// TODO Auto-generated method stub
+		return -1;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
+	 */
+	public int getDepth() {
+		String depth=icon.getDepth();
+		if(depth.length()==0){
+			return -1;
+		}
+		return Integer.parseInt(depth);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
+	 */
+	public InputStream getInputStream() throws IOException {
+		String urlString=ParseLocation.getUrlBase(cyberdev.getLocation())+icon.getURL();
+		URL url=new URL(urlString);
+		HTTPRequestForIcon requestor=new HTTPRequestForIcon(url);
+		
+		return requestor.getInputStream();
+	}
+
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java
index 40c7c26..877fe03 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java
@@ -1,159 +1,159 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.upnp;
-
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import org.cybergarage.upnp.Action;
-import org.cybergarage.upnp.ActionList;
-import org.cybergarage.upnp.Service;
-import org.cybergarage.upnp.ServiceStateTable;
-import org.cybergarage.upnp.StateVariable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/** 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPServiceImpl implements UPnPService {
-	private Service service;
-	private Hashtable actions;
-	private Hashtable stateVariables;
-	
-	public UPnPServiceImpl(Service service) {
-		this.service = service;
-		actions = new Hashtable();
-		stateVariables=new Hashtable();
-		/*
-		 * action
-		 */
-		ActionList actionlist = service.getActionList();
-		for (int i = 0; i < actionlist.size(); i++) {
-			Action act = actionlist.getAction(i);
-			actions.put(act.getName(), new UPnPActionImpl(act,this));
-		}
-		/*StateVariable*/
-		ServiceStateTable stateTable=service.getServiceStateTable();
-		for(int i=0;i<stateTable.size();i++){
-			StateVariable var= stateTable.getStateVariable(i);
-			stateVariables.put(var.getName(),new UPnPStateVariableImpl(var));
-		}
-	
-	
-	} /*
-	   * (non-Javadoc)
-	   * 
-	   * @see org.osgi.service.upnp.UPnPService#getId()
-	   */
-	public String getId() {
-		// TODO Auto-generated method stub
-		return service.getServiceID();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPService#getType()
-	 */
-	public String getType() {
-		// TODO Auto-generated method stub
-		return service.getServiceType();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPService#getVersion()
-	 */
-	public String getVersion() {
-		String serviceType = service.getServiceType();
-		int start = serviceType.lastIndexOf(':');
-		String version = serviceType.substring(start+1);
-		return version;
-	} 
-	/*
-	   * (non-Javadoc)
-	   * 
-	   * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
-	   */
-	public UPnPAction getAction(String name) {
-		//TODO to check
-		return (UPnPAction) actions.get(name);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPService#getActions()
-	 */
-	public UPnPAction[] getActions() {
-		//TODO check again
-		Enumeration e=actions.elements();
-		if(e==null){
-			return null;
-		}
-		UPnPAction [] uPnPacts=new UPnPAction[actions.size()];
-		int i=0;
-		while(e.hasMoreElements()){
-			uPnPacts[i]=(UPnPActionImpl)e.nextElement();
-			i++;
-		}
-		return uPnPacts;
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
-	 */
-	public UPnPStateVariable[] getStateVariables() {
-		//TODO check again
-		UPnPStateVariableImpl [] vars =new UPnPStateVariableImpl[stateVariables.size()];
-		Enumeration e=stateVariables.elements();
-		if(e==null){
-			return null;
-		}
-		int i=0;
-		while(e.hasMoreElements()){
-			vars[i]=(UPnPStateVariableImpl)e.nextElement();
-			i++;
-		}
-		return vars;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String name) {
-		//TODO chack again
-		return (UPnPStateVariableImpl) stateVariables.get(name);
-	}
-
-	public Service getCyberService(){
-		return service;
-	}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.upnp;
+
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import org.cybergarage.upnp.Action;
+import org.cybergarage.upnp.ActionList;
+import org.cybergarage.upnp.Service;
+import org.cybergarage.upnp.ServiceStateTable;
+import org.cybergarage.upnp.StateVariable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/** 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPServiceImpl implements UPnPService {
+	private Service service;
+	private Hashtable actions;
+	private Hashtable stateVariables;
+	
+	public UPnPServiceImpl(Service service) {
+		this.service = service;
+		actions = new Hashtable();
+		stateVariables=new Hashtable();
+		/*
+		 * action
+		 */
+		ActionList actionlist = service.getActionList();
+		for (int i = 0; i < actionlist.size(); i++) {
+			Action act = actionlist.getAction(i);
+			actions.put(act.getName(), new UPnPActionImpl(act,this));
+		}
+		/*StateVariable*/
+		ServiceStateTable stateTable=service.getServiceStateTable();
+		for(int i=0;i<stateTable.size();i++){
+			StateVariable var= stateTable.getStateVariable(i);
+			stateVariables.put(var.getName(),new UPnPStateVariableImpl(var));
+		}
+	
+	
+	} /*
+	   * (non-Javadoc)
+	   * 
+	   * @see org.osgi.service.upnp.UPnPService#getId()
+	   */
+	public String getId() {
+		// TODO Auto-generated method stub
+		return service.getServiceID();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPService#getType()
+	 */
+	public String getType() {
+		// TODO Auto-generated method stub
+		return service.getServiceType();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPService#getVersion()
+	 */
+	public String getVersion() {
+		String serviceType = service.getServiceType();
+		int start = serviceType.lastIndexOf(':');
+		String version = serviceType.substring(start+1);
+		return version;
+	} 
+	/*
+	   * (non-Javadoc)
+	   * 
+	   * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
+	   */
+	public UPnPAction getAction(String name) {
+		//TODO to check
+		return (UPnPAction) actions.get(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPService#getActions()
+	 */
+	public UPnPAction[] getActions() {
+		//TODO check again
+		Enumeration e=actions.elements();
+		if(e==null){
+			return null;
+		}
+		UPnPAction [] uPnPacts=new UPnPAction[actions.size()];
+		int i=0;
+		while(e.hasMoreElements()){
+			uPnPacts[i]=(UPnPActionImpl)e.nextElement();
+			i++;
+		}
+		return uPnPacts;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
+	 */
+	public UPnPStateVariable[] getStateVariables() {
+		//TODO check again
+		UPnPStateVariableImpl [] vars =new UPnPStateVariableImpl[stateVariables.size()];
+		Enumeration e=stateVariables.elements();
+		if(e==null){
+			return null;
+		}
+		int i=0;
+		while(e.hasMoreElements()){
+			vars[i]=(UPnPStateVariableImpl)e.nextElement();
+			i++;
+		}
+		return vars;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String name) {
+		//TODO chack again
+		return (UPnPStateVariableImpl) stateVariables.get(name);
+	}
+
+	public Service getCyberService(){
+		return service;
+	}
+
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java
index f64b995..dd86bb9 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java
@@ -1,274 +1,274 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.core.upnp;
-
-
-import java.util.Date;
-import java.util.Hashtable;
-
-import org.cybergarage.upnp.AllowedValueList;
-import org.cybergarage.upnp.AllowedValueRange;
-import org.cybergarage.upnp.StateVariable;
-
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.basedriver.Activator;
-import org.apache.felix.upnp.basedriver.util.Converter;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPStateVariableImpl implements UPnPStateVariable {
-
-	private StateVariable variable;
-    
-    private Number max = null;
-    private Number min = null;
-    private Number step = null;
-
-    private String[] values = null;    
-    
-    private Boolean hasMaxMinStep = null;
-    private Boolean hasRangeValues = null;    
-
-	private static Hashtable upnp2javaTable = null;
-	
-	static{
-		upnp2javaTable = new Hashtable(30);
-		String[] upnpType = null;
-		upnpType = new String[]{"ui1","ui2","i1","i2","i4","int"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],Integer.class);
-		}
-
-		upnpType = new String[]{"ui4","time","time.tz"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],Long.class);
-		}		
-
-		upnpType = new String[]{"r4","float"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],Float.class);
-		}		
-
-		upnpType = new String[]{"r8","number","fixed.14.4"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],Double.class);
-		}		
-
-		upnpType = new String[]{"char"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],Character.class);
-		}		
-
-		upnpType = new String[]{"string","uri","uuid"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],String.class);
-		}		
-
-		upnpType = new String[]{"date","dateTime","dateTime.tz"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],Date.class);
-		}		
-
-		upnpType = new String[]{"boolean"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],Boolean.class);
-		}		
-
-		upnpType = new String[]{"bin.base64","bin.hex"};
-		for (int i = 0; i < upnpType.length; i++) {
-			upnp2javaTable.put(upnpType[i],byte[].class);
-		}		
-		
-		
-	}
-	
-	/**
-	 * @param variable
-	 */
-	public UPnPStateVariableImpl(StateVariable variable) {
-
-		this.variable = variable;
-	} 
-
-    /**
-     * @see org.osgi.service.upnp.UPnPStateVariable#getName()
-	 */
-	public String getName() {
-		return variable.getName();
-	}
-
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
-	 */
-	public Class getJavaDataType() {
-		return (Class) upnp2javaTable.get(variable.getDataType());
-	}
-
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
-	 */
-	public String getUPnPDataType() {
-		return variable.getDataType();
-	}
-
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
-	 */
-	public Object getDefaultValue() {
-		//TODO must be implemented from scretch, it's just raccommend
-		return null;
-	}
-
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
-	 */
-	public String[] getAllowedValues() {
-        if(hasRangeValues == null)
-            initValueConstraint();
-        
-        return values;
-	}
-
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
-	 */
-	public Number getMinimum() {
-        if(hasMaxMinStep == null)
-            initValueConstraint();
-        
-        return min;
-	}
-
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
-	 */
-	public Number getMaximum() {
-        if(hasMaxMinStep == null)
-            initValueConstraint();
-        
-        return max;
-	}
-
-    /**
-     * <b>NOTE:</b>  This type of control caches the value recieved by the Device so if XML changes it doesn't affect the OSGi service
-     * 
-     * @since 0.3
-     */
-    private void initValueConstraint(){
-        if(hasRangeValues != null || hasMaxMinStep != null)
-            return;
-
-        hasRangeValues = Boolean.FALSE;
-        hasMaxMinStep = Boolean.FALSE;
-        
-        final AllowedValueRange allowedValueRange = variable.getAllowedValueRange();
-        final AllowedValueList allowedValueList = variable.getAllowedValueList();
-        
-        if(allowedValueRange != null && allowedValueList != null){
-            Activator.logger.WARNING("Imported device with StateVariable "
-                                     +variable.getName()+" contains either AllowedValueRange and AllowedValueList UPnP doesn't allow it because it. Neither of the restriction will be applied");
-            
-        }else if( allowedValueRange != null ){
-            
-            initMaxMinStep(allowedValueRange);
-            
-        }else if( allowedValueList != null ){
-            
-            initAllowedValues(allowedValueList);
-            
-        }
-    }
-    
-    /**
-     * @param allowedValueList
-     * @since 0.3
-     */
-    private void initAllowedValues(AllowedValueList allowedValueList){
-        //PRE:invoked only by initValueConstraint() thus allowedValueList must not null
-        if (String.class != getJavaDataType()) {
-            Activator.logger.WARNING("Imported device with StateVariable "
-                                     +variable.getName()+" contains AllowedValueList but its UPnP type doesn't allow it because it is +"+getUPnPDataType());            
-            return;
-        }
-
-        if(allowedValueList.size() == 0){
-            return ;
-        } 
-
-        values = new String[allowedValueList.size()];
-        for (int i = 0; i < allowedValueList.size(); i++) {
-            values[i] = allowedValueList.getAllowedValue(i).getValue();
-        }
-    }
-
-    /**
-     * @param allowedValueRange
-     * @since 0.3
-     */
-    private void initMaxMinStep(AllowedValueRange allowedValueRange){
-        //PRE:invoked only by initValueConstraint() thus allowedValueRange must not  be null
-        if(allowedValueRange==null){
-            return;
-        }
-
-        if(!Number.class.isAssignableFrom(getJavaDataType())){
-            Activator.logger.WARNING("Imported device with StateVariable "
-                                     +variable.getName()+" contains AllowedValueRange but its UPnP type doesn't allow it because it is +"+getUPnPDataType());            
-            return;
-        }
-        
-        final String maxStr = allowedValueRange.getMaximum();
-        final String minStr = allowedValueRange.getMinimum();
-        final String stepStr = allowedValueRange.getStep();
-        
-        try{
-            final String type = getUPnPDataType();
-            max = (Number)Converter.parseString(maxStr,type);
-            min = (Number)Converter.parseString(minStr,type);
-            step = (Number)Converter.parseString(stepStr,type);
-        }catch(Exception ex){
-            Activator.logger.WARNING("Imported device with StateVariable "
-                +variable.getName()+" contains an invalid definition for AllowedValueRange");
-        }
-        hasMaxMinStep = Boolean.TRUE;
-    }
-    
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
-	 */
-	public Number getStep() {
-        if(hasMaxMinStep == null)
-            initValueConstraint();
-        
-        return step;        
-
-	}
-
-	/**
-	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
-	 */
-	public boolean sendsEvents() {
-		return variable.isSendEvents();
-	}
-
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.core.upnp;
+
+
+import java.util.Date;
+import java.util.Hashtable;
+
+import org.cybergarage.upnp.AllowedValueList;
+import org.cybergarage.upnp.AllowedValueRange;
+import org.cybergarage.upnp.StateVariable;
+
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.basedriver.Activator;
+import org.apache.felix.upnp.basedriver.util.Converter;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPStateVariableImpl implements UPnPStateVariable {
+
+	private StateVariable variable;
+    
+    private Number max = null;
+    private Number min = null;
+    private Number step = null;
+
+    private String[] values = null;    
+    
+    private Boolean hasMaxMinStep = null;
+    private Boolean hasRangeValues = null;    
+
+	private static Hashtable upnp2javaTable = null;
+	
+	static{
+		upnp2javaTable = new Hashtable(30);
+		String[] upnpType = null;
+		upnpType = new String[]{"ui1","ui2","i1","i2","i4","int"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],Integer.class);
+		}
+
+		upnpType = new String[]{"ui4","time","time.tz"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],Long.class);
+		}		
+
+		upnpType = new String[]{"r4","float"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],Float.class);
+		}		
+
+		upnpType = new String[]{"r8","number","fixed.14.4"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],Double.class);
+		}		
+
+		upnpType = new String[]{"char"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],Character.class);
+		}		
+
+		upnpType = new String[]{"string","uri","uuid"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],String.class);
+		}		
+
+		upnpType = new String[]{"date","dateTime","dateTime.tz"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],Date.class);
+		}		
+
+		upnpType = new String[]{"boolean"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],Boolean.class);
+		}		
+
+		upnpType = new String[]{"bin.base64","bin.hex"};
+		for (int i = 0; i < upnpType.length; i++) {
+			upnp2javaTable.put(upnpType[i],byte[].class);
+		}		
+		
+		
+	}
+	
+	/**
+	 * @param variable
+	 */
+	public UPnPStateVariableImpl(StateVariable variable) {
+
+		this.variable = variable;
+	} 
+
+    /**
+     * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return variable.getName();
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return (Class) upnp2javaTable.get(variable.getDataType());
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return variable.getDataType();
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		//TODO must be implemented from scretch, it's just raccommend
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+        if(hasRangeValues == null)
+            initValueConstraint();
+        
+        return values;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+        if(hasMaxMinStep == null)
+            initValueConstraint();
+        
+        return min;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+        if(hasMaxMinStep == null)
+            initValueConstraint();
+        
+        return max;
+	}
+
+    /**
+     * <b>NOTE:</b>  This type of control caches the value recieved by the Device so if XML changes it doesn't affect the OSGi service
+     * 
+     * @since 0.3
+     */
+    private void initValueConstraint(){
+        if(hasRangeValues != null || hasMaxMinStep != null)
+            return;
+
+        hasRangeValues = Boolean.FALSE;
+        hasMaxMinStep = Boolean.FALSE;
+        
+        final AllowedValueRange allowedValueRange = variable.getAllowedValueRange();
+        final AllowedValueList allowedValueList = variable.getAllowedValueList();
+        
+        if(allowedValueRange != null && allowedValueList != null){
+            Activator.logger.WARNING("Imported device with StateVariable "
+                                     +variable.getName()+" contains either AllowedValueRange and AllowedValueList UPnP doesn't allow it because it. Neither of the restriction will be applied");
+            
+        }else if( allowedValueRange != null ){
+            
+            initMaxMinStep(allowedValueRange);
+            
+        }else if( allowedValueList != null ){
+            
+            initAllowedValues(allowedValueList);
+            
+        }
+    }
+    
+    /**
+     * @param allowedValueList
+     * @since 0.3
+     */
+    private void initAllowedValues(AllowedValueList allowedValueList){
+        //PRE:invoked only by initValueConstraint() thus allowedValueList must not null
+        if (String.class != getJavaDataType()) {
+            Activator.logger.WARNING("Imported device with StateVariable "
+                                     +variable.getName()+" contains AllowedValueList but its UPnP type doesn't allow it because it is +"+getUPnPDataType());            
+            return;
+        }
+
+        if(allowedValueList.size() == 0){
+            return ;
+        } 
+
+        values = new String[allowedValueList.size()];
+        for (int i = 0; i < allowedValueList.size(); i++) {
+            values[i] = allowedValueList.getAllowedValue(i).getValue();
+        }
+    }
+
+    /**
+     * @param allowedValueRange
+     * @since 0.3
+     */
+    private void initMaxMinStep(AllowedValueRange allowedValueRange){
+        //PRE:invoked only by initValueConstraint() thus allowedValueRange must not  be null
+        if(allowedValueRange==null){
+            return;
+        }
+
+        if(!Number.class.isAssignableFrom(getJavaDataType())){
+            Activator.logger.WARNING("Imported device with StateVariable "
+                                     +variable.getName()+" contains AllowedValueRange but its UPnP type doesn't allow it because it is +"+getUPnPDataType());            
+            return;
+        }
+        
+        final String maxStr = allowedValueRange.getMaximum();
+        final String minStr = allowedValueRange.getMinimum();
+        final String stepStr = allowedValueRange.getStep();
+        
+        try{
+            final String type = getUPnPDataType();
+            max = (Number)Converter.parseString(maxStr,type);
+            min = (Number)Converter.parseString(minStr,type);
+            step = (Number)Converter.parseString(stepStr,type);
+        }catch(Exception ex){
+            Activator.logger.WARNING("Imported device with StateVariable "
+                +variable.getName()+" contains an invalid definition for AllowedValueRange");
+        }
+        hasMaxMinStep = Boolean.TRUE;
+    }
+    
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+        if(hasMaxMinStep == null)
+            initValueConstraint();
+        
+        return step;        
+
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return variable.isSendEvents();
+	}
+
+
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java
index e24e043..332bf60 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java
@@ -1,143 +1,143 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.util;
-
-
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.cybergarage.upnp.Device;
-import org.cybergarage.upnp.DeviceList;
-import org.cybergarage.upnp.IconList;
-import org.cybergarage.upnp.Service;
-import org.cybergarage.upnp.ServiceList;
-
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPIcon;
-import org.osgi.service.upnp.UPnPService;
-
-import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPIconImpl;
-import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPServiceImpl;
-import org.apache.felix.upnp.basedriver.util.Constants;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class DeviceSetup {
-
-	public static void deviceSetup(Dictionary properties, Device dev,Vector icons,Hashtable services) {
-		//TODO if I don't have any device, the size of devlist is 0 
-		DeviceList devList = dev.getDeviceList();
-		/* childrenUDN property */
-		if (devList.size() > 0) {
-			String[] childrenUDN = new String[devList.size()];
-			for (int i = 0; i < devList.size(); i++) {
-				childrenUDN[i] = devList.getDevice(i).getUDN();
-			}
-			properties.put(UPnPDevice.CHILDREN_UDN, childrenUDN);
-		}
-		/* DEVICE CATEGORY */
-		properties.put(
-		        org.osgi.service
-		        	.device.Constants.DEVICE_CATEGORY,
-	        	new String[]{UPnPDevice.DEVICE_CATEGORY}
-	        );
-
-		/*UPNP_IMPORT*/
-		properties.put(Constants.UPNP_IMPORT, "http://felix.apache.org");
-		
-		/* FRIENDLY_NAME */
-		//check the implementation fo getFriendlyName made by CyberLink
-		properties.put(UPnPDevice.FRIENDLY_NAME, dev.getFriendlyName());
-		/* MANUFACTURER */
-		properties.put(UPnPDevice.MANUFACTURER, dev.getManufacture());
-		/* MANUFACTURER_URL */
-		properties.put(UPnPDevice.MANUFACTURER_URL, dev.getManufactureURL());
-		/* MODEL_DESCRIPTION */
-		properties.put(UPnPDevice.MODEL_DESCRIPTION, dev.getModelDescription());
-		/* MODEL_NAME */
-		properties.put(UPnPDevice.MODEL_NAME, dev.getModelName());
-		/* MODEL_NUMBER */
-		properties.put(UPnPDevice.MODEL_NUMBER, dev.getModelNumber());
-		/* MODEL_URL */
-		properties.put(UPnPDevice.MODEL_URL, dev.getModelURL());
-		/* PARENT_UDN */
-		if (!dev.isRootDevice()) {
-			Device parent = dev.getParentDevice();
-			/*Device root = dev.getRootDevice();
-			if (root == null) {
-				System.out.println("il device " + dev.getFriendlyName()
-						+ "non ha root !!!");
-			}*/
-			properties.put(UPnPDevice.PARENT_UDN, parent.getUDN());
-		}
-		/* PRESENTATION_URL */
-		properties.put(UPnPDevice.PRESENTATION_URL, dev.getPresentationURL());
-		/* SERIAL_NUMBER */
-		properties.put(UPnPDevice.SERIAL_NUMBER, dev.getSerialNumber());
-		/* TYPE */
-		properties.put(UPnPDevice.TYPE, dev.getDeviceType());
-		/* UDN */
-		properties.put(UPnPDevice.UDN, dev.getUDN());
-		/* UPC */
-		properties.put(UPnPDevice.UPC, dev.getUPC());
-
-		IconList iconsList = dev.getIconList();
-		if (iconsList.size() != 0) {
-			for (int i = 0; i < iconsList.size(); i++) {
-				UPnPIcon icon = new UPnPIconImpl(iconsList.getIcon(i),dev);
-				icons.add(icon);
-			}
-		}
-		/* 
-		 * service of this device
-		 */ 
-		ServiceList serviceList = dev.getServiceList();
-		/*
-		 * if dev contain no service I'll get an empty SserviceList object
-		 */
-		String[] servicesIDProperty = new String[serviceList.size()];
-		String[] servicesTypeProperty;
-		HashSet serTypeSet = new HashSet();
-		for (int i = 0; i < serviceList.size(); i++) {
-			Service service = serviceList.getService(i);
-			UPnPServiceImpl serviceImpl = new UPnPServiceImpl(service);
-			services.put(service.getServiceID(), serviceImpl);
-			servicesIDProperty[i] = serviceImpl.getId();
-			serTypeSet.add(serviceImpl.getType());
-		}
-		servicesTypeProperty = new String[serTypeSet.size()];
-		Iterator iter = serTypeSet.iterator();
-		int i = 0;
-		while (iter.hasNext()) {
-			servicesTypeProperty[i] = (String) iter.next();
-			i++;
-		}
-		properties.put(UPnPService.ID, servicesIDProperty);
-		properties.put(UPnPService.TYPE, servicesTypeProperty);
-
-	
-	}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.util;
+
+
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.cybergarage.upnp.Device;
+import org.cybergarage.upnp.DeviceList;
+import org.cybergarage.upnp.IconList;
+import org.cybergarage.upnp.Service;
+import org.cybergarage.upnp.ServiceList;
+
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPIcon;
+import org.osgi.service.upnp.UPnPService;
+
+import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPIconImpl;
+import org.apache.felix.upnp.basedriver.importer.core.upnp.UPnPServiceImpl;
+import org.apache.felix.upnp.basedriver.util.Constants;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class DeviceSetup {
+
+	public static void deviceSetup(Dictionary properties, Device dev,Vector icons,Hashtable services) {
+		//TODO if I don't have any device, the size of devlist is 0 
+		DeviceList devList = dev.getDeviceList();
+		/* childrenUDN property */
+		if (devList.size() > 0) {
+			String[] childrenUDN = new String[devList.size()];
+			for (int i = 0; i < devList.size(); i++) {
+				childrenUDN[i] = devList.getDevice(i).getUDN();
+			}
+			properties.put(UPnPDevice.CHILDREN_UDN, childrenUDN);
+		}
+		/* DEVICE CATEGORY */
+		properties.put(
+		        org.osgi.service
+		        	.device.Constants.DEVICE_CATEGORY,
+	        	new String[]{UPnPDevice.DEVICE_CATEGORY}
+	        );
+
+		/*UPNP_IMPORT*/
+		properties.put(Constants.UPNP_IMPORT, "http://felix.apache.org");
+		
+		/* FRIENDLY_NAME */
+		//check the implementation fo getFriendlyName made by CyberLink
+		properties.put(UPnPDevice.FRIENDLY_NAME, dev.getFriendlyName());
+		/* MANUFACTURER */
+		properties.put(UPnPDevice.MANUFACTURER, dev.getManufacture());
+		/* MANUFACTURER_URL */
+		properties.put(UPnPDevice.MANUFACTURER_URL, dev.getManufactureURL());
+		/* MODEL_DESCRIPTION */
+		properties.put(UPnPDevice.MODEL_DESCRIPTION, dev.getModelDescription());
+		/* MODEL_NAME */
+		properties.put(UPnPDevice.MODEL_NAME, dev.getModelName());
+		/* MODEL_NUMBER */
+		properties.put(UPnPDevice.MODEL_NUMBER, dev.getModelNumber());
+		/* MODEL_URL */
+		properties.put(UPnPDevice.MODEL_URL, dev.getModelURL());
+		/* PARENT_UDN */
+		if (!dev.isRootDevice()) {
+			Device parent = dev.getParentDevice();
+			/*Device root = dev.getRootDevice();
+			if (root == null) {
+				System.out.println("il device " + dev.getFriendlyName()
+						+ "non ha root !!!");
+			}*/
+			properties.put(UPnPDevice.PARENT_UDN, parent.getUDN());
+		}
+		/* PRESENTATION_URL */
+		properties.put(UPnPDevice.PRESENTATION_URL, dev.getPresentationURL());
+		/* SERIAL_NUMBER */
+		properties.put(UPnPDevice.SERIAL_NUMBER, dev.getSerialNumber());
+		/* TYPE */
+		properties.put(UPnPDevice.TYPE, dev.getDeviceType());
+		/* UDN */
+		properties.put(UPnPDevice.UDN, dev.getUDN());
+		/* UPC */
+		properties.put(UPnPDevice.UPC, dev.getUPC());
+
+		IconList iconsList = dev.getIconList();
+		if (iconsList.size() != 0) {
+			for (int i = 0; i < iconsList.size(); i++) {
+				UPnPIcon icon = new UPnPIconImpl(iconsList.getIcon(i),dev);
+				icons.add(icon);
+			}
+		}
+		/* 
+		 * service of this device
+		 */ 
+		ServiceList serviceList = dev.getServiceList();
+		/*
+		 * if dev contain no service I'll get an empty SserviceList object
+		 */
+		String[] servicesIDProperty = new String[serviceList.size()];
+		String[] servicesTypeProperty;
+		HashSet serTypeSet = new HashSet();
+		for (int i = 0; i < serviceList.size(); i++) {
+			Service service = serviceList.getService(i);
+			UPnPServiceImpl serviceImpl = new UPnPServiceImpl(service);
+			services.put(service.getServiceID(), serviceImpl);
+			servicesIDProperty[i] = serviceImpl.getId();
+			serTypeSet.add(serviceImpl.getType());
+		}
+		servicesTypeProperty = new String[serTypeSet.size()];
+		Iterator iter = serTypeSet.iterator();
+		int i = 0;
+		while (iter.hasNext()) {
+			servicesTypeProperty[i] = (String) iter.next();
+			i++;
+		}
+		properties.put(UPnPService.ID, servicesIDProperty);
+		properties.put(UPnPService.TYPE, servicesTypeProperty);
+
+	
+	}
+
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java
index 6987bfb..3ebfa84 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java
@@ -1,98 +1,98 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.URL;
-
-/** 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class HTTPRequestForIcon {
-	private URL url;
-
-	public HTTPRequestForIcon(URL url) {
-		this.url = url;
-	}
-	public InputStream getInputStream() throws IOException {
-		//TODO we should speak about that
-		InetAddress inet = InetAddress.getByName(url.getHost());
-		int port = url.getPort();
-		Socket socket = null;
-		socket = new Socket(inet, port);
-		OutputStream out = null;
-		out = socket.getOutputStream();
-		String CRLF = "\r\n";
-		url.getFile();
-		String request = "GET " + url.getPath() + " " + "HTTP/1.1" + CRLF
-				+ "Host: " + url.getHost() + CRLF + "Connection: " + "close"
-				+ CRLF + CRLF;
-		//System.out.println(request);
-		byte[] get = request.getBytes();
-		out.write(get, 0, get.length);
-		InputStream in = socket.getInputStream();
-		boolean exit = true;
-		while (exit) {
-			byte[] b = new byte[1];
-			in.read(b, 0, b.length);
-
-			if (b[0] == '\r') {
-				in.read(b, 0, b.length);
-				while (b[0] == '\r') {
-					in.read(b, 0, b.length);
-				}
-				if (b[0] != '\n') {
-					continue;
-				}
-				in.read(b, 0, b.length);
-				if (b[0] != '\r') {
-					continue;
-				}
-				in.read(b, 0, b.length);
-				if (b[0] != '\n') {
-					continue;
-				}
-				exit = false;
-			}
-		}
-
-		return in;
-
-		/*
-		 * HTTPResponse response=new HTTPResponse(in); 
-		 * InputStream  iconInStream=response.getContentInputStream(); 
-		 * return iconInStream;
-		 * 
-		 */
-		/*
-		 * 
-		 * byte[] buff = new byte[maxLength]; int initial = 0; while (initial <
-		 * maxLength - 1) { int read = 0; read = in.read(buff, initial, 1024);
-		 * if (read == -1) break; initial += read; } System.out.println(new
-		 * String(buff));
-		 */
-
-	}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.URL;
+
+/** 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class HTTPRequestForIcon {
+	private URL url;
+
+	public HTTPRequestForIcon(URL url) {
+		this.url = url;
+	}
+	public InputStream getInputStream() throws IOException {
+		//TODO we should speak about that
+		InetAddress inet = InetAddress.getByName(url.getHost());
+		int port = url.getPort();
+		Socket socket = null;
+		socket = new Socket(inet, port);
+		OutputStream out = null;
+		out = socket.getOutputStream();
+		String CRLF = "\r\n";
+		url.getFile();
+		String request = "GET " + url.getPath() + " " + "HTTP/1.1" + CRLF
+				+ "Host: " + url.getHost() + CRLF + "Connection: " + "close"
+				+ CRLF + CRLF;
+		//System.out.println(request);
+		byte[] get = request.getBytes();
+		out.write(get, 0, get.length);
+		InputStream in = socket.getInputStream();
+		boolean exit = true;
+		while (exit) {
+			byte[] b = new byte[1];
+			in.read(b, 0, b.length);
+
+			if (b[0] == '\r') {
+				in.read(b, 0, b.length);
+				while (b[0] == '\r') {
+					in.read(b, 0, b.length);
+				}
+				if (b[0] != '\n') {
+					continue;
+				}
+				in.read(b, 0, b.length);
+				if (b[0] != '\r') {
+					continue;
+				}
+				in.read(b, 0, b.length);
+				if (b[0] != '\n') {
+					continue;
+				}
+				exit = false;
+			}
+		}
+
+		return in;
+
+		/*
+		 * HTTPResponse response=new HTTPResponse(in); 
+		 * InputStream  iconInStream=response.getContentInputStream(); 
+		 * return iconInStream;
+		 * 
+		 */
+		/*
+		 * 
+		 * byte[] buff = new byte[maxLength]; int initial = 0; while (initial <
+		 * maxLength - 1) { int read = 0; read = in.read(buff, initial, 1024);
+		 * if (read == -1) break; initial += read; } System.out.println(new
+		 * String(buff));
+		 */
+
+	}
+
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java
index 21c0c4f..089259d 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java
@@ -1,31 +1,31 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.util;
-
-/** 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class ParseLocation {
-	public static String getUrlBase(String location){
-		String [] splited=StringSplitter.split(location, '/');
-		String value=splited[0]+"/"+"/"+splited[2];
-		return value;		
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.util;
+
+/** 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class ParseLocation {
+	public static String getUrlBase(String location){
+		String [] splited=StringSplitter.split(location, '/');
+		String value=splited[0]+"/"+"/"+splited[2];
+		return value;		
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java
index c0194ac..47f426f 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java
@@ -1,63 +1,63 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.importer.util;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class ParseUSN {
-	boolean service;
-	boolean device;
-	String udn;
-	String serviceType;
-	
-	public ParseUSN(String usn) {
-		String [] splited=StringSplitter.split(usn, ':');
-		if(splited.length==5||splited.length==2){
-			udn="uuid:"+splited[1];
-			device=true;
-			service=false;
-		}else if(splited.length==8){
-			udn="uuid:"+splited[1];
-			if(splited[5].equals("device")){
-				device=true;
-				service=false;
-			}else{
-				serviceType=splited[3]+":"+splited[4]+":"+splited[5]+":"+splited[6]+":"+splited[7];
-				device=false;
-				service=true;
-			}
-		}
-	}	
-
-	public boolean isService() {
-		return service;
-	}
-	public boolean isDevice() {
-		return device;
-	}
-	public String getUDN() {
-		return udn;
-	}
-	public String getServiceType() {
-		return serviceType;
-	}
-	
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.importer.util;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class ParseUSN {
+	boolean service;
+	boolean device;
+	String udn;
+	String serviceType;
+	
+	public ParseUSN(String usn) {
+		String [] splited=StringSplitter.split(usn, ':');
+		if(splited.length==5||splited.length==2){
+			udn="uuid:"+splited[1];
+			device=true;
+			service=false;
+		}else if(splited.length==8){
+			udn="uuid:"+splited[1];
+			if(splited[5].equals("device")){
+				device=true;
+				service=false;
+			}else{
+				serviceType=splited[3]+":"+splited[4]+":"+splited[5]+":"+splited[6]+":"+splited[7];
+				device=false;
+				service=true;
+			}
+		}
+	}	
+
+	public boolean isService() {
+		return service;
+	}
+	public boolean isDevice() {
+		return device;
+	}
+	public String getUDN() {
+		return udn;
+	}
+	public String getServiceType() {
+		return serviceType;
+	}
+	
 }
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/tool/Logger.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/tool/Logger.java
index e1c4ed1..2d28aa2 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/tool/Logger.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/tool/Logger.java
@@ -1,253 +1,253 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.tool;
-
-import java.io.PrintStream;
-
-import org.apache.felix.upnp.basedriver.Activator;
-import org.cybergarage.util.Debug;
-import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class Logger implements ServiceListener {
-	
-	private ServiceReference rls;
-	private LogService osgiLogService;
-    private int level;
-	private PrintStream out;
-	public  final static String NEWLINE = System.getProperty("line.separator");
-    public static final String ROW ="\n================REQUEST=====================\n";
-    public static final String END_ROW ="--------------------------------------------";
-    
-	private final static String LEVEL_TO_STRING[] = new String[]{
-		"",
-		"ERROR [ " + Activator.bc.getBundle().getBundleId() + " ] ",
-		"WARNING [ " + Activator.bc.getBundle().getBundleId() + " ] ",
-		"INFO [ " + Activator.bc.getBundle().getBundleId() + " ] ",
-		"DEBUG [ " + Activator.bc.getBundle().getBundleId() + " ] ",
-	};
-	
-	
-	/**
-	 * Create a Logger with <code>System.out</code> as <tt>PrintStream</tt> and without 
-	 * 		reporting message on both <tt>PrintStream</tt> and <tt>LogService</tt>
-	 * 
-	 * @param log <tt>ServiceReference</tt> to the <tt>LogService</tt> to use, 
-	 * 		or null to avoid the use of this service
-	 * 
-	 * @see #Logger(LogService, PrintStream, boolean)
-	 */
-	public Logger(String levelStr){
-	    this.out = System.out;
-		try {
-	        this.level = Integer.parseInt(levelStr);
-	    } catch (Exception ex){
-	    	out.println("WARNING [UPnPBaseDriver Log]: " + levelStr+" is not a valid value!");
-	    	this.level=2;
-	    }
- 	    findService();
-	}
-
-    public void setCyberDebug(String value){
-        try {
-            if (Boolean.valueOf(value).booleanValue()){
-                Debug.on();
-                out.println("INFO [UPnPBaseDriver] Started CyberLink Debug");
-            }
-       } catch (Exception ex){
-            out.println("WARNING [UPnPBaseDriver CyberLog]: " + value +" is not a valid value!");
-        }
-    }
-    
-    ////////////////////////////////////////////////////////////////////////////////////
-    //////////////////////////// programmatic interface ////////////////////////////////
-    ////////////////////////////////////////////////////////////////////////////////////
-    
-    public void setLogLevel(int level){
-        if (level < 0 || level >4 ) throw new IllegalArgumentException("Log Level must be [0-4]");
-        this.level = level;
-    }
-    
-    public int getLogLevel(){
-        return this.level;
-    }
-    
-    
-    public void setCyberDebug(boolean value){
-        if (value) Debug.on();
-        else Debug.off();
-    }
-    
-    public boolean getCyberDebug(){
-        return Debug.isOn();
-    }
-    //////////////////////////// end programmatic interface ////////////////////////////
-   
-    
-	public final void ERROR(String message) {
-	    log(1,message);
-	}
-	
-	public final void WARNING(String message) {
-	    log(2,message);
-	}
-	
-	public final void INFO(String message) {
-	    log(3,message);
-	}
-	
-    public final void DEBUG(String message) {
-        log(4,message);
-    }
-    
-    public final void PACKET(String message) {
-        log(4, new StringBuffer(ROW).append(message).append(END_ROW).toString());
-    }
-
-    /**
-     * Logs a message.
-     *
-     * <p>The <tt>ServiceReference</tt> field and the <tt>Throwable</tt>
-     * field of the <tt>LogEntry</tt> object will be set to <tt>null</tt>.
-     * @param msglevel The severity of the message.
-     * This should be one of the defined log levels
-     * but may be any integer that is interpreted in a user defined way.
-     * @param message Human readable string describing the condition or <tt>null</tt>.
-     * @see #LOG_ERROR
-     * @see #LOG_WARNING
-     * @see #LOG_INFO
-     * @see #LOG_DEBUG
-     */
-	public void log(int msglevel, String message) {
-		synchronized (this) {
-            if (msglevel <= this.level){
-    			if (this.osgiLogService != null ){
-    				    osgiLogService.log(msglevel, message);
-    			}
-    			else {
-    				StringBuffer sb = new StringBuffer(Logger.LEVEL_TO_STRING[msglevel]);
-    			    this.out.println(sb.append(message));
-    			}
-            }
-		}
-		
-	}
-
-	 /**
-     * Logs a message with an exception.
-     *
-     * <p>The <tt>ServiceReference</tt> field of the <tt>LogEntry</tt> object will be set to <tt>null</tt>.
-     * @param msglevel The severity of the message.
-     * This should be one of the defined log levels
-     * but may be any integer that is interpreted in a user defined way.
-     * @param message The human readable string describing the condition or <tt>null</tt>.
-     * @param exception The exception that reflects the condition or <tt>null</tt>.
-     * @see #LOG_ERROR
-     * @see #LOG_WARNING
-     * @see #LOG_INFO
-     * @see #LOG_DEBUG
-     */
-	public void log(int msglevel, String message, Throwable exception) {
-		synchronized (this) {
-            if (msglevel <= this.level){ 
-    			if(this.osgiLogService != null){
-    				    osgiLogService.log(msglevel, message, exception);
-    			}
-    			else {
-    				StringBuffer sb = new StringBuffer(Logger.LEVEL_TO_STRING[msglevel]);
-    			    this.out.println(sb.append(message).append(NEWLINE).append(exception));
-    				exception.printStackTrace(this.out);
-    			}
-            }
-		}
-	}
-
-	private synchronized void setLogService(ServiceReference reference){
-		this.rls = reference;
-		this.osgiLogService = (LogService) Activator.bc.getService(rls);
-	}	
-	/**
-	 * This look for a <tt>LogService</tt> if it founds no <tt>LogService</tt> will register a new
-	 * Listener of LogService 
-	 *
-	 */
-	private synchronized void findService() {
-		//PRE:Actually no LogService are setted and we are registered as ServiceListener 
-		//		for LogService (unregisterin event)
-		this.rls = Activator.bc.getServiceReference(LogService.class.getName());
-		if (this.rls != null){
-			this.osgiLogService = (LogService) Activator.bc.getService(rls);
-		}
-		try {
-			Activator.bc.addServiceListener(this, 
-					"(" + Constants.OBJECTCLASS	+ "=" + LogService.class.getName() + ")"
-			);
-		} catch (InvalidSyntaxException ignore) {}				
-		//POST: We are connected to a LogService or we are registered as ServiceListener 
-		//		for LogService(registering event)
-	}
-	
-	private synchronized void releaseLogService() {
-        if( osgiLogService != null)
-            Activator.bc.ungetService(this.rls);
-		this.rls = null;
-		this.osgiLogService = null;
-	}
-	
-	/**
-	 * Used to keep track the existence of a <tt>LogService</tt>
-	 * 
-	 * @see ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
-	 */
-	public void serviceChanged(ServiceEvent e) {
-		switch (e.getType()) {
-			case ServiceEvent.REGISTERED: {
-			    // put here code check for serviceid
-				setLogService(e.getServiceReference());
-			}break;
-	
-			case ServiceEvent.MODIFIED: 
-			break;
-	
-			case ServiceEvent.UNREGISTERING: {				
-			    // put here code check for serviceid
-				releaseLogService();
-			}break;
-		}		
-	}
-
-	/**
-	 * Stop using the <tt>LogService</tt> and listening for those service event
-	 * 
-	 * NOTE: All the message will be reported to <tt>PrintStream</tt>
-	 *
-	 */
-	public void close(){	
-		Activator.bc.removeServiceListener(this);
-		releaseLogService();
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.tool;
+
+import java.io.PrintStream;
+
+import org.apache.felix.upnp.basedriver.Activator;
+import org.cybergarage.util.Debug;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class Logger implements ServiceListener {
+	
+	private ServiceReference rls;
+	private LogService osgiLogService;
+    private int level;
+	private PrintStream out;
+	public  final static String NEWLINE = System.getProperty("line.separator");
+    public static final String ROW ="\n================REQUEST=====================\n";
+    public static final String END_ROW ="--------------------------------------------";
+    
+	private final static String LEVEL_TO_STRING[] = new String[]{
+		"",
+		"ERROR [ " + Activator.bc.getBundle().getBundleId() + " ] ",
+		"WARNING [ " + Activator.bc.getBundle().getBundleId() + " ] ",
+		"INFO [ " + Activator.bc.getBundle().getBundleId() + " ] ",
+		"DEBUG [ " + Activator.bc.getBundle().getBundleId() + " ] ",
+	};
+	
+	
+	/**
+	 * Create a Logger with <code>System.out</code> as <tt>PrintStream</tt> and without 
+	 * 		reporting message on both <tt>PrintStream</tt> and <tt>LogService</tt>
+	 * 
+	 * @param log <tt>ServiceReference</tt> to the <tt>LogService</tt> to use, 
+	 * 		or null to avoid the use of this service
+	 * 
+	 * @see #Logger(LogService, PrintStream, boolean)
+	 */
+	public Logger(String levelStr){
+	    this.out = System.out;
+		try {
+	        this.level = Integer.parseInt(levelStr);
+	    } catch (Exception ex){
+	    	out.println("WARNING [UPnPBaseDriver Log]: " + levelStr+" is not a valid value!");
+	    	this.level=2;
+	    }
+ 	    findService();
+	}
+
+    public void setCyberDebug(String value){
+        try {
+            if (Boolean.valueOf(value).booleanValue()){
+                Debug.on();
+                out.println("INFO [UPnPBaseDriver] Started CyberLink Debug");
+            }
+       } catch (Exception ex){
+            out.println("WARNING [UPnPBaseDriver CyberLog]: " + value +" is not a valid value!");
+        }
+    }
+    
+    ////////////////////////////////////////////////////////////////////////////////////
+    //////////////////////////// programmatic interface ////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////
+    
+    public void setLogLevel(int level){
+        if (level < 0 || level >4 ) throw new IllegalArgumentException("Log Level must be [0-4]");
+        this.level = level;
+    }
+    
+    public int getLogLevel(){
+        return this.level;
+    }
+    
+    
+    public void setCyberDebug(boolean value){
+        if (value) Debug.on();
+        else Debug.off();
+    }
+    
+    public boolean getCyberDebug(){
+        return Debug.isOn();
+    }
+    //////////////////////////// end programmatic interface ////////////////////////////
+   
+    
+	public final void ERROR(String message) {
+	    log(1,message);
+	}
+	
+	public final void WARNING(String message) {
+	    log(2,message);
+	}
+	
+	public final void INFO(String message) {
+	    log(3,message);
+	}
+	
+    public final void DEBUG(String message) {
+        log(4,message);
+    }
+    
+    public final void PACKET(String message) {
+        log(4, new StringBuffer(ROW).append(message).append(END_ROW).toString());
+    }
+
+    /**
+     * Logs a message.
+     *
+     * <p>The <tt>ServiceReference</tt> field and the <tt>Throwable</tt>
+     * field of the <tt>LogEntry</tt> object will be set to <tt>null</tt>.
+     * @param msglevel The severity of the message.
+     * This should be one of the defined log levels
+     * but may be any integer that is interpreted in a user defined way.
+     * @param message Human readable string describing the condition or <tt>null</tt>.
+     * @see #LOG_ERROR
+     * @see #LOG_WARNING
+     * @see #LOG_INFO
+     * @see #LOG_DEBUG
+     */
+	public void log(int msglevel, String message) {
+		synchronized (this) {
+            if (msglevel <= this.level){
+    			if (this.osgiLogService != null ){
+    				    osgiLogService.log(msglevel, message);
+    			}
+    			else {
+    				StringBuffer sb = new StringBuffer(Logger.LEVEL_TO_STRING[msglevel]);
+    			    this.out.println(sb.append(message));
+    			}
+            }
+		}
+		
+	}
+
+	 /**
+     * Logs a message with an exception.
+     *
+     * <p>The <tt>ServiceReference</tt> field of the <tt>LogEntry</tt> object will be set to <tt>null</tt>.
+     * @param msglevel The severity of the message.
+     * This should be one of the defined log levels
+     * but may be any integer that is interpreted in a user defined way.
+     * @param message The human readable string describing the condition or <tt>null</tt>.
+     * @param exception The exception that reflects the condition or <tt>null</tt>.
+     * @see #LOG_ERROR
+     * @see #LOG_WARNING
+     * @see #LOG_INFO
+     * @see #LOG_DEBUG
+     */
+	public void log(int msglevel, String message, Throwable exception) {
+		synchronized (this) {
+            if (msglevel <= this.level){ 
+    			if(this.osgiLogService != null){
+    				    osgiLogService.log(msglevel, message, exception);
+    			}
+    			else {
+    				StringBuffer sb = new StringBuffer(Logger.LEVEL_TO_STRING[msglevel]);
+    			    this.out.println(sb.append(message).append(NEWLINE).append(exception));
+    				exception.printStackTrace(this.out);
+    			}
+            }
+		}
+	}
+
+	private synchronized void setLogService(ServiceReference reference){
+		this.rls = reference;
+		this.osgiLogService = (LogService) Activator.bc.getService(rls);
+	}	
+	/**
+	 * This look for a <tt>LogService</tt> if it founds no <tt>LogService</tt> will register a new
+	 * Listener of LogService 
+	 *
+	 */
+	private synchronized void findService() {
+		//PRE:Actually no LogService are setted and we are registered as ServiceListener 
+		//		for LogService (unregisterin event)
+		this.rls = Activator.bc.getServiceReference(LogService.class.getName());
+		if (this.rls != null){
+			this.osgiLogService = (LogService) Activator.bc.getService(rls);
+		}
+		try {
+			Activator.bc.addServiceListener(this, 
+					"(" + Constants.OBJECTCLASS	+ "=" + LogService.class.getName() + ")"
+			);
+		} catch (InvalidSyntaxException ignore) {}				
+		//POST: We are connected to a LogService or we are registered as ServiceListener 
+		//		for LogService(registering event)
+	}
+	
+	private synchronized void releaseLogService() {
+        if( osgiLogService != null)
+            Activator.bc.ungetService(this.rls);
+		this.rls = null;
+		this.osgiLogService = null;
+	}
+	
+	/**
+	 * Used to keep track the existence of a <tt>LogService</tt>
+	 * 
+	 * @see ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
+	 */
+	public void serviceChanged(ServiceEvent e) {
+		switch (e.getType()) {
+			case ServiceEvent.REGISTERED: {
+			    // put here code check for serviceid
+				setLogService(e.getServiceReference());
+			}break;
+	
+			case ServiceEvent.MODIFIED: 
+			break;
+	
+			case ServiceEvent.UNREGISTERING: {				
+			    // put here code check for serviceid
+				releaseLogService();
+			}break;
+		}		
+	}
+
+	/**
+	 * Stop using the <tt>LogService</tt> and listening for those service event
+	 * 
+	 * NOTE: All the message will be reported to <tt>PrintStream</tt>
+	 *
+	 */
+	public void close(){	
+		Activator.bc.removeServiceListener(this);
+		releaseLogService();
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Converter.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Converter.java
index 68a602c..8ee1bcb 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Converter.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Converter.java
@@ -1,254 +1,254 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.basedriver.util;
-
-import java.text.ParseException;
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.apache.xerces.impl.dv.util.Base64;
-import org.apache.xerces.impl.dv.util.HexBin;
-
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/** 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class Converter {
-	
-	/**
-	 * 
-	 * @param value Object that contain the value
-	 * @param upnpType String conating the UPnP Type of the Object
-	 * @return a String that contain the UPnP rappresentation of the value contained in Object
-	 * 		of type specified by typeUPnP
-	 */
-	public static String toString(Object value,String upnpType) throws Exception{
-		if((value==null)||(upnpType==null))
-			throw new NullPointerException("Must be specified a valid value and upnpType");
-		
-		if(value instanceof Number){
-			if(value instanceof Integer){
-				return value.toString();
-			}else if(value instanceof Float){
-				return value.toString();
-			}else if(value instanceof Long){
-				if(upnpType.equals(UPnPStateVariable.TYPE_TIME)){
-					long l = ((Long)value).longValue();
-					if(l<0) throw new IllegalArgumentException(l+ "Must be greater than 0");
-					Calendar c = Calendar.getInstance();
-					c.set(Calendar.HOUR_OF_DAY,(int) (l/3600000));					
-					int x=(int) (l % 3600000);
-					c.set(Calendar.MINUTE,(int) (x / 60000));
-					c.set(Calendar.SECOND,(x % 60000)/1000);
-					SimpleDateFormat sdt = new SimpleDateFormat("HH:mm:ss");
-					return sdt.format(c.getTime());
-				}else if(upnpType.equals(UPnPStateVariable.TYPE_TIME_TZ)){
-					long l = ((Long)value).longValue();
-					if(l<0) throw new IllegalArgumentException(l+ "Must be greater than 0");
-					Calendar c = Calendar.getInstance();
-					c.set(Calendar.HOUR_OF_DAY,(int) (l/3600000));					
-					int x=(int) (l % 3600000);
-					c.set(Calendar.MINUTE,(int) (x / 60000));
-					c.set(Calendar.SECOND,(x % 60000)/1000);
-					SimpleDateFormat sdt = new SimpleDateFormat("HH:mm:ssZ");
-					return sdt.format(c.getTime());
-				}else{
-					//Must be UPnPStateVariable.TYPE_UI4)
-					return value.toString();
-				}
-			}else if(value instanceof Double){
-				if(upnpType.equals(UPnPStateVariable.TYPE_FIXED_14_4)){
-					return Long.toString(((Double)value).longValue())+"."+
-						Integer.toString((int) (((((Double)value).doubleValue()*10000D) % 10000)));  
-				}else{
-					//Must be UPnPStateVariable.TYPE_R8 or UPnPStateVariable.TYPE_NUMBER
-					return value.toString();
-				}
-			}
-		}else if(value instanceof Date){
-			if(upnpType.equals("dateTime")){
-				SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
-				return sdt.format(value);				
-			}else if(upnpType.equals("dateTime.tz")){
-				SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
-				return sdt.format(value);								
-			}else if(upnpType.equals("date")){
-				SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd");
-				return sdt.format(value);
-			}
-		}else if(value instanceof Boolean){
-			//Must be UPnPStateVariable.TYPE_BOOLEAN
-			if(((Boolean)value).booleanValue()){
-				return "1";
-			}else{
-				return "0";
-			}
-		}else if(value instanceof Character){
-			//Must be UPnPStateVariable.TYPE_CHAR
-			return value.toString();
-		}else if(value instanceof String){
-			return value.toString();
-			//Must be one of 
-			//	UPnPStateVariable.TYPE_STRING or 
-			//	UPnPStateVariable.TYPE_URI or 
-			//	UPnPStateVariable.TYPE_UUID
-		}else if(value instanceof byte[]){
-			if(upnpType.equals("bin.hex")){
-				return HexBin.encode((byte[]) value);				
-			}else if(upnpType.equals("bin.base64")){
-				return Base64.encode((byte[]) value);
-			}
-		}
-		throw new IllegalArgumentException("Invalid Binding");
-	}
-	
-	/**
-	 * 
-	 * @param value
-	 * @param upnpType
-	 * @return
-	 */
-	public static Object parseString(String value,String upnpType) throws Exception{
-		if (value ==null && upnpType.equals("string"))
-                value = "";
-        if((value==null)||(upnpType==null))
-				throw new NullPointerException("Must be specified a valid value and upnpType");
-		
-		if (upnpType.equals("ui1") || upnpType.equals("ui2")
-				|| upnpType.equals("i1") || upnpType.equals("i2")
-				|| upnpType.equals("i4") || upnpType.equals("int")) {
-			
-			return new Integer(value);
-		} else if (upnpType.equals("ui4")){			
-			return new Long(value);
-		} else if(upnpType.equals("time")){
-			String[] timeFormats=new String[]{"HH:mm:ss"};
-			Date d=getDateValue(value,timeFormats,timeFormats);
-			
-			Calendar c = Calendar.getInstance();
-			c.setTime(d);
-			return new Long(
-					c.get(Calendar.HOUR_OF_DAY)*3600000
-					+c.get(Calendar.MINUTE)*60000
-					+c.get(Calendar.SECOND)*1000
-			);
-		} else if(upnpType.equals("time.tz")) {
-			String[] timeFormats=new String[]{"HH:mm:ssZ","HH:mm:ss"};
-			Date d=getDateValue(value,timeFormats,timeFormats);
-			TimeZone tz = TimeZone.getDefault();			
-			Calendar c = Calendar.getInstance(tz);
-			c.setTime(d);
-			
-			if(timeFormats[0].equals("HH:mm:ssZ")&&(tz.inDaylightTime(d)))
-				c.add(Calendar.MILLISECOND,3600000);
-			return new Long(
-					c.get(Calendar.HOUR_OF_DAY)*3600000
-					+c.get(Calendar.MINUTE)*60000
-					+c.get(Calendar.SECOND)*1000					
-			);
-		} else if (upnpType.equals("r4") || upnpType.equals("float")) {				
-			return new Float(value);
-		} else if (upnpType.equals("r8") || upnpType.equals("number")
-			|| upnpType.equals("fixed.14.4")){			
-			return new Double(value);
-		} else if (upnpType.equals("char")) {			
-			return new Character(value.charAt(0));
-		} else if (upnpType.equals("string") || upnpType.equals("uri")
-				|| upnpType.equals("uuid")) {			
-			return value;
-		} else if (upnpType.equals("date")) {
-			String[] timeFormats=new String[]{"yyyy-MM-dd"};
-			
-			Date d=getDateValue(value,timeFormats,timeFormats);
-			return d;			
-		} else if (upnpType.equals("dateTime")) {
-			
-			String[] timeFormats=new String[]{
-					"yyyy-MM-dd",
-					"yyyy-MM-dd'T'HH:mm:ss"
-			};
-			
-			Date d=getDateValue(value,timeFormats,timeFormats);
-			return d;
-		} else if (upnpType.equals("dateTime.tz")) {
-			
-			String[] timeFormats=new String[]{
-					"yyyy-MM-dd",
-					"yyyy-MM-dd'T'HH:mm:ss",
-					"yyyy-MM-dd'T'HH:mm:ssZ"
-			};
-			
-			Date d=getDateValue(value,timeFormats,timeFormats);
-			return d;			
-		} else if (upnpType.equals("boolean")) {
-			if(value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("true")
-			|| value.equalsIgnoreCase("1"))
-				return Boolean.TRUE;
-			else
-				return Boolean.FALSE;					
-		} else if (upnpType.equals("bin.base64")) {
-			return Base64.decode(value);
-		} else if (upnpType.equals("bin.hex")) {
-			return HexBin.decode(value);
-		}
-		throw new IllegalArgumentException("Invalid Binding");		
-	}
-	
-	private static String normalizeTimeZone(String value){
-		if(value.endsWith("Z")){
-			value=value.substring(0,value.length()-1)+"+0000";
-		}else if((value.length()>7)
-			&&(value.charAt(value.length()-3)==':')
-			&&((value.charAt(value.length()-6)=='-')||(value.charAt(value.length()-6)=='+'))){
-			
-			value=value.substring(0,value.length()-3)+value.substring(value.length()-2);
-		}		
-		return value;
-	}
-	
-	/**
-	 * @param value
-	 * @param timeFormats
-	 * @param choosedIndex
-	 * @return
-	 * @throws ParseException
-	 */
-	private static Date getDateValue(String value, String[] timeFormats, String[] choosedIndex) throws ParseException {
-		ParsePosition position = null;
-		Date d;
-		value=normalizeTimeZone(value);
-		for (int i=0; i<timeFormats.length; i++) {
-			position =  new ParsePosition(0);
-			SimpleDateFormat  sdt = new SimpleDateFormat(timeFormats[i]);
-			d=sdt.parse(value,position);
-			if(d!=null){
-				if(position.getIndex()>=value.length()){
-					choosedIndex[0]=timeFormats[i];
-					return d;			
-				}
-			}
-		}
-		throw new ParseException("Error parsing "+value,position.getIndex());
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.basedriver.util;
+
+import java.text.ParseException;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.apache.xerces.impl.dv.util.Base64;
+import org.apache.xerces.impl.dv.util.HexBin;
+
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/** 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class Converter {
+	
+	/**
+	 * 
+	 * @param value Object that contain the value
+	 * @param upnpType String conating the UPnP Type of the Object
+	 * @return a String that contain the UPnP rappresentation of the value contained in Object
+	 * 		of type specified by typeUPnP
+	 */
+	public static String toString(Object value,String upnpType) throws Exception{
+		if((value==null)||(upnpType==null))
+			throw new NullPointerException("Must be specified a valid value and upnpType");
+		
+		if(value instanceof Number){
+			if(value instanceof Integer){
+				return value.toString();
+			}else if(value instanceof Float){
+				return value.toString();
+			}else if(value instanceof Long){
+				if(upnpType.equals(UPnPStateVariable.TYPE_TIME)){
+					long l = ((Long)value).longValue();
+					if(l<0) throw new IllegalArgumentException(l+ "Must be greater than 0");
+					Calendar c = Calendar.getInstance();
+					c.set(Calendar.HOUR_OF_DAY,(int) (l/3600000));					
+					int x=(int) (l % 3600000);
+					c.set(Calendar.MINUTE,(int) (x / 60000));
+					c.set(Calendar.SECOND,(x % 60000)/1000);
+					SimpleDateFormat sdt = new SimpleDateFormat("HH:mm:ss");
+					return sdt.format(c.getTime());
+				}else if(upnpType.equals(UPnPStateVariable.TYPE_TIME_TZ)){
+					long l = ((Long)value).longValue();
+					if(l<0) throw new IllegalArgumentException(l+ "Must be greater than 0");
+					Calendar c = Calendar.getInstance();
+					c.set(Calendar.HOUR_OF_DAY,(int) (l/3600000));					
+					int x=(int) (l % 3600000);
+					c.set(Calendar.MINUTE,(int) (x / 60000));
+					c.set(Calendar.SECOND,(x % 60000)/1000);
+					SimpleDateFormat sdt = new SimpleDateFormat("HH:mm:ssZ");
+					return sdt.format(c.getTime());
+				}else{
+					//Must be UPnPStateVariable.TYPE_UI4)
+					return value.toString();
+				}
+			}else if(value instanceof Double){
+				if(upnpType.equals(UPnPStateVariable.TYPE_FIXED_14_4)){
+					return Long.toString(((Double)value).longValue())+"."+
+						Integer.toString((int) (((((Double)value).doubleValue()*10000D) % 10000)));  
+				}else{
+					//Must be UPnPStateVariable.TYPE_R8 or UPnPStateVariable.TYPE_NUMBER
+					return value.toString();
+				}
+			}
+		}else if(value instanceof Date){
+			if(upnpType.equals("dateTime")){
+				SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+				return sdt.format(value);				
+			}else if(upnpType.equals("dateTime.tz")){
+				SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+				return sdt.format(value);								
+			}else if(upnpType.equals("date")){
+				SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd");
+				return sdt.format(value);
+			}
+		}else if(value instanceof Boolean){
+			//Must be UPnPStateVariable.TYPE_BOOLEAN
+			if(((Boolean)value).booleanValue()){
+				return "1";
+			}else{
+				return "0";
+			}
+		}else if(value instanceof Character){
+			//Must be UPnPStateVariable.TYPE_CHAR
+			return value.toString();
+		}else if(value instanceof String){
+			return value.toString();
+			//Must be one of 
+			//	UPnPStateVariable.TYPE_STRING or 
+			//	UPnPStateVariable.TYPE_URI or 
+			//	UPnPStateVariable.TYPE_UUID
+		}else if(value instanceof byte[]){
+			if(upnpType.equals("bin.hex")){
+				return HexBin.encode((byte[]) value);				
+			}else if(upnpType.equals("bin.base64")){
+				return Base64.encode((byte[]) value);
+			}
+		}
+		throw new IllegalArgumentException("Invalid Binding");
+	}
+	
+	/**
+	 * 
+	 * @param value
+	 * @param upnpType
+	 * @return
+	 */
+	public static Object parseString(String value,String upnpType) throws Exception{
+		if (value ==null && upnpType.equals("string"))
+                value = "";
+        if((value==null)||(upnpType==null))
+				throw new NullPointerException("Must be specified a valid value and upnpType");
+		
+		if (upnpType.equals("ui1") || upnpType.equals("ui2")
+				|| upnpType.equals("i1") || upnpType.equals("i2")
+				|| upnpType.equals("i4") || upnpType.equals("int")) {
+			
+			return new Integer(value);
+		} else if (upnpType.equals("ui4")){			
+			return new Long(value);
+		} else if(upnpType.equals("time")){
+			String[] timeFormats=new String[]{"HH:mm:ss"};
+			Date d=getDateValue(value,timeFormats,timeFormats);
+			
+			Calendar c = Calendar.getInstance();
+			c.setTime(d);
+			return new Long(
+					c.get(Calendar.HOUR_OF_DAY)*3600000
+					+c.get(Calendar.MINUTE)*60000
+					+c.get(Calendar.SECOND)*1000
+			);
+		} else if(upnpType.equals("time.tz")) {
+			String[] timeFormats=new String[]{"HH:mm:ssZ","HH:mm:ss"};
+			Date d=getDateValue(value,timeFormats,timeFormats);
+			TimeZone tz = TimeZone.getDefault();			
+			Calendar c = Calendar.getInstance(tz);
+			c.setTime(d);
+			
+			if(timeFormats[0].equals("HH:mm:ssZ")&&(tz.inDaylightTime(d)))
+				c.add(Calendar.MILLISECOND,3600000);
+			return new Long(
+					c.get(Calendar.HOUR_OF_DAY)*3600000
+					+c.get(Calendar.MINUTE)*60000
+					+c.get(Calendar.SECOND)*1000					
+			);
+		} else if (upnpType.equals("r4") || upnpType.equals("float")) {				
+			return new Float(value);
+		} else if (upnpType.equals("r8") || upnpType.equals("number")
+			|| upnpType.equals("fixed.14.4")){			
+			return new Double(value);
+		} else if (upnpType.equals("char")) {			
+			return new Character(value.charAt(0));
+		} else if (upnpType.equals("string") || upnpType.equals("uri")
+				|| upnpType.equals("uuid")) {			
+			return value;
+		} else if (upnpType.equals("date")) {
+			String[] timeFormats=new String[]{"yyyy-MM-dd"};
+			
+			Date d=getDateValue(value,timeFormats,timeFormats);
+			return d;			
+		} else if (upnpType.equals("dateTime")) {
+			
+			String[] timeFormats=new String[]{
+					"yyyy-MM-dd",
+					"yyyy-MM-dd'T'HH:mm:ss"
+			};
+			
+			Date d=getDateValue(value,timeFormats,timeFormats);
+			return d;
+		} else if (upnpType.equals("dateTime.tz")) {
+			
+			String[] timeFormats=new String[]{
+					"yyyy-MM-dd",
+					"yyyy-MM-dd'T'HH:mm:ss",
+					"yyyy-MM-dd'T'HH:mm:ssZ"
+			};
+			
+			Date d=getDateValue(value,timeFormats,timeFormats);
+			return d;			
+		} else if (upnpType.equals("boolean")) {
+			if(value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("true")
+			|| value.equalsIgnoreCase("1"))
+				return Boolean.TRUE;
+			else
+				return Boolean.FALSE;					
+		} else if (upnpType.equals("bin.base64")) {
+			return Base64.decode(value);
+		} else if (upnpType.equals("bin.hex")) {
+			return HexBin.decode(value);
+		}
+		throw new IllegalArgumentException("Invalid Binding");		
+	}
+	
+	private static String normalizeTimeZone(String value){
+		if(value.endsWith("Z")){
+			value=value.substring(0,value.length()-1)+"+0000";
+		}else if((value.length()>7)
+			&&(value.charAt(value.length()-3)==':')
+			&&((value.charAt(value.length()-6)=='-')||(value.charAt(value.length()-6)=='+'))){
+			
+			value=value.substring(0,value.length()-3)+value.substring(value.length()-2);
+		}		
+		return value;
+	}
+	
+	/**
+	 * @param value
+	 * @param timeFormats
+	 * @param choosedIndex
+	 * @return
+	 * @throws ParseException
+	 */
+	private static Date getDateValue(String value, String[] timeFormats, String[] choosedIndex) throws ParseException {
+		ParsePosition position = null;
+		Date d;
+		value=normalizeTimeZone(value);
+		for (int i=0; i<timeFormats.length; i++) {
+			position =  new ParsePosition(0);
+			SimpleDateFormat  sdt = new SimpleDateFormat(timeFormats[i]);
+			d=sdt.parse(value,position);
+			if(d!=null){
+				if(position.getIndex()>=value.length()){
+					choosedIndex[0]=timeFormats[i];
+					return d;			
+				}
+			}
+		}
+		throw new ParseException("Error parsing "+value,position.getIndex());
+	}
+}
diff --git a/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/Base64.java b/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/Base64.java
index 8a15e63..947dc8b 100644
--- a/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/Base64.java
+++ b/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/Base64.java
@@ -35,7 +35,7 @@
  *
  * @author Jeffrey Rodriguez
  * @author Sandy Gao
- * @version $Id: Base64.java,v 1.15 2004/10/14 15:20:18 mrglavas Exp $
+ * @version $Id$
  */
 public final class  Base64 {
 
diff --git a/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/HexBin.java b/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/HexBin.java
index 8a9249d..6590f73 100644
--- a/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/HexBin.java
+++ b/upnp/basedriver/src/main/java/org/apache/xerces/impl/dv/util/HexBin.java
@@ -27,7 +27,7 @@
  * @xerces.internal  
  * 
  * @author Jeffrey Rodriguez
- * @version $Id: HexBin.java,v 1.13 2004/10/14 15:20:18 mrglavas Exp $
+ * @version $Id$
  */
 public final class  HexBin {
     static private final int  BASELENGTH   = 128;
diff --git a/upnp/doc/config.properties.upnp b/upnp/doc/config.properties.upnp
index 6da7806..9f44b0e 100644
--- a/upnp/doc/config.properties.upnp
+++ b/upnp/doc/config.properties.upnp
@@ -1,510 +1,510 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#
-# Framework config properties.
-#
-org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
- org.osgi.service.packageadmin; version=1.2.0, \
- org.osgi.service.startlevel; version=1.0.0, \
- org.osgi.service.url; version=1.0.0, \
- org.osgi.util.tracker; version=1.3.2 \
- ${jre-${java.specification.version}}
-
-#org.osgi.framework.bootdelegation=sun.*,com.sun.*
-
-felix.cache.profile=upnp
-
-felix.auto.start.1= \
- file:bundle/org.apache.felix.shell-1.1.0-SNAPSHOT.jar \
- file:bundle/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar \
- file:bundle/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT.jar \
- file:../org.osgi.core/target/org.osgi.core-1.1.0-SNAPSHOT.jar \
- file:../javax.servlet/target/javax.servlet-1.0.1-SNAPSHOT.jar \
- file:../org.osgi.compendium/target/org.osgi.compendium-1.1.0-SNAPSHOT.jar \
- file:../http.jetty/target/org.apache.felix.http.jetty-0.9.0-SNAPSHOT.jar \
- file:../upnp/basedriver/target/org.apache.felix.upnp.basedriver-0.3.0-SNAPSHOT.jar \
- file:../upnp/extra/target/org.apache.felix.upnp.extra-0.3.0-SNAPSHOT.jar \
- file:../upnp/tester/target/org.apache.felix.upnp.tester-0.2.0-SNAPSHOT.jar \
- file:../upnp/samples/tv/target/org.apache.felix.upnp.sample.tv-0.2.0-SNAPSHOT.jar \
- file:../upnp/samples/clock/target/org.apache.felix.upnp.sample.clock-0.2.0-SNAPSHOT.jar \
- file:../upnp/samples/binarylight/target/org.apache.felix.upnp.sample.binaryLight-0.2.0-SNAPSHOT.jar
-
-felix.log.level=4
-felix.startlevel.framework=1
-felix.startlevel.bundle=1
-#framework.service.urlhandlers=false
-
-#
-# Bundle config properties.
-#
-org.osgi.service.http.port=8080
-osgi.shell.telnet=on
-#obr.repository.url=http://bundles.osgi.org/obr/browse?_xml=1&cmd=repository
-
-
-#
-# UPnP Basedriver properties
-#
-
-#felix.upnpbase.log=2
-#felix.upnpbase.exporter.enabled=true
-#felix.upnpbase.importer.enabled=true
-#felix.upnpbase.cyberdomo.log=false
-#felix.upnpbase.cyberdomo.net.loopback=false
-#felix.upnpbase.cyberdomo.net.onlyIPV4=true
-#felix.upnpbase.cyberdomo.net.onlyIPV6=false
-
-#
-# Other useful properties you might configure are
-# the System Properties used by Cyberdomo (e.g. -Dcyberdomo.ssdp.mx=10)
-#
-# cyberdomo.ssdp.mx (default 5)
-# cyberdomo.ssdp.buffersize (default 2048)
-# cyberdomo.ssdp.port (default 1900 )
-#
-
-#
-# Java platform package export properties.
-#
-jre-1.3=, \
- javax.accessibility; \
- javax.naming; \
- javax.naming.directory; \
- javax.naming.event; \
- javax.naming.ldap; \
- javax.naming.spi; \
- javax.rmi; \
- javax.rmi.CORBA; \
- javax.sound.midi; \
- javax.sound.midi.spi; \
- javax.sound.sampled; \
- javax.sound.sampled.spi; \
- javax.swing; \
- javax.swing.border; \
- javax.swing.colorchooser; \
- javax.swing.event; \
- javax.swing.filechooser; \
- javax.swing.plaf; \
- javax.swing.plaf.basic; \
- javax.swing.plaf.metal; \
- javax.swing.plaf.multi; \
- javax.swing.table; \
- javax.swing.text; \
- javax.swing.text.html; \
- javax.swing.text.html.parser; \
- javax.swing.text.rtf; \
- javax.swing.tree; \
- javax.swing.undo; \
- javax.transaction; \
- org.omg.CORBA; \
- org.omg.CORBA_2_3; \
- org.omg.CORBA_2_3.portable; \
- org.omg.CORBA.DynAnyPackage; \
- org.omg.CORBA.ORBPackage; \
- org.omg.CORBA.portable; \
- org.omg.CORBA.TypeCodePackage; \
- org.omg.CosNaming; \
- org.omg.CosNaming.NamingContextPackage; \
- org.omg.SendingContext; \
- org.omg.stub.java.rmi; \
- version="1.3.0"
-
-jre-1.4=, \
- javax.accessibility; \
- javax.crypto; \
- javax.crypto.interfaces; \
- javax.crypto.spec; \
- javax.imageio; \
- javax.imageio.event; \
- javax.imageio.metadata; \
- javax.imageio.plugins.jpeg; \
- javax.imageio.spi; \
- javax.imageio.stream; \
- javax.naming; \
- javax.naming.directory; \
- javax.naming.event; \
- javax.naming.ldap; \
- javax.naming.spi; \
- javax.net; \
- javax.net.ssl; \
- javax.print; \
- javax.print.attribute; \
- javax.print.attribute.standard; \
- javax.print.event; \
- javax.rmi; \
- javax.rmi.CORBA; \
- javax.security.auth; \
- javax.security.auth.callback; \
- javax.security.auth.kerberos; \
- javax.security.auth.login; \
- javax.security.auth.spi; \
- javax.security.auth.x500; \
- javax.sound.midi; \
- javax.sound.midi.spi; \
- javax.sound.sampled; \
- javax.sound.sampled.spi; \
- javax.sql; \
- javax.swing; \
- javax.swing.border; \
- javax.swing.colorchooser; \
- javax.swing.event; \
- javax.swing.filechooser; \
- javax.swing.plaf; \
- javax.swing.plaf.basic; \
- javax.swing.plaf.metal; \
- javax.swing.plaf.multi; \
- javax.swing.table; \
- javax.swing.text; \
- javax.swing.text.html; \
- javax.swing.text.html.parser; \
- javax.swing.text.rtf; \
- javax.swing.tree; \
- javax.swing.undo; \
- javax.transaction; \
- javax.transaction.xa; \
- javax.xml.parsers; \
- javax.xml.transform; \
- javax.xml.transform.dom; \
- javax.xml.transform.sax; \
- javax.xml.transform.stream; \
- org.ietf.jgss; \
- org.omg.CORBA; \
- org.omg.CORBA_2_3; \
- org.omg.CORBA_2_3.portable; \
- org.omg.CORBA.DynAnyPackage; \
- org.omg.CORBA.ORBPackage; \
- org.omg.CORBA.portable; \
- org.omg.CORBA.TypeCodePackage; \
- org.omg.CosNaming; \
- org.omg.CosNaming.NamingContextExtPackage; \
- org.omg.CosNaming.NamingContextPackage; \
- org.omg.Dynamic; \
- org.omg.DynamicAny; \
- org.omg.DynamicAny.DynAnyFactoryPackage; \
- org.omg.DynamicAny.DynAnyPackage; \
- org.omg.IOP; \
- org.omg.IOP.CodecFactoryPackage; \
- org.omg.IOP.CodecPackage; \
- org.omg.Messaging; \
- org.omg.PortableInterceptor; \
- org.omg.PortableInterceptor.ORBInitInfoPackage; \
- org.omg.PortableServer; \
- org.omg.PortableServer.CurrentPackage; \
- org.omg.PortableServer.POAManagerPackage; \
- org.omg.PortableServer.POAPackage; \
- org.omg.PortableServer.portable; \
- org.omg.PortableServer.ServantLocatorPackage; \
- org.omg.SendingContext; \
- org.omg.stub.java.rmi; \
- org.w3c.dom; \
- org.w3c.dom.css; \
- org.w3c.dom.events; \
- org.w3c.dom.html; \
- org.w3c.dom.stylesheets; \
- org.w3c.dom.traversal; \
- org.w3c.dom.views; \
- org.xml.sax; \
- org.xml.sax.ext; \
- org.xml.sax.helpers; \
- version="1.4.0"
-
-jre-1.5=, \
- javax.accessibility; \
- javax.activity; \
- javax.crypto; \
- javax.crypto.interfaces; \
- javax.crypto.spec; \
- javax.imageio; \
- javax.imageio.event; \
- javax.imageio.metadata; \
- javax.imageio.plugins.bmp; \
- javax.imageio.plugins.jpeg; \
- javax.imageio.spi; \
- javax.imageio.stream; \
- javax.management; \
- javax.management.loading; \
- javax.management.modelmbean; \
- javax.management.monitor; \
- javax.management.openmbean; \
- javax.management.relation; \
- javax.management.remote; \
- javax.management.remote.rmi; \
- javax.management.timer; \
- javax.naming; \
- javax.naming.directory; \
- javax.naming.event; \
- javax.naming.ldap; \
- javax.naming.spi; \
- javax.net; \
- javax.net.ssl; \
- javax.print; \
- javax.print.attribute; \
- javax.print.attribute.standard; \
- javax.print.event; \
- javax.rmi; \
- javax.rmi.CORBA; \
- javax.rmi.ssl; \
- javax.security.auth; \
- javax.security.auth.callback; \
- javax.security.auth.kerberos; \
- javax.security.auth.login; \
- javax.security.auth.spi; \
- javax.security.auth.x500; \
- javax.security.sasl; \
- javax.sound.midi; \
- javax.sound.midi.spi; \
- javax.sound.sampled; \
- javax.sound.sampled.spi; \
- javax.sql; \
- javax.sql.rowset; \
- javax.sql.rowset.serial; \
- javax.sql.rowset.spi; \
- javax.swing; \
- javax.swing.border; \
- javax.swing.colorchooser; \
- javax.swing.event; \
- javax.swing.filechooser; \
- javax.swing.plaf; \
- javax.swing.plaf.basic; \
- javax.swing.plaf.metal; \
- javax.swing.plaf.multi; \
- javax.swing.plaf.synth; \
- javax.swing.table; \
- javax.swing.text; \
- javax.swing.text.html; \
- javax.swing.text.html.parser; \
- javax.swing.text.rtf; \
- javax.swing.tree; \
- javax.swing.undo; \
- javax.transaction; \
- javax.transaction.xa; \
- javax.xml; \
- javax.xml.datatype; \
- javax.xml.namespace; \
- javax.xml.parsers; \
- javax.xml.transform; \
- javax.xml.transform.dom; \
- javax.xml.transform.sax; \
- javax.xml.transform.stream; \
- javax.xml.validation; \
- javax.xml.xpath; \
- org.ietf.jgss; \
- org.omg.CORBA; \
- org.omg.CORBA_2_3; \
- org.omg.CORBA_2_3.portable; \
- org.omg.CORBA.DynAnyPackage; \
- org.omg.CORBA.ORBPackage; \
- org.omg.CORBA.portable; \
- org.omg.CORBA.TypeCodePackage; \
- org.omg.CosNaming; \
- org.omg.CosNaming.NamingContextExtPackage; \
- org.omg.CosNaming.NamingContextPackage; \
- org.omg.Dynamic; \
- org.omg.DynamicAny; \
- org.omg.DynamicAny.DynAnyFactoryPackage; \
- org.omg.DynamicAny.DynAnyPackage; \
- org.omg.IOP; \
- org.omg.IOP.CodecFactoryPackage; \
- org.omg.IOP.CodecPackage; \
- org.omg.Messaging; \
- org.omg.PortableInterceptor; \
- org.omg.PortableInterceptor.ORBInitInfoPackage; \
- org.omg.PortableServer; \
- org.omg.PortableServer.CurrentPackage; \
- org.omg.PortableServer.POAManagerPackage; \
- org.omg.PortableServer.POAPackage; \
- org.omg.PortableServer.portable; \
- org.omg.PortableServer.ServantLocatorPackage; \
- org.omg.SendingContext; \
- org.omg.stub.java.rmi; \
- org.omg.stub.javax.management.remote.rmi; \
- org.w3c.dom; \
- org.w3c.dom.bootstrap; \
- org.w3c.dom.css; \
- org.w3c.dom.events; \
- org.w3c.dom.html; \
- org.w3c.dom.ls; \
- org.w3c.dom.ranges; \
- org.w3c.dom.stylesheets; \
- org.w3c.dom.traversal; \
- org.w3c.dom.views; \
- org.xml.sax; \
- org.xml.sax.ext; \
- org.xml.sax.helpers; \
- version="1.5.0"
-
-jre-1.6=, \
- javax.accessibility; \
- javax.activation; \
- javax.activity; \
- javax.annotation; \
- javax.annotation.processing; \
- javax.crypto; \
- javax.crypto.interfaces; \
- javax.crypto.spec; \
- javax.imageio; \
- javax.imageio.event; \
- javax.imageio.metadata; \
- javax.imageio.plugins.bmp; \
- javax.imageio.plugins.jpeg; \
- javax.imageio.spi; \
- javax.imageio.stream; \
- javax.jws; \
- javax.jws.soap; \
- javax.lang.model; \
- javax.lang.model.element; \
- javax.lang.model.type; \
- javax.lang.model.util; \
- javax.management; \
- javax.management.loading; \
- javax.management.modelmbean; \
- javax.management.monitor; \
- javax.management.openmbean; \
- javax.management.relation; \
- javax.management.remote; \
- javax.management.remote.rmi; \
- javax.management.timer; \
- javax.naming; \
- javax.naming.directory; \
- javax.naming.event; \
- javax.naming.ldap; \
- javax.naming.spi; \
- javax.net; \
- javax.net.ssl; \
- javax.print; \
- javax.print.attribute; \
- javax.print.attribute.standard; \
- javax.print.event; \
- javax.rmi; \
- javax.rmi.CORBA; \
- javax.rmi.ssl; \
- javax.script; \
- javax.security.auth; \
- javax.security.auth.callback; \
- javax.security.auth.kerberos; \
- javax.security.auth.login; \
- javax.security.auth.spi; \
- javax.security.auth.x500; \
- javax.security.cert; \
- javax.security.sasl; \
- javax.sound.midi; \
- javax.sound.midi.spi; \
- javax.sound.sampled; \
- javax.sound.sampled.spi; \
- javax.sql; \
- javax.sql.rowset; \
- javax.sql.rowset.serial; \
- javax.sql.rowset.spi; \
- javax.swing; \
- javax.swing.border; \
- javax.swing.colorchooser; \
- javax.swing.event; \
- javax.swing.filechooser; \
- javax.swing.plaf; \
- javax.swing.plaf.basic; \
- javax.swing.plaf.metal; \
- javax.swing.plaf.multi; \
- javax.swing.plaf.synth; \
- javax.swing.table; \
- javax.swing.text; \
- javax.swing.text.html; \
- javax.swing.text.html.parser; \
- javax.swing.text.rtf; \
- javax.swing.tree; \
- javax.swing.undo; \
- javax.tools; \
- javax.transaction; \
- javax.transaction.xa; \
- javax.xml; \
- javax.xml.bind; \
- javax.xml.bind.annotation; \
- javax.xml.bind.annotation.adapters; \
- javax.xml.bind.attachment; \
- javax.xml.bind.helpers; \
- javax.xml.bind.util; \
- javax.xml.crypto; \
- javax.xml.crypto.dom; \
- javax.xml.crypto.dsig; \
- javax.xml.crypto.dsig.dom; \
- javax.xml.crypto.dsig.keyinfo; \
- javax.xml.crypto.dsig.spec; \
- javax.xml.datatype; \
- javax.xml.namespace; \
- javax.xml.parsers; \
- javax.xml.soap; \
- javax.xml.stream; \
- javax.xml.stream.events; \
- javax.xml.stream.util; \
- javax.xml.transform; \
- javax.xml.transform.dom; \
- javax.xml.transform.sax; \
- javax.xml.transform.stax; \
- javax.xml.transform.stream; \
- javax.xml.validation; \
- javax.xml.ws; \
- javax.xml.ws.handler; \
- javax.xml.ws.handler.soap; \
- javax.xml.ws.http; \
- javax.xml.ws.soap; \
- javax.xml.ws.spi; \
- javax.xml.xpath; \
- org.ietf.jgss; \
- org.omg.CORBA; \
- org.omg.CORBA_2_3; \
- org.omg.CORBA_2_3.portable; \
- org.omg.CORBA.DynAnyPackage; \
- org.omg.CORBA.ORBPackage; \
- org.omg.CORBA.portable; \
- org.omg.CORBA.TypeCodePackage; \
- org.omg.CosNaming; \
- org.omg.CosNaming.NamingContextExtPackage; \
- org.omg.CosNaming.NamingContextPackage; \
- org.omg.Dynamic; \
- org.omg.DynamicAny; \
- org.omg.DynamicAny.DynAnyFactoryPackage; \
- org.omg.DynamicAny.DynAnyPackage; \
- org.omg.IOP; \
- org.omg.IOP.CodecFactoryPackage; \
- org.omg.IOP.CodecPackage; \
- org.omg.Messaging; \
- org.omg.PortableInterceptor; \
- org.omg.PortableInterceptor.ORBInitInfoPackage; \
- org.omg.PortableServer; \
- org.omg.PortableServer.CurrentPackage; \
- org.omg.PortableServer.POAManagerPackage; \
- org.omg.PortableServer.POAPackage; \
- org.omg.PortableServer.portable; \
- org.omg.PortableServer.ServantLocatorPackage; \
- org.omg.SendingContext; \
- org.omg.stub.java.rmi; \
- org.omg.stub.javax.management.remote.rmi; \
- org.w3c.dom; \
- org.w3c.dom.bootstrap; \
- org.w3c.dom.css; \
- org.w3c.dom.events; \
- org.w3c.dom.html; \
- org.w3c.dom.ls; \
- org.w3c.dom.ranges; \
- org.w3c.dom.stylesheets; \
- org.w3c.dom.traversal; \
- org.w3c.dom.views; \
- org.w3c.dom.xpath; \
- org.xml.sax; \
- org.xml.sax.ext; \
- org.xml.sax.helpers; \
- version=\"1.6.0\"
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.0.0, \
+ org.osgi.service.url; version=1.0.0, \
+ org.osgi.util.tracker; version=1.3.2 \
+ ${jre-${java.specification.version}}
+
+#org.osgi.framework.bootdelegation=sun.*,com.sun.*
+
+felix.cache.profile=upnp
+
+felix.auto.start.1= \
+ file:bundle/org.apache.felix.shell-1.1.0-SNAPSHOT.jar \
+ file:bundle/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar \
+ file:bundle/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT.jar \
+ file:../org.osgi.core/target/org.osgi.core-1.1.0-SNAPSHOT.jar \
+ file:../javax.servlet/target/javax.servlet-1.0.1-SNAPSHOT.jar \
+ file:../org.osgi.compendium/target/org.osgi.compendium-1.1.0-SNAPSHOT.jar \
+ file:../http.jetty/target/org.apache.felix.http.jetty-0.9.0-SNAPSHOT.jar \
+ file:../upnp/basedriver/target/org.apache.felix.upnp.basedriver-0.9.0-SNAPSHOT.jar \
+ file:../upnp/extra/target/org.apache.felix.upnp.extra-0.3.0-SNAPSHOT.jar \
+ file:../upnp/tester/target/org.apache.felix.upnp.tester-0.2.0-SNAPSHOT.jar \
+ file:../upnp/samples/tv/target/org.apache.felix.upnp.sample.tv-0.2.0-SNAPSHOT.jar \
+ file:../upnp/samples/clock/target/org.apache.felix.upnp.sample.clock-0.2.0-SNAPSHOT.jar \
+ file:../upnp/samples/binarylight/target/org.apache.felix.upnp.sample.binaryLight-0.2.0-SNAPSHOT.jar
+
+felix.log.level=4
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+#framework.service.urlhandlers=false
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+osgi.shell.telnet=on
+#obr.repository.url=http://bundles.osgi.org/obr/browse?_xml=1&cmd=repository
+
+
+#
+# UPnP Basedriver properties
+#
+
+#felix.upnpbase.log=2
+#felix.upnpbase.exporter.enabled=true
+#felix.upnpbase.importer.enabled=true
+#felix.upnpbase.cyberdomo.log=false
+#felix.upnpbase.cyberdomo.net.loopback=false
+#felix.upnpbase.cyberdomo.net.onlyIPV4=true
+#felix.upnpbase.cyberdomo.net.onlyIPV6=false
+
+#
+# Other useful properties you might configure are
+# the System Properties used by Cyberdomo (e.g. -Dcyberdomo.ssdp.mx=10)
+#
+# cyberdomo.ssdp.mx (default 5)
+# cyberdomo.ssdp.buffersize (default 2048)
+# cyberdomo.ssdp.port (default 1900 )
+#
+
+#
+# Java platform package export properties.
+#
+jre-1.3=, \
+ javax.accessibility; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ version="1.3.0"
+
+jre-1.4=, \
+ javax.accessibility; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml.parsers; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stream; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.4.0"
+
+jre-1.5=, \
+ javax.accessibility; \
+ javax.activity; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.5.0"
+
+jre-1.6=, \
+ javax.accessibility; \
+ javax.activation; \
+ javax.activity; \
+ javax.annotation; \
+ javax.annotation.processing; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.jws; \
+ javax.jws.soap; \
+ javax.lang.model; \
+ javax.lang.model.element; \
+ javax.lang.model.type; \
+ javax.lang.model.util; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.script; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.cert; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.tools; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.bind; \
+ javax.xml.bind.annotation; \
+ javax.xml.bind.annotation.adapters; \
+ javax.xml.bind.attachment; \
+ javax.xml.bind.helpers; \
+ javax.xml.bind.util; \
+ javax.xml.crypto; \
+ javax.xml.crypto.dom; \
+ javax.xml.crypto.dsig; \
+ javax.xml.crypto.dsig.dom; \
+ javax.xml.crypto.dsig.keyinfo; \
+ javax.xml.crypto.dsig.spec; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.soap; \
+ javax.xml.stream; \
+ javax.xml.stream.events; \
+ javax.xml.stream.util; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.ws; \
+ javax.xml.ws.handler; \
+ javax.xml.ws.handler.soap; \
+ javax.xml.ws.http; \
+ javax.xml.ws.soap; \
+ javax.xml.ws.spi; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.w3c.dom.xpath; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version=\"1.6.0\"
diff --git a/upnp/doc/upnp.sh.bat b/upnp/doc/upnp.sh.bat
old mode 100644
new mode 100755
index 3c1aa34..3557d59
--- a/upnp/doc/upnp.sh.bat
+++ b/upnp/doc/upnp.sh.bat
@@ -1,8 +1,8 @@
-#!/bin/sh
-
-
-cd ../../main
-
-echo "lauching Felix with UPnP bundles"
-java -Dfelix.config.properties=file:../upnp/doc/config.properties.upnp -jar bin/felix.jar
-
+#!/bin/sh
+
+
+cd ../../main
+
+echo "lauching Felix with UPnP bundles"
+java -Dfelix.config.properties=file:../upnp/doc/config.properties.upnp -jar bin/felix.jar
+
diff --git a/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/EventSource.java b/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/EventSource.java
index fca147e..eedb72a 100644
--- a/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/EventSource.java
+++ b/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/EventSource.java
@@ -1,33 +1,33 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.extra.util;
-
-import java.beans.PropertyChangeListener;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public interface EventSource {
-	void addPropertyChangeListener(PropertyChangeListener listener);
-	void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
-	void removePropertyChangeListener(PropertyChangeListener listener);
-	void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.extra.util;
+
+import java.beans.PropertyChangeListener;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public interface EventSource {
+	void addPropertyChangeListener(PropertyChangeListener listener);
+	void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
+	void removePropertyChangeListener(PropertyChangeListener listener);
+	void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
+}
+
diff --git a/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java b/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java
index 6f40474..0dd7f8b 100644
--- a/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java
+++ b/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java
@@ -1,259 +1,259 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.extra.util;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Dictionary;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Vector;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class UPnPEventNotifier implements PropertyChangeListener, ServiceListener {
-	private BundleContext context;
-	private UPnPDevice device;
-	private UPnPService service;
-	private String deviceId;
-	private String serviceId;
-	
-	private Properties UPnPTargetListener;
-	private Vector upnpListeners = new Vector();
-	final private Object LOCK = new Object();
-	
-	
-	private class NotifierThread extends Thread {
-		private ServiceReference sr;
-		private Properties events;
-
-		public NotifierThread(ServiceReference sr, Properties events){
-			super("UPnPEventNotifier");
-			this.sr = sr;
-			this.events = events;
-		}
-		
-		public void run(){
-			try {
-				UPnPEventListener listener = (UPnPEventListener) context.getService(sr);
-				listener.notifyUPnPEvent(deviceId,serviceId,events);
-				context.ungetService(sr);
-			} catch (Exception ignored){
-			}
-		}
-	}
-
-	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service, EventSource source){
-		this(context,device,service);
-		
-		if (source != null){
-			UPnPStateVariable[] vars = service.getStateVariables();
-			if (vars != null){
-				for (int i=0;i<vars.length;i++){
-					if(vars[i].sendsEvents()){
-						source.addPropertyChangeListener(vars[i].getName(),this);
-					}
-				}
-			}
-		}
-
-	}
-	
-	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service){
-		this.context=context;
-		this.device=device;
-		this.service=service;
-		setupUPnPListenerWatcher();
-	}
-	
-	/**
-	 * @param deviceId
-	 */
-	private void setupUPnPListenerWatcher() {
-		Dictionary dict = device.getDescriptions(null);
-		this.deviceId = (String) dict.get(UPnPDevice.ID);
-		this.serviceId=service.getId();
-		UPnPTargetListener = new Properties();
-		UPnPTargetListener.put(UPnPDevice.ID,deviceId);
-		UPnPTargetListener.put(UPnPService.ID,serviceId);
-		UPnPTargetListener.put(UPnPDevice.TYPE,dict.get(UPnPDevice.TYPE));
-		UPnPTargetListener.put(UPnPService.TYPE,service.getType());
-		String ANY_UPnPEventListener = "("+Constants.OBJECTCLASS+"="+UPnPEventListener.class.getName()+")";
-		
-		synchronized (LOCK) {
-		    try {
-		    	String filter = ANY_UPnPEventListener;
-				context.addServiceListener(this,filter);
-			} catch (Exception ex) {
-				System.out.println(ex);
-			}
-						
-			ServiceReference[] listeners = null; 
-			try {
-				listeners = context.getServiceReferences(UPnPEventListener.class.getName(),null);
-				if (listeners != null){
-					for (int i = 0;i<listeners.length;i++){
-						ServiceReference sr = listeners[i];
-						Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
-						if (filter == null) upnpListeners.add(sr);
-						else {				
-							if (filter.match(UPnPTargetListener))
-								addNewListener(sr);
-						}
-					}
-				}
-			} catch (Exception ex) {
-				System.out.println(ex);
-			}
-			
-			Properties status = getCurrentStatus();
-			if (! status.isEmpty())
-					doNotify(status);
-		
-		} // end LOCK
-	
-	}
-
-	private Properties getCurrentStatus() {
-		Properties status = new Properties();
-		UPnPStateVariable[] vars = service.getStateVariables();
-		if (vars != null){
-			for (int i=0;i<vars.length;i++){
-				if(vars[i].sendsEvents()){
-					if (vars[i] instanceof UPnPLocalStateVariable){
-						UPnPLocalStateVariable localVar = (UPnPLocalStateVariable) vars[i];
-						String property = localVar.getName();
-						Object value = localVar.getCurrentValue();
-						status.put(property,value);						
-					}
-					else {
-						System.out.println("[Warning] The StateVariable (" +vars[i].getName() +")"
-								+ " of device (ID:" + deviceId 	+ ") "
-								+ "should implement the interface UPnPLocalStateVariable");
-					}
-				}
-			} // end for
-		}
-		return status;
-	}
-
-	/* (non-Javadoc)
-	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
-	 */
-	public void propertyChange(PropertyChangeEvent evt) {
-        String property = evt.getPropertyName();
-		Object value = evt.getNewValue();
-		Properties events = new Properties();		
-        events.put(property,value);
-		doNotify(events);
-	}
-
-	private void doNotify(Properties events){
-				
-		synchronized (LOCK) {			
-			Iterator list = upnpListeners.iterator();
-			while (list.hasNext()){
-				final ServiceReference sr = (ServiceReference)list.next();
-				new NotifierThread(sr,events).start();						
-			}
-		}		
-	}
-	
-	private void doNotify(ServiceReference sr) {
-		Properties status = getCurrentStatus();
-		if (! status.isEmpty())
-			new NotifierThread(sr,status).start();						
-	}
-
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
-	 */
-	public void serviceChanged(ServiceEvent e) {
-		ServiceReference sr = e.getServiceReference();		
-		synchronized (LOCK) {			
-			switch(e.getType()){
-				case ServiceEvent.REGISTERED:{
-					Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
-					if (filter == null) {
-						addNewListener(sr);
-						doNotify(sr);
-					}
-					else {				
-						if (filter.match(UPnPTargetListener)){
-							addNewListener(sr);
-							doNotify(sr);
-						}
-					}
-				};break;
-				
-				case ServiceEvent.MODIFIED:{				
-		               Filter filter = (Filter)	sr.getProperty(UPnPEventListener.UPNP_FILTER);
-		               removeListener(sr);
-		               if (filter == null)
-		                   addNewListener(sr);
-		               else {
-		                   if (filter.match(UPnPTargetListener))
-		                       addNewListener(sr);
-		               }
-				};break;
-				
-				case ServiceEvent.UNREGISTERING:{	
-					removeListener(sr);
-				};break;					
-			}
-		}//end LOCK
-		
-	}
-
-
-	/**
-	 * @param reference
-	 */
-	private void removeListener(ServiceReference reference) {
-		upnpListeners.remove(reference);		
-	}
-
-	/**
-	 * @param reference
-	 */
-	private void addNewListener(ServiceReference reference) {
-		upnpListeners.add(reference);	
-	}
-	
-	public void destroy(){
-		context.removeServiceListener(this);
-		upnpListeners.removeAllElements();
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.extra.util;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPLocalStateVariable;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class UPnPEventNotifier implements PropertyChangeListener, ServiceListener {
+	private BundleContext context;
+	private UPnPDevice device;
+	private UPnPService service;
+	private String deviceId;
+	private String serviceId;
+	
+	private Properties UPnPTargetListener;
+	private Vector upnpListeners = new Vector();
+	final private Object LOCK = new Object();
+	
+	
+	private class NotifierThread extends Thread {
+		private ServiceReference sr;
+		private Properties events;
+
+		public NotifierThread(ServiceReference sr, Properties events){
+			super("UPnPEventNotifier");
+			this.sr = sr;
+			this.events = events;
+		}
+		
+		public void run(){
+			try {
+				UPnPEventListener listener = (UPnPEventListener) context.getService(sr);
+				listener.notifyUPnPEvent(deviceId,serviceId,events);
+				context.ungetService(sr);
+			} catch (Exception ignored){
+			}
+		}
+	}
+
+	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service, EventSource source){
+		this(context,device,service);
+		
+		if (source != null){
+			UPnPStateVariable[] vars = service.getStateVariables();
+			if (vars != null){
+				for (int i=0;i<vars.length;i++){
+					if(vars[i].sendsEvents()){
+						source.addPropertyChangeListener(vars[i].getName(),this);
+					}
+				}
+			}
+		}
+
+	}
+	
+	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service){
+		this.context=context;
+		this.device=device;
+		this.service=service;
+		setupUPnPListenerWatcher();
+	}
+	
+	/**
+	 * @param deviceId
+	 */
+	private void setupUPnPListenerWatcher() {
+		Dictionary dict = device.getDescriptions(null);
+		this.deviceId = (String) dict.get(UPnPDevice.ID);
+		this.serviceId=service.getId();
+		UPnPTargetListener = new Properties();
+		UPnPTargetListener.put(UPnPDevice.ID,deviceId);
+		UPnPTargetListener.put(UPnPService.ID,serviceId);
+		UPnPTargetListener.put(UPnPDevice.TYPE,dict.get(UPnPDevice.TYPE));
+		UPnPTargetListener.put(UPnPService.TYPE,service.getType());
+		String ANY_UPnPEventListener = "("+Constants.OBJECTCLASS+"="+UPnPEventListener.class.getName()+")";
+		
+		synchronized (LOCK) {
+		    try {
+		    	String filter = ANY_UPnPEventListener;
+				context.addServiceListener(this,filter);
+			} catch (Exception ex) {
+				System.out.println(ex);
+			}
+						
+			ServiceReference[] listeners = null; 
+			try {
+				listeners = context.getServiceReferences(UPnPEventListener.class.getName(),null);
+				if (listeners != null){
+					for (int i = 0;i<listeners.length;i++){
+						ServiceReference sr = listeners[i];
+						Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
+						if (filter == null) upnpListeners.add(sr);
+						else {				
+							if (filter.match(UPnPTargetListener))
+								addNewListener(sr);
+						}
+					}
+				}
+			} catch (Exception ex) {
+				System.out.println(ex);
+			}
+			
+			Properties status = getCurrentStatus();
+			if (! status.isEmpty())
+					doNotify(status);
+		
+		} // end LOCK
+	
+	}
+
+	private Properties getCurrentStatus() {
+		Properties status = new Properties();
+		UPnPStateVariable[] vars = service.getStateVariables();
+		if (vars != null){
+			for (int i=0;i<vars.length;i++){
+				if(vars[i].sendsEvents()){
+					if (vars[i] instanceof UPnPLocalStateVariable){
+						UPnPLocalStateVariable localVar = (UPnPLocalStateVariable) vars[i];
+						String property = localVar.getName();
+						Object value = localVar.getCurrentValue();
+						status.put(property,value);						
+					}
+					else {
+						System.out.println("[Warning] The StateVariable (" +vars[i].getName() +")"
+								+ " of device (ID:" + deviceId 	+ ") "
+								+ "should implement the interface UPnPLocalStateVariable");
+					}
+				}
+			} // end for
+		}
+		return status;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+	 */
+	public void propertyChange(PropertyChangeEvent evt) {
+        String property = evt.getPropertyName();
+		Object value = evt.getNewValue();
+		Properties events = new Properties();		
+        events.put(property,value);
+		doNotify(events);
+	}
+
+	private void doNotify(Properties events){
+				
+		synchronized (LOCK) {			
+			Iterator list = upnpListeners.iterator();
+			while (list.hasNext()){
+				final ServiceReference sr = (ServiceReference)list.next();
+				new NotifierThread(sr,events).start();						
+			}
+		}		
+	}
+	
+	private void doNotify(ServiceReference sr) {
+		Properties status = getCurrentStatus();
+		if (! status.isEmpty())
+			new NotifierThread(sr,status).start();						
+	}
+
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
+	 */
+	public void serviceChanged(ServiceEvent e) {
+		ServiceReference sr = e.getServiceReference();		
+		synchronized (LOCK) {			
+			switch(e.getType()){
+				case ServiceEvent.REGISTERED:{
+					Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
+					if (filter == null) {
+						addNewListener(sr);
+						doNotify(sr);
+					}
+					else {				
+						if (filter.match(UPnPTargetListener)){
+							addNewListener(sr);
+							doNotify(sr);
+						}
+					}
+				};break;
+				
+				case ServiceEvent.MODIFIED:{				
+		               Filter filter = (Filter)	sr.getProperty(UPnPEventListener.UPNP_FILTER);
+		               removeListener(sr);
+		               if (filter == null)
+		                   addNewListener(sr);
+		               else {
+		                   if (filter.match(UPnPTargetListener))
+		                       addNewListener(sr);
+		               }
+				};break;
+				
+				case ServiceEvent.UNREGISTERING:{	
+					removeListener(sr);
+				};break;					
+			}
+		}//end LOCK
+		
+	}
+
+
+	/**
+	 * @param reference
+	 */
+	private void removeListener(ServiceReference reference) {
+		upnpListeners.remove(reference);		
+	}
+
+	/**
+	 * @param reference
+	 */
+	private void addNewListener(ServiceReference reference) {
+		upnpListeners.add(reference);	
+	}
+	
+	public void destroy(){
+		context.removeServiceListener(this);
+		upnpListeners.removeAllElements();
+	}
+}
diff --git a/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java b/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java
index 3d80a93..9f0bc4b 100644
--- a/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java
+++ b/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java
@@ -1,139 +1,139 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.extra.util;
-
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPService;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPSubscriber {
-	private BundleContext context;
-	private UPnPEventListener listener;
-	private HashMap hash;
-	
-	private class Subscription implements UPnPEventListener{
-	    ServiceRegistration registration;
-	    
-	    Subscription(String keys){
-	 		try {
-				Filter filter = context.createFilter(keys);
-				Properties props = new Properties();
-				props.put(UPnPEventListener.UPNP_FILTER, filter);
-				registration = context.registerService(UPnPEventListener.class.getName(), this, props);
-			}catch (Exception ex){
-				System.out.println(ex);
-			}
-	    }
-	    
-	    public void unsubscribe(){
-			registration.unregister();
-	    }
-	    
-        public void notifyUPnPEvent(String arg0, String arg1, Dictionary arg2) {
-            listener.notifyUPnPEvent( arg0,  arg1,  arg2);
-        }
-	}
-	
-	
-	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
-	    if ((context == null)|| (listener == null))
-	        throw new IllegalArgumentException("Illegal arguments in UPnPSubscriber constructor.");
-		this.context = context;
-		this.listener = listener;
-		hash = new HashMap();
-	}
-
-	public void subscribe(String filter){
-		if (hash.get(filter) == null){
-		    hash.put(filter, new Subscription(filter));
-		}	
-	}
-	
-	public void unsubscribe(String filter){
-		if (hash.containsKey(filter)) {
-		    Subscription subscription = (Subscription) hash.get(filter);
-		    subscription.unsubscribe();
-			hash.remove(filter);
-		}
-	}
-	
-	public void unsubscribeAll(){
-	    Iterator list = hash.entrySet().iterator();
-	    while (list.hasNext()){		        
-	        Map.Entry entry = (Map.Entry) list.next();
-	        Subscription subcription = (Subscription) entry.getValue();
-	        subcription.unsubscribe();
-		    list.remove();
-	    }
-	}
-
-	public String subscribeServiceIdOf(String deviceId, String serviceId){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeServiceTypeOf(String deviceId, String serviceType){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeEveryServiceType(String deviceType, String serviceType){
-		String keys = "(&(" + UPnPDevice.TYPE + "="+ deviceType + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeAllServicesOf(String deviceId){
-		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeEveryDeviceTypeServices(String deviceType){
-		String keys = "(" + UPnPDevice.TYPE + "="+ deviceType + ")";
-		subscribe(keys);
-		return keys;
-	}
-	
-	
-	public void unsubscribeServiceIdOf(String deviceId, String serviceId){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
-		unsubscribe(keys);
-	}
-	
-	public void unsubscribeAllServicesOf(String deviceId){
-		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
-		unsubscribe(keys);
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.extra.util;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPService;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPSubscriber {
+	private BundleContext context;
+	private UPnPEventListener listener;
+	private HashMap hash;
+	
+	private class Subscription implements UPnPEventListener{
+	    ServiceRegistration registration;
+	    
+	    Subscription(String keys){
+	 		try {
+				Filter filter = context.createFilter(keys);
+				Properties props = new Properties();
+				props.put(UPnPEventListener.UPNP_FILTER, filter);
+				registration = context.registerService(UPnPEventListener.class.getName(), this, props);
+			}catch (Exception ex){
+				System.out.println(ex);
+			}
+	    }
+	    
+	    public void unsubscribe(){
+			registration.unregister();
+	    }
+	    
+        public void notifyUPnPEvent(String arg0, String arg1, Dictionary arg2) {
+            listener.notifyUPnPEvent( arg0,  arg1,  arg2);
+        }
+	}
+	
+	
+	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
+	    if ((context == null)|| (listener == null))
+	        throw new IllegalArgumentException("Illegal arguments in UPnPSubscriber constructor.");
+		this.context = context;
+		this.listener = listener;
+		hash = new HashMap();
+	}
+
+	public void subscribe(String filter){
+		if (hash.get(filter) == null){
+		    hash.put(filter, new Subscription(filter));
+		}	
+	}
+	
+	public void unsubscribe(String filter){
+		if (hash.containsKey(filter)) {
+		    Subscription subscription = (Subscription) hash.get(filter);
+		    subscription.unsubscribe();
+			hash.remove(filter);
+		}
+	}
+	
+	public void unsubscribeAll(){
+	    Iterator list = hash.entrySet().iterator();
+	    while (list.hasNext()){		        
+	        Map.Entry entry = (Map.Entry) list.next();
+	        Subscription subcription = (Subscription) entry.getValue();
+	        subcription.unsubscribe();
+		    list.remove();
+	    }
+	}
+
+	public String subscribeServiceIdOf(String deviceId, String serviceId){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeServiceTypeOf(String deviceId, String serviceType){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeEveryServiceType(String deviceType, String serviceType){
+		String keys = "(&(" + UPnPDevice.TYPE + "="+ deviceType + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeAllServicesOf(String deviceId){
+		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeEveryDeviceTypeServices(String deviceType){
+		String keys = "(" + UPnPDevice.TYPE + "="+ deviceType + ")";
+		subscribe(keys);
+		return keys;
+	}
+	
+	
+	public void unsubscribeServiceIdOf(String deviceId, String serviceId){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
+		unsubscribe(keys);
+	}
+	
+	public void unsubscribeAllServicesOf(String deviceId){
+		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
+		unsubscribe(keys);
+	}
 }
\ No newline at end of file
diff --git a/upnp/pom.xml b/upnp/pom.xml
index 97f830d..fec9fb6 100644
--- a/upnp/pom.xml
+++ b/upnp/pom.xml
@@ -16,48 +16,48 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project>
-  <parent>
-    <groupId>org.apache.felix</groupId>
-    <artifactId>felix</artifactId>
-    <version>1.0.2</version>
-    <relativePath>../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <packaging>pom</packaging>
-  <name>Apache Felix UPnP: Root POM</name>
-  <artifactId>upnp</artifactId>
-  <version>1.0.0</version>
-
-  <profiles>
-    <profile>
-      <id>packaging-bundle</id>
-      <activation>
-        <property>
-          <name>packaging</name>
-          <value>bundle</value>
-        </property>
-      </activation>
-      <modules>
-          <module>extra</module>
-          <module>basedriver</module>
-          <module>tester</module>
-          <module>samples</module>
-      </modules>
-    </profile>
-    <profile>
-      <id>default</id>
-      <activation>
-        <property>
-          <name>!packaging</name>
-        </property>
-      </activation>
-      <modules>
-          <module>extra</module>
-          <module>basedriver</module>
-          <module>tester</module>
-          <module>samples</module>
-      </modules>
-    </profile>
-  </profiles>
-</project>
+<project>
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix</artifactId>
+    <version>1.0.2</version>
+    <relativePath>../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>pom</packaging>
+  <name>Apache Felix UPnP: Root POM</name>
+  <artifactId>upnp</artifactId>
+  <version>1.0.0</version>
+
+  <profiles>
+    <profile>
+      <id>packaging-bundle</id>
+      <activation>
+        <property>
+          <name>packaging</name>
+          <value>bundle</value>
+        </property>
+      </activation>
+      <modules>
+          <module>extra</module>
+          <module>basedriver</module>
+          <module>tester</module>
+          <module>samples</module>
+      </modules>
+    </profile>
+    <profile>
+      <id>default</id>
+      <activation>
+        <property>
+          <name>!packaging</name>
+        </property>
+      </activation>
+      <modules>
+          <module>extra</module>
+          <module>basedriver</module>
+          <module>tester</module>
+          <module>samples</module>
+      </modules>
+    </profile>
+  </profiles>
+</project>
diff --git a/upnp/samples/binarylight/pom.xml b/upnp/samples/binarylight/pom.xml
index 05279d2..ba8b09f 100644
--- a/upnp/samples/binarylight/pom.xml
+++ b/upnp/samples/binarylight/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -17,66 +17,66 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <artifactId>felix</artifactId>
-    <groupId>org.apache.felix</groupId>
-    <version>1.0.2</version>
-    <relativePath>../../../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.felix</groupId>
-  <artifactId>org.apache.felix.upnp.sample.binaryLight</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Felix UPnP Sample Binary-Light</name>
-  <version>0.2.0-SNAPSHOT</version>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>felix</artifactId>
+    <groupId>org.apache.felix</groupId>
+    <version>1.0.2</version>
+    <relativePath>../../../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.felix</groupId>
+  <artifactId>org.apache.felix.upnp.sample.binaryLight</artifactId>
+  <packaging>bundle</packaging>
+  <name>Apache Felix UPnP Sample Binary-Light</name>
+  <version>0.2.0-SNAPSHOT</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
         <version>1.4.0</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>${pom.name}</Bundle-Name>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-Name>${pom.name}</Bundle-Name>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
-            <Bundle-Description>Standardized BinaryLight DCPs to test UPnP Base Driver</Bundle-Description>
-            <Bundle-SymbolicName>org.apache.felix.upnp.sample.binaryLight</Bundle-SymbolicName>
-            <Bundle-Activator>org.apache.felix.upnp.sample.binaryLight.Activator</Bundle-Activator>
-            <Private-Package>org.apache.felix.upnp.sample.binaryLight.*</Private-Package>
-            <Import-Package>*</Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
+            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
+            <Bundle-Description>Standardized BinaryLight DCPs to test UPnP Base Driver</Bundle-Description>
+            <Bundle-SymbolicName>org.apache.felix.upnp.sample.binaryLight</Bundle-SymbolicName>
+            <Bundle-Activator>org.apache.felix.upnp.sample.binaryLight.Activator</Bundle-Activator>
+            <Private-Package>org.apache.felix.upnp.sample.binaryLight.*</Private-Package>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
       <version>1.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>javax.servlet</artifactId>
-      <version>1.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.upnp.extra</artifactId>
-      <version>0.3.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-</project>
-
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>javax.servlet</artifactId>
+      <version>1.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.upnp.extra</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>
+
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java
index 374cc20..d48d2d3 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java
@@ -1,113 +1,113 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-import org.apache.felix.upnp.extra.util.EventSource;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class LightModel implements EventSource{
-	
-	private boolean status = false;
-	private boolean target = false;
-	private boolean failure = false;
-	private PropertyChangeSupport propertySupport = new PropertyChangeSupport(this);
-	
-	public LightModel(){	
-	}
-	
-	public void addPropertyChangeListener(PropertyChangeListener listener){
-		propertySupport.addPropertyChangeListener(listener);
-	}
-	
-	public void removePropertyChangeListener(PropertyChangeListener listener){
-		propertySupport.removePropertyChangeListener(listener);
-	}
-	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-		propertySupport.addPropertyChangeListener(propertyName,listener);
-	}
-
-	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-		propertySupport.removePropertyChangeListener(propertyName,listener);
-	}
-	
-	public void doSwitch(boolean value){
-		if (value) switchOn();
-		else switchOff();
-	}
-	
-	public void switchOn(){
-		target = true;
-		if(! failure) {
-			boolean oldStatus = status;
-			status = true;
-			propertySupport.firePropertyChange("Status",oldStatus,status);
-		}
-	}
-	
-	public void switchOff(){
-		target = false;
-		if(! failure) {
-			boolean oldStatus = status;
-			status = false;
-			propertySupport.firePropertyChange("Status",oldStatus,status);
-		}
-	}
-	
-	public void setFailure(boolean value){
-		failure = value;
-		if (failure){
-			status = false;
-		}
-		else {
-			if (target)		{
-				status = true;
-			}
-			else{
-				status = false;
-			}
-		}
-		propertySupport.firePropertyChange("Status",!status,status);
-		propertySupport.firePropertyChange("Failure",!failure,failure);
-	}
-	
-
-	/**
-	 * @return
-	 */
-	public boolean getTarget() {
-		return target;
-	}
-
-	/**
-	 * @return
-	 */
-	public boolean getStatus() {
-		return status;
-	}
-
-
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+import org.apache.felix.upnp.extra.util.EventSource;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class LightModel implements EventSource{
+	
+	private boolean status = false;
+	private boolean target = false;
+	private boolean failure = false;
+	private PropertyChangeSupport propertySupport = new PropertyChangeSupport(this);
+	
+	public LightModel(){	
+	}
+	
+	public void addPropertyChangeListener(PropertyChangeListener listener){
+		propertySupport.addPropertyChangeListener(listener);
+	}
+	
+	public void removePropertyChangeListener(PropertyChangeListener listener){
+		propertySupport.removePropertyChangeListener(listener);
+	}
+	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+		propertySupport.addPropertyChangeListener(propertyName,listener);
+	}
+
+	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+		propertySupport.removePropertyChangeListener(propertyName,listener);
+	}
+	
+	public void doSwitch(boolean value){
+		if (value) switchOn();
+		else switchOff();
+	}
+	
+	public void switchOn(){
+		target = true;
+		if(! failure) {
+			boolean oldStatus = status;
+			status = true;
+			propertySupport.firePropertyChange("Status",oldStatus,status);
+		}
+	}
+	
+	public void switchOff(){
+		target = false;
+		if(! failure) {
+			boolean oldStatus = status;
+			status = false;
+			propertySupport.firePropertyChange("Status",oldStatus,status);
+		}
+	}
+	
+	public void setFailure(boolean value){
+		failure = value;
+		if (failure){
+			status = false;
+		}
+		else {
+			if (target)		{
+				status = true;
+			}
+			else{
+				status = false;
+			}
+		}
+		propertySupport.firePropertyChange("Status",!status,status);
+		propertySupport.firePropertyChange("Failure",!failure,failure);
+	}
+	
+
+	/**
+	 * @return
+	 */
+	public boolean getTarget() {
+		return target;
+	}
+
+	/**
+	 * @return
+	 */
+	public boolean getStatus() {
+		return status;
+	}
+
+
+
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java
index 2e56106..02238cc 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java
@@ -1,185 +1,185 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.net.URL;
-
-import javax.swing.AbstractAction;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-
-import org.osgi.framework.BundleException;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class LightUI extends JFrame implements PropertyChangeListener {
-    private final static ImageIcon LIGHT_ON = LightUI.loadIcon("LightOn.gif","ON");
-    private final static ImageIcon LIGHT_OFF = LightUI.loadIcon("LightOff.gif","OFF");
-    private final static ImageIcon LIGHT_FAIL = LightUI.loadIcon("LightFail.gif","FAILURE");
-	private final JLabel label = new JLabel();
-    private LightModel model;
-	private JButton btnSwitch;
-	private JButton btnFailure;
-   
-	public LightUI(LightModel model)   {
-		super("Felix UPnP BinaryLight");
-		this.model = model;
-		setSize(150,150);
-		JPanel panel = new JPanel(new BorderLayout());
-		panel.add(doMainPanel(),BorderLayout.CENTER);
-		panel.add(doControlPanel(),BorderLayout.SOUTH);
-		getContentPane().add(panel);
-		model.addPropertyChangeListener(this);
-
-		addWindowListener(new WindowAdapter(){
-			public void windowClosing(WindowEvent e) 
-			{
-				try {
-					Activator.context.getBundle().stop();
-				} catch (BundleException ex) {
-					ex.printStackTrace();
-				}
-			}
-		});			
-	       try {
-	            URL eventIconUrl = LightUI.class.getResource("images/logo.gif");           
-	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
-	            setIconImage(icon.getImage());
-	       }
-	        catch (Exception ex){
-	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
-	        }
-	
-		pack();
-		setVisible(true);
-    }
-	
-	private JPanel doMainPanel(){
-		JPanel panel = new JPanel();
-		label.setIcon(LIGHT_OFF);
-		//label.setSize(new Dimension(32,32));
-	    label.addMouseListener(new MouseAdapter(){          
-	          public void mouseClicked(MouseEvent e){
-	            if (SwingUtilities.isLeftMouseButton(e)){
-	              if (e.getClickCount()==1){
-	              Icon icon = label.getIcon();
-	              if (icon == LIGHT_ON)
-	                  model.switchOff();
-	              else 
-	                  model.switchOn();
-	              }
-	            }
-	          }
-	    });
-	    panel.add(label);
-	    return panel;
-	}
-	          
-	private JPanel doControlPanel(){
-		JPanel panel = new JPanel();
-		btnSwitch = new JButton("On");
-		btnFailure = new JButton("Break");
-		panel.add(btnSwitch);
-		panel.add(btnFailure);
-		
-		btnSwitch.addActionListener(new AbstractAction(){
-			public void actionPerformed(ActionEvent e) {
-				if (btnSwitch.getText().equals("On")){
-					btnSwitch.setText("Off");
-	                model.switchOn();
-				}else {
-					btnSwitch.setText("On");
-	                model.switchOff();					
-				}
-			}			
-		});
-		
-		btnFailure.addActionListener(new AbstractAction(){
-			public void actionPerformed(ActionEvent e) {
-				if (btnFailure.getText().equals("Break")){
-					btnFailure.setText("Repair");
-					btnSwitch.setEnabled(false);
-	                model.setFailure(true);
-				} else {
-					btnFailure.setText("Break");
-					btnSwitch.setEnabled(true);
-	                model.setFailure(false);					
-				}
-			}			
-		});
-		
-		return panel;
-	}
-	
-    public  static ImageIcon loadIcon(String path,String title)
-    {
-        try {
-            URL eventIconUrl = LightUI.class.getResource("images/" + path);
-            return new ImageIcon(eventIconUrl,title);
-        }
-        catch (Exception ex){
-			System.out.println("Resource:" + path + " not found : " + ex.toString());
-            return null;
-        }
-    }
-
-	/* (non-Javadoc)
-	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
-	 */
-    public void propertyChange(PropertyChangeEvent evt) {
-    	String property = evt.getPropertyName();
-    	boolean value = ((Boolean) evt.getNewValue()).booleanValue();
-    	System.out.println("BinaryLight property::"+property + " changed to:" +  value);
-        	if (property.equals("Status")){
-    		if (value){
-    			label.setIcon(LIGHT_ON);
-    			btnSwitch.setText("Off");
-    		}
-    		else{
-    			label.setIcon(LIGHT_OFF);
-    			btnSwitch.setText("On");
-    		}
-    	}
-    	else if (property.equals("Failure")){            
-    		if (value)
-    			label.setIcon(LIGHT_FAIL);
-    	}
-    	getContentPane().validate();
-    	repaint();
-
-	}
-
-	
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.net.URL;
+
+import javax.swing.AbstractAction;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.osgi.framework.BundleException;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class LightUI extends JFrame implements PropertyChangeListener {
+    private final static ImageIcon LIGHT_ON = LightUI.loadIcon("LightOn.gif","ON");
+    private final static ImageIcon LIGHT_OFF = LightUI.loadIcon("LightOff.gif","OFF");
+    private final static ImageIcon LIGHT_FAIL = LightUI.loadIcon("LightFail.gif","FAILURE");
+	private final JLabel label = new JLabel();
+    private LightModel model;
+	private JButton btnSwitch;
+	private JButton btnFailure;
+   
+	public LightUI(LightModel model)   {
+		super("Felix UPnP BinaryLight");
+		this.model = model;
+		setSize(150,150);
+		JPanel panel = new JPanel(new BorderLayout());
+		panel.add(doMainPanel(),BorderLayout.CENTER);
+		panel.add(doControlPanel(),BorderLayout.SOUTH);
+		getContentPane().add(panel);
+		model.addPropertyChangeListener(this);
+
+		addWindowListener(new WindowAdapter(){
+			public void windowClosing(WindowEvent e) 
+			{
+				try {
+					Activator.context.getBundle().stop();
+				} catch (BundleException ex) {
+					ex.printStackTrace();
+				}
+			}
+		});			
+	       try {
+	            URL eventIconUrl = LightUI.class.getResource("images/logo.gif");           
+	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
+	            setIconImage(icon.getImage());
+	       }
+	        catch (Exception ex){
+	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
+	        }
+	
+		pack();
+		setVisible(true);
+    }
+	
+	private JPanel doMainPanel(){
+		JPanel panel = new JPanel();
+		label.setIcon(LIGHT_OFF);
+		//label.setSize(new Dimension(32,32));
+	    label.addMouseListener(new MouseAdapter(){          
+	          public void mouseClicked(MouseEvent e){
+	            if (SwingUtilities.isLeftMouseButton(e)){
+	              if (e.getClickCount()==1){
+	              Icon icon = label.getIcon();
+	              if (icon == LIGHT_ON)
+	                  model.switchOff();
+	              else 
+	                  model.switchOn();
+	              }
+	            }
+	          }
+	    });
+	    panel.add(label);
+	    return panel;
+	}
+	          
+	private JPanel doControlPanel(){
+		JPanel panel = new JPanel();
+		btnSwitch = new JButton("On");
+		btnFailure = new JButton("Break");
+		panel.add(btnSwitch);
+		panel.add(btnFailure);
+		
+		btnSwitch.addActionListener(new AbstractAction(){
+			public void actionPerformed(ActionEvent e) {
+				if (btnSwitch.getText().equals("On")){
+					btnSwitch.setText("Off");
+	                model.switchOn();
+				}else {
+					btnSwitch.setText("On");
+	                model.switchOff();					
+				}
+			}			
+		});
+		
+		btnFailure.addActionListener(new AbstractAction(){
+			public void actionPerformed(ActionEvent e) {
+				if (btnFailure.getText().equals("Break")){
+					btnFailure.setText("Repair");
+					btnSwitch.setEnabled(false);
+	                model.setFailure(true);
+				} else {
+					btnFailure.setText("Break");
+					btnSwitch.setEnabled(true);
+	                model.setFailure(false);					
+				}
+			}			
+		});
+		
+		return panel;
+	}
+	
+    public  static ImageIcon loadIcon(String path,String title)
+    {
+        try {
+            URL eventIconUrl = LightUI.class.getResource("images/" + path);
+            return new ImageIcon(eventIconUrl,title);
+        }
+        catch (Exception ex){
+			System.out.println("Resource:" + path + " not found : " + ex.toString());
+            return null;
+        }
+    }
+
+	/* (non-Javadoc)
+	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+	 */
+    public void propertyChange(PropertyChangeEvent evt) {
+    	String property = evt.getPropertyName();
+    	boolean value = ((Boolean) evt.getNewValue()).booleanValue();
+    	System.out.println("BinaryLight property::"+property + " changed to:" +  value);
+        	if (property.equals("Status")){
+    		if (value){
+    			label.setIcon(LIGHT_ON);
+    			btnSwitch.setText("Off");
+    		}
+    		else{
+    			label.setIcon(LIGHT_OFF);
+    			btnSwitch.setText("On");
+    		}
+    	}
+    	else if (property.equals("Failure")){            
+    		if (value)
+    			label.setIcon(LIGHT_FAIL);
+    	}
+    	getContentPane().validate();
+    	repaint();
+
+	}
+
+	
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java
index 9b19b6a..06744ff 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java
@@ -1,93 +1,93 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.actions;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class GetStatusAction implements UPnPAction {
-
-	final private String NAME = "GetStatus";
-	final private String RESULT_STATUS = "ResultStatus";
-	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
-	private UPnPStateVariable state;
-	private LightModel model;
-	
-	
-	public GetStatusAction(LightModel model,UPnPStateVariable state){
-		this.state = state;
-		this.model=model;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return state;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		boolean status = model.getStatus();
-		Hashtable result = new Hashtable();
-		result.put(RESULT_STATUS,new Boolean(status));
-		return result;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.actions;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class GetStatusAction implements UPnPAction {
+
+	final private String NAME = "GetStatus";
+	final private String RESULT_STATUS = "ResultStatus";
+	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+	private UPnPStateVariable state;
+	private LightModel model;
+	
+	
+	public GetStatusAction(LightModel model,UPnPStateVariable state){
+		this.state = state;
+		this.model=model;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return state;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		boolean status = model.getStatus();
+		Hashtable result = new Hashtable();
+		result.put(RESULT_STATUS,new Boolean(status));
+		return result;
+	}
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java
index b40d2ef..8529ab3 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java
@@ -1,93 +1,93 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.actions;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class GetTargetAction implements UPnPAction {
-
-	final private String NAME = "GetTarget";
-	final private String RET_TARGET_VALUE = "RetTargetValue";
-	final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
-	private UPnPStateVariable state;
-	private LightModel model;
-	
-	
-	public GetTargetAction(LightModel model,UPnPStateVariable state){
-		this.state = state;
-		this.model=model;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return state;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		boolean target = model.getTarget();
-		Hashtable result = new Hashtable();
-		result.put(RET_TARGET_VALUE,new Boolean(target));
-		return result;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.actions;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class GetTargetAction implements UPnPAction {
+
+	final private String NAME = "GetTarget";
+	final private String RET_TARGET_VALUE = "RetTargetValue";
+	final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
+	private UPnPStateVariable state;
+	private LightModel model;
+	
+	
+	public GetTargetAction(LightModel model,UPnPStateVariable state){
+		this.state = state;
+		this.model=model;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return state;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		boolean target = model.getTarget();
+		Hashtable result = new Hashtable();
+		result.put(RET_TARGET_VALUE,new Boolean(target));
+		return result;
+	}
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java
index cac1e44..ebf4677 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java
@@ -1,90 +1,90 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.actions;
-
-import java.util.Dictionary;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class SetTargetAction implements UPnPAction {
-
-	final private String NAME = "SetTarget";
-	final private String NEW_TARGET_VALUE = "NewTargetValue";
-	final private String[] IN_ARG_NAMES = new String[]{NEW_TARGET_VALUE};
-	private UPnPStateVariable state;
-	private LightModel model;
-	
-	
-	public SetTargetAction(LightModel model,UPnPStateVariable state){
-		this.state = state;
-		this.model=model;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		return IN_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return state;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		Boolean value = (Boolean) args.get(NEW_TARGET_VALUE);
-		model.doSwitch(value.booleanValue());
-		return null;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.actions;
+
+import java.util.Dictionary;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class SetTargetAction implements UPnPAction {
+
+	final private String NAME = "SetTarget";
+	final private String NEW_TARGET_VALUE = "NewTargetValue";
+	final private String[] IN_ARG_NAMES = new String[]{NEW_TARGET_VALUE};
+	private UPnPStateVariable state;
+	private LightModel model;
+	
+	
+	public SetTargetAction(LightModel model,UPnPStateVariable state){
+		this.state = state;
+		this.model=model;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		return IN_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return state;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		Boolean value = (Boolean) args.get(NEW_TARGET_VALUE);
+		model.doSwitch(value.booleanValue());
+		return null;
+	}
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
index 7065d42..c99bb9b 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
@@ -1,146 +1,146 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.devices;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Dictionary;
-import java.util.Properties;
-import java.util.Random;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPIcon;
-import org.osgi.service.upnp.UPnPService;
-
-import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-import org.apache.felix.upnp.sample.binaryLight.LightUI;
-import org.apache.felix.upnp.sample.binaryLight.icons.LightIcon;
-import org.apache.felix.upnp.sample.binaryLight.services.PowerSwitchService;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class LightDevice implements UPnPDevice {
-
-	final private String DEVICE_ID = "uuid:Felix-BinaryLight+" +Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
-	private BundleContext context;
-	private LightModel model;
-	private LightUI ui;
-	private PowerSwitchService powerSwitch;
-	private UPnPService[] services;
-	private Dictionary dictionary;
-	private UPnPEventNotifier notifier;
-	
-	public LightDevice(BundleContext context) {
-		this.context=context;
-		model = new LightModel();
-		ui = new LightUI(model);
-		powerSwitch = new PowerSwitchService(model);
-		services = new UPnPService[]{powerSwitch};
-		setupDeviceProperties();
-		buildEventNotifyer();
-	}
-
-	public LightModel getModel(){
-		return model;
-	}
-	/**
-	 * 
-	 */
-	private void buildEventNotifyer() {
-		notifier = new UPnPEventNotifier(context,this,powerSwitch,model);
-	}
-
-	private void setupDeviceProperties(){
-		dictionary = new Properties();
-		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
-		dictionary.put(
-		        org.osgi.service
-		        	.device.Constants.DEVICE_CATEGORY,
-	        	new String[]{UPnPDevice.DEVICE_CATEGORY}
-	        );
-		//dictionary.put(UPnPDevice.DEVICE_CATEGORY,new String[]{UPnPDevice.DEVICE_CATEGORY});
-		dictionary.put(UPnPDevice.FRIENDLY_NAME,"Felix OSGi-UPnP BinaryLight");
-		dictionary.put(UPnPDevice.MANUFACTURER,"Apache Software Foundation");
-		dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://felix.apache.org");
-		dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A BinaryLight device to test OSGi to UPnP service export");
-		dictionary.put(UPnPDevice.MODEL_NAME,"Lucciola");
-		dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
-		dictionary.put(UPnPDevice.MODEL_URL,"http://felix.apache.org/site/upnp-examples.html");
-		String port = context.getProperty("org.osgi.service.http.port");
-        InetAddress inet;
-		try {
-			inet = InetAddress.getLocalHost();
-	        String hostname = inet.getHostName();
-            //String hostname = inet.getHostAddress();
-		dictionary.put(UPnPDevice.PRESENTATION_URL,"http://"+hostname + ":"+port+"/upnp/binaryLight/");
-		} catch (UnknownHostException e) {
-			System.out.println("Warning: enable to cacth localhost name");
-		}
-		dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
-		dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:BinaryLight:1");
-		dictionary.put(UPnPDevice.UDN,DEVICE_ID);
-		//dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
-		dictionary.put(UPnPDevice.UPC,"1213456789");
-	}
-	
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
-	 */
-	public UPnPService getService(String serviceId) {
-		if  (serviceId.equals(powerSwitch.getId())) return powerSwitch;
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
-	 */
-	public UPnPService[] getServices() {
-		return services;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
-	 */
-	public UPnPIcon[] getIcons(String locale) {
-		UPnPIcon icon = new LightIcon();
-		return new UPnPIcon[]{icon} ;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
-	 */
-	public Dictionary getDescriptions(String locale) {
-		return dictionary;
-	}
-
-	/**
-	 * 
-	 */
-	public void close() {
-		ui.dispose();
-		notifier.destroy();
-	}
-	
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.devices;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Dictionary;
+import java.util.Properties;
+import java.util.Random;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPIcon;
+import org.osgi.service.upnp.UPnPService;
+
+import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+import org.apache.felix.upnp.sample.binaryLight.LightUI;
+import org.apache.felix.upnp.sample.binaryLight.icons.LightIcon;
+import org.apache.felix.upnp.sample.binaryLight.services.PowerSwitchService;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class LightDevice implements UPnPDevice {
+
+	final private String DEVICE_ID = "uuid:Felix-BinaryLight+" +Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
+	private BundleContext context;
+	private LightModel model;
+	private LightUI ui;
+	private PowerSwitchService powerSwitch;
+	private UPnPService[] services;
+	private Dictionary dictionary;
+	private UPnPEventNotifier notifier;
+	
+	public LightDevice(BundleContext context) {
+		this.context=context;
+		model = new LightModel();
+		ui = new LightUI(model);
+		powerSwitch = new PowerSwitchService(model);
+		services = new UPnPService[]{powerSwitch};
+		setupDeviceProperties();
+		buildEventNotifyer();
+	}
+
+	public LightModel getModel(){
+		return model;
+	}
+	/**
+	 * 
+	 */
+	private void buildEventNotifyer() {
+		notifier = new UPnPEventNotifier(context,this,powerSwitch,model);
+	}
+
+	private void setupDeviceProperties(){
+		dictionary = new Properties();
+		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
+		dictionary.put(
+		        org.osgi.service
+		        	.device.Constants.DEVICE_CATEGORY,
+	        	new String[]{UPnPDevice.DEVICE_CATEGORY}
+	        );
+		//dictionary.put(UPnPDevice.DEVICE_CATEGORY,new String[]{UPnPDevice.DEVICE_CATEGORY});
+		dictionary.put(UPnPDevice.FRIENDLY_NAME,"Felix OSGi-UPnP BinaryLight");
+		dictionary.put(UPnPDevice.MANUFACTURER,"Apache Software Foundation");
+		dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://felix.apache.org");
+		dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A BinaryLight device to test OSGi to UPnP service export");
+		dictionary.put(UPnPDevice.MODEL_NAME,"Lucciola");
+		dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
+		dictionary.put(UPnPDevice.MODEL_URL,"http://felix.apache.org/site/upnp-examples.html");
+		String port = context.getProperty("org.osgi.service.http.port");
+        InetAddress inet;
+		try {
+			inet = InetAddress.getLocalHost();
+	        String hostname = inet.getHostName();
+            //String hostname = inet.getHostAddress();
+		dictionary.put(UPnPDevice.PRESENTATION_URL,"http://"+hostname + ":"+port+"/upnp/binaryLight/");
+		} catch (UnknownHostException e) {
+			System.out.println("Warning: enable to cacth localhost name");
+		}
+		dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
+		dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:BinaryLight:1");
+		dictionary.put(UPnPDevice.UDN,DEVICE_ID);
+		//dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
+		dictionary.put(UPnPDevice.UPC,"1213456789");
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
+	 */
+	public UPnPService getService(String serviceId) {
+		if  (serviceId.equals(powerSwitch.getId())) return powerSwitch;
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
+	 */
+	public UPnPService[] getServices() {
+		return services;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
+	 */
+	public UPnPIcon[] getIcons(String locale) {
+		UPnPIcon icon = new LightIcon();
+		return new UPnPIcon[]{icon} ;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
+	 */
+	public Dictionary getDescriptions(String locale) {
+		return dictionary;
+	}
+
+	/**
+	 * 
+	 */
+	public void close() {
+		ui.dispose();
+		notifier.destroy();
+	}
+	
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/icons/LightIcon.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/icons/LightIcon.java
index 6f54e3b..75171b0 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/icons/LightIcon.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/icons/LightIcon.java
@@ -1,73 +1,73 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.icons;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.osgi.service.upnp.UPnPIcon;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class LightIcon implements UPnPIcon {
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
-	 */
-	public String getMimeType() {
-		return "image/gif";
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
-	 */
-	public int getWidth() {
-		return 32;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
-	 */
-	public int getHeight() {
-		return 32;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
-	 */
-	public int getSize() {
-		return 1072;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
-	 */
-	public int getDepth() {
-		return 16;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
-	 */
-	public InputStream getInputStream() throws IOException {
-		return LightIcon.class.getResourceAsStream("images/LightOn.gif");
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.icons;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.osgi.service.upnp.UPnPIcon;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class LightIcon implements UPnPIcon {
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
+	 */
+	public String getMimeType() {
+		return "image/gif";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
+	 */
+	public int getWidth() {
+		return 32;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
+	 */
+	public int getHeight() {
+		return 32;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
+	 */
+	public int getSize() {
+		return 1072;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
+	 */
+	public int getDepth() {
+		return 16;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
+	 */
+	public InputStream getInputStream() throws IOException {
+		return LightIcon.class.getResourceAsStream("images/LightOn.gif");
+	}
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java
index c4fc2ac..7904c05 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java
@@ -1,118 +1,118 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.services;
-
-import java.util.HashMap;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-import org.apache.felix.upnp.sample.binaryLight.actions.GetStatusAction;
-import org.apache.felix.upnp.sample.binaryLight.actions.GetTargetAction;
-import org.apache.felix.upnp.sample.binaryLight.actions.SetTargetAction;
-import org.apache.felix.upnp.sample.binaryLight.statevariables.StatusStateVariable;
-import org.apache.felix.upnp.sample.binaryLight.statevariables.TargetStateVariable;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class PowerSwitchService implements UPnPService{
-	
-	final private String SERVICE_ID = "urn:upnp-org:serviceId:SwitchPower:1";
-	final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:SwitchPower:1";
-	final private String VERSION ="1";
-
-	private LightModel model;
-	private UPnPStateVariable status,target;
-	private UPnPStateVariable[] states;
-	private HashMap actions = new HashMap();
-	
-	
-	public PowerSwitchService(LightModel model){
-		this.model = model;
-		status = new StatusStateVariable(model);
-		target = new TargetStateVariable();
-		this.states = new UPnPStateVariable[]{status,target};
-		
-		UPnPAction setTarget = new SetTargetAction(model,target);
-		UPnPAction getTarget = new GetTargetAction(model,target);
-		UPnPAction getStatus = new GetStatusAction(model,status);
-		actions.put(setTarget.getName(),setTarget);
-		actions.put(getTarget.getName(),getTarget);
-		actions.put(getStatus.getName(),getStatus);
-		
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getId()
-	 */
-	public String getId() {
-		return SERVICE_ID;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getType()
-	 */
-	public String getType() {
-		return SERVICE_TYPE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getVersion()
-	 */
-	public String getVersion() {
-		return VERSION;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
-	 */
-	public UPnPAction getAction(String name) {
-		return (UPnPAction)actions.get(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getActions()
-	 */
-	public UPnPAction[] getActions() {
-		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
-	 */
-	public UPnPStateVariable[] getStateVariables() {
-		return states;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String name) {
-		if (name.equals("Status"))
-			return status;
-		else if (name.equals("Target"))
-			return target;
-		else return null;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.services;
+
+import java.util.HashMap;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+import org.apache.felix.upnp.sample.binaryLight.actions.GetStatusAction;
+import org.apache.felix.upnp.sample.binaryLight.actions.GetTargetAction;
+import org.apache.felix.upnp.sample.binaryLight.actions.SetTargetAction;
+import org.apache.felix.upnp.sample.binaryLight.statevariables.StatusStateVariable;
+import org.apache.felix.upnp.sample.binaryLight.statevariables.TargetStateVariable;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class PowerSwitchService implements UPnPService{
+	
+	final private String SERVICE_ID = "urn:upnp-org:serviceId:SwitchPower:1";
+	final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:SwitchPower:1";
+	final private String VERSION ="1";
+
+	private LightModel model;
+	private UPnPStateVariable status,target;
+	private UPnPStateVariable[] states;
+	private HashMap actions = new HashMap();
+	
+	
+	public PowerSwitchService(LightModel model){
+		this.model = model;
+		status = new StatusStateVariable(model);
+		target = new TargetStateVariable();
+		this.states = new UPnPStateVariable[]{status,target};
+		
+		UPnPAction setTarget = new SetTargetAction(model,target);
+		UPnPAction getTarget = new GetTargetAction(model,target);
+		UPnPAction getStatus = new GetStatusAction(model,status);
+		actions.put(setTarget.getName(),setTarget);
+		actions.put(getTarget.getName(),getTarget);
+		actions.put(getStatus.getName(),getStatus);
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getId()
+	 */
+	public String getId() {
+		return SERVICE_ID;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getType()
+	 */
+	public String getType() {
+		return SERVICE_TYPE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getVersion()
+	 */
+	public String getVersion() {
+		return VERSION;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
+	 */
+	public UPnPAction getAction(String name) {
+		return (UPnPAction)actions.get(name);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getActions()
+	 */
+	public UPnPAction[] getActions() {
+		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
+	 */
+	public UPnPStateVariable[] getStateVariables() {
+		return states;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String name) {
+		if (name.equals("Status"))
+			return status;
+		else if (name.equals("Target"))
+			return target;
+		else return null;
+	}
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/StatusStateVariable.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/StatusStateVariable.java
index f28ea45..38c5f63 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/StatusStateVariable.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/StatusStateVariable.java
@@ -1,102 +1,102 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.statevariables;
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-
-public class StatusStateVariable implements UPnPLocalStateVariable{
-	
-	final private String NAME = "Status";
-	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
-	private LightModel model;
-	
-	
-	public StatusStateVariable(LightModel model){
-		this.model= model;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
-	 */
-	public Class getJavaDataType() {
-		return Boolean.class;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
-	 */
-	public String getUPnPDataType() {
-		return TYPE_BOOLEAN;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
-	 */
-	public Object getDefaultValue() {
-		return DEFAULT_VALUE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
-	 */
-	public String[] getAllowedValues() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
-	 */
-	public Number getMinimum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
-	 */
-	public Number getMaximum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
-	 */
-	public Number getStep() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
-	 */
-	public boolean sendsEvents() {
-		return true;
-	}
-
-	public Object getCurrentValue() {
-		return new Boolean(model.getStatus());
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.statevariables;
+import org.osgi.service.upnp.UPnPLocalStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+
+public class StatusStateVariable implements UPnPLocalStateVariable{
+	
+	final private String NAME = "Status";
+	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
+	private LightModel model;
+	
+	
+	public StatusStateVariable(LightModel model){
+		this.model= model;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return Boolean.class;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_BOOLEAN;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return true;
+	}
+
+	public Object getCurrentValue() {
+		return new Boolean(model.getStatus());
+	}
+}
diff --git a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/TargetStateVariable.java b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/TargetStateVariable.java
index cfa8918..c99a983 100644
--- a/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/TargetStateVariable.java
+++ b/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/statevariables/TargetStateVariable.java
@@ -1,94 +1,94 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.binaryLight.statevariables;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class TargetStateVariable implements UPnPStateVariable{
-	
-	final private String NAME = "Target";
-	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
-	
-	
-	public TargetStateVariable(){
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
-	 */
-	public Class getJavaDataType() {
-		return Boolean.class;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
-	 */
-	public String getUPnPDataType() {
-		return TYPE_BOOLEAN;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
-	 */
-	public Object getDefaultValue() {
-		return DEFAULT_VALUE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
-	 */
-	public String[] getAllowedValues() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
-	 */
-	public Number getMinimum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
-	 */
-	public Number getMaximum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
-	 */
-	public Number getStep() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
-	 */
-	public boolean sendsEvents() {
-		return false;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.binaryLight.statevariables;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class TargetStateVariable implements UPnPStateVariable{
+	
+	final private String NAME = "Target";
+	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
+	
+	
+	public TargetStateVariable(){
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return Boolean.class;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_BOOLEAN;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return false;
+	}
+}
diff --git a/upnp/samples/clock/pom.xml b/upnp/samples/clock/pom.xml
index cdbbdb3..bd219df 100644
--- a/upnp/samples/clock/pom.xml
+++ b/upnp/samples/clock/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -17,60 +17,60 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <artifactId>felix</artifactId>
-    <groupId>org.apache.felix</groupId>
-    <version>1.0.2</version>
-    <relativePath>../../../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.felix</groupId>
-  <artifactId>org.apache.felix.upnp.sample.clock</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Felix UPnP Sample Clock</name>
-  <version>0.2.0-SNAPSHOT</version>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>felix</artifactId>
+    <groupId>org.apache.felix</groupId>
+    <version>1.0.2</version>
+    <relativePath>../../../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.felix</groupId>
+  <artifactId>org.apache.felix.upnp.sample.clock</artifactId>
+  <packaging>bundle</packaging>
+  <name>Apache Felix UPnP Sample Clock</name>
+  <version>0.2.0-SNAPSHOT</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
         <version>1.4.0</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>${pom.name}</Bundle-Name>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-Name>${pom.name}</Bundle-Name>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
-            <Bundle-Description>CyberLink Clock clone to test UPnPBase driver</Bundle-Description>
-            <Bundle-SymbolicName>org.apache.felix.upnp.sample.clock</Bundle-SymbolicName>
-            <Bundle-Activator>org.apache.felix.upnp.sample.clock.Activator</Bundle-Activator>
-            <Private-Package>org.apache.felix.upnp.sample.clock.*</Private-Package>
-            <Import-Package>*</Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
+            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
+            <Bundle-Description>CyberLink Clock clone to test UPnPBase driver</Bundle-Description>
+            <Bundle-SymbolicName>org.apache.felix.upnp.sample.clock</Bundle-SymbolicName>
+            <Bundle-Activator>org.apache.felix.upnp.sample.clock.Activator</Bundle-Activator>
+            <Private-Package>org.apache.felix.upnp.sample.clock.*</Private-Package>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
       <version>1.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.upnp.extra</artifactId>
-      <version>0.3.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-</project>
-
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.upnp.extra</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>
+
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/Clock.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/Clock.java
index fffbc77..ef69110 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/Clock.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/Clock.java
@@ -1,156 +1,156 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.util.Calendar;
-
-public class Clock
-{
-	private Calendar cal;
-
-	public Clock(Calendar cal)
-	{
-		this.cal = cal;
-	}
-
-	public Calendar getCalendar()
-	{
-		return cal;
-	}
-
-	////////////////////////////////////////////////
-	//	Time
-	////////////////////////////////////////////////
-
-	public int getHour()
-	{
-		return getCalendar().get(Calendar.HOUR);
-	}
-
-	public int getMinute()
-	{
-		return getCalendar().get(Calendar.MINUTE);
-	}
-
-	public int getSecond()
-	{
-		return getCalendar().get(Calendar.SECOND);
-	}
-	
-	////////////////////////////////////////////////
-	//	paint
-	////////////////////////////////////////////////
-
-	public final static Clock getInstance()
-	{
-		return new Clock(Calendar.getInstance());
-	}
-
-	////////////////////////////////////////////////
-	//	getDateString
-	////////////////////////////////////////////////
-
-	public final static String toClockString(int value)
-	{
-		if (value < 10)
-			return "0" + Integer.toString(value);
-		return Integer.toString(value);
-	}
-
-	private final static String MONTH_STRING[] = {
-		"Jan",
-		"Feb",
-		"Mar",
-		"Apr",
-		"May",
-		"Jun",
-		"Jul",
-		"Aug",
-		"Sep",
-		"Oct",
-		"Nov",
-		"Dec",
-	};
-
-	public final static String toMonthString(int value)
-	{
-		value -= Calendar.JANUARY;
-		if (0 <= value && value < 12)
-			return MONTH_STRING[value];
-		return "";
-	}
-	
-	private final static String WEEK_STRING[] = {
-		"Sun",
-		"Mon",
-		"Tue",
-		"Wed",
-		"Thu",
-		"Fri",
-		"Sat",
-	};
-
-	public final static String toWeekString(int value)
-	{
-		value -= Calendar.SUNDAY;
-		if (0 <= value && value < 7)
-			return WEEK_STRING[value];
-		return "";
-	}
-	
-	public String getDateString()
-	{
-		Calendar cal = getCalendar();
-		return
-			toWeekString(cal.get(Calendar.DAY_OF_WEEK)) +", " + 
-			toMonthString(cal.get(Calendar.MONTH)) + " " +
-			Integer.toString(cal.get(Calendar.DATE)) + ", " +
-			toClockString(cal.get(Calendar.YEAR) % 100);
-	}
-
-	////////////////////////////////////////////////
-	//	getTimeString
-	////////////////////////////////////////////////
-	
-	public String getTimeString()
-	{
-		Calendar cal = getCalendar();
-		return
-			toClockString(cal.get(Calendar.HOUR)) +
-			(((cal.get(Calendar.SECOND) % 2) == 0) ? ":" : " ") +
-			toClockString(cal.get(Calendar.MINUTE));
-	}
-
-	////////////////////////////////////////////////
-	//	toString
-	////////////////////////////////////////////////
-
-	public String toString()
-	{
-		Calendar cal = getCalendar();
-		return
-			getDateString() + ", " +
-			toClockString(cal.get(Calendar.HOUR)) + ":" +
-			toClockString(cal.get(Calendar.MINUTE)) + ":" +
-			toClockString(cal.get(Calendar.SECOND));
-	}
-		
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.util.Calendar;
+
+public class Clock
+{
+	private Calendar cal;
+
+	public Clock(Calendar cal)
+	{
+		this.cal = cal;
+	}
+
+	public Calendar getCalendar()
+	{
+		return cal;
+	}
+
+	////////////////////////////////////////////////
+	//	Time
+	////////////////////////////////////////////////
+
+	public int getHour()
+	{
+		return getCalendar().get(Calendar.HOUR);
+	}
+
+	public int getMinute()
+	{
+		return getCalendar().get(Calendar.MINUTE);
+	}
+
+	public int getSecond()
+	{
+		return getCalendar().get(Calendar.SECOND);
+	}
+	
+	////////////////////////////////////////////////
+	//	paint
+	////////////////////////////////////////////////
+
+	public final static Clock getInstance()
+	{
+		return new Clock(Calendar.getInstance());
+	}
+
+	////////////////////////////////////////////////
+	//	getDateString
+	////////////////////////////////////////////////
+
+	public final static String toClockString(int value)
+	{
+		if (value < 10)
+			return "0" + Integer.toString(value);
+		return Integer.toString(value);
+	}
+
+	private final static String MONTH_STRING[] = {
+		"Jan",
+		"Feb",
+		"Mar",
+		"Apr",
+		"May",
+		"Jun",
+		"Jul",
+		"Aug",
+		"Sep",
+		"Oct",
+		"Nov",
+		"Dec",
+	};
+
+	public final static String toMonthString(int value)
+	{
+		value -= Calendar.JANUARY;
+		if (0 <= value && value < 12)
+			return MONTH_STRING[value];
+		return "";
+	}
+	
+	private final static String WEEK_STRING[] = {
+		"Sun",
+		"Mon",
+		"Tue",
+		"Wed",
+		"Thu",
+		"Fri",
+		"Sat",
+	};
+
+	public final static String toWeekString(int value)
+	{
+		value -= Calendar.SUNDAY;
+		if (0 <= value && value < 7)
+			return WEEK_STRING[value];
+		return "";
+	}
+	
+	public String getDateString()
+	{
+		Calendar cal = getCalendar();
+		return
+			toWeekString(cal.get(Calendar.DAY_OF_WEEK)) +", " + 
+			toMonthString(cal.get(Calendar.MONTH)) + " " +
+			Integer.toString(cal.get(Calendar.DATE)) + ", " +
+			toClockString(cal.get(Calendar.YEAR) % 100);
+	}
+
+	////////////////////////////////////////////////
+	//	getTimeString
+	////////////////////////////////////////////////
+	
+	public String getTimeString()
+	{
+		Calendar cal = getCalendar();
+		return
+			toClockString(cal.get(Calendar.HOUR)) +
+			(((cal.get(Calendar.SECOND) % 2) == 0) ? ":" : " ") +
+			toClockString(cal.get(Calendar.MINUTE));
+	}
+
+	////////////////////////////////////////////////
+	//	toString
+	////////////////////////////////////////////////
+
+	public String toString()
+	{
+		Calendar cal = getCalendar();
+		return
+			getDateString() + ", " +
+			toClockString(cal.get(Calendar.HOUR)) + ":" +
+			toClockString(cal.get(Calendar.MINUTE)) + ":" +
+			toClockString(cal.get(Calendar.SECOND));
+	}
+		
+}
+
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
index cbce196..fac9bb0 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
@@ -1,142 +1,142 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-
-import java.beans.PropertyChangeEvent;
-import java.util.Calendar;
-import java.util.Dictionary;
-import java.util.Properties;
-import java.util.Random;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPIcon;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
-
-public class ClockDevice implements UPnPDevice {
-
-	final private String DEVICE_ID = "uuid:Felix-Clock+"+Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
-	private BundleContext context;
-	private TimerService timerService;
-	private UPnPService[] services;
-	private Dictionary dictionary;
-	public static UPnPEventNotifier notifier = null;
-	
-	public ClockDevice(BundleContext context) {
-		this.context=context;
-		timerService = new TimerService();
-		services = new UPnPService[]{timerService};
-		setupDeviceProperties();
-		buildEventNotifyer();
-	}
-
-	/**
-	 * 
-	 */
-	private void buildEventNotifyer() {
-		 notifier = new UPnPEventNotifier(context,this,timerService);
-	}
-
-	private void setupDeviceProperties(){
-		dictionary = new Properties();
-		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
-		dictionary.put(
-		        org.osgi.service
-		        	.device.Constants.DEVICE_CATEGORY,
-	        	new String[]{UPnPDevice.DEVICE_CATEGORY}
-	        );
-		//dictionary.put(UPnPDevice.DEVICE_CATEGORY,new String[]{UPnPDevice.DEVICE_CATEGORY});
-		dictionary.put(UPnPDevice.FRIENDLY_NAME,"Felix OSGi-UPnP Clock");
-		dictionary.put(UPnPDevice.MANUFACTURER,"Apache Software Foundation");
-		dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://felix.apache.org");
-		dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A CyberLink Clock device clone to test OSGi to UPnP service export");
-		dictionary.put(UPnPDevice.MODEL_NAME,"DolceDormire");
-		dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
-		dictionary.put(UPnPDevice.MODEL_URL,"http://felix.apache.org/site/upnp-examples.html");
-		//dictionary.put(UPnPDevice.PRESENTATION_URL,"http://felix.apache.org/dolceDormire/presentation");
-		dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
-		dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:clock:1");
-		dictionary.put(UPnPDevice.UDN,DEVICE_ID);
-		//dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
-		dictionary.put(UPnPDevice.UPC,"1213456789");
-	}
-	
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
-	 */
-	public UPnPService getService(String serviceId) {
-		if  (serviceId.equals(timerService.getId())) return timerService;
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
-	 */
-	public UPnPService[] getServices() {
-		return services;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
-	 */
-	public UPnPIcon[] getIcons(String locale) {
-		UPnPIcon icon = new ClockIcon();
-		return new UPnPIcon[]{icon} ;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
-	 */
-	public Dictionary getDescriptions(String locale) {
-		return dictionary;
-	}
-
-	/**
-	 * 
-	 */
-	public void start() {
-		// TODO Auto-generated method stub
-		
-	}
-
-	/**
-	 * 
-	 */
-	public void stop() {
-		notifier.destroy();	
-	}
-
-	/**
-	 * 
-	 */
-	public void update() {
-		Clock clock = Clock.getInstance();
-		Calendar cal = clock.getCalendar();
-        long time = cal.getTime().getTime();
-        UPnPStateVariable variable =  timerService.getStateVariable("Time");
-		notifier.propertyChange(new PropertyChangeEvent(variable,"Time",new Long(time-1000),new Long(time)));
-	}
-	
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+
+import java.beans.PropertyChangeEvent;
+import java.util.Calendar;
+import java.util.Dictionary;
+import java.util.Properties;
+import java.util.Random;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPIcon;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
+
+public class ClockDevice implements UPnPDevice {
+
+	final private String DEVICE_ID = "uuid:Felix-Clock+"+Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
+	private BundleContext context;
+	private TimerService timerService;
+	private UPnPService[] services;
+	private Dictionary dictionary;
+	public static UPnPEventNotifier notifier = null;
+	
+	public ClockDevice(BundleContext context) {
+		this.context=context;
+		timerService = new TimerService();
+		services = new UPnPService[]{timerService};
+		setupDeviceProperties();
+		buildEventNotifyer();
+	}
+
+	/**
+	 * 
+	 */
+	private void buildEventNotifyer() {
+		 notifier = new UPnPEventNotifier(context,this,timerService);
+	}
+
+	private void setupDeviceProperties(){
+		dictionary = new Properties();
+		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
+		dictionary.put(
+		        org.osgi.service
+		        	.device.Constants.DEVICE_CATEGORY,
+	        	new String[]{UPnPDevice.DEVICE_CATEGORY}
+	        );
+		//dictionary.put(UPnPDevice.DEVICE_CATEGORY,new String[]{UPnPDevice.DEVICE_CATEGORY});
+		dictionary.put(UPnPDevice.FRIENDLY_NAME,"Felix OSGi-UPnP Clock");
+		dictionary.put(UPnPDevice.MANUFACTURER,"Apache Software Foundation");
+		dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://felix.apache.org");
+		dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A CyberLink Clock device clone to test OSGi to UPnP service export");
+		dictionary.put(UPnPDevice.MODEL_NAME,"DolceDormire");
+		dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
+		dictionary.put(UPnPDevice.MODEL_URL,"http://felix.apache.org/site/upnp-examples.html");
+		//dictionary.put(UPnPDevice.PRESENTATION_URL,"http://felix.apache.org/dolceDormire/presentation");
+		dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
+		dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:clock:1");
+		dictionary.put(UPnPDevice.UDN,DEVICE_ID);
+		//dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
+		dictionary.put(UPnPDevice.UPC,"1213456789");
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
+	 */
+	public UPnPService getService(String serviceId) {
+		if  (serviceId.equals(timerService.getId())) return timerService;
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
+	 */
+	public UPnPService[] getServices() {
+		return services;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
+	 */
+	public UPnPIcon[] getIcons(String locale) {
+		UPnPIcon icon = new ClockIcon();
+		return new UPnPIcon[]{icon} ;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
+	 */
+	public Dictionary getDescriptions(String locale) {
+		return dictionary;
+	}
+
+	/**
+	 * 
+	 */
+	public void start() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/**
+	 * 
+	 */
+	public void stop() {
+		notifier.destroy();	
+	}
+
+	/**
+	 * 
+	 */
+	public void update() {
+		Clock clock = Clock.getInstance();
+		Calendar cal = clock.getCalendar();
+        long time = cal.getTime().getTime();
+        UPnPStateVariable variable =  timerService.getStateVariable("Time");
+		notifier.propertyChange(new PropertyChangeEvent(variable,"Time",new Long(time-1000),new Long(time)));
+	}
+	
+}
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockFrame.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockFrame.java
index aa19acb..4adeff2 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockFrame.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockFrame.java
@@ -1,123 +1,123 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.awt.BorderLayout;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.net.URL;
-
-import javax.swing.ImageIcon;
-import javax.swing.JFrame;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-public class ClockFrame extends JFrame implements Runnable 
-{
-	private final static String TITLE = "Felix UPnP Clock";
-	private ClockDevice clockDev;
-	private ClockPane clockPane;
-	
-	public ClockFrame(final BundleContext context)
-	{
-		super(TITLE);
-		try {
-			clockDev = new ClockDevice( context);
-		}
-		catch (Exception e) {
-			System.out.println(e);
-		}
-				
-		getContentPane().setLayout(new BorderLayout());
-
-		clockPane = new ClockPane();		
-		getContentPane().add(clockPane, BorderLayout.CENTER);
-
-		addWindowListener(new WindowAdapter(){
-			public void windowClosing(WindowEvent e) 
-			{
-				try {
-					context.getBundle().stop();
-				} catch (BundleException ex) {
-					ex.printStackTrace();
-				}
-			}
-		});			
-	       try {
-	            URL eventIconUrl = ClockFrame.class.getResource("images/logo.gif");           
-	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
-	            setIconImage(icon.getImage());
-	       }
-	        catch (Exception ex){
-	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
-	        }
-		
-		pack();
-		setVisible(true);
-	}
-
-	public ClockPane getClockPanel()
-	{
-		return clockPane;
-	}
-
-	public ClockDevice getClockDevice()
-	{
-		return clockDev;
-	}
-		
-	////////////////////////////////////////////////
-	//	run	
-	////////////////////////////////////////////////
-
-	private Thread timerThread = null;
-		
-	public void run()
-	{
-		Thread thisThread = Thread.currentThread();
-
-		while (timerThread == thisThread) {
-			getClockDevice().update();
-			getClockPanel().repaint();
-			try {
-				Thread.sleep(1000);
-			}
-			catch(InterruptedException e) {}
-		}
-	}
-	
-	public void start()
-	{
-		clockDev.start();
-		
-		timerThread = new Thread(this,"upnp.sample.clock.ClockFrame");
-		timerThread.start();
-	}
-	
-	public void stop()
-	{
-		clockDev.stop();
-		timerThread = null;
-		dispose();
-	}
-
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.awt.BorderLayout;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public class ClockFrame extends JFrame implements Runnable 
+{
+	private final static String TITLE = "Felix UPnP Clock";
+	private ClockDevice clockDev;
+	private ClockPane clockPane;
+	
+	public ClockFrame(final BundleContext context)
+	{
+		super(TITLE);
+		try {
+			clockDev = new ClockDevice( context);
+		}
+		catch (Exception e) {
+			System.out.println(e);
+		}
+				
+		getContentPane().setLayout(new BorderLayout());
+
+		clockPane = new ClockPane();		
+		getContentPane().add(clockPane, BorderLayout.CENTER);
+
+		addWindowListener(new WindowAdapter(){
+			public void windowClosing(WindowEvent e) 
+			{
+				try {
+					context.getBundle().stop();
+				} catch (BundleException ex) {
+					ex.printStackTrace();
+				}
+			}
+		});			
+	       try {
+	            URL eventIconUrl = ClockFrame.class.getResource("images/logo.gif");           
+	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
+	            setIconImage(icon.getImage());
+	       }
+	        catch (Exception ex){
+	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
+	        }
+		
+		pack();
+		setVisible(true);
+	}
+
+	public ClockPane getClockPanel()
+	{
+		return clockPane;
+	}
+
+	public ClockDevice getClockDevice()
+	{
+		return clockDev;
+	}
+		
+	////////////////////////////////////////////////
+	//	run	
+	////////////////////////////////////////////////
+
+	private Thread timerThread = null;
+		
+	public void run()
+	{
+		Thread thisThread = Thread.currentThread();
+
+		while (timerThread == thisThread) {
+			getClockDevice().update();
+			getClockPanel().repaint();
+			try {
+				Thread.sleep(1000);
+			}
+			catch(InterruptedException e) {}
+		}
+	}
+	
+	public void start()
+	{
+		clockDev.start();
+		
+		timerThread = new Thread(this,"upnp.sample.clock.ClockFrame");
+		timerThread.start();
+	}
+	
+	public void stop()
+	{
+		clockDev.stop();
+		timerThread = null;
+		dispose();
+	}
+
+}
+
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockIcon.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockIcon.java
index f97d539..764ed1e 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockIcon.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockIcon.java
@@ -1,69 +1,69 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.osgi.service.upnp.UPnPIcon;
-
-public class ClockIcon implements UPnPIcon {
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
-	 */
-	public String getMimeType() {
-		return "image/gif";
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
-	 */
-	public int getWidth() {
-		return 32;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
-	 */
-	public int getHeight() {
-		return 32;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
-	 */
-	public int getSize() {
-		return 0;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
-	 */
-	public int getDepth() {
-		return 16;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
-	 */
-	public InputStream getInputStream() throws IOException {
-		return ClockIcon.class.getResourceAsStream("images/clock.gif");
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.osgi.service.upnp.UPnPIcon;
+
+public class ClockIcon implements UPnPIcon {
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
+	 */
+	public String getMimeType() {
+		return "image/gif";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
+	 */
+	public int getWidth() {
+		return 32;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
+	 */
+	public int getHeight() {
+		return 32;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
+	 */
+	public int getSize() {
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
+	 */
+	public int getDepth() {
+		return 16;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
+	 */
+	public InputStream getInputStream() throws IOException {
+		return ClockIcon.class.getResourceAsStream("images/clock.gif");
+	}
+}
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java
index 9cc5c0c..25b931e 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java
@@ -1,212 +1,212 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-
-import javax.imageio.ImageIO;
-import javax.swing.JPanel;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class ClockPane extends JPanel  // MouseListener
-{
-	public ClockPane()
-	{
-		loadImage();
-		initPanel();
-	}
-
-	////////////////////////////////////////////////
-	//	Background
-	////////////////////////////////////////////////
-	
-
-	private BufferedImage panelmage;
-	
-	private void loadImage()
-	{
-		
-		try {
-			panelmage = ImageIO.read(ClockPane.class.getResourceAsStream("images/clock.jpg"));
-		}
-		catch (Exception e) {
-			System.out.println(e);
-		}
-	}
-
-	private BufferedImage getPaneImage()
-	{
-		return panelmage;
-	}
-
-	////////////////////////////////////////////////
-	//	Background
-	////////////////////////////////////////////////
-
-	private void initPanel()
-	{
-		BufferedImage panelmage = getPaneImage();
-		setPreferredSize(new Dimension(panelmage.getWidth(), panelmage.getHeight()));
-	}
-
-	////////////////////////////////////////////////
-	//	Font
-	////////////////////////////////////////////////
-
-	private final static String DEFAULT_FONT_NAME = "Lucida Console";
-	private final static int DEFAULT_TIME_FONT_SIZE = 60;
-	private final static int DEFAULT_DATE_FONT_SIZE = 18;
-	private final static int DEFAULT_SECOND_BLOCK_HEIGHT = 8;
-	private final static int DEFAULT_SECOND_BLOCK_FONT_SIZE = 10;
-
-	private Font timeFont = null;
-	private Font dateFont = null;
-	private Font secondFont = null;
-
-	private Font getFont(Graphics g, int size)
-	{
-		Font font = new Font(DEFAULT_FONT_NAME, Font.PLAIN, size);
-		if (font != null)
-			return font;
-		return g.getFont();
-	}
-		
-	private Font getTimeFont(Graphics g)
-	{
-		if (timeFont == null)
-			timeFont = getFont(g, DEFAULT_TIME_FONT_SIZE);
-		return timeFont;
-	}
-
-	private Font getDateFont(Graphics g)
-	{
-		if (dateFont == null)
-			dateFont = getFont(g, DEFAULT_DATE_FONT_SIZE);
-		return dateFont;
-	}
-
-	private Font getSecondFont(Graphics g)
-	{
-		if (secondFont == null)
-			secondFont = getFont(g, DEFAULT_SECOND_BLOCK_FONT_SIZE);
-		return secondFont;
-	}
-
-	////////////////////////////////////////////////
-	//	paint
-	////////////////////////////////////////////////
-
-	private void drawClockInfo(Graphics g)
-	{
-		Clock clock = Clock.getInstance();
-		
-		int winWidth = getWidth();
-		int winHeight = getHeight();
-		
-		g.setColor(Color.BLACK);
-		
-		//// Time String ////
-		
-		String timeStr = clock.getTimeString();
-
-		Font timeFont = getTimeFont(g);
-		g.setFont(timeFont);
-
-		FontMetrics timeFontMetric = g.getFontMetrics();
-		Rectangle2D timeStrBounds = timeFontMetric.getStringBounds(timeStr, g);
-
-		int timeStrWidth = (int)timeStrBounds.getWidth();		
-		int timeStrHeight = (int)timeStrBounds.getHeight();
-		int timeStrX = (winWidth-timeStrWidth)/2;
-		int timeStrY = (winHeight+timeStrHeight)/2;
-		int timeStrOffset = timeStrHeight/8/2;
-		g.drawString(
-			timeStr,
-			timeStrX,
-			timeStrY);
-
-		//// Date String ////
-
-		String dateStr = clock.getDateString();
-
-		Font dateFont = getDateFont(g);
-		g.setFont(dateFont);
-
-		FontMetrics dateFontMetric = g.getFontMetrics();
-		Rectangle2D dateStrBounds = dateFontMetric.getStringBounds(dateStr, g);
-
-		g.drawString(
-			dateStr,
-			(winWidth-(int)dateStrBounds.getWidth())/2,
-			timeStrY-timeStrHeight-timeStrOffset);
-
-		//// Second Bar ////
-		
-		Font secFont = getSecondFont(g);
-		g.setFont(secFont);
-		int sec = clock.getSecond();
-		int secBarBlockSize = timeStrWidth / 60;
-		int secBarBlockY = timeStrY + timeStrOffset;
-		for (int n=0; n<sec; n++) {
-			int x = timeStrX + (secBarBlockSize*n);
-			g.fillRect(
-				x,
-				secBarBlockY,
-				secBarBlockSize-1,
-				DEFAULT_SECOND_BLOCK_HEIGHT);
-		}
-		if (sec != 0 && (sec % 10) == 0) {
-			int x = timeStrX + (secBarBlockSize*sec);
-			g.drawString(
-				Integer.toString(sec),
-				x + secBarBlockSize,
-				secBarBlockY + DEFAULT_SECOND_BLOCK_HEIGHT);
-		}
-	}
-
-	private void clear(Graphics g)
-	{
-		g.setColor(Color.GRAY);
-		g.clearRect(0, 0, getWidth(), getHeight());
-	}
-	
-
-	private void drawPanelImage(Graphics g)
-	{
-		g.drawImage(getPaneImage(), 0, 0, null);
-	}
-		
-	public void paint(Graphics g)
-	{
-		clear(g);
-		drawPanelImage(g);
-		drawClockInfo(g);
-	}
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+
+import javax.imageio.ImageIO;
+import javax.swing.JPanel;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class ClockPane extends JPanel  // MouseListener
+{
+	public ClockPane()
+	{
+		loadImage();
+		initPanel();
+	}
+
+	////////////////////////////////////////////////
+	//	Background
+	////////////////////////////////////////////////
+	
+
+	private BufferedImage panelmage;
+	
+	private void loadImage()
+	{
+		
+		try {
+			panelmage = ImageIO.read(ClockPane.class.getResourceAsStream("images/clock.jpg"));
+		}
+		catch (Exception e) {
+			System.out.println(e);
+		}
+	}
+
+	private BufferedImage getPaneImage()
+	{
+		return panelmage;
+	}
+
+	////////////////////////////////////////////////
+	//	Background
+	////////////////////////////////////////////////
+
+	private void initPanel()
+	{
+		BufferedImage panelmage = getPaneImage();
+		setPreferredSize(new Dimension(panelmage.getWidth(), panelmage.getHeight()));
+	}
+
+	////////////////////////////////////////////////
+	//	Font
+	////////////////////////////////////////////////
+
+	private final static String DEFAULT_FONT_NAME = "Lucida Console";
+	private final static int DEFAULT_TIME_FONT_SIZE = 60;
+	private final static int DEFAULT_DATE_FONT_SIZE = 18;
+	private final static int DEFAULT_SECOND_BLOCK_HEIGHT = 8;
+	private final static int DEFAULT_SECOND_BLOCK_FONT_SIZE = 10;
+
+	private Font timeFont = null;
+	private Font dateFont = null;
+	private Font secondFont = null;
+
+	private Font getFont(Graphics g, int size)
+	{
+		Font font = new Font(DEFAULT_FONT_NAME, Font.PLAIN, size);
+		if (font != null)
+			return font;
+		return g.getFont();
+	}
+		
+	private Font getTimeFont(Graphics g)
+	{
+		if (timeFont == null)
+			timeFont = getFont(g, DEFAULT_TIME_FONT_SIZE);
+		return timeFont;
+	}
+
+	private Font getDateFont(Graphics g)
+	{
+		if (dateFont == null)
+			dateFont = getFont(g, DEFAULT_DATE_FONT_SIZE);
+		return dateFont;
+	}
+
+	private Font getSecondFont(Graphics g)
+	{
+		if (secondFont == null)
+			secondFont = getFont(g, DEFAULT_SECOND_BLOCK_FONT_SIZE);
+		return secondFont;
+	}
+
+	////////////////////////////////////////////////
+	//	paint
+	////////////////////////////////////////////////
+
+	private void drawClockInfo(Graphics g)
+	{
+		Clock clock = Clock.getInstance();
+		
+		int winWidth = getWidth();
+		int winHeight = getHeight();
+		
+		g.setColor(Color.BLACK);
+		
+		//// Time String ////
+		
+		String timeStr = clock.getTimeString();
+
+		Font timeFont = getTimeFont(g);
+		g.setFont(timeFont);
+
+		FontMetrics timeFontMetric = g.getFontMetrics();
+		Rectangle2D timeStrBounds = timeFontMetric.getStringBounds(timeStr, g);
+
+		int timeStrWidth = (int)timeStrBounds.getWidth();		
+		int timeStrHeight = (int)timeStrBounds.getHeight();
+		int timeStrX = (winWidth-timeStrWidth)/2;
+		int timeStrY = (winHeight+timeStrHeight)/2;
+		int timeStrOffset = timeStrHeight/8/2;
+		g.drawString(
+			timeStr,
+			timeStrX,
+			timeStrY);
+
+		//// Date String ////
+
+		String dateStr = clock.getDateString();
+
+		Font dateFont = getDateFont(g);
+		g.setFont(dateFont);
+
+		FontMetrics dateFontMetric = g.getFontMetrics();
+		Rectangle2D dateStrBounds = dateFontMetric.getStringBounds(dateStr, g);
+
+		g.drawString(
+			dateStr,
+			(winWidth-(int)dateStrBounds.getWidth())/2,
+			timeStrY-timeStrHeight-timeStrOffset);
+
+		//// Second Bar ////
+		
+		Font secFont = getSecondFont(g);
+		g.setFont(secFont);
+		int sec = clock.getSecond();
+		int secBarBlockSize = timeStrWidth / 60;
+		int secBarBlockY = timeStrY + timeStrOffset;
+		for (int n=0; n<sec; n++) {
+			int x = timeStrX + (secBarBlockSize*n);
+			g.fillRect(
+				x,
+				secBarBlockY,
+				secBarBlockSize-1,
+				DEFAULT_SECOND_BLOCK_HEIGHT);
+		}
+		if (sec != 0 && (sec % 10) == 0) {
+			int x = timeStrX + (secBarBlockSize*sec);
+			g.drawString(
+				Integer.toString(sec),
+				x + secBarBlockSize,
+				secBarBlockY + DEFAULT_SECOND_BLOCK_HEIGHT);
+		}
+	}
+
+	private void clear(Graphics g)
+	{
+		g.setColor(Color.GRAY);
+		g.clearRect(0, 0, getWidth(), getHeight());
+	}
+	
+
+	private void drawPanelImage(Graphics g)
+	{
+		g.drawImage(getPaneImage(), 0, 0, null);
+	}
+		
+	public void paint(Graphics g)
+	{
+		clear(g);
+		drawPanelImage(g);
+		drawClockInfo(g);
+	}
+}
+
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java
index f2f4abb..db32b79 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java
@@ -1,89 +1,89 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class GetTimeAction implements UPnPAction {
-
-	final private String NAME = "GetTime";
-	final private String RESULT_STATUS = "CurrentTime";
-	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
-	private TimeStateVariable time;
-	
-	
-	public GetTimeAction(TimeStateVariable time){
-		this.time = time;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return time;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		String value = time.getCurrentTime();
-		Hashtable result = new Hashtable();
-		result.put(RESULT_STATUS,value);
-		return result;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class GetTimeAction implements UPnPAction {
+
+	final private String NAME = "GetTime";
+	final private String RESULT_STATUS = "CurrentTime";
+	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+	private TimeStateVariable time;
+	
+	
+	public GetTimeAction(TimeStateVariable time){
+		this.time = time;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return time;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		String value = time.getCurrentTime();
+		Hashtable result = new Hashtable();
+		result.put(RESULT_STATUS,value);
+		return result;
+	}
+}
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java
index 2fd6795..3c936db 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java
@@ -1,96 +1,96 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class ResultStateVariable implements UPnPStateVariable{
-	
-	final private String NAME = "Result";
-	final private String DEFAULT_VALUE = "";
-	private Clock clock;
-	
-	
-	public ResultStateVariable(){
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
-	 */
-	public Class getJavaDataType() {
-		return String.class;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
-	 */
-	public String getUPnPDataType() {
-		return TYPE_STRING;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
-	 */
-	public Object getDefaultValue() {
-		return DEFAULT_VALUE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
-	 */
-	public String[] getAllowedValues() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
-	 */
-	public Number getMinimum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
-	 */
-	public Number getMaximum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
-	 */
-	public Number getStep() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
-	 */
-	public boolean sendsEvents() {
-		return false;
-	}
-	
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class ResultStateVariable implements UPnPStateVariable{
+	
+	final private String NAME = "Result";
+	final private String DEFAULT_VALUE = "";
+	private Clock clock;
+	
+	
+	public ResultStateVariable(){
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return String.class;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_STRING;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return false;
+	}
+	
+}
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java
index 752028e..69183eb 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java
@@ -1,97 +1,97 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.beans.PropertyChangeEvent;
-import java.util.Dictionary;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class SetTimeAction implements UPnPAction {
-
-	final private String NAME = "SetTime";
-	final private String NEW_TIME_VALUE = "NewTime";
-	final private String NEW_RESULT_VALUE = "Result";
-	final private String[] IN_ARG_NAMES = new String[]{NEW_TIME_VALUE};
-	final private String[] OUT_ARG_NAMES = new String[]{NEW_RESULT_VALUE};
-	private UPnPStateVariable time,result;
-	
-	
-	public SetTimeAction(UPnPStateVariable time,UPnPStateVariable result){
-		this.time = time;
-		this.result=result;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return "Result";
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		return IN_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		if (argumentName.equals("NewTime")) return time;
-		else if (argumentName.equals("Result")) return result;
-		else return null;
-	}
-
-	/* (non-Javadoc)
-	 * 
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		Long newValue = (Long) args.get(NEW_TIME_VALUE);
-        Long oldValue = (Long) ((TimeStateVariable) time).getCurrentValue();
-		((TimeStateVariable) time).setCurrentTime(newValue.longValue());
-        ClockDevice.notifier.propertyChange(new PropertyChangeEvent(time,"Time",oldValue,newValue));        
-		args.remove(NEW_TIME_VALUE);
-		args.put(NEW_RESULT_VALUE,((TimeStateVariable) time).getCurrentTime());
-		return args;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.beans.PropertyChangeEvent;
+import java.util.Dictionary;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class SetTimeAction implements UPnPAction {
+
+	final private String NAME = "SetTime";
+	final private String NEW_TIME_VALUE = "NewTime";
+	final private String NEW_RESULT_VALUE = "Result";
+	final private String[] IN_ARG_NAMES = new String[]{NEW_TIME_VALUE};
+	final private String[] OUT_ARG_NAMES = new String[]{NEW_RESULT_VALUE};
+	private UPnPStateVariable time,result;
+	
+	
+	public SetTimeAction(UPnPStateVariable time,UPnPStateVariable result){
+		this.time = time;
+		this.result=result;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return "Result";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		return IN_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		if (argumentName.equals("NewTime")) return time;
+		else if (argumentName.equals("Result")) return result;
+		else return null;
+	}
+
+	/* (non-Javadoc)
+	 * 
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		Long newValue = (Long) args.get(NEW_TIME_VALUE);
+        Long oldValue = (Long) ((TimeStateVariable) time).getCurrentValue();
+		((TimeStateVariable) time).setCurrentTime(newValue.longValue());
+        ClockDevice.notifier.propertyChange(new PropertyChangeEvent(time,"Time",oldValue,newValue));        
+		args.remove(NEW_TIME_VALUE);
+		args.put(NEW_RESULT_VALUE,((TimeStateVariable) time).getCurrentTime());
+		return args;
+	}
+}
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java
index 6985f0f..3a49517 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java
@@ -1,110 +1,110 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-import java.util.Date;
-
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-
-public class TimeStateVariable implements UPnPLocalStateVariable{
-	
-	final private String NAME = "Time";
-	final private String DEFAULT_VALUE = "";
-	private Clock clock;
-	
-	
-	public TimeStateVariable(){
-		clock = Clock.getInstance();
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
-	 */
-	public Class getJavaDataType() {
-		return Long.class;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
-	 */
-	public String getUPnPDataType() {
-		return TYPE_TIME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
-	 */
-	public Object getDefaultValue() {
-		return DEFAULT_VALUE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
-	 */
-	public String[] getAllowedValues() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
-	 */
-	public Number getMinimum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
-	 */
-	public Number getMaximum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
-	 */
-	public Number getStep() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
-	 */
-	public boolean sendsEvents() {
-		return true;
-	}
-	
-	public String getCurrentTime(){
-		return clock.getTimeString();
-	}
-	
-	public void setCurrentTime(long milliseconds){        
-		clock.getCalendar().setTime(new Date(milliseconds));
-	}
-
-	public Object getCurrentValue() {
-		return new Long(clock.getCalendar().getTime().getTime());
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+import java.util.Date;
+
+import org.osgi.service.upnp.UPnPLocalStateVariable;
+
+public class TimeStateVariable implements UPnPLocalStateVariable{
+	
+	final private String NAME = "Time";
+	final private String DEFAULT_VALUE = "";
+	private Clock clock;
+	
+	
+	public TimeStateVariable(){
+		clock = Clock.getInstance();
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return Long.class;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_TIME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return true;
+	}
+	
+	public String getCurrentTime(){
+		return clock.getTimeString();
+	}
+	
+	public void setCurrentTime(long milliseconds){        
+		clock.getCalendar().setTime(new Date(milliseconds));
+	}
+
+	public Object getCurrentValue() {
+		return new Long(clock.getCalendar().getTime().getTime());
+	}
+}
diff --git a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
index 76edcaa..ef92ead 100644
--- a/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
+++ b/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
@@ -1,106 +1,106 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.util.HashMap;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class TimerService implements UPnPService {
-	final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:timer:1";
-	final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:timer:1";
-	final private String VERSION ="1";
-
-	private UPnPStateVariable time,result;
-	private UPnPStateVariable[] states;
-	private HashMap actions = new HashMap();
-	
-	
-	public TimerService(){
-		time = new TimeStateVariable();
-		result = new ResultStateVariable();
-		this.states = new UPnPStateVariable[]{time,result};
-		
-		UPnPAction setTime= new SetTimeAction(time,result);
-		UPnPAction getTime = new GetTimeAction((TimeStateVariable)time);
-		actions.put(setTime.getName(),setTime);
-		actions.put(getTime.getName(),getTime);
-		
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getId()
-	 */
-	public String getId() {
-		return SERVICE_ID;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getType()
-	 */
-	public String getType() {
-		return SERVICE_TYPE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getVersion()
-	 */
-	public String getVersion() {
-		return VERSION;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
-	 */
-	public UPnPAction getAction(String name) {
-		return (UPnPAction)actions.get(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getActions()
-	 */
-	public UPnPAction[] getActions() {
-		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
-	 */
-	public UPnPStateVariable[] getStateVariables() {
-		return states;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String name) {
-		if (name.equals("Time"))
-			return time;
-		else if (name.equals("Result"))
-			return result;
-		else return null;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.util.HashMap;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class TimerService implements UPnPService {
+	final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:timer:1";
+	final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:timer:1";
+	final private String VERSION ="1";
+
+	private UPnPStateVariable time,result;
+	private UPnPStateVariable[] states;
+	private HashMap actions = new HashMap();
+	
+	
+	public TimerService(){
+		time = new TimeStateVariable();
+		result = new ResultStateVariable();
+		this.states = new UPnPStateVariable[]{time,result};
+		
+		UPnPAction setTime= new SetTimeAction(time,result);
+		UPnPAction getTime = new GetTimeAction((TimeStateVariable)time);
+		actions.put(setTime.getName(),setTime);
+		actions.put(getTime.getName(),getTime);
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getId()
+	 */
+	public String getId() {
+		return SERVICE_ID;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getType()
+	 */
+	public String getType() {
+		return SERVICE_TYPE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getVersion()
+	 */
+	public String getVersion() {
+		return VERSION;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
+	 */
+	public UPnPAction getAction(String name) {
+		return (UPnPAction)actions.get(name);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getActions()
+	 */
+	public UPnPAction[] getActions() {
+		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
+	 */
+	public UPnPStateVariable[] getStateVariables() {
+		return states;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String name) {
+		if (name.equals("Time"))
+			return time;
+		else if (name.equals("Result"))
+			return result;
+		else return null;
+	}
+}
diff --git a/upnp/samples/pom.xml b/upnp/samples/pom.xml
index 05aa0f6..c54df7b 100644
--- a/upnp/samples/pom.xml
+++ b/upnp/samples/pom.xml
@@ -16,46 +16,46 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project>
-  <parent>
-    <groupId>org.apache.felix</groupId>
-    <artifactId>felix</artifactId>
-    <version>1.0.2</version>
-    <relativePath>../../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <packaging>pom</packaging>
-  <name>Apache Felix UPnP Examples: Build</name>
-  <artifactId>upnp.examples.build</artifactId>
-  <version>0.9.0-SNAPSHOT</version>
-
-  <profiles>
-    <profile>
-      <id>packaging-bundle</id>
-      <activation>
-        <property>
-          <name>packaging</name>
-          <value>bundle</value>
-        </property>
-      </activation>
-      <modules>
-          <module>binarylight</module>
-          <module>clock</module>
-          <module>tv</module>
-      </modules>
-    </profile>
-    <profile>
-      <id>default</id>
-      <activation>
-        <property>
-          <name>!packaging</name>
-        </property>
-      </activation>
-      <modules>
-          <module>binarylight</module>
-          <module>clock</module>
-          <module>tv</module>
-      </modules>
-    </profile>
-  </profiles>
-</project>
+<project>
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix</artifactId>
+    <version>1.0.2</version>
+    <relativePath>../../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>pom</packaging>
+  <name>Apache Felix UPnP Examples: Build</name>
+  <artifactId>upnp.examples.build</artifactId>
+  <version>0.9.0-SNAPSHOT</version>
+
+  <profiles>
+    <profile>
+      <id>packaging-bundle</id>
+      <activation>
+        <property>
+          <name>packaging</name>
+          <value>bundle</value>
+        </property>
+      </activation>
+      <modules>
+          <module>binarylight</module>
+          <module>clock</module>
+          <module>tv</module>
+      </modules>
+    </profile>
+    <profile>
+      <id>default</id>
+      <activation>
+        <property>
+          <name>!packaging</name>
+        </property>
+      </activation>
+      <modules>
+          <module>binarylight</module>
+          <module>clock</module>
+          <module>tv</module>
+      </modules>
+    </profile>
+  </profiles>
+</project>
diff --git a/upnp/samples/tv/pom.xml b/upnp/samples/tv/pom.xml
index 8e546c9..2386e4f 100644
--- a/upnp/samples/tv/pom.xml
+++ b/upnp/samples/tv/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -17,60 +17,60 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <artifactId>felix</artifactId>
-    <groupId>org.apache.felix</groupId>
-    <version>1.0.2</version>
-    <relativePath>../../../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.felix</groupId>
-  <artifactId>org.apache.felix.upnp.sample.tv</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Felix UPnP Sample TV</name>
-  <version>0.2.0-SNAPSHOT</version>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>felix</artifactId>
+    <groupId>org.apache.felix</groupId>
+    <version>1.0.2</version>
+    <relativePath>../../../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.felix</groupId>
+  <artifactId>org.apache.felix.upnp.sample.tv</artifactId>
+  <packaging>bundle</packaging>
+  <name>Apache Felix UPnP Sample TV</name>
+  <version>0.2.0-SNAPSHOT</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
         <version>1.4.0</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>${pom.name}</Bundle-Name>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-Name>${pom.name}</Bundle-Name>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
-            <Bundle-Description>CyberLink Tv clone to test UPnPBase driver</Bundle-Description>
-            <Bundle-SymbolicName>org.apache.felix.upnp.sample.tv</Bundle-SymbolicName>
-            <Bundle-Activator>org.apache.felix.upnp.sample.tv.Activator</Bundle-Activator>
-            <Private-Package>org.apache.felix.upnp.sample.tv.*</Private-Package>
-            <Import-Package>*</Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
+            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
+            <Bundle-Description>CyberLink Tv clone to test UPnPBase driver</Bundle-Description>
+            <Bundle-SymbolicName>org.apache.felix.upnp.sample.tv</Bundle-SymbolicName>
+            <Bundle-Activator>org.apache.felix.upnp.sample.tv.Activator</Bundle-Activator>
+            <Private-Package>org.apache.felix.upnp.sample.tv.*</Private-Package>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
       <version>1.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.upnp.extra</artifactId>
-      <version>0.3.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-</project>
-
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.upnp.extra</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>
+
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java
index 3c786df..5106e1d 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java
@@ -1,85 +1,85 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class GetPowerAction implements UPnPAction {
-
-	final private String NAME = "GetPower";
-	final private String RESULT_STATUS = "Power";
-	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
-	private PowerStateVariable power;
-	
-	
-	public GetPowerAction(PowerStateVariable power){
-		this.power = power;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return power;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		Boolean value = power.getCurrentPower();
-		Hashtable result = new Hashtable();
-		result.put(RESULT_STATUS,value);
-		return result;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class GetPowerAction implements UPnPAction {
+
+	final private String NAME = "GetPower";
+	final private String RESULT_STATUS = "Power";
+	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+	private PowerStateVariable power;
+	
+	
+	public GetPowerAction(PowerStateVariable power){
+		this.power = power;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return power;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		Boolean value = power.getCurrentPower();
+		Hashtable result = new Hashtable();
+		result.put(RESULT_STATUS,value);
+		return result;
+	}
+}
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java
index 347d9fc..2352dde 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java
@@ -1,103 +1,103 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.util.HashMap;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class PowerService implements UPnPService {
-	final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:power:1";
-	final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:power:1";
-	final private String VERSION ="1";
-
-	private PowerStateVariable power;
-	private ResultStateVariable result;
-	private UPnPStateVariable[] states;
-	private HashMap actions = new HashMap();
-	
-	
-	public PowerService(){
-		power = new PowerStateVariable();
-		result = new ResultStateVariable();
-		this.states = new UPnPStateVariable[]{power,result};
-		
-		UPnPAction setPower= new SetPowerAction(power,result);
-		UPnPAction getPower = new GetPowerAction(power);
-		actions.put(setPower.getName(),setPower);
-		actions.put(getPower.getName(),getPower);
-		
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getId()
-	 */
-	public String getId() {
-		return SERVICE_ID;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getType()
-	 */
-	public String getType() {
-		return SERVICE_TYPE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getVersion()
-	 */
-	public String getVersion() {
-		return VERSION;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
-	 */
-	public UPnPAction getAction(String name) {
-		return (UPnPAction)actions.get(name);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getActions()
-	 */
-	public UPnPAction[] getActions() {
-		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
-	 */
-	public UPnPStateVariable[] getStateVariables() {
-		return states;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String name) {
-		if (name.equals("Power"))
-			return power;
-		else if (name.equals("Result"))
-			return result;
-		else return null;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.util.HashMap;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class PowerService implements UPnPService {
+	final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:power:1";
+	final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:power:1";
+	final private String VERSION ="1";
+
+	private PowerStateVariable power;
+	private ResultStateVariable result;
+	private UPnPStateVariable[] states;
+	private HashMap actions = new HashMap();
+	
+	
+	public PowerService(){
+		power = new PowerStateVariable();
+		result = new ResultStateVariable();
+		this.states = new UPnPStateVariable[]{power,result};
+		
+		UPnPAction setPower= new SetPowerAction(power,result);
+		UPnPAction getPower = new GetPowerAction(power);
+		actions.put(setPower.getName(),setPower);
+		actions.put(getPower.getName(),getPower);
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getId()
+	 */
+	public String getId() {
+		return SERVICE_ID;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getType()
+	 */
+	public String getType() {
+		return SERVICE_TYPE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getVersion()
+	 */
+	public String getVersion() {
+		return VERSION;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
+	 */
+	public UPnPAction getAction(String name) {
+		return (UPnPAction)actions.get(name);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getActions()
+	 */
+	public UPnPAction[] getActions() {
+		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
+	 */
+	public UPnPStateVariable[] getStateVariables() {
+		return states;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String name) {
+		if (name.equals("Power"))
+			return power;
+		else if (name.equals("Result"))
+			return result;
+		else return null;
+	}
+}
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java
index ef66bc0..1507bb8 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java
@@ -1,120 +1,120 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-import java.beans.PropertyChangeEvent;
-
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-
-import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
-
-public class PowerStateVariable implements UPnPLocalStateVariable {
-	
-	final private String NAME = "Power";
-	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
-	private UPnPEventNotifier notifier;
-	private Boolean power = Boolean.FALSE;
-	
-	public PowerStateVariable(){
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
-	 */
-	public Class getJavaDataType() {
-		return Boolean.class;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
-	 */
-	public String getUPnPDataType() {
-		return TYPE_BOOLEAN;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
-	 */
-	public Object getDefaultValue() {
-		return DEFAULT_VALUE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
-	 */
-	public String[] getAllowedValues() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
-	 */
-	public Number getMinimum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
-	 */
-	public Number getMaximum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
-	 */
-	public Number getStep() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
-	 */
-	public boolean sendsEvents() {
-		return true;
-	}
-	
-	public Boolean getCurrentPower(){
-		return power;
-	}
-	
-	public void setPower(Boolean value){
-		if (!value.equals(power)) {
-			Boolean oldValue = power;
-			power = value;
-			if (notifier != null)
-			notifier.propertyChange(new PropertyChangeEvent(this,"Power",oldValue,value));
-		}
-	}
-
-	public void setNotifier(UPnPEventNotifier notifier){
-		this.notifier = notifier;
-	}
-
-    public Object getCurrentValue() {
-         return power;
-    }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+import java.beans.PropertyChangeEvent;
+
+import org.osgi.service.upnp.UPnPLocalStateVariable;
+
+import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
+
+public class PowerStateVariable implements UPnPLocalStateVariable {
+	
+	final private String NAME = "Power";
+	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
+	private UPnPEventNotifier notifier;
+	private Boolean power = Boolean.FALSE;
+	
+	public PowerStateVariable(){
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return Boolean.class;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_BOOLEAN;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return true;
+	}
+	
+	public Boolean getCurrentPower(){
+		return power;
+	}
+	
+	public void setPower(Boolean value){
+		if (!value.equals(power)) {
+			Boolean oldValue = power;
+			power = value;
+			if (notifier != null)
+			notifier.propertyChange(new PropertyChangeEvent(this,"Power",oldValue,value));
+		}
+	}
+
+	public void setNotifier(UPnPEventNotifier notifier){
+		this.notifier = notifier;
+	}
+
+    public Object getCurrentValue() {
+         return power;
+    }
+}
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java
index a50ef03..b64ac28 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java
@@ -1,95 +1,95 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class ResultStateVariable implements UPnPStateVariable{
-	
-	final private String NAME = "Result";
-	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
-	
-	
-	public ResultStateVariable(){
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
-	 */
-	public Class getJavaDataType() {
-		return Boolean.class;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
-	 */
-	public String getUPnPDataType() {
-		return TYPE_BOOLEAN;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
-	 */
-	public Object getDefaultValue() {
-		return DEFAULT_VALUE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
-	 */
-	public String[] getAllowedValues() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
-	 */
-	public Number getMinimum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
-	 */
-	public Number getMaximum() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
-	 */
-	public Number getStep() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
-	 */
-	public boolean sendsEvents() {
-		return false;
-	}
-	
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class ResultStateVariable implements UPnPStateVariable{
+	
+	final private String NAME = "Result";
+	final private Boolean DEFAULT_VALUE = Boolean.FALSE;
+	
+	
+	public ResultStateVariable(){
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return Boolean.class;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_BOOLEAN;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return false;
+	}
+	
+}
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/SetPowerAction.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/SetPowerAction.java
index 30d67ff..909bdc8 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/SetPowerAction.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/SetPowerAction.java
@@ -1,91 +1,91 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class SetPowerAction implements UPnPAction {
-
-	final private String NAME = "SetPower";
-	final private String NEW_TIME_VALUE = "Power";
-	final private String NEW_RESULT_VALUE = "Result";
-	final private String[] IN_ARG_NAMES = new String[]{NEW_TIME_VALUE};
-	final private String[] OUT_ARG_NAMES = new String[]{NEW_RESULT_VALUE};
-	private PowerStateVariable power;
-	private ResultStateVariable result;
-	
-	
-	public SetPowerAction(PowerStateVariable power,ResultStateVariable result){
-		this.power = power;
-		this.result=result;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return "Result";
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		return IN_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		if (argumentName.equals("Power")) return power;
-		else if (argumentName.equals("Result")) return result;
-		else return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		Boolean value = (Boolean) args.get(NEW_TIME_VALUE);
-		power.setPower(value);
-		Hashtable result = new Hashtable();
-		result.put(NEW_RESULT_VALUE,Boolean.TRUE);
-		return result;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class SetPowerAction implements UPnPAction {
+
+	final private String NAME = "SetPower";
+	final private String NEW_TIME_VALUE = "Power";
+	final private String NEW_RESULT_VALUE = "Result";
+	final private String[] IN_ARG_NAMES = new String[]{NEW_TIME_VALUE};
+	final private String[] OUT_ARG_NAMES = new String[]{NEW_RESULT_VALUE};
+	private PowerStateVariable power;
+	private ResultStateVariable result;
+	
+	
+	public SetPowerAction(PowerStateVariable power,ResultStateVariable result){
+		this.power = power;
+		this.result=result;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return "Result";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		return IN_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		if (argumentName.equals("Power")) return power;
+		else if (argumentName.equals("Result")) return result;
+		else return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		Boolean value = (Boolean) args.get(NEW_TIME_VALUE);
+		power.setPower(value);
+		Hashtable result = new Hashtable();
+		result.put(NEW_RESULT_VALUE,Boolean.TRUE);
+		return result;
+	}
+}
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
index e7b70ae..f5a0d02 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
@@ -1,319 +1,319 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.awt.Component;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Dictionary;
-import java.util.Properties;
-import java.util.Random;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPIcon;
-import org.osgi.service.upnp.UPnPService;
-
-import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
-import org.apache.felix.upnp.extra.util.UPnPSubscriber;
-
-public class TvDevice implements UPnPDevice,UPnPEventListener,ServiceListener  {
-	
-	final private String DEVICE_ID = "uuid:Felix-TV+" +Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
-	private final static String CLOCK_DEVICE_TYPE = "urn:schemas-upnp-org:device:clock:1";
-	private final static String TIME_SERVICE_TYPE = "urn:schemas-upnp-org:service:timer:1";
-	
-	private final static String LIGHT_DEVICE_TYPE = "urn:schemas-upnp-org:device:light:1";
-	private final static String POWER_SERVICE_TYPE = "urn:schemas-upnp-org:service:power:1";
-
-	private final static String AIRCON_DEVICE_TYPE = "urn:schemas-upnp-org:device:aircon:1";
-	private final static String TEMP_SERVICE_TYPE = "urn:schemas-upnp-org:service:temp:1";
-	
-	private final static String WASHER_DEVICE_TYPE = "urn:schemas-upnp-org:device:washer:1";
-	private final static String STATUS_SERVICE_TYPE = "urn:schemas-upnp-org:service:state:1";
-
-	private final String devicesFilter = 
-		"(&"+
-			"("+Constants.OBJECTCLASS+"="+UPnPDevice.class.getName()+"))";
-			/*"(|("+UPnPDevice.TYPE+"="+ CLOCK_SERVICE_TYPE+")"+
-				"("+UPnPDevice.TYPE+"="+ LIGHT_SERVICE_TYPE+")"+
-				"("+UPnPDevice.TYPE+"="+ AIRCON_SERVICE_TYPE+")"+
-				"("+UPnPDevice.TYPE+"="+ WASHER_SERVICE_TYPE+")))";*/
-
-	private BundleContext context;
-	private PowerService powerService;
-	private UPnPService[] services;
-	private Dictionary dictionary;
-	private UPnPEventNotifier notifier;
-	private PowerStateVariable powerState;
-
-	public TvDevice() {
-		powerService = new PowerService();
-		services = new UPnPService[]{powerService};
-		powerState = (PowerStateVariable) powerService.getStateVariable("Power");
-		setupDeviceProperties();
-		buildEventNotifyer();
-		try {
-			Activator.context.addServiceListener(this,devicesFilter);
-		} catch (InvalidSyntaxException e) {
-			System.out.println(e);		
-		}
-	}
-
-	/**
-	 * 
-	 */
-	private void buildEventNotifyer() {
-		notifier = new UPnPEventNotifier(Activator.context,this,powerService);
-		powerState.setNotifier(notifier);
-	}
-
-	private void setupDeviceProperties(){
-		dictionary = new Properties();
-		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
-		//org.osgi.service.device.Constants.DEVICE_CATEGORY
-		//dictionary.put("DEVICE_CATEGORY","UPnP");
-		dictionary.put(
-	        org.osgi.service
-	        	.device.Constants.DEVICE_CATEGORY,
-        	new String[]{UPnPDevice.DEVICE_CATEGORY}
-        );
-		dictionary.put(UPnPDevice.FRIENDLY_NAME,"Felix Sample Tv");
-		dictionary.put(UPnPDevice.MANUFACTURER,"Apache Software Foundation");
-		dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://felix.apache.org");
-		dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A CyberLink Tv device clone to test OSGi to UPnP service import");
-		dictionary.put(UPnPDevice.MODEL_NAME,"BimbiTv");
-		dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
-		dictionary.put(UPnPDevice.MODEL_URL,"http://felix.apache.org/site/upnp-examples.html");
-		//dictionary.put(UPnPDevice.PRESENTATION_URL,"http://felix.apache.org/BimbiTv/presentation");
-		dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
-		dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:tv:1");
-		dictionary.put(UPnPDevice.UDN,DEVICE_ID);
-		//dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
-		dictionary.put(UPnPDevice.UPC,"1213456789");
-	}
-	
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
-	 */
-	public UPnPService getService(String serviceId) {
-		if  (serviceId.equals(powerService.getId())) return powerService;
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
-	 */
-	public UPnPService[] getServices() {
-		return services;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
-	 */
-	public UPnPIcon[] getIcons(String locale) {
-		UPnPIcon icon = new TvIcon();
-		return new UPnPIcon[]{icon} ;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
-	 */
-	public Dictionary getDescriptions(String locale) {
-		return dictionary;
-	}
-
-
-
-	////////////////////////////////////////////////
-	//	Component
-	////////////////////////////////////////////////
-
-	private Component comp;
-	
-	public void setComponent(Component comp)
-	{
-		this.comp = comp;	
-	}
-	
-	public Component getComponent()
-	{
-		return comp;
-	}
-	
-	////////////////////////////////////////////////
-	//	on/off
-	////////////////////////////////////////////////
-
-	private boolean onFlag = false;
-	
-	public void on()
-	{
-		powerState.setPower(Boolean.TRUE);
-		doSubscribe();
-	}
-
-	public boolean isOn()
-	{ 
-		return powerState.getCurrentPower().booleanValue();
-	}
-	public void off()
-	{
-		powerState.setPower(Boolean.FALSE);
-		undoSubscribe();
-	}
-
-
-	////////////////////////////////////////////////
-	//	Clock
-	////////////////////////////////////////////////
-
-	private String clockTime = ""; 
-	
-	public String getClockTime()
-	{
-		return clockTime;	
-	}
-	
-	////////////////////////////////////////////////
-	//	Aircon
-	////////////////////////////////////////////////
-
-	private String airconTemp = ""; 
-	
-	public String getAirconTempture()
-	{
-		return airconTemp;	
-	}
-
-	////////////////////////////////////////////////
-	//	Message
-	////////////////////////////////////////////////
-
-	private String message = ""; 
-	
-	public void setMessage(String msg)
-	{
-		message = msg;
-	}
-	
-	public String getMessage()
-	{
-		return message;
-	}
-	
-
-	////////////////////////////////////////////////
-	//	Subscribe
-	////////////////////////////////////////////////
-	
-	private UPnPSubscriber subscriber;
-	
-	public void doSubscribe()
-	{
-		subscriber = new UPnPSubscriber(Activator.context,this);
-		subscriber.subscribeEveryServiceType(CLOCK_DEVICE_TYPE, TIME_SERVICE_TYPE);
-		subscriber.subscribeEveryServiceType(AIRCON_DEVICE_TYPE, TEMP_SERVICE_TYPE);
-		subscriber.subscribeEveryServiceType(LIGHT_DEVICE_TYPE, POWER_SERVICE_TYPE);
-		subscriber.subscribeEveryServiceType(WASHER_DEVICE_TYPE, STATUS_SERVICE_TYPE);
-	}
-	
-	public void undoSubscribe(){
-		subscriber.unsubscribeAll();
-	}
-	
-	ArrayList LinkedDevices = new ArrayList();
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPEventListener#notifyUPnPEvent(java.lang.String, java.lang.String, java.util.Dictionary)
-	 */
-	public void notifyUPnPEvent(String deviceId, String serviceId, Dictionary events) {
-		if( !LinkedDevices.contains(deviceId))
-			LinkedDevices.add(deviceId);
-		if (deviceId.indexOf("Clock") != -1){
-				Long time = (Long) events.get("Time");
-				clockTime = new Date(time.longValue()).toString();				
-		}
-		else if (deviceId.indexOf("AirCon") != -1)
-				airconTemp = (String) events.get("Temp");
-		else if (deviceId.indexOf("Washer") != -1)
-				message = (String) events.get("State");
-		else if (deviceId.indexOf("Light") != -1)
-				message = (String) events.get("Power");
- 
-		comp.repaint();
-	}
-
-
-	////////////////////////////////////////////////
-	//	start/stop
-	////////////////////////////////////////////////
-	
-	public void start()
-	{
-		on();
-	}
-
-	public void stop()
-	{
-		((PowerStateVariable) powerService.getStateVariable("Power")).setNotifier(null);
-		notifier.destroy();
-		off();
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
-	 */
-	public void serviceChanged(ServiceEvent event) {
-		switch(event.getType()){
-			case ServiceEvent.REGISTERED:{
-			};break;
-			
-			case ServiceEvent.MODIFIED:{				
-			};break;
-			
-			case ServiceEvent.UNREGISTERING:{	
-				ServiceReference sr = event.getServiceReference();
-				String UDN = (String)sr.getProperty(UPnPDevice.ID);
-				if (UDN != null){
-					if (LinkedDevices.contains(UDN)) {
-						if (UDN.indexOf("Clock") != -1)
-								clockTime = "";
-						else if (UDN.indexOf("AirCon") != -1)
-								airconTemp = "";
-						else if (UDN.indexOf("Washer") != -1)
-								message = "";
-						else if (UDN.indexOf("Light") != -1)
-								message = "";
-					}
-				}
-				comp.repaint();
-		 	};break;
-		}
-	}
-
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.Properties;
+import java.util.Random;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPIcon;
+import org.osgi.service.upnp.UPnPService;
+
+import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
+import org.apache.felix.upnp.extra.util.UPnPSubscriber;
+
+public class TvDevice implements UPnPDevice,UPnPEventListener,ServiceListener  {
+	
+	final private String DEVICE_ID = "uuid:Felix-TV+" +Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
+	private final static String CLOCK_DEVICE_TYPE = "urn:schemas-upnp-org:device:clock:1";
+	private final static String TIME_SERVICE_TYPE = "urn:schemas-upnp-org:service:timer:1";
+	
+	private final static String LIGHT_DEVICE_TYPE = "urn:schemas-upnp-org:device:light:1";
+	private final static String POWER_SERVICE_TYPE = "urn:schemas-upnp-org:service:power:1";
+
+	private final static String AIRCON_DEVICE_TYPE = "urn:schemas-upnp-org:device:aircon:1";
+	private final static String TEMP_SERVICE_TYPE = "urn:schemas-upnp-org:service:temp:1";
+	
+	private final static String WASHER_DEVICE_TYPE = "urn:schemas-upnp-org:device:washer:1";
+	private final static String STATUS_SERVICE_TYPE = "urn:schemas-upnp-org:service:state:1";
+
+	private final String devicesFilter = 
+		"(&"+
+			"("+Constants.OBJECTCLASS+"="+UPnPDevice.class.getName()+"))";
+			/*"(|("+UPnPDevice.TYPE+"="+ CLOCK_SERVICE_TYPE+")"+
+				"("+UPnPDevice.TYPE+"="+ LIGHT_SERVICE_TYPE+")"+
+				"("+UPnPDevice.TYPE+"="+ AIRCON_SERVICE_TYPE+")"+
+				"("+UPnPDevice.TYPE+"="+ WASHER_SERVICE_TYPE+")))";*/
+
+	private BundleContext context;
+	private PowerService powerService;
+	private UPnPService[] services;
+	private Dictionary dictionary;
+	private UPnPEventNotifier notifier;
+	private PowerStateVariable powerState;
+
+	public TvDevice() {
+		powerService = new PowerService();
+		services = new UPnPService[]{powerService};
+		powerState = (PowerStateVariable) powerService.getStateVariable("Power");
+		setupDeviceProperties();
+		buildEventNotifyer();
+		try {
+			Activator.context.addServiceListener(this,devicesFilter);
+		} catch (InvalidSyntaxException e) {
+			System.out.println(e);		
+		}
+	}
+
+	/**
+	 * 
+	 */
+	private void buildEventNotifyer() {
+		notifier = new UPnPEventNotifier(Activator.context,this,powerService);
+		powerState.setNotifier(notifier);
+	}
+
+	private void setupDeviceProperties(){
+		dictionary = new Properties();
+		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
+		//org.osgi.service.device.Constants.DEVICE_CATEGORY
+		//dictionary.put("DEVICE_CATEGORY","UPnP");
+		dictionary.put(
+	        org.osgi.service
+	        	.device.Constants.DEVICE_CATEGORY,
+        	new String[]{UPnPDevice.DEVICE_CATEGORY}
+        );
+		dictionary.put(UPnPDevice.FRIENDLY_NAME,"Felix Sample Tv");
+		dictionary.put(UPnPDevice.MANUFACTURER,"Apache Software Foundation");
+		dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://felix.apache.org");
+		dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A CyberLink Tv device clone to test OSGi to UPnP service import");
+		dictionary.put(UPnPDevice.MODEL_NAME,"BimbiTv");
+		dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
+		dictionary.put(UPnPDevice.MODEL_URL,"http://felix.apache.org/site/upnp-examples.html");
+		//dictionary.put(UPnPDevice.PRESENTATION_URL,"http://felix.apache.org/BimbiTv/presentation");
+		dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
+		dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:tv:1");
+		dictionary.put(UPnPDevice.UDN,DEVICE_ID);
+		//dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
+		dictionary.put(UPnPDevice.UPC,"1213456789");
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
+	 */
+	public UPnPService getService(String serviceId) {
+		if  (serviceId.equals(powerService.getId())) return powerService;
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
+	 */
+	public UPnPService[] getServices() {
+		return services;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
+	 */
+	public UPnPIcon[] getIcons(String locale) {
+		UPnPIcon icon = new TvIcon();
+		return new UPnPIcon[]{icon} ;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
+	 */
+	public Dictionary getDescriptions(String locale) {
+		return dictionary;
+	}
+
+
+
+	////////////////////////////////////////////////
+	//	Component
+	////////////////////////////////////////////////
+
+	private Component comp;
+	
+	public void setComponent(Component comp)
+	{
+		this.comp = comp;	
+	}
+	
+	public Component getComponent()
+	{
+		return comp;
+	}
+	
+	////////////////////////////////////////////////
+	//	on/off
+	////////////////////////////////////////////////
+
+	private boolean onFlag = false;
+	
+	public void on()
+	{
+		powerState.setPower(Boolean.TRUE);
+		doSubscribe();
+	}
+
+	public boolean isOn()
+	{ 
+		return powerState.getCurrentPower().booleanValue();
+	}
+	public void off()
+	{
+		powerState.setPower(Boolean.FALSE);
+		undoSubscribe();
+	}
+
+
+	////////////////////////////////////////////////
+	//	Clock
+	////////////////////////////////////////////////
+
+	private String clockTime = ""; 
+	
+	public String getClockTime()
+	{
+		return clockTime;	
+	}
+	
+	////////////////////////////////////////////////
+	//	Aircon
+	////////////////////////////////////////////////
+
+	private String airconTemp = ""; 
+	
+	public String getAirconTempture()
+	{
+		return airconTemp;	
+	}
+
+	////////////////////////////////////////////////
+	//	Message
+	////////////////////////////////////////////////
+
+	private String message = ""; 
+	
+	public void setMessage(String msg)
+	{
+		message = msg;
+	}
+	
+	public String getMessage()
+	{
+		return message;
+	}
+	
+
+	////////////////////////////////////////////////
+	//	Subscribe
+	////////////////////////////////////////////////
+	
+	private UPnPSubscriber subscriber;
+	
+	public void doSubscribe()
+	{
+		subscriber = new UPnPSubscriber(Activator.context,this);
+		subscriber.subscribeEveryServiceType(CLOCK_DEVICE_TYPE, TIME_SERVICE_TYPE);
+		subscriber.subscribeEveryServiceType(AIRCON_DEVICE_TYPE, TEMP_SERVICE_TYPE);
+		subscriber.subscribeEveryServiceType(LIGHT_DEVICE_TYPE, POWER_SERVICE_TYPE);
+		subscriber.subscribeEveryServiceType(WASHER_DEVICE_TYPE, STATUS_SERVICE_TYPE);
+	}
+	
+	public void undoSubscribe(){
+		subscriber.unsubscribeAll();
+	}
+	
+	ArrayList LinkedDevices = new ArrayList();
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPEventListener#notifyUPnPEvent(java.lang.String, java.lang.String, java.util.Dictionary)
+	 */
+	public void notifyUPnPEvent(String deviceId, String serviceId, Dictionary events) {
+		if( !LinkedDevices.contains(deviceId))
+			LinkedDevices.add(deviceId);
+		if (deviceId.indexOf("Clock") != -1){
+				Long time = (Long) events.get("Time");
+				clockTime = new Date(time.longValue()).toString();				
+		}
+		else if (deviceId.indexOf("AirCon") != -1)
+				airconTemp = (String) events.get("Temp");
+		else if (deviceId.indexOf("Washer") != -1)
+				message = (String) events.get("State");
+		else if (deviceId.indexOf("Light") != -1)
+				message = (String) events.get("Power");
+ 
+		comp.repaint();
+	}
+
+
+	////////////////////////////////////////////////
+	//	start/stop
+	////////////////////////////////////////////////
+	
+	public void start()
+	{
+		on();
+	}
+
+	public void stop()
+	{
+		((PowerStateVariable) powerService.getStateVariable("Power")).setNotifier(null);
+		notifier.destroy();
+		off();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
+	 */
+	public void serviceChanged(ServiceEvent event) {
+		switch(event.getType()){
+			case ServiceEvent.REGISTERED:{
+			};break;
+			
+			case ServiceEvent.MODIFIED:{				
+			};break;
+			
+			case ServiceEvent.UNREGISTERING:{	
+				ServiceReference sr = event.getServiceReference();
+				String UDN = (String)sr.getProperty(UPnPDevice.ID);
+				if (UDN != null){
+					if (LinkedDevices.contains(UDN)) {
+						if (UDN.indexOf("Clock") != -1)
+								clockTime = "";
+						else if (UDN.indexOf("AirCon") != -1)
+								airconTemp = "";
+						else if (UDN.indexOf("Washer") != -1)
+								message = "";
+						else if (UDN.indexOf("Light") != -1)
+								message = "";
+					}
+				}
+				comp.repaint();
+		 	};break;
+		}
+	}
+
+}
+
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvFrame.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvFrame.java
index 1bafddc..0d50cbf 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvFrame.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvFrame.java
@@ -1,123 +1,123 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.awt.BorderLayout;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.net.URL;
-
-import javax.swing.ImageIcon;
-import javax.swing.JFrame;
-
-import org.osgi.framework.BundleException;
-
-public class TvFrame extends JFrame implements Runnable 
-{
-	private final static String TITLE = "Felix UpnP TV";
-	
-	private TvDevice tvDev;
-	private TvPane tvPane;
-	
-	public TvFrame()
-	{
-		super(TITLE);
-
-		tvDev = new TvDevice();
-
-		getContentPane().setLayout(new BorderLayout());
-
-		tvPane = new TvPane();
-		tvDev.setComponent(tvPane);
-		tvPane.setDevice(tvDev);
-		getContentPane().add(tvPane, BorderLayout.CENTER);
-
-		addWindowListener(new WindowAdapter(){
-			public void windowClosing(WindowEvent e) 
-			{
-				try {
-					Activator.context.getBundle().stop();
-				} catch (BundleException ex) {
-					ex.printStackTrace();
-				}
-			}
-		});			
-		
-	       try {
-	            URL eventIconUrl = TvFrame.class.getResource("images/logo.gif");           
-	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
-	            setIconImage(icon.getImage());
-	       }
-	        catch (Exception ex){
-	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
-	        }
-	        
-		pack();
-		setVisible(true);
-	}
-
-	public TvPane getTvPanel()
-	{
-		return tvPane;
-	}
-
-	public TvDevice getTvDevice()
-	{
-		return tvDev;
-	}
-		
-	////////////////////////////////////////////////
-	//	run	
-	////////////////////////////////////////////////
-
-	private Thread timerThread = null;
-		
-	public void run()
-	{
-		Thread thisThread = Thread.currentThread();
-
-		while (timerThread == thisThread) {
-			tvDev.setMessage("");
-			tvPane.repaint();
-			try {
-				Thread.sleep(1000*5);
-			}
-			catch(InterruptedException e) {}
-		}
-	}
-	
-	public void start()
-	{
-		tvDev.start();
-		
-		timerThread = new Thread(this,"upnp.sample.tv.TVFrame");
-		timerThread.start();
-	}
-	
-	public void stop()
-	{
-		tvDev.stop();
-		timerThread = null;
-		dispose();
-	}
-
-
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.awt.BorderLayout;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+
+import org.osgi.framework.BundleException;
+
+public class TvFrame extends JFrame implements Runnable 
+{
+	private final static String TITLE = "Felix UpnP TV";
+	
+	private TvDevice tvDev;
+	private TvPane tvPane;
+	
+	public TvFrame()
+	{
+		super(TITLE);
+
+		tvDev = new TvDevice();
+
+		getContentPane().setLayout(new BorderLayout());
+
+		tvPane = new TvPane();
+		tvDev.setComponent(tvPane);
+		tvPane.setDevice(tvDev);
+		getContentPane().add(tvPane, BorderLayout.CENTER);
+
+		addWindowListener(new WindowAdapter(){
+			public void windowClosing(WindowEvent e) 
+			{
+				try {
+					Activator.context.getBundle().stop();
+				} catch (BundleException ex) {
+					ex.printStackTrace();
+				}
+			}
+		});			
+		
+	       try {
+	            URL eventIconUrl = TvFrame.class.getResource("images/logo.gif");           
+	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
+	            setIconImage(icon.getImage());
+	       }
+	        catch (Exception ex){
+	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
+	        }
+	        
+		pack();
+		setVisible(true);
+	}
+
+	public TvPane getTvPanel()
+	{
+		return tvPane;
+	}
+
+	public TvDevice getTvDevice()
+	{
+		return tvDev;
+	}
+		
+	////////////////////////////////////////////////
+	//	run	
+	////////////////////////////////////////////////
+
+	private Thread timerThread = null;
+		
+	public void run()
+	{
+		Thread thisThread = Thread.currentThread();
+
+		while (timerThread == thisThread) {
+			tvDev.setMessage("");
+			tvPane.repaint();
+			try {
+				Thread.sleep(1000*5);
+			}
+			catch(InterruptedException e) {}
+		}
+	}
+	
+	public void start()
+	{
+		tvDev.start();
+		
+		timerThread = new Thread(this,"upnp.sample.tv.TVFrame");
+		timerThread.start();
+	}
+	
+	public void stop()
+	{
+		tvDev.stop();
+		timerThread = null;
+		dispose();
+	}
+
+
+}
+
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvIcon.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvIcon.java
index a6df26d..fb1dec3 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvIcon.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvIcon.java
@@ -1,69 +1,69 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.osgi.service.upnp.UPnPIcon;
-
-public class TvIcon implements UPnPIcon {
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
-	 */
-	public String getMimeType() {
-		return "image/gif";
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
-	 */
-	public int getWidth() {
-		return 32;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
-	 */
-	public int getHeight() {
-		return 32;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
-	 */
-	public int getSize() {
-		return 0;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
-	 */
-	public int getDepth() {
-		return 16;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
-	 */
-	public InputStream getInputStream() throws IOException {
-		return TvIcon.class.getResourceAsStream("images/tv.gif");
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.osgi.service.upnp.UPnPIcon;
+
+public class TvIcon implements UPnPIcon {
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getMimeType()
+	 */
+	public String getMimeType() {
+		return "image/gif";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getWidth()
+	 */
+	public int getWidth() {
+		return 32;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getHeight()
+	 */
+	public int getHeight() {
+		return 32;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getSize()
+	 */
+	public int getSize() {
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getDepth()
+	 */
+	public int getDepth() {
+		return 16;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPIcon#getInputStream()
+	 */
+	public InputStream getInputStream() throws IOException {
+		return TvIcon.class.getResourceAsStream("images/tv.gif");
+	}
+}
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvPane.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvPane.java
index f8a0549..7dd1da4 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvPane.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvPane.java
@@ -1,214 +1,214 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-
-import javax.imageio.ImageIO;
-import javax.swing.JPanel;
-
-public class TvPane extends JPanel  // MouseListener
-{
-	private final static int IMAGE_BORDER_SIZE = 20;
-	private final static int IMAGE_BOTTOM_BORDER_SIZE = 30;
-	
-	////////////////////////////////////////////////
-	//	Constructor
-	////////////////////////////////////////////////
-
-	public TvPane()
-	{
-		loadImage();
-		initPanel();
-	}
-
-	////////////////////////////////////////////////
-	//	TvDevice
-	////////////////////////////////////////////////
-
-	private TvDevice tvDev = null;
-	
-	public void setDevice(TvDevice dev)
-	{
-		tvDev = dev;
-	}
-
-	public TvDevice getDevice()
-	{
-		return tvDev;
-	}
-	
-	////////////////////////////////////////////////
-	//	Background
-	////////////////////////////////////////////////
-
-	private BufferedImage panelmage;
-	private BufferedImage tvOnImage;
-	
-	private void loadImage()
-	{
-		try {
-			panelmage = ImageIO.read(TvPane.class.getResourceAsStream("images/tv.jpg"));
-			tvOnImage = ImageIO.read(TvPane.class.getResourceAsStream("images/tvon.jpg"));
-		}
-		catch (Exception e) {
-			System.out.println(e);
-		}
-	}
-
-	////////////////////////////////////////////////
-	//	Background
-	////////////////////////////////////////////////
-
-	private void initPanel()
-	{
-		setPreferredSize(new Dimension(panelmage.getWidth(), panelmage.getHeight()));
-	}
-
-	////////////////////////////////////////////////
-	//	Font
-	////////////////////////////////////////////////
-
-	private final static String DEFAULT_FONT_NAME = "Lucida Console";
-	private final static int DEFAULT_TIME_FONT_SIZE = 10;
-
-	private Font timeFont = null;
-
-	private Font getFont(Graphics g, int size)
-	{
-		Font font = new Font(DEFAULT_FONT_NAME, Font.BOLD, size);
-		if (font != null)
-			return font;
-		return g.getFont();
-	}
-		
-	private Font getFont(Graphics g)
-	{
-		if (timeFont == null)
-			timeFont = getFont(g, DEFAULT_TIME_FONT_SIZE);
-		return timeFont;
-	}
-
-	////////////////////////////////////////////////
-	//	paint
-	////////////////////////////////////////////////
-
-	private void drawClockInfo(Graphics g)
-	{
-		TvDevice tvDev = getDevice();
-
-		int winWidth = getWidth();
-		int winHeight = getHeight();
-		
-		Font font = getFont(g);
-		g.setFont(font);
-		FontMetrics fontMetric = g.getFontMetrics();
-		g.setColor(Color.RED);
-
-		Rectangle2D strBounds;
-		int strWidth;
-		int strHeight;
-		int strX;
-		int strY;
-		
-		//// Time String ////
-		
-		String timeStr = tvDev.getClockTime();
-		if (timeStr != null && 0 < timeStr.length()) {
-			strBounds = fontMetric.getStringBounds(timeStr, g);
-			strWidth = (int)strBounds.getWidth();		
-			strHeight = (int)strBounds.getHeight();
-			strX = IMAGE_BORDER_SIZE;
-			strY = IMAGE_BORDER_SIZE + strHeight;
-			g.drawString(
-				timeStr,
-				strX,
-				strY);
-		}
-		
-		//// Tempture String ////
-		
-		String tempStr = tvDev.getAirconTempture();
-		if (tempStr != null && 0 < tempStr.length()) {
-			tempStr += "C";
-			strBounds = fontMetric.getStringBounds(tempStr, g);
-			strWidth = (int)strBounds.getWidth();		
-			strHeight = (int)strBounds.getHeight();
-			strX = winWidth - IMAGE_BORDER_SIZE - strWidth;
-			strY = IMAGE_BORDER_SIZE + strHeight;
-			g.drawString(
-				tempStr,
-				strX,
-				strY);
-		}
-
-		//// Message String ////
-		
-		String msgStr = tvDev.getMessage();
-		if (msgStr != null && 0 < msgStr.length()) {
-			strBounds = fontMetric.getStringBounds(msgStr, g);
-			strWidth = (int)strBounds.getWidth();		
-			strHeight = (int)strBounds.getHeight();
-			strX = IMAGE_BORDER_SIZE;
-			strY = getHeight()-IMAGE_BOTTOM_BORDER_SIZE-2;
-			g.drawString(
-				msgStr,
-				strX,
-				strY);
-		}
-	}
-
-	private void drawTvImage(Graphics g)
-	{
-		//g.setColor(Color.WHITE);
-		//g.clearRect(IMAGE_BORDER_SIZE, IMAGE_BORDER_SIZE, getWidth()-IMAGE_BORDER_SIZE*2, getHeight()-IMAGE_BORDER_SIZE-IMAGE_BOTTOM_BORDER_SIZE);
-		g.drawImage(tvOnImage, IMAGE_BORDER_SIZE, IMAGE_BORDER_SIZE, null);
-	}
-	
-	private void clear(Graphics g)
-	{
-		g.setColor(Color.GRAY);
-		g.clearRect(0, 0, getWidth(), getHeight());
-	}
-	
-
-	private void drawPanelImage(Graphics g)
-	{
-		g.drawImage(panelmage, 0, 0, null);
-	}
-		
-	public void paint(Graphics g)
-	{
-		clear(g);
-		drawPanelImage(g);
-		TvDevice tvDev = getDevice();
-		if (tvDev.isOn() == true) {
-			drawTvImage(g);
-			drawClockInfo(g);
-		}
-	}
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+
+import javax.imageio.ImageIO;
+import javax.swing.JPanel;
+
+public class TvPane extends JPanel  // MouseListener
+{
+	private final static int IMAGE_BORDER_SIZE = 20;
+	private final static int IMAGE_BOTTOM_BORDER_SIZE = 30;
+	
+	////////////////////////////////////////////////
+	//	Constructor
+	////////////////////////////////////////////////
+
+	public TvPane()
+	{
+		loadImage();
+		initPanel();
+	}
+
+	////////////////////////////////////////////////
+	//	TvDevice
+	////////////////////////////////////////////////
+
+	private TvDevice tvDev = null;
+	
+	public void setDevice(TvDevice dev)
+	{
+		tvDev = dev;
+	}
+
+	public TvDevice getDevice()
+	{
+		return tvDev;
+	}
+	
+	////////////////////////////////////////////////
+	//	Background
+	////////////////////////////////////////////////
+
+	private BufferedImage panelmage;
+	private BufferedImage tvOnImage;
+	
+	private void loadImage()
+	{
+		try {
+			panelmage = ImageIO.read(TvPane.class.getResourceAsStream("images/tv.jpg"));
+			tvOnImage = ImageIO.read(TvPane.class.getResourceAsStream("images/tvon.jpg"));
+		}
+		catch (Exception e) {
+			System.out.println(e);
+		}
+	}
+
+	////////////////////////////////////////////////
+	//	Background
+	////////////////////////////////////////////////
+
+	private void initPanel()
+	{
+		setPreferredSize(new Dimension(panelmage.getWidth(), panelmage.getHeight()));
+	}
+
+	////////////////////////////////////////////////
+	//	Font
+	////////////////////////////////////////////////
+
+	private final static String DEFAULT_FONT_NAME = "Lucida Console";
+	private final static int DEFAULT_TIME_FONT_SIZE = 10;
+
+	private Font timeFont = null;
+
+	private Font getFont(Graphics g, int size)
+	{
+		Font font = new Font(DEFAULT_FONT_NAME, Font.BOLD, size);
+		if (font != null)
+			return font;
+		return g.getFont();
+	}
+		
+	private Font getFont(Graphics g)
+	{
+		if (timeFont == null)
+			timeFont = getFont(g, DEFAULT_TIME_FONT_SIZE);
+		return timeFont;
+	}
+
+	////////////////////////////////////////////////
+	//	paint
+	////////////////////////////////////////////////
+
+	private void drawClockInfo(Graphics g)
+	{
+		TvDevice tvDev = getDevice();
+
+		int winWidth = getWidth();
+		int winHeight = getHeight();
+		
+		Font font = getFont(g);
+		g.setFont(font);
+		FontMetrics fontMetric = g.getFontMetrics();
+		g.setColor(Color.RED);
+
+		Rectangle2D strBounds;
+		int strWidth;
+		int strHeight;
+		int strX;
+		int strY;
+		
+		//// Time String ////
+		
+		String timeStr = tvDev.getClockTime();
+		if (timeStr != null && 0 < timeStr.length()) {
+			strBounds = fontMetric.getStringBounds(timeStr, g);
+			strWidth = (int)strBounds.getWidth();		
+			strHeight = (int)strBounds.getHeight();
+			strX = IMAGE_BORDER_SIZE;
+			strY = IMAGE_BORDER_SIZE + strHeight;
+			g.drawString(
+				timeStr,
+				strX,
+				strY);
+		}
+		
+		//// Tempture String ////
+		
+		String tempStr = tvDev.getAirconTempture();
+		if (tempStr != null && 0 < tempStr.length()) {
+			tempStr += "C";
+			strBounds = fontMetric.getStringBounds(tempStr, g);
+			strWidth = (int)strBounds.getWidth();		
+			strHeight = (int)strBounds.getHeight();
+			strX = winWidth - IMAGE_BORDER_SIZE - strWidth;
+			strY = IMAGE_BORDER_SIZE + strHeight;
+			g.drawString(
+				tempStr,
+				strX,
+				strY);
+		}
+
+		//// Message String ////
+		
+		String msgStr = tvDev.getMessage();
+		if (msgStr != null && 0 < msgStr.length()) {
+			strBounds = fontMetric.getStringBounds(msgStr, g);
+			strWidth = (int)strBounds.getWidth();		
+			strHeight = (int)strBounds.getHeight();
+			strX = IMAGE_BORDER_SIZE;
+			strY = getHeight()-IMAGE_BOTTOM_BORDER_SIZE-2;
+			g.drawString(
+				msgStr,
+				strX,
+				strY);
+		}
+	}
+
+	private void drawTvImage(Graphics g)
+	{
+		//g.setColor(Color.WHITE);
+		//g.clearRect(IMAGE_BORDER_SIZE, IMAGE_BORDER_SIZE, getWidth()-IMAGE_BORDER_SIZE*2, getHeight()-IMAGE_BORDER_SIZE-IMAGE_BOTTOM_BORDER_SIZE);
+		g.drawImage(tvOnImage, IMAGE_BORDER_SIZE, IMAGE_BORDER_SIZE, null);
+	}
+	
+	private void clear(Graphics g)
+	{
+		g.setColor(Color.GRAY);
+		g.clearRect(0, 0, getWidth(), getHeight());
+	}
+	
+
+	private void drawPanelImage(Graphics g)
+	{
+		g.drawImage(panelmage, 0, 0, null);
+	}
+		
+	public void paint(Graphics g)
+	{
+		clear(g);
+		drawPanelImage(g);
+		TvDevice tvDev = getDevice();
+		if (tvDev.isOn() == true) {
+			drawTvImage(g);
+			drawClockInfo(g);
+		}
+	}
+}
+
diff --git a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPSubscriber.java b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPSubscriber.java
index 8780f90..8d1341d 100644
--- a/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPSubscriber.java
+++ b/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPSubscriber.java
@@ -1,63 +1,63 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.util.Properties;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPService;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class UPnPSubscriber {
-	ServiceRegistration registration = null;
-	BundleContext context;
-	UPnPEventListener listener;
-	
-	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
-		this.context = context;
-		this.listener = listener;
-	}
-	
-	public void subscribe(String deviceType, String serviceType){
-		String keys = "(&(" + UPnPDevice.TYPE + "="+ deviceType + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
-		try {
-			Filter filter = context.createFilter(keys);
-			Properties props = new Properties();
-			props.put(UPnPEventListener.UPNP_FILTER, filter);
-			registration = context.registerService(UPnPEventListener.class.getName(), listener, props);
-		}catch (Exception ex){
-			System.out.println(ex);
-		}
-	}
-	
-	public void unsubscribe(){
-		registration.unregister();
-		registration = null;
-	}
-	
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPService;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class UPnPSubscriber {
+	ServiceRegistration registration = null;
+	BundleContext context;
+	UPnPEventListener listener;
+	
+	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
+		this.context = context;
+		this.listener = listener;
+	}
+	
+	public void subscribe(String deviceType, String serviceType){
+		String keys = "(&(" + UPnPDevice.TYPE + "="+ deviceType + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
+		try {
+			Filter filter = context.createFilter(keys);
+			Properties props = new Properties();
+			props.put(UPnPEventListener.UPNP_FILTER, filter);
+			registration = context.registerService(UPnPEventListener.class.getName(), listener, props);
+		}catch (Exception ex){
+			System.out.println(ex);
+		}
+	}
+	
+	public void unsubscribe(){
+		registration.unregister();
+		registration = null;
+	}
+	
+
+}
diff --git a/upnp/tester/pom.xml b/upnp/tester/pom.xml
index 8452770..69edf6e 100644
--- a/upnp/tester/pom.xml
+++ b/upnp/tester/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -17,69 +17,70 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <artifactId>felix</artifactId>
-    <groupId>org.apache.felix</groupId>
-    <version>1.0.2</version>
-    <relativePath>../../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.felix</groupId>
-  <artifactId>org.apache.felix.upnp.tester</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Felix UPnP Tester</name>
-  <version>0.2.0-SNAPSHOT</version>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>felix</artifactId>
+    <groupId>org.apache.felix</groupId>
+    <version>1.0.2</version>
+    <relativePath>../../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.felix</groupId>
+  <artifactId>org.apache.felix.upnp.tester</artifactId>
+  <packaging>bundle</packaging>
+  <name>Apache Felix UPnP Tester</name>
+  <version>0.2.0-SNAPSHOT</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
         <version>1.4.0</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>${pom.name}</Bundle-Name>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-Name>${pom.name}</Bundle-Name>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Bundle-Author><![CDATA[Matteo Demuru <demuru@apache.org>,Francesco Furfari <furfari@apache.org>,Stefano "Kismet" Lenzi <lenzi@apache.org>]]></Bundle-Author>
-            <Bundle-Description>
-               	OSGi Generic Control Point to control UPnPDevice services
-            </Bundle-Description>
-            <Bundle-SymbolicName>org.apache.felix.upnp.tester</Bundle-SymbolicName>
-            <Bundle-Activator>org.apache.felix.upnp.tester.Activator</Bundle-Activator>
-            <Private-Package>org.apache.felix.upnp.tester.*</Private-Package>
-            <Import-Package>*</Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
+            <Bundle-Author><![CDATA[Matteo Demuru <demuru@apache.org>,Francesco Furfari <furfari@apache.org>,Stefano "Kismet" Lenzi <lenzi@apache.org>]]></Bundle-Author>
+            <Bundle-Description>
+               	OSGi Generic Control Point to control UPnPDevice services
+            </Bundle-Description>
+            <Bundle-SymbolicName>org.apache.felix.upnp.tester</Bundle-SymbolicName>
+            <Bundle-Activator>org.apache.felix.upnp.tester.Activator</Bundle-Activator>
+            <Private-Package>org.apache.felix.upnp.tester.*</Private-Package>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
       <version>1.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.upnp.basedriver</artifactId>
-      <version>0.3.0-SNAPSHOT</version>
-    </dependency>
-     <!-- dependency>
-       Note: this dependency might be restored when (if) a converter utility will be exposed by extra bundle.
-       So far Tester uses the Converter class of the basedriver (it should be fixed)
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.upnp.extra</artifactId>
-      <version>0.3.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency -->
-  </dependencies>
-</project>
-
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.upnp.basedriver</artifactId>
+      <version>0.8.0</version>
+      <scope>provided</scope>
+    </dependency>
+     <!-- dependency>
+       Note: this dependency might be restored when (if) a converter utility will be exposed by extra bundle.
+       So far Tester uses the Converter class of the basedriver (it should be fixed)
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.upnp.extra</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency -->
+  </dependencies>
+</project>
+
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/ControlPoint.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/ControlPoint.java
index ac39d5d..b459386 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/ControlPoint.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/ControlPoint.java
@@ -1,375 +1,375 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester;
-
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.net.URL;
-
-import javax.swing.AbstractAction;
-import javax.swing.ButtonGroup;
-import javax.swing.ImageIcon;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JSplitPane;
-import javax.swing.event.PopupMenuEvent;
-import javax.swing.event.PopupMenuListener;
-
-import org.osgi.framework.BundleException;
-
-import org.apache.felix.upnp.tester.discovery.DriverProxy;
-import org.apache.felix.upnp.tester.discovery.RootDeviceListener;
-import org.apache.felix.upnp.tester.gui.LogPanel;
-import org.apache.felix.upnp.tester.gui.PropertiesViewer;
-import org.apache.felix.upnp.tester.gui.TreeViewer;
-import org.apache.felix.upnp.tester.gui.Util;
- 
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class ControlPoint implements PopupMenuListener {
-	RootDeviceListener listener;
-	TreeViewer viewer;
-	PropertiesViewer properties;
-	JFrame frame;
-	
-	
-	public ControlPoint() {
-		frame = new JFrame("Felix UPnPDevice Tester");
-       try {
-            URL eventIconUrl = Util.class.getResource("IMAGES/logo.gif");           
-            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
-            frame.setIconImage(icon.getImage());
-       }
-        catch (Exception ex){
-                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
-        }
-		//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        
-		frame.addWindowListener(new WindowAdapter(){
-			public void windowClosing(WindowEvent e){
-				try {
-					Activator.context.getBundle().stop();
-				} catch (BundleException ex) {
-					ex.printStackTrace();
-				}
-			}
-
-		});       
-		frame.setBounds(0,0,300,200);
-        
-        
-        doMenuBar(frame);
-		doControlPanel();
-        Mediator.setControlPoint(this);
-        Mediator.setMainFrame(frame);
-		listener = new RootDeviceListener();
-        Mediator.setRootDeviceListener(listener);
-		listener.setDeviceNodeListener(viewer);
-		
-		frame.pack();
-		frame.setVisible(true);
-        
-		DriverProxy driverProxy = new DriverProxy();
-        Mediator.setDriverProxy(driverProxy);
-        
-		listener.activate();
-	}
-	
-	public void close(){
-		listener.deactive();
-		frame.dispose();
-        Mediator.getDriverProxy().close();           
-	}
-	
-	private void doControlPanel(){
-		JPanel panel = new JPanel(new BorderLayout());
-		viewer = new TreeViewer();
-		viewer.setPreferredSize(new Dimension(180,450));
-		properties = new PropertiesViewer();
-		Mediator.setPropertiesViewer(properties);
-	
-		JSplitPane treeSplitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,viewer,properties);
-		JPanel logPanel = new LogPanel();
-		logPanel.setPreferredSize(new Dimension(180,100));
-		JSplitPane logSplitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT,treeSplitter,logPanel);
-		panel.add(logSplitter);
-		frame.getContentPane().add(panel);
-		
-		
-	}
-	
-      /////////////////////////// MENU /////////////////////////////
-    JMenu searchMenu,loggerMenu,cyberMenu;  
-    public void doMenuBar(JFrame frame) {
-
-        JMenuBar menuBar = new JMenuBar();
-        
-        //////////////// FILE
-        JMenu file_menu = new JMenu("File");
-        file_menu.setMnemonic(KeyEvent.VK_F);
-
-        searchMenu = new JMenu("Search");
-        final String ALL_DEVICE = "ssdp:all";
-        final String ROOT_DEVICE = "upnp:rootdevice";
-        searchMenu.setMnemonic(KeyEvent.VK_L);
-        searchMenu.setEnabled(false);
-        AbstractAction searchAction = new AbstractAction(){
-            public void actionPerformed(ActionEvent e) {
-                DriverProxy controller = Mediator.getDriverProxy();
-                if (e.getActionCommand().equals(ALL_DEVICE))
-                    controller.doSearch(ALL_DEVICE);
-                else if (e.getActionCommand().equals(ROOT_DEVICE))
-                    controller.doSearch(ROOT_DEVICE);
-            }
-        };
-        
-        JMenuItem rootDeviceItem = new JMenuItem("Root Devices");
-        rootDeviceItem.setMnemonic(KeyEvent.VK_R);
-        rootDeviceItem.addActionListener(searchAction);
-        rootDeviceItem.setActionCommand(ROOT_DEVICE);
-        searchMenu.add(rootDeviceItem);
-        
-        JMenuItem allDeviceItem = new JMenuItem("All Devices");
-        allDeviceItem .setMnemonic(KeyEvent.VK_A);
-        allDeviceItem .addActionListener(searchAction);
-        allDeviceItem .setActionCommand(ALL_DEVICE);
-        searchMenu.add(allDeviceItem);
-        
-        
-        JMenuItem checkIncompleteItem = new JMenuItem("Print Pending Devices");
-        checkIncompleteItem.setMnemonic(KeyEvent.VK_I);
-        checkIncompleteItem.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    Mediator.getRootDeviceListener().checkIncompleteDevice();
-                }
-            });
-        
-        JMenuItem checkErrataItem = new JMenuItem("Check Errata UPnPDevices");
-        checkErrataItem.setMnemonic(KeyEvent.VK_E);
-        checkErrataItem.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {                    
-                    RootDeviceListener.checkErrataDevice();}
-            });
-        
-        
-        loggerMenu = new JMenu("Felix Logger");
-        final String NO_LOGGING ="No Logging";
-        final String ERROR ="Error";
-        final String WARNING ="Warning";
-        final String INFO ="Info";
-        final String DEBUG ="Debug";
-
-        loggerMenu.getPopupMenu().addPopupMenuListener(this);
-        loggerMenu.setMnemonic(KeyEvent.VK_L);
-        loggerMenu.setEnabled(false);
-        AbstractAction loggerAction = new AbstractAction(){
-            public void actionPerformed(ActionEvent e) {
-                DriverProxy controller = Mediator.getDriverProxy();
-                if (e.getActionCommand().equals(NO_LOGGING))
-                    controller.setLogLevel(0);
-                else if (e.getActionCommand().equals(ERROR))
-                    controller.setLogLevel(1);
-                else if (e.getActionCommand().equals(WARNING))
-                    controller.setLogLevel(2);
-                else if (e.getActionCommand().equals(INFO))
-                    controller.setLogLevel(3);
-                else if (e.getActionCommand().equals(DEBUG))
-                    controller.setLogLevel(4);
-            }
-        };
-       
-        ButtonGroup group = new ButtonGroup();
-        
-        JRadioButtonMenuItem rbMenuItem = new JRadioButtonMenuItem(NO_LOGGING);
-        rbMenuItem.setSelected(true);
-        rbMenuItem.setMnemonic(KeyEvent.VK_N);
-        rbMenuItem.setActionCommand(NO_LOGGING);
-        rbMenuItem.addActionListener(loggerAction);
-        group.add(rbMenuItem);
-        loggerMenu.add(rbMenuItem);
-        loggerMenu.addSeparator();
-        
-        rbMenuItem = new JRadioButtonMenuItem(ERROR);
-        rbMenuItem.setMnemonic(KeyEvent.VK_E);
-        rbMenuItem.setActionCommand(ERROR);
-        rbMenuItem.addActionListener(loggerAction);
-        group.add(rbMenuItem);
-        loggerMenu.add(rbMenuItem);
-
-        rbMenuItem = new JRadioButtonMenuItem(WARNING);
-        rbMenuItem.setMnemonic(KeyEvent.VK_W);
-        rbMenuItem.setActionCommand(WARNING);
-        rbMenuItem.addActionListener(loggerAction);
-        group.add(rbMenuItem);
-        loggerMenu.add(rbMenuItem);
-        
-        rbMenuItem = new JRadioButtonMenuItem(INFO);
-        rbMenuItem.setMnemonic(KeyEvent.VK_I);
-        rbMenuItem.setActionCommand(INFO);
-        rbMenuItem.addActionListener(loggerAction);
-        group.add(rbMenuItem);
-        loggerMenu.add(rbMenuItem);
-        
-        rbMenuItem = new JRadioButtonMenuItem(DEBUG);
-        rbMenuItem.setMnemonic(KeyEvent.VK_D);
-        rbMenuItem.setActionCommand(DEBUG);
-        rbMenuItem.addActionListener(loggerAction);
-        group.add(rbMenuItem);
-        loggerMenu.add(rbMenuItem);
-
-        final String ON ="On";
-        final String OFF ="Off";
-        cyberMenu = new JMenu("Cyber Debugger");
-        cyberMenu.getPopupMenu().addPopupMenuListener(this);
-        cyberMenu.setMnemonic(KeyEvent.VK_C);
-        cyberMenu.setEnabled(false);
-        AbstractAction cyberAction = new AbstractAction(){
-            public void actionPerformed(ActionEvent e) {
-                DriverProxy controller = Mediator.getDriverProxy();
-                if (e.getActionCommand().equals(ON))
-                    controller.setCyberDebug(true);
-                else if (e.getActionCommand().equals(OFF))
-                    controller.setCyberDebug(false);
-            }
-        };
-
-       
-        ButtonGroup cyberGroup = new ButtonGroup();
-        rbMenuItem = new JRadioButtonMenuItem(ON);
-        rbMenuItem.setSelected(true);
-        rbMenuItem.setMnemonic(KeyEvent.VK_O);
-        rbMenuItem.setActionCommand(ON);
-        rbMenuItem.addActionListener(cyberAction);
-        cyberGroup.add(rbMenuItem);
-        cyberMenu.add(rbMenuItem);
-
-        rbMenuItem = new JRadioButtonMenuItem(OFF);
-        rbMenuItem.setMnemonic(KeyEvent.VK_F);
-        rbMenuItem.setActionCommand(OFF);
-        rbMenuItem.addActionListener(cyberAction);
-        cyberGroup.add(rbMenuItem);
-        cyberMenu.add(rbMenuItem);
-        
-        /*
-        JMenuItem clearSubscriptionItem = new JMenuItem("Clear Subscriptions");
-        clearSubscriptionItem.setMnemonic(KeyEvent.VK_S);
-        clearSubscriptionItem.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-// to do
-                    }
-            });
-        */
-        
-        JMenuItem exitItem = new JMenuItem("Exit");
-        exitItem.setMnemonic(KeyEvent.VK_X);
-        exitItem.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    try {
-                        Activator.context.getBundle().stop();
-                    }catch (Exception ex){
-                        ex.printStackTrace();
-                    }
-                }
-            });
-        
-
-        file_menu.add(searchMenu);
-        file_menu.addSeparator();
-        file_menu.add(loggerMenu);
-        file_menu.add(cyberMenu);
-        file_menu.addSeparator();
-        file_menu.add(checkIncompleteItem);
-        file_menu.add(checkErrataItem);
-        //file_menu.addSeparator();
-        //file_menu.add(clearSubscriptionItem);
-        file_menu.addSeparator();
-        file_menu.add(exitItem);
-
-        menuBar.add(file_menu);                   
-        frame.setJMenuBar(menuBar);
-
-    }
-
- 
-    public void enableMenus(boolean driverAvailable,int logLevel,boolean cyberDebug) {
-        searchMenu.setEnabled(driverAvailable);
-        Component[] items = searchMenu.getPopupMenu().getComponents();
-        for (int i=0;i < items.length;i++)
-            items[i].setEnabled(driverAvailable);
-
-        loggerMenu.setEnabled(driverAvailable);
-        items = loggerMenu.getPopupMenu().getComponents();
-        for (int i=0;i < items.length;i++)
-            items[i].setEnabled(driverAvailable);
-        if (driverAvailable){
-                ((JRadioButtonMenuItem)items[logLevel>0?logLevel+1:0]).setSelected(true);
-        }
-        cyberMenu.setEnabled(driverAvailable);           
-        items = cyberMenu.getPopupMenu().getComponents();
-        for (int i=0;i < items.length;i++)
-            items[i].setEnabled(driverAvailable);
-        if (driverAvailable){
-            if (cyberDebug)
-                ((JRadioButtonMenuItem)items[0]).setSelected(true);
-            else
-                ((JRadioButtonMenuItem)items[1]).setSelected(true);
-        }
-   }
-
-    public void popupMenuCanceled(PopupMenuEvent e) { }
-    public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { }
-
-    public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
-        JPopupMenu loggerPopup = loggerMenu.getPopupMenu();
-        JPopupMenu cyberPopup = cyberMenu.getPopupMenu();
-        if (e.getSource()==loggerPopup){
-            int logLevel = Mediator.getDriverProxy().getLogLevel();
-            Component[] items = loggerPopup.getComponents();
-            ((JRadioButtonMenuItem)items[logLevel>0?logLevel+1:0]).setSelected(true);          
-        }
-        else if (e.getSource()==cyberPopup){
-            boolean cyberDebug = Mediator.getDriverProxy().getCyberDebug();
-            Component[] items = cyberPopup.getComponents();
-            if (cyberDebug)
-                ((JRadioButtonMenuItem)items[0]).setSelected(true);
-            else
-                ((JRadioButtonMenuItem)items[1]).setSelected(true);            
-        }
-       
-        
-    }
-
-
-
-	
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester;
+
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.net.URL;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JSplitPane;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+
+import org.osgi.framework.BundleException;
+
+import org.apache.felix.upnp.tester.discovery.DriverProxy;
+import org.apache.felix.upnp.tester.discovery.RootDeviceListener;
+import org.apache.felix.upnp.tester.gui.LogPanel;
+import org.apache.felix.upnp.tester.gui.PropertiesViewer;
+import org.apache.felix.upnp.tester.gui.TreeViewer;
+import org.apache.felix.upnp.tester.gui.Util;
+ 
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class ControlPoint implements PopupMenuListener {
+	RootDeviceListener listener;
+	TreeViewer viewer;
+	PropertiesViewer properties;
+	JFrame frame;
+	
+	
+	public ControlPoint() {
+		frame = new JFrame("Felix UPnPDevice Tester");
+       try {
+            URL eventIconUrl = Util.class.getResource("IMAGES/logo.gif");           
+            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
+            frame.setIconImage(icon.getImage());
+       }
+        catch (Exception ex){
+                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
+        }
+		//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        
+		frame.addWindowListener(new WindowAdapter(){
+			public void windowClosing(WindowEvent e){
+				try {
+					Activator.context.getBundle().stop();
+				} catch (BundleException ex) {
+					ex.printStackTrace();
+				}
+			}
+
+		});       
+		frame.setBounds(0,0,300,200);
+        
+        
+        doMenuBar(frame);
+		doControlPanel();
+        Mediator.setControlPoint(this);
+        Mediator.setMainFrame(frame);
+		listener = new RootDeviceListener();
+        Mediator.setRootDeviceListener(listener);
+		listener.setDeviceNodeListener(viewer);
+		
+		frame.pack();
+		frame.setVisible(true);
+        
+		DriverProxy driverProxy = new DriverProxy();
+        Mediator.setDriverProxy(driverProxy);
+        
+		listener.activate();
+	}
+	
+	public void close(){
+		listener.deactive();
+		frame.dispose();
+        Mediator.getDriverProxy().close();           
+	}
+	
+	private void doControlPanel(){
+		JPanel panel = new JPanel(new BorderLayout());
+		viewer = new TreeViewer();
+		viewer.setPreferredSize(new Dimension(180,450));
+		properties = new PropertiesViewer();
+		Mediator.setPropertiesViewer(properties);
+	
+		JSplitPane treeSplitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,viewer,properties);
+		JPanel logPanel = new LogPanel();
+		logPanel.setPreferredSize(new Dimension(180,100));
+		JSplitPane logSplitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT,treeSplitter,logPanel);
+		panel.add(logSplitter);
+		frame.getContentPane().add(panel);
+		
+		
+	}
+	
+      /////////////////////////// MENU /////////////////////////////
+    JMenu searchMenu,loggerMenu,cyberMenu;  
+    public void doMenuBar(JFrame frame) {
+
+        JMenuBar menuBar = new JMenuBar();
+        
+        //////////////// FILE
+        JMenu file_menu = new JMenu("File");
+        file_menu.setMnemonic(KeyEvent.VK_F);
+
+        searchMenu = new JMenu("Search");
+        final String ALL_DEVICE = "ssdp:all";
+        final String ROOT_DEVICE = "upnp:rootdevice";
+        searchMenu.setMnemonic(KeyEvent.VK_L);
+        searchMenu.setEnabled(false);
+        AbstractAction searchAction = new AbstractAction(){
+            public void actionPerformed(ActionEvent e) {
+                DriverProxy controller = Mediator.getDriverProxy();
+                if (e.getActionCommand().equals(ALL_DEVICE))
+                    controller.doSearch(ALL_DEVICE);
+                else if (e.getActionCommand().equals(ROOT_DEVICE))
+                    controller.doSearch(ROOT_DEVICE);
+            }
+        };
+        
+        JMenuItem rootDeviceItem = new JMenuItem("Root Devices");
+        rootDeviceItem.setMnemonic(KeyEvent.VK_R);
+        rootDeviceItem.addActionListener(searchAction);
+        rootDeviceItem.setActionCommand(ROOT_DEVICE);
+        searchMenu.add(rootDeviceItem);
+        
+        JMenuItem allDeviceItem = new JMenuItem("All Devices");
+        allDeviceItem .setMnemonic(KeyEvent.VK_A);
+        allDeviceItem .addActionListener(searchAction);
+        allDeviceItem .setActionCommand(ALL_DEVICE);
+        searchMenu.add(allDeviceItem);
+        
+        
+        JMenuItem checkIncompleteItem = new JMenuItem("Print Pending Devices");
+        checkIncompleteItem.setMnemonic(KeyEvent.VK_I);
+        checkIncompleteItem.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    Mediator.getRootDeviceListener().checkIncompleteDevice();
+                }
+            });
+        
+        JMenuItem checkErrataItem = new JMenuItem("Check Errata UPnPDevices");
+        checkErrataItem.setMnemonic(KeyEvent.VK_E);
+        checkErrataItem.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {                    
+                    RootDeviceListener.checkErrataDevice();}
+            });
+        
+        
+        loggerMenu = new JMenu("Felix Logger");
+        final String NO_LOGGING ="No Logging";
+        final String ERROR ="Error";
+        final String WARNING ="Warning";
+        final String INFO ="Info";
+        final String DEBUG ="Debug";
+
+        loggerMenu.getPopupMenu().addPopupMenuListener(this);
+        loggerMenu.setMnemonic(KeyEvent.VK_L);
+        loggerMenu.setEnabled(false);
+        AbstractAction loggerAction = new AbstractAction(){
+            public void actionPerformed(ActionEvent e) {
+                DriverProxy controller = Mediator.getDriverProxy();
+                if (e.getActionCommand().equals(NO_LOGGING))
+                    controller.setLogLevel(0);
+                else if (e.getActionCommand().equals(ERROR))
+                    controller.setLogLevel(1);
+                else if (e.getActionCommand().equals(WARNING))
+                    controller.setLogLevel(2);
+                else if (e.getActionCommand().equals(INFO))
+                    controller.setLogLevel(3);
+                else if (e.getActionCommand().equals(DEBUG))
+                    controller.setLogLevel(4);
+            }
+        };
+       
+        ButtonGroup group = new ButtonGroup();
+        
+        JRadioButtonMenuItem rbMenuItem = new JRadioButtonMenuItem(NO_LOGGING);
+        rbMenuItem.setSelected(true);
+        rbMenuItem.setMnemonic(KeyEvent.VK_N);
+        rbMenuItem.setActionCommand(NO_LOGGING);
+        rbMenuItem.addActionListener(loggerAction);
+        group.add(rbMenuItem);
+        loggerMenu.add(rbMenuItem);
+        loggerMenu.addSeparator();
+        
+        rbMenuItem = new JRadioButtonMenuItem(ERROR);
+        rbMenuItem.setMnemonic(KeyEvent.VK_E);
+        rbMenuItem.setActionCommand(ERROR);
+        rbMenuItem.addActionListener(loggerAction);
+        group.add(rbMenuItem);
+        loggerMenu.add(rbMenuItem);
+
+        rbMenuItem = new JRadioButtonMenuItem(WARNING);
+        rbMenuItem.setMnemonic(KeyEvent.VK_W);
+        rbMenuItem.setActionCommand(WARNING);
+        rbMenuItem.addActionListener(loggerAction);
+        group.add(rbMenuItem);
+        loggerMenu.add(rbMenuItem);
+        
+        rbMenuItem = new JRadioButtonMenuItem(INFO);
+        rbMenuItem.setMnemonic(KeyEvent.VK_I);
+        rbMenuItem.setActionCommand(INFO);
+        rbMenuItem.addActionListener(loggerAction);
+        group.add(rbMenuItem);
+        loggerMenu.add(rbMenuItem);
+        
+        rbMenuItem = new JRadioButtonMenuItem(DEBUG);
+        rbMenuItem.setMnemonic(KeyEvent.VK_D);
+        rbMenuItem.setActionCommand(DEBUG);
+        rbMenuItem.addActionListener(loggerAction);
+        group.add(rbMenuItem);
+        loggerMenu.add(rbMenuItem);
+
+        final String ON ="On";
+        final String OFF ="Off";
+        cyberMenu = new JMenu("Cyber Debugger");
+        cyberMenu.getPopupMenu().addPopupMenuListener(this);
+        cyberMenu.setMnemonic(KeyEvent.VK_C);
+        cyberMenu.setEnabled(false);
+        AbstractAction cyberAction = new AbstractAction(){
+            public void actionPerformed(ActionEvent e) {
+                DriverProxy controller = Mediator.getDriverProxy();
+                if (e.getActionCommand().equals(ON))
+                    controller.setCyberDebug(true);
+                else if (e.getActionCommand().equals(OFF))
+                    controller.setCyberDebug(false);
+            }
+        };
+
+       
+        ButtonGroup cyberGroup = new ButtonGroup();
+        rbMenuItem = new JRadioButtonMenuItem(ON);
+        rbMenuItem.setSelected(true);
+        rbMenuItem.setMnemonic(KeyEvent.VK_O);
+        rbMenuItem.setActionCommand(ON);
+        rbMenuItem.addActionListener(cyberAction);
+        cyberGroup.add(rbMenuItem);
+        cyberMenu.add(rbMenuItem);
+
+        rbMenuItem = new JRadioButtonMenuItem(OFF);
+        rbMenuItem.setMnemonic(KeyEvent.VK_F);
+        rbMenuItem.setActionCommand(OFF);
+        rbMenuItem.addActionListener(cyberAction);
+        cyberGroup.add(rbMenuItem);
+        cyberMenu.add(rbMenuItem);
+        
+        /*
+        JMenuItem clearSubscriptionItem = new JMenuItem("Clear Subscriptions");
+        clearSubscriptionItem.setMnemonic(KeyEvent.VK_S);
+        clearSubscriptionItem.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+// to do
+                    }
+            });
+        */
+        
+        JMenuItem exitItem = new JMenuItem("Exit");
+        exitItem.setMnemonic(KeyEvent.VK_X);
+        exitItem.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    try {
+                        Activator.context.getBundle().stop();
+                    }catch (Exception ex){
+                        ex.printStackTrace();
+                    }
+                }
+            });
+        
+
+        file_menu.add(searchMenu);
+        file_menu.addSeparator();
+        file_menu.add(loggerMenu);
+        file_menu.add(cyberMenu);
+        file_menu.addSeparator();
+        file_menu.add(checkIncompleteItem);
+        file_menu.add(checkErrataItem);
+        //file_menu.addSeparator();
+        //file_menu.add(clearSubscriptionItem);
+        file_menu.addSeparator();
+        file_menu.add(exitItem);
+
+        menuBar.add(file_menu);                   
+        frame.setJMenuBar(menuBar);
+
+    }
+
+ 
+    public void enableMenus(boolean driverAvailable,int logLevel,boolean cyberDebug) {
+        searchMenu.setEnabled(driverAvailable);
+        Component[] items = searchMenu.getPopupMenu().getComponents();
+        for (int i=0;i < items.length;i++)
+            items[i].setEnabled(driverAvailable);
+
+        loggerMenu.setEnabled(driverAvailable);
+        items = loggerMenu.getPopupMenu().getComponents();
+        for (int i=0;i < items.length;i++)
+            items[i].setEnabled(driverAvailable);
+        if (driverAvailable){
+                ((JRadioButtonMenuItem)items[logLevel>0?logLevel+1:0]).setSelected(true);
+        }
+        cyberMenu.setEnabled(driverAvailable);           
+        items = cyberMenu.getPopupMenu().getComponents();
+        for (int i=0;i < items.length;i++)
+            items[i].setEnabled(driverAvailable);
+        if (driverAvailable){
+            if (cyberDebug)
+                ((JRadioButtonMenuItem)items[0]).setSelected(true);
+            else
+                ((JRadioButtonMenuItem)items[1]).setSelected(true);
+        }
+   }
+
+    public void popupMenuCanceled(PopupMenuEvent e) { }
+    public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { }
+
+    public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+        JPopupMenu loggerPopup = loggerMenu.getPopupMenu();
+        JPopupMenu cyberPopup = cyberMenu.getPopupMenu();
+        if (e.getSource()==loggerPopup){
+            int logLevel = Mediator.getDriverProxy().getLogLevel();
+            Component[] items = loggerPopup.getComponents();
+            ((JRadioButtonMenuItem)items[logLevel>0?logLevel+1:0]).setSelected(true);          
+        }
+        else if (e.getSource()==cyberPopup){
+            boolean cyberDebug = Mediator.getDriverProxy().getCyberDebug();
+            Component[] items = cyberPopup.getComponents();
+            if (cyberDebug)
+                ((JRadioButtonMenuItem)items[0]).setSelected(true);
+            else
+                ((JRadioButtonMenuItem)items[1]).setSelected(true);            
+        }
+       
+        
+    }
+
+
+
+	
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/Mediator.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/Mediator.java
index 128f8c0..8361eab 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/Mediator.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/Mediator.java
@@ -1,93 +1,93 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester;
-
-
-import javax.swing.JFrame;
-import javax.swing.JTree;
-
-import org.apache.felix.upnp.tester.discovery.DriverProxy;
-import org.apache.felix.upnp.tester.discovery.RootDeviceListener;
-import org.apache.felix.upnp.tester.gui.PropertiesViewer;
-import org.apache.felix.upnp.tester.gui.TreeViewer;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public  class Mediator {
-	static PropertiesViewer props;
-	static JTree tree;
-    static JFrame frame; 
-    static DriverProxy driverProxy;
-    static RootDeviceListener rootDeviceListener; 
-    static ControlPoint controlPoint; 
-    static TreeViewer treeViewer; 
-	
-
-	public static void setPropertiesViewer(PropertiesViewer props){
-		Mediator.props=props;
-	}
-	public static PropertiesViewer getPropertiesViewer(){
-		return props;
-	}
-	
-    public static void setUPnPDeviceTree(JTree tree){
-        Mediator.tree=tree;
-    }
-    public static JTree getUPnPDeviceTree(){
-        return tree;
-    }
-    
-    public static void setTreeViewer(TreeViewer treeViewer){
-        Mediator.treeViewer=treeViewer;
-    }
-    public static TreeViewer getTreeViewer(){
-        return treeViewer;
-    }
-	
-    public static void setMainFrame(JFrame frame){
-        Mediator.frame=frame;
-    }
-    public static JFrame getMainFrame(){
-        return frame;
-    }
-    public static void setControlPoint(ControlPoint controlPoint){
-        Mediator.controlPoint=controlPoint;
-    }
-    public static ControlPoint getControlPoint(){
-        return controlPoint;
-    }
-    
-    public static void setDriverProxy(DriverProxy driverProxy) {
-        Mediator.driverProxy = driverProxy;        
-    }
-    
-    public static DriverProxy getDriverProxy(){
-        return driverProxy;
-    }
-    
-    public static void setRootDeviceListener(RootDeviceListener listener) {
-        Mediator.rootDeviceListener = listener;        
-    }
-    
-    public static RootDeviceListener getRootDeviceListener(){
-        return rootDeviceListener;
-    }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester;
+
+
+import javax.swing.JFrame;
+import javax.swing.JTree;
+
+import org.apache.felix.upnp.tester.discovery.DriverProxy;
+import org.apache.felix.upnp.tester.discovery.RootDeviceListener;
+import org.apache.felix.upnp.tester.gui.PropertiesViewer;
+import org.apache.felix.upnp.tester.gui.TreeViewer;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public  class Mediator {
+	static PropertiesViewer props;
+	static JTree tree;
+    static JFrame frame; 
+    static DriverProxy driverProxy;
+    static RootDeviceListener rootDeviceListener; 
+    static ControlPoint controlPoint; 
+    static TreeViewer treeViewer; 
+	
+
+	public static void setPropertiesViewer(PropertiesViewer props){
+		Mediator.props=props;
+	}
+	public static PropertiesViewer getPropertiesViewer(){
+		return props;
+	}
+	
+    public static void setUPnPDeviceTree(JTree tree){
+        Mediator.tree=tree;
+    }
+    public static JTree getUPnPDeviceTree(){
+        return tree;
+    }
+    
+    public static void setTreeViewer(TreeViewer treeViewer){
+        Mediator.treeViewer=treeViewer;
+    }
+    public static TreeViewer getTreeViewer(){
+        return treeViewer;
+    }
+	
+    public static void setMainFrame(JFrame frame){
+        Mediator.frame=frame;
+    }
+    public static JFrame getMainFrame(){
+        return frame;
+    }
+    public static void setControlPoint(ControlPoint controlPoint){
+        Mediator.controlPoint=controlPoint;
+    }
+    public static ControlPoint getControlPoint(){
+        return controlPoint;
+    }
+    
+    public static void setDriverProxy(DriverProxy driverProxy) {
+        Mediator.driverProxy = driverProxy;        
+    }
+    
+    public static DriverProxy getDriverProxy(){
+        return driverProxy;
+    }
+    
+    public static void setRootDeviceListener(RootDeviceListener listener) {
+        Mediator.rootDeviceListener = listener;        
+    }
+    
+    public static RootDeviceListener getRootDeviceListener(){
+        return rootDeviceListener;
+    }
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/UPnPSubscriber.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/UPnPSubscriber.java
index 0c4d983..baaff4d 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/UPnPSubscriber.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/UPnPSubscriber.java
@@ -1,90 +1,90 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.felix.upnp.tester;
-
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPService;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPSubscriber {
-	private BundleContext context;
-	private UPnPEventListener listener;
-	private HashMap hash;
-	
-	private class Subscription implements UPnPEventListener{
-	    ServiceRegistration registration;
-	    
-	    Subscription(String keys){
-	 		try {
-				Filter filter = context.createFilter(keys);
-				Properties props = new Properties();
-				props.put(UPnPEventListener.UPNP_FILTER, filter);
-				registration = context.registerService(UPnPEventListener.class.getName(), this, props);
-			}catch (Exception ex){
-				System.out.println(ex);
-			}
-	    }
-	    
-	    public void unsubscribe(){
-			registration.unregister();
-	    }
-	    
-        public void notifyUPnPEvent(String arg0, String arg1, Dictionary arg2) {
-            listener.notifyUPnPEvent( arg0,  arg1,  arg2);
-        }
-	}
-	
-	
-	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
-		this.context = context;
-		this.listener = listener;
-		hash = new HashMap();
-	}
-	
-	public void subscribe(String deviceId, String serviceId){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
-		if (hash.get(keys) == null){
-		    hash.put(keys, new Subscription(keys));
-		}
-	}
-	
-	public void unsubscribe(String deviceId, String serviceId){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
-		if (hash.containsKey(keys)) {
-		    Subscription subscription = (Subscription) hash.get(keys);
-		    subscription.unsubscribe();
-			hash.remove(keys);
-		}
-	}
-
-
- 	
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.felix.upnp.tester;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPService;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPSubscriber {
+	private BundleContext context;
+	private UPnPEventListener listener;
+	private HashMap hash;
+	
+	private class Subscription implements UPnPEventListener{
+	    ServiceRegistration registration;
+	    
+	    Subscription(String keys){
+	 		try {
+				Filter filter = context.createFilter(keys);
+				Properties props = new Properties();
+				props.put(UPnPEventListener.UPNP_FILTER, filter);
+				registration = context.registerService(UPnPEventListener.class.getName(), this, props);
+			}catch (Exception ex){
+				System.out.println(ex);
+			}
+	    }
+	    
+	    public void unsubscribe(){
+			registration.unregister();
+	    }
+	    
+        public void notifyUPnPEvent(String arg0, String arg1, Dictionary arg2) {
+            listener.notifyUPnPEvent( arg0,  arg1,  arg2);
+        }
+	}
+	
+	
+	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
+		this.context = context;
+		this.listener = listener;
+		hash = new HashMap();
+	}
+	
+	public void subscribe(String deviceId, String serviceId){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
+		if (hash.get(keys) == null){
+		    hash.put(keys, new Subscription(keys));
+		}
+	}
+	
+	public void unsubscribe(String deviceId, String serviceId){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
+		if (hash.containsKey(keys)) {
+		    Subscription subscription = (Subscription) hash.get(keys);
+		    subscription.unsubscribe();
+			hash.remove(keys);
+		}
+	}
+
+
+ 	
+
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNode.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNode.java
index 550194b..3c7eff8 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNode.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNode.java
@@ -1,215 +1,215 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.discovery;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.upnp.UPnPDevice;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class DeviceNode {
-	
-	private ServiceReference sr;
-	private boolean isRootNode;
-	private String udn ;
-	private boolean hasChild;
-	private int numberOfSons;
-	private ArrayList children;
-	private DeviceNode parent;
-	
-	public DeviceNode(ServiceReference sr){
-		//PRE: argument is always UPnPDevice service reference
-		if (sr == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode constructor");
-		this.sr = sr;
-		udn = (String) sr.getProperty(UPnPDevice.UDN);
-		parent=null;
-		isRootNode = (sr.getProperty(UPnPDevice.PARENT_UDN) == null);
-		String[] sons = ((String[]) sr.getProperty(UPnPDevice.CHILDREN_UDN));
-		hasChild = (sons != null);
-		if (hasChild) {
-			children = new ArrayList();
-			numberOfSons = sons.length;
-		}
-		/*
-		//Operation to let DeviceNode::isComplete() O(1)
-		isComplete = !hasChild;
-		*/					
-	}
-	
-	public ServiceReference getReference(){
-		return sr;
-	}
-	public UPnPDevice getDevice(BundleContext ctx){
-		return (UPnPDevice)ctx.getService(sr);
-	}
-	
-	public void attach(DeviceNode node){
-		if (node == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.attach() method");
-		node.parent = this;
-		/*
-		//Operation to let DeviceNode::isComplete() O(1)
-		if((numberOfSons==children.size()-1)
-				&&(node.isComplete())){
-			this.isComplete = true;
-		}
-		*/
-		children.add(node);
-	}
-	
-	public DeviceNode dethatch(String name){
-		DeviceNode dn = this.search(name);
-		if(dn==null) 
-			return null;
-		
-		if(dn.parent!=null){
-			Iterator list = dn.parent.children.iterator();
-			while (list.hasNext()) {
-				DeviceNode x = (DeviceNode) list.next();
-				if(x.udn.equals(name)){
-					list.remove();
-					/*
-					//Operation to let DeviceNode::isComplete() O(1)
-					dn.parent.isComplete=false;
-					*/					
-					break;
-				}
-			}
-		}
-		dn.parent=null;
-		return dn;
-	}
-	
-	public Collection getAllChildren(){
-		if((this.children==null)||(this.children.size()==0)) 
-			return new ArrayList();
-		
-		Vector v = new Vector(this.children);
-		Iterator list = this.children.iterator();
-		while (list.hasNext()) {
-			DeviceNode x = (DeviceNode) list.next();
-			Collection c = x.getAllChildren();
-			if(c==null) continue;
-			v.addAll(c);
-		}
-		return v;
-	}
-
-	public Collection getChildren(){
-		if((this.children==null)||(this.children.size()==0)) 
-			return new ArrayList();
-		return this.children;
-	}	
-	
-	/**
-	 * @param name <code>String</code> that contain the UDN to look for
-	 * @return return a <code>DeviceNode</code> that have the UDN equals to name and <br>
-	 * 		if there is any <code>DeviceNode</code> with the proper UDN value return <code>null</code>
-	 */
-	public DeviceNode search(String name){
-		if (name == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.search() method");
-		if (name.equals(udn))
-			return this;
-		else if (hasChild){
-			Iterator list = children.iterator();
-			while (list.hasNext()){
-				DeviceNode child = (DeviceNode)list.next();
-				DeviceNode node = child.search(name);
-				if (node != null) return node;				
-			}
-		}
-		return null;
-	}
-	
-	/**
-	 * 
-	 * @param udn
-	 * @return <code>true</code> if and only if this <code>DeviceNode</code>
-	 * 		contains a DeviceNode with UDN equals to passed argument or if
-	 * 		its USN is equal to passed argument
-	 */
-	public boolean contains(String udn){
-		return this.search(udn)!=null;
-	}
-	
-	public boolean isComplete(){	
-		/*
-		//Operation to let DeviceNode::isComplete() O(1)
-		return isComplete;
-		*/		
-		if (! hasChild) return true;
-		if (numberOfSons != children.size())return false;
-		Iterator list = children.iterator();
-		while (list.hasNext()){
-			DeviceNode child = (DeviceNode)list.next();
-			if (! child.isComplete()) return false;
-		}
-		return true;
-	}
-	
-	public DeviceNode isAttachable(DeviceNode node){
-		if (node == null) 
-			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.isAttachable() method");
-		String parentUDN=(String) node.getReference().getProperty(UPnPDevice.PARENT_UDN);
-		if(parentUDN==null) return null;
-		return search(parentUDN);		
-	}
-		
-	public boolean isRoot(){
-		return isRootNode;		
-	}
-	
-	public boolean equals(String udn){
-		return this.udn.equals(udn);
-	}
-	
-	public String toString(){
-		return udn;
-	}		
-	public boolean isLeaf() {
-		return !hasChild;
-	}
-    
-    public void print(){
-        System.out.println("####Device Node");
-        String[] props = sr.getPropertyKeys();
-        for (int i=0;i< props.length;i++){
-            Object prop= sr.getProperty(props[i]);
-            if (prop instanceof String[]){
-                System.out.println(props[i]+ "=");
-                String[] multiple = (String[])prop;
-                for (int j=0;j< multiple.length;j++){
-                    System.out.println(multiple[j]+ ";"); 
-                }
-
-            }
-            else System.out.println(props[i]+ "="+ prop);
-        }
-        System.out.println("####Device Node");
-   }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.discovery;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.upnp.UPnPDevice;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class DeviceNode {
+	
+	private ServiceReference sr;
+	private boolean isRootNode;
+	private String udn ;
+	private boolean hasChild;
+	private int numberOfSons;
+	private ArrayList children;
+	private DeviceNode parent;
+	
+	public DeviceNode(ServiceReference sr){
+		//PRE: argument is always UPnPDevice service reference
+		if (sr == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode constructor");
+		this.sr = sr;
+		udn = (String) sr.getProperty(UPnPDevice.UDN);
+		parent=null;
+		isRootNode = (sr.getProperty(UPnPDevice.PARENT_UDN) == null);
+		String[] sons = ((String[]) sr.getProperty(UPnPDevice.CHILDREN_UDN));
+		hasChild = (sons != null);
+		if (hasChild) {
+			children = new ArrayList();
+			numberOfSons = sons.length;
+		}
+		/*
+		//Operation to let DeviceNode::isComplete() O(1)
+		isComplete = !hasChild;
+		*/					
+	}
+	
+	public ServiceReference getReference(){
+		return sr;
+	}
+	public UPnPDevice getDevice(BundleContext ctx){
+		return (UPnPDevice)ctx.getService(sr);
+	}
+	
+	public void attach(DeviceNode node){
+		if (node == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.attach() method");
+		node.parent = this;
+		/*
+		//Operation to let DeviceNode::isComplete() O(1)
+		if((numberOfSons==children.size()-1)
+				&&(node.isComplete())){
+			this.isComplete = true;
+		}
+		*/
+		children.add(node);
+	}
+	
+	public DeviceNode dethatch(String name){
+		DeviceNode dn = this.search(name);
+		if(dn==null) 
+			return null;
+		
+		if(dn.parent!=null){
+			Iterator list = dn.parent.children.iterator();
+			while (list.hasNext()) {
+				DeviceNode x = (DeviceNode) list.next();
+				if(x.udn.equals(name)){
+					list.remove();
+					/*
+					//Operation to let DeviceNode::isComplete() O(1)
+					dn.parent.isComplete=false;
+					*/					
+					break;
+				}
+			}
+		}
+		dn.parent=null;
+		return dn;
+	}
+	
+	public Collection getAllChildren(){
+		if((this.children==null)||(this.children.size()==0)) 
+			return new ArrayList();
+		
+		Vector v = new Vector(this.children);
+		Iterator list = this.children.iterator();
+		while (list.hasNext()) {
+			DeviceNode x = (DeviceNode) list.next();
+			Collection c = x.getAllChildren();
+			if(c==null) continue;
+			v.addAll(c);
+		}
+		return v;
+	}
+
+	public Collection getChildren(){
+		if((this.children==null)||(this.children.size()==0)) 
+			return new ArrayList();
+		return this.children;
+	}	
+	
+	/**
+	 * @param name <code>String</code> that contain the UDN to look for
+	 * @return return a <code>DeviceNode</code> that have the UDN equals to name and <br>
+	 * 		if there is any <code>DeviceNode</code> with the proper UDN value return <code>null</code>
+	 */
+	public DeviceNode search(String name){
+		if (name == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.search() method");
+		if (name.equals(udn))
+			return this;
+		else if (hasChild){
+			Iterator list = children.iterator();
+			while (list.hasNext()){
+				DeviceNode child = (DeviceNode)list.next();
+				DeviceNode node = child.search(name);
+				if (node != null) return node;				
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * 
+	 * @param udn
+	 * @return <code>true</code> if and only if this <code>DeviceNode</code>
+	 * 		contains a DeviceNode with UDN equals to passed argument or if
+	 * 		its USN is equal to passed argument
+	 */
+	public boolean contains(String udn){
+		return this.search(udn)!=null;
+	}
+	
+	public boolean isComplete(){	
+		/*
+		//Operation to let DeviceNode::isComplete() O(1)
+		return isComplete;
+		*/		
+		if (! hasChild) return true;
+		if (numberOfSons != children.size())return false;
+		Iterator list = children.iterator();
+		while (list.hasNext()){
+			DeviceNode child = (DeviceNode)list.next();
+			if (! child.isComplete()) return false;
+		}
+		return true;
+	}
+	
+	public DeviceNode isAttachable(DeviceNode node){
+		if (node == null) 
+			throw new IllegalArgumentException("null is not a valid arg in DeviceNode.isAttachable() method");
+		String parentUDN=(String) node.getReference().getProperty(UPnPDevice.PARENT_UDN);
+		if(parentUDN==null) return null;
+		return search(parentUDN);		
+	}
+		
+	public boolean isRoot(){
+		return isRootNode;		
+	}
+	
+	public boolean equals(String udn){
+		return this.udn.equals(udn);
+	}
+	
+	public String toString(){
+		return udn;
+	}		
+	public boolean isLeaf() {
+		return !hasChild;
+	}
+    
+    public void print(){
+        System.out.println("####Device Node");
+        String[] props = sr.getPropertyKeys();
+        for (int i=0;i< props.length;i++){
+            Object prop= sr.getProperty(props[i]);
+            if (prop instanceof String[]){
+                System.out.println(props[i]+ "=");
+                String[] multiple = (String[])prop;
+                for (int j=0;j< multiple.length;j++){
+                    System.out.println(multiple[j]+ ";"); 
+                }
+
+            }
+            else System.out.println(props[i]+ "="+ prop);
+        }
+        System.out.println("####Device Node");
+   }
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNodeListener.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNodeListener.java
index 0fa8702..a37a602 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNodeListener.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DeviceNodeListener.java
@@ -1,28 +1,28 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.discovery;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public interface DeviceNodeListener {
-	public void deviceDetected(DeviceNode d);
-	public void rootDeviceUnplugged(String udn);
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.discovery;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public interface DeviceNodeListener {
+	public void deviceDetected(DeviceNode d);
+	public void rootDeviceUnplugged(String udn);
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DriverProxy.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DriverProxy.java
index 179cb5d..851ad8f 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DriverProxy.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/discovery/DriverProxy.java
@@ -1,123 +1,123 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.discovery;
-
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-
-import org.apache.felix.upnp.basedriver.controller.DevicesInfo;
-import org.apache.felix.upnp.basedriver.controller.DriverController;
-import org.apache.felix.upnp.tester.Activator;
-import org.apache.felix.upnp.tester.Mediator;
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class DriverProxy implements ServiceListener {
-    private DevicesInfo devicesInfo;
-    private DriverController drvController;
-    public DriverProxy(){
-        ServiceReference sr = Activator.context.getServiceReference(DevicesInfo.class.getName());
-        if (sr != null){
-            devicesInfo = (DevicesInfo)Activator.context.getService(sr);
-            drvController = (DriverController) devicesInfo;
-            Mediator.getControlPoint().enableMenus(true,getLogLevel(),getCyberDebug());
-            Mediator.getTreeViewer().setPopupMenuEnabled(true);
-        }
-        String filter =  "(" + Constants.OBJECTCLASS + "=" + DevicesInfo.class.getName() + ")" ;
-        try {
-            Activator.context.addServiceListener(this,filter);  
-        } catch (Exception ignored){};
-     }
-    
-    public boolean isDriverAvailable(){
-        return (drvController != null);
-    }
-    
-    public String getDeviceDescriptionURI(String udn){
-        if (devicesInfo != null)
-            return devicesInfo.getLocationURL(udn);
-        return "";
-    }
-    
-    public String getServiceDescriptionURI(String udn,String serviceId){
-        if (devicesInfo != null)
-            return devicesInfo.getSCPDURL(udn,serviceId);
-        return null;
-    }
-    
-    public String resolveRelativeUrl(String udn,String link){
-        if (devicesInfo != null)
-            return devicesInfo.resolveRelativeUrl(udn,link);
-        return null;
-    }
-    
-    public boolean getCyberDebug(){
-        if (drvController != null)
-            return drvController.getCyberDebug();
-        return false;
-    }
-    public void setCyberDebug(boolean b){
-        if (drvController != null)
-            drvController.setCyberDebug(b);
-    }
-    public int getLogLevel(){
-        if (drvController != null)
-            return drvController.getLogLevel();
-        return 0;
-    }
-    
-    public void setLogLevel(int value){
-        if (drvController != null)
-            drvController.setLogLevel(value);
-    }
-    public void doSearch(String target){
-        if (drvController != null)
-            drvController.search(target);
-    }
-    
-    
-    public void serviceChanged(ServiceEvent e) {
-        switch(e.getType()){
-            case ServiceEvent.REGISTERED:{
-                Object service = Activator.context.getService(e.getServiceReference());
-                if (service != null){
-                devicesInfo = (DevicesInfo) service;
-                drvController = (DriverController) devicesInfo;
-                Mediator.getControlPoint().enableMenus(true,getLogLevel(),getCyberDebug());
-                Mediator.getTreeViewer().setPopupMenuEnabled(true);
-                }
-            };break;
-            case ServiceEvent.UNREGISTERING:{   
-                devicesInfo = null;
-                drvController =null;
-                Mediator.getControlPoint().enableMenus(false,0,false);
-                Mediator.getTreeViewer().setPopupMenuEnabled(false);
-            };break;
-        }       
-    }
-    
-    public void close(){
-        Activator.context.removeServiceListener(this);           
-    }
-
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.discovery;
+
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+import org.apache.felix.upnp.basedriver.controller.DevicesInfo;
+import org.apache.felix.upnp.basedriver.controller.DriverController;
+import org.apache.felix.upnp.tester.Activator;
+import org.apache.felix.upnp.tester.Mediator;
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class DriverProxy implements ServiceListener {
+    private DevicesInfo devicesInfo;
+    private DriverController drvController;
+    public DriverProxy(){
+        ServiceReference sr = Activator.context.getServiceReference(DevicesInfo.class.getName());
+        if (sr != null){
+            devicesInfo = (DevicesInfo)Activator.context.getService(sr);
+            drvController = (DriverController) devicesInfo;
+            Mediator.getControlPoint().enableMenus(true,getLogLevel(),getCyberDebug());
+            Mediator.getTreeViewer().setPopupMenuEnabled(true);
+        }
+        String filter =  "(" + Constants.OBJECTCLASS + "=" + DevicesInfo.class.getName() + ")" ;
+        try {
+            Activator.context.addServiceListener(this,filter);  
+        } catch (Exception ignored){};
+     }
+    
+    public boolean isDriverAvailable(){
+        return (drvController != null);
+    }
+    
+    public String getDeviceDescriptionURI(String udn){
+        if (devicesInfo != null)
+            return devicesInfo.getLocationURL(udn);
+        return "";
+    }
+    
+    public String getServiceDescriptionURI(String udn,String serviceId){
+        if (devicesInfo != null)
+            return devicesInfo.getSCPDURL(udn,serviceId);
+        return null;
+    }
+    
+    public String resolveRelativeUrl(String udn,String link){
+        if (devicesInfo != null)
+            return devicesInfo.resolveRelativeUrl(udn,link);
+        return null;
+    }
+    
+    public boolean getCyberDebug(){
+        if (drvController != null)
+            return drvController.getCyberDebug();
+        return false;
+    }
+    public void setCyberDebug(boolean b){
+        if (drvController != null)
+            drvController.setCyberDebug(b);
+    }
+    public int getLogLevel(){
+        if (drvController != null)
+            return drvController.getLogLevel();
+        return 0;
+    }
+    
+    public void setLogLevel(int value){
+        if (drvController != null)
+            drvController.setLogLevel(value);
+    }
+    public void doSearch(String target){
+        if (drvController != null)
+            drvController.search(target);
+    }
+    
+    
+    public void serviceChanged(ServiceEvent e) {
+        switch(e.getType()){
+            case ServiceEvent.REGISTERED:{
+                Object service = Activator.context.getService(e.getServiceReference());
+                if (service != null){
+                devicesInfo = (DevicesInfo) service;
+                drvController = (DriverController) devicesInfo;
+                Mediator.getControlPoint().enableMenus(true,getLogLevel(),getCyberDebug());
+                Mediator.getTreeViewer().setPopupMenuEnabled(true);
+                }
+            };break;
+            case ServiceEvent.UNREGISTERING:{   
+                devicesInfo = null;
+                drvController =null;
+                Mediator.getControlPoint().enableMenus(false,0,false);
+                Mediator.getTreeViewer().setPopupMenuEnabled(false);
+            };break;
+        }       
+    }
+    
+    public void close(){
+        Activator.context.removeServiceListener(this);           
+    }
+
+
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/ActionPanel.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/ActionPanel.java
index d8654b4..3e5a744 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/ActionPanel.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/ActionPanel.java
@@ -1,366 +1,366 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.gui;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractCellEditor;
-import javax.swing.DefaultCellEditor;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSlider;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableModel;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPException;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.basedriver.util.Converter;
-import org.apache.felix.upnp.tester.Mediator;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class ActionPanel extends JPanel {
-	
-	UPnPAction action;
-	ArgumentsModel argsModel;
-	MyTable table; 
-	JPanel buttonPanel;
-	
-	OutputArgumentsModel outArgsModel; 
-	JTable outTable; 
-	
-	/**
-	 * 
-	 */
-	public ActionPanel() {
-		super(new GridBagLayout());
-		buildButtonPanel();
-		buildTable();
-		add(new JScrollPane(table),Util.setConstrains(0,0,1,1,100,100));
-		add(new JScrollPane(outTable),Util.setConstrains(0,1,1,1,100,100)); 
-		add(buttonPanel,Util.setConstrains(1,0,1,1,1,1));
-	}
-
-	private void buildButtonPanel(){
-		buttonPanel = new JPanel();
-		JButton doAction = new JButton("Do Action");
-		doAction.addActionListener(new AbstractAction(){
-			public void actionPerformed(ActionEvent e) {
-				outArgsModel.clearData(); 
-
-				Dictionary params = null;
-				Dictionary result = null;
-				if (argsModel.getRowCount()!= 0){
-					if (table.isEditing()) table.getCellEditor().stopCellEditing();
-					params = new Hashtable();
-					for (int i =0;i<argsModel.getRowCount();i++){
-						String name = (String) argsModel.getValueAt(i,0);
-						String value = (String)argsModel.getValueAt(i,3);
-						try {
-                            params.put(
-                            	name,
-                                Converter.parseString(
-                                    value,
-                                    action.getStateVariable(name).getUPnPDataType()));
-                        } catch (Exception ex) {
-                        	LogPanel.log("Error invoking action (bad parameter)");
-                         	return ;
-                        }
-					}
-				}
-				try {result = action.invoke(params);}
-                catch (UPnPException ex){
-                    String error =  
-                        "===== Action Failed =====" +
-                        "\nUPnP Error Code::\n    " +ex.getUPnPError_Code() +
-                        "\nUPnP Error Description::\n    " +ex.getMessage();
-                    printReport(params,error);
-                    JOptionPane.showMessageDialog(
-                        Mediator.getPropertiesViewer(),error);                   
-                }
-                catch (Exception ex){
-                    printReport(params,ex.getMessage());
-					JOptionPane.showMessageDialog(
-						Mediator.getPropertiesViewer(),
-						ex.getMessage()
-					);
-				}
-				if (result != null) {
-                    printReport(params,result);
-					outArgsModel.setData(action,result);
-					JOptionPane.showMessageDialog(
-						Mediator.getPropertiesViewer(),
-						"Action invoked!"
-					);
-				
-				}
-			}
-            private void printReport(Dictionary params,Object result) {
-                String input = "";
-                String output = "";
-                if (params != null) input = params.toString();
-                if (output != null) output = result.toString();
-                String method = action.getName();
-                String report = "\n==== Action:: " + method + " ====\n"
-                                + input 
-                                + "\n----------- result ----------\n"
-                                + output
-                                + "\n-----------------------------";
-               LogPanel.log(report);
-            }
-		});		
-	    buttonPanel.add(doAction);
-	}
-	
-	private void buildTable(){
-		argsModel = new ArgumentsModel();
-	    table = new MyTable(argsModel); 
-		argsModel.setTable(table); 		
-
-		outArgsModel = new OutputArgumentsModel();
-	    outTable = new JTable(outArgsModel); 
-	}
-
-	public void setArguments(UPnPAction action){
-		this.action = action;
-		argsModel.setData(action);		
-		outArgsModel.clearData(); 
-	}
-	
-}
-
-//thanks to Thomas Wagner 18/10/2005
-class OutputArgumentsModel extends ArgumentsModel { 
-
-	public OutputArgumentsModel() {
-		super();
-        header = new String[]{"output arg name","related Var","Java \\ UpnP type","value"};
-	}
-
-	public void clearData() {
-		names = new String[]{""};
-        related = new String[]{""};
-    	types = new String[]{""};
-    	values = new String[]{""};
-		size=0;
-		this.fireTableChanged(new TableModelEvent(this));
-	}
-
-    public void setData(UPnPAction  action, Object result){
-
-		Hashtable res = (Hashtable) result;
-
-        String[] names = action.getOutputArgumentNames();
-   	    size = 0;
-    	this.names = names;
-    	if (names!=null){
-	    	values = new String[names.length];
-            types = new String[names.length];
-            related = new String[names.length];
-	    	for (int i=0;i<names.length;i++) {
-                UPnPStateVariable currentStateVar = action.getStateVariable(names[i]);
-
-				Object value = res.get(names[i]);
-                values[i]=value.toString();
-                related[i] = currentStateVar.getName();
-                
-                String javaType =currentStateVar.getJavaDataType().toString();
-                javaType = javaType.substring(javaType.lastIndexOf('.')+1);
-                String upnpType = currentStateVar.getUPnPDataType();
-                types[i] = javaType + " \\ " + upnpType;
-            }   	
-	    	size = names.length;
-    	}
-		this.fireTableChanged(new TableModelEvent(this));
-    }
-}
-
-//thanks to Thomas Wagner 12/10/2005
-class ArgumentsModel extends  AbstractTableModel {
-	int size = 0;
-	private MyTable table;	
-	String[] names = new String[]{""};
-    String[] related = new String[]{""};
-    String[] types = new String[]{""};
-    String[] values = new String[]{""};
-	String[] header = new String[]{"arg name","related Var","Java \\ UpnP type","value"};
-   
-	public void setTable(MyTable table) { 
-		this.table = table;
-	}
- 
-	public int getColumnCount() { return 4; }
-    public int getRowCount() { return size;}
-    public String getColumnName(int col) { return header[col]; }
-    public boolean isCellEditable(int rowIndex, int columnIndex) {
-    	return (columnIndex ==3);
-    }
-    public Object getValueAt(int row, int col) { 
-    	if (col == 0) return names[row];
-        else if (col == 1) return related[row];
-        else if (col == 2) return types[row];
-        else if (col == 3) return values[row];
-    	return null;
-	}   
-    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
-    	values[rowIndex]= (String) aValue; 
-    }
-
-    public void setData(UPnPAction  action){
-
-		table.deleteMyCellEditors();
-        
-
-        String[] names = action.getInputArgumentNames();
-   	    size = 0;
-    	this.names = names;
-    	if (names!=null){
-	    	values = new String[names.length];
-            related = new String[names.length];
-            types = new String[names.length];
-	    	for (int i=0;i<names.length;i++) {
-                values[i]="";
-                UPnPStateVariable currentStateVar = action.getStateVariable(names[i]);
-                related[i] = currentStateVar.getName();
-                String javaType = currentStateVar.getJavaDataType().toString();
-                javaType = javaType.substring(javaType.lastIndexOf('.')+1);
-                String upnpType = currentStateVar.getUPnPDataType();
-                types[i] = javaType + " \\ " + upnpType;
-
-				//handle allowed value list
-				if ( currentStateVar.getAllowedValues() != null) {
-					String av[] = currentStateVar.getAllowedValues();
-					JComboBox comboBox = new JComboBox();
-					for (int j = 0; j < av.length; j++) {
-						comboBox.addItem(av[j]);
-					}
-					values[i] = av[0]; //preset the first value from list
-					table.setMyCellEditor(new DefaultCellEditor(comboBox),i);
-				}
-
-				//handle default value
-				if (currentStateVar.getDefaultValue() != null) {
-					String val = currentStateVar.getDefaultValue().toString();
-					if(val.length() > 0)
-						values[i] = val;
-				}
-				
-               //handle range values
-               if ((currentStateVar.getMaximum()!= null)
-                   &&(currentStateVar.getMinimum()!= null)){
-                   int max = currentStateVar.getMaximum().intValue();
-                   int min = currentStateVar.getMinimum().intValue();
-                   int value = min;
-                   try { value = Integer.parseInt(values[i]);}
-                   catch (NumberFormatException ignored){}
-                   table.setMyCellEditor(new SliderEditor(min,max,value),i);
-               }
-
-            }   	
-	    	size = names.length;
-    	}
-		this.fireTableChanged(new TableModelEvent(this));
-        this.fireTableStructureChanged();
-    }
-}
-
-// thanks to Thomas Wagner 12/10/2005
-class MyTable extends JTable { 
-
-	private Hashtable cellEditors;
-	
-	public MyTable(TableModel dm) {
-		super(dm);
-		cellEditors = new Hashtable();
-	}
-
-	public void setMyCellEditor(TableCellEditor editor,int col){
-		cellEditors.put(new Integer(col),editor);
-	}
-
-	public void deleteMyCellEditors(){
-		cellEditors.clear();
-	}
-
-	//overwritten JTable method	
-	public TableCellEditor getCellEditor(int row,int col) {
-		TableCellEditor tce = (TableCellEditor) cellEditors.get(new Integer(row));
-		if( tce != null) {
-			return tce;
-		} else {
-			return super.getCellEditor(row,col);
-		}
-	}
-}
-
-class SliderEditor extends AbstractCellEditor implements TableCellEditor
-{
-    JPanel editor;
-    JTextField text;
-    JSlider slider;
-    public SliderEditor(int min, int max, int value){
-         editor = new JPanel(new BorderLayout());
-         //editor.setBorder(new EmptyBorder(1,0,1,0));
-         text = new JTextField(Integer.toString(max).length());
-         slider = new JSlider(SwingConstants.HORIZONTAL,min,max,value);
-         editor.add(text,BorderLayout.WEST);
-         editor.add(slider);
-         slider.addChangeListener(new ChangeListener(){
-            public void stateChanged(ChangeEvent e) {
-                //if (! replSlider.getValueIsAdjusting()){
-                text.setText(new Integer(slider.getValue()).toString());
-                //}
-            }
-         });
-
-    }
-    
-    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
-        text.setText((String) value);
-        try {
-            slider.setValue(Integer.parseInt((String)value));
-        } catch (NumberFormatException ignored) {}
-        return editor;
-    }
-
-    public Object getCellEditorValue() {
-        return text.getText();
-    }
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractCellEditor;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSlider;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.TableModelEvent;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableModel;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPException;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.basedriver.util.Converter;
+import org.apache.felix.upnp.tester.Mediator;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class ActionPanel extends JPanel {
+	
+	UPnPAction action;
+	ArgumentsModel argsModel;
+	MyTable table; 
+	JPanel buttonPanel;
+	
+	OutputArgumentsModel outArgsModel; 
+	JTable outTable; 
+	
+	/**
+	 * 
+	 */
+	public ActionPanel() {
+		super(new GridBagLayout());
+		buildButtonPanel();
+		buildTable();
+		add(new JScrollPane(table),Util.setConstrains(0,0,1,1,100,100));
+		add(new JScrollPane(outTable),Util.setConstrains(0,1,1,1,100,100)); 
+		add(buttonPanel,Util.setConstrains(1,0,1,1,1,1));
+	}
+
+	private void buildButtonPanel(){
+		buttonPanel = new JPanel();
+		JButton doAction = new JButton("Do Action");
+		doAction.addActionListener(new AbstractAction(){
+			public void actionPerformed(ActionEvent e) {
+				outArgsModel.clearData(); 
+
+				Dictionary params = null;
+				Dictionary result = null;
+				if (argsModel.getRowCount()!= 0){
+					if (table.isEditing()) table.getCellEditor().stopCellEditing();
+					params = new Hashtable();
+					for (int i =0;i<argsModel.getRowCount();i++){
+						String name = (String) argsModel.getValueAt(i,0);
+						String value = (String)argsModel.getValueAt(i,3);
+						try {
+                            params.put(
+                            	name,
+                                Converter.parseString(
+                                    value,
+                                    action.getStateVariable(name).getUPnPDataType()));
+                        } catch (Exception ex) {
+                        	LogPanel.log("Error invoking action (bad parameter)");
+                         	return ;
+                        }
+					}
+				}
+				try {result = action.invoke(params);}
+                catch (UPnPException ex){
+                    String error =  
+                        "===== Action Failed =====" +
+                        "\nUPnP Error Code::\n    " +ex.getUPnPError_Code() +
+                        "\nUPnP Error Description::\n    " +ex.getMessage();
+                    printReport(params,error);
+                    JOptionPane.showMessageDialog(
+                        Mediator.getPropertiesViewer(),error);                   
+                }
+                catch (Exception ex){
+                    printReport(params,ex.getMessage());
+					JOptionPane.showMessageDialog(
+						Mediator.getPropertiesViewer(),
+						ex.getMessage()
+					);
+				}
+				if (result != null) {
+                    printReport(params,result);
+					outArgsModel.setData(action,result);
+					JOptionPane.showMessageDialog(
+						Mediator.getPropertiesViewer(),
+						"Action invoked!"
+					);
+				
+				}
+			}
+            private void printReport(Dictionary params,Object result) {
+                String input = "";
+                String output = "";
+                if (params != null) input = params.toString();
+                if (output != null) output = result.toString();
+                String method = action.getName();
+                String report = "\n==== Action:: " + method + " ====\n"
+                                + input 
+                                + "\n----------- result ----------\n"
+                                + output
+                                + "\n-----------------------------";
+               LogPanel.log(report);
+            }
+		});		
+	    buttonPanel.add(doAction);
+	}
+	
+	private void buildTable(){
+		argsModel = new ArgumentsModel();
+	    table = new MyTable(argsModel); 
+		argsModel.setTable(table); 		
+
+		outArgsModel = new OutputArgumentsModel();
+	    outTable = new JTable(outArgsModel); 
+	}
+
+	public void setArguments(UPnPAction action){
+		this.action = action;
+		argsModel.setData(action);		
+		outArgsModel.clearData(); 
+	}
+	
+}
+
+//thanks to Thomas Wagner 18/10/2005
+class OutputArgumentsModel extends ArgumentsModel { 
+
+	public OutputArgumentsModel() {
+		super();
+        header = new String[]{"output arg name","related Var","Java \\ UpnP type","value"};
+	}
+
+	public void clearData() {
+		names = new String[]{""};
+        related = new String[]{""};
+    	types = new String[]{""};
+    	values = new String[]{""};
+		size=0;
+		this.fireTableChanged(new TableModelEvent(this));
+	}
+
+    public void setData(UPnPAction  action, Object result){
+
+		Hashtable res = (Hashtable) result;
+
+        String[] names = action.getOutputArgumentNames();
+   	    size = 0;
+    	this.names = names;
+    	if (names!=null){
+	    	values = new String[names.length];
+            types = new String[names.length];
+            related = new String[names.length];
+	    	for (int i=0;i<names.length;i++) {
+                UPnPStateVariable currentStateVar = action.getStateVariable(names[i]);
+
+				Object value = res.get(names[i]);
+                values[i]=value.toString();
+                related[i] = currentStateVar.getName();
+                
+                String javaType =currentStateVar.getJavaDataType().toString();
+                javaType = javaType.substring(javaType.lastIndexOf('.')+1);
+                String upnpType = currentStateVar.getUPnPDataType();
+                types[i] = javaType + " \\ " + upnpType;
+            }   	
+	    	size = names.length;
+    	}
+		this.fireTableChanged(new TableModelEvent(this));
+    }
+}
+
+//thanks to Thomas Wagner 12/10/2005
+class ArgumentsModel extends  AbstractTableModel {
+	int size = 0;
+	private MyTable table;	
+	String[] names = new String[]{""};
+    String[] related = new String[]{""};
+    String[] types = new String[]{""};
+    String[] values = new String[]{""};
+	String[] header = new String[]{"arg name","related Var","Java \\ UpnP type","value"};
+   
+	public void setTable(MyTable table) { 
+		this.table = table;
+	}
+ 
+	public int getColumnCount() { return 4; }
+    public int getRowCount() { return size;}
+    public String getColumnName(int col) { return header[col]; }
+    public boolean isCellEditable(int rowIndex, int columnIndex) {
+    	return (columnIndex ==3);
+    }
+    public Object getValueAt(int row, int col) { 
+    	if (col == 0) return names[row];
+        else if (col == 1) return related[row];
+        else if (col == 2) return types[row];
+        else if (col == 3) return values[row];
+    	return null;
+	}   
+    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+    	values[rowIndex]= (String) aValue; 
+    }
+
+    public void setData(UPnPAction  action){
+
+		table.deleteMyCellEditors();
+        
+
+        String[] names = action.getInputArgumentNames();
+   	    size = 0;
+    	this.names = names;
+    	if (names!=null){
+	    	values = new String[names.length];
+            related = new String[names.length];
+            types = new String[names.length];
+	    	for (int i=0;i<names.length;i++) {
+                values[i]="";
+                UPnPStateVariable currentStateVar = action.getStateVariable(names[i]);
+                related[i] = currentStateVar.getName();
+                String javaType = currentStateVar.getJavaDataType().toString();
+                javaType = javaType.substring(javaType.lastIndexOf('.')+1);
+                String upnpType = currentStateVar.getUPnPDataType();
+                types[i] = javaType + " \\ " + upnpType;
+
+				//handle allowed value list
+				if ( currentStateVar.getAllowedValues() != null) {
+					String av[] = currentStateVar.getAllowedValues();
+					JComboBox comboBox = new JComboBox();
+					for (int j = 0; j < av.length; j++) {
+						comboBox.addItem(av[j]);
+					}
+					values[i] = av[0]; //preset the first value from list
+					table.setMyCellEditor(new DefaultCellEditor(comboBox),i);
+				}
+
+				//handle default value
+				if (currentStateVar.getDefaultValue() != null) {
+					String val = currentStateVar.getDefaultValue().toString();
+					if(val.length() > 0)
+						values[i] = val;
+				}
+				
+               //handle range values
+               if ((currentStateVar.getMaximum()!= null)
+                   &&(currentStateVar.getMinimum()!= null)){
+                   int max = currentStateVar.getMaximum().intValue();
+                   int min = currentStateVar.getMinimum().intValue();
+                   int value = min;
+                   try { value = Integer.parseInt(values[i]);}
+                   catch (NumberFormatException ignored){}
+                   table.setMyCellEditor(new SliderEditor(min,max,value),i);
+               }
+
+            }   	
+	    	size = names.length;
+    	}
+		this.fireTableChanged(new TableModelEvent(this));
+        this.fireTableStructureChanged();
+    }
+}
+
+// thanks to Thomas Wagner 12/10/2005
+class MyTable extends JTable { 
+
+	private Hashtable cellEditors;
+	
+	public MyTable(TableModel dm) {
+		super(dm);
+		cellEditors = new Hashtable();
+	}
+
+	public void setMyCellEditor(TableCellEditor editor,int col){
+		cellEditors.put(new Integer(col),editor);
+	}
+
+	public void deleteMyCellEditors(){
+		cellEditors.clear();
+	}
+
+	//overwritten JTable method	
+	public TableCellEditor getCellEditor(int row,int col) {
+		TableCellEditor tce = (TableCellEditor) cellEditors.get(new Integer(row));
+		if( tce != null) {
+			return tce;
+		} else {
+			return super.getCellEditor(row,col);
+		}
+	}
+}
+
+class SliderEditor extends AbstractCellEditor implements TableCellEditor
+{
+    JPanel editor;
+    JTextField text;
+    JSlider slider;
+    public SliderEditor(int min, int max, int value){
+         editor = new JPanel(new BorderLayout());
+         //editor.setBorder(new EmptyBorder(1,0,1,0));
+         text = new JTextField(Integer.toString(max).length());
+         slider = new JSlider(SwingConstants.HORIZONTAL,min,max,value);
+         editor.add(text,BorderLayout.WEST);
+         editor.add(slider);
+         slider.addChangeListener(new ChangeListener(){
+            public void stateChanged(ChangeEvent e) {
+                //if (! replSlider.getValueIsAdjusting()){
+                text.setText(new Integer(slider.getValue()).toString());
+                //}
+            }
+         });
+
+    }
+    
+    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+        text.setText((String) value);
+        try {
+            slider.setValue(Integer.parseInt((String)value));
+        } catch (NumberFormatException ignored) {}
+        return editor;
+    }
+
+    public Object getCellEditorValue() {
+        return text.getText();
+    }
+}
+
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/LogPanel.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/LogPanel.java
index 5fe322d..c9def89 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/LogPanel.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/LogPanel.java
@@ -1,74 +1,74 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.gui;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollBar;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class LogPanel extends JPanel {
-    private static JTextArea logArea = new JTextArea(4,50);
-    private static JPanel statusBar = new JPanel(new BorderLayout());
-    private static JLabel statusText = new JLabel();
-    
-    private static JScrollPane scroll = new JScrollPane(logArea);
-    
-    public LogPanel() {
-        super(new BorderLayout());
-        logArea.setText("");
-        //add(new JScrollPane(new JTextArea(4,80)));
-        add(scroll);
-        statusBar.add(statusText,BorderLayout.EAST);
-        add(statusBar,BorderLayout.SOUTH);
-        }
-
-    /* public static void log(String msg) {
-        logArea.append(msg + "\n\r");
-		JScrollBar scrBar = scroll.getVerticalScrollBar();
-		int maxPos = scrBar.getMaximum();
-		scrBar.setValue(maxPos);
-   }*/
-    
-    public static void log(final String msg){ 
-        synchronized (logArea) {
-            logArea.append(msg );
-            logArea.append("\n\r");
-        }
-        JScrollBar scrBar = scroll.getVerticalScrollBar();
-        int maxPos = scrBar.getMaximum();
-        scrBar.setValue(maxPos);
-    }
-    
-    public static void status(final String msg){ 
-        statusText.setText(msg);
-     }
-
-   public static void clear(String msg) {
-        logArea.setText("");
-   }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.gui;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class LogPanel extends JPanel {
+    private static JTextArea logArea = new JTextArea(4,50);
+    private static JPanel statusBar = new JPanel(new BorderLayout());
+    private static JLabel statusText = new JLabel();
+    
+    private static JScrollPane scroll = new JScrollPane(logArea);
+    
+    public LogPanel() {
+        super(new BorderLayout());
+        logArea.setText("");
+        //add(new JScrollPane(new JTextArea(4,80)));
+        add(scroll);
+        statusBar.add(statusText,BorderLayout.EAST);
+        add(statusBar,BorderLayout.SOUTH);
+        }
+
+    /* public static void log(String msg) {
+        logArea.append(msg + "\n\r");
+		JScrollBar scrBar = scroll.getVerticalScrollBar();
+		int maxPos = scrBar.getMaximum();
+		scrBar.setValue(maxPos);
+   }*/
+    
+    public static void log(final String msg){ 
+        synchronized (logArea) {
+            logArea.append(msg );
+            logArea.append("\n\r");
+        }
+        JScrollBar scrBar = scroll.getVerticalScrollBar();
+        int maxPos = scrBar.getMaximum();
+        scrBar.setValue(maxPos);
+    }
+    
+    public static void status(final String msg){ 
+        statusText.setText(msg);
+     }
+
+   public static void clear(String msg) {
+        logArea.setText("");
+   }
+
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/PropertiesViewer.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/PropertiesViewer.java
index fa9ea4f..ae08dff 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/PropertiesViewer.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/PropertiesViewer.java
@@ -1,223 +1,223 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.gui;
-
-
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.GridBagLayout;
-import java.awt.Point;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseMotionListener;
-
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTree;
-import javax.swing.event.TableModelEvent;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.DefaultTableCellRenderer;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPDevice;
-
-import org.apache.felix.upnp.tester.Mediator;
-import org.apache.felix.upnp.tester.discovery.DeviceNode;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class PropertiesViewer extends JPanel {
-
-    ActionPanel actionsPanel;
-	SubscriptionPanel subscriptionPanel;
-	DataModel dataModel;
-	JTable table;
-	
-	public PropertiesViewer(){
-		super(new GridBagLayout());
-		buildTable();
-		actionsPanel = new ActionPanel();
-		subscriptionPanel = new SubscriptionPanel();
-		
-		JScrollPane scroll = new JScrollPane(table);
-		scroll.setPreferredSize(new Dimension(500,200));
-		//actionsPanel.setPreferredSize(new Dimension(500,100)); twa
-		actionsPanel.setPreferredSize(new Dimension(500,200));
-		add(scroll,Util.setConstrains(0,0,6,2,100,50));
-		add(actionsPanel,Util.setConstrains(0,2,6,1,100,20));
-		add(subscriptionPanel,Util.setConstrains(0,3,6,1,100,5));
-		showActionPanel(false);
-		showSubscriptionPanel(false);
-         
-        table.addMouseMotionListener(new MouseMotionListener(){
-           private final Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
-           
-           public void mouseDragged(MouseEvent e) {}
-           public void mouseMoved(MouseEvent e) {
-                String link = getDataLink(e.getPoint());
-                if (link != null)
-                    table.setCursor(handCursor);                       
-                else
-                    table.setCursor(Cursor.getDefaultCursor());
-           }
-
-        });
-        
-        table.addMouseListener(new MouseAdapter(){
-            public void mouseClicked(MouseEvent e){
-                String link = getDataLink(e.getPoint());
-                if (link != null)
-                    Util.openUrl(link);              
-            }
-        });
-
-    }   
-        
-    public String getDataLink(Point p) {
-        int col = table.columnAtPoint(p);
-        if (col != 1) 
-            return null;
-        else {
-            int row = table.rowAtPoint(p);
-            String data = (String) dataModel.getValueAt(row,col);
-            if (data == null) return null;
-            if (data.length()<4) return null;
-            String begin = data.substring(0,4);
-            if (begin.equalsIgnoreCase("http"))
-                return data;
-            else {
-                String propertyName= (String) dataModel.getValueAt(row,0);
-                if (propertyName.equalsIgnoreCase(UPnPDevice.PRESENTATION_URL)
-                    ||propertyName.equalsIgnoreCase(UPnPDevice.MANUFACTURER_URL)
-                    ||propertyName.equalsIgnoreCase(UPnPDevice.MODEL_URL) )
-                    {
-                    JTree tree = Mediator.getUPnPDeviceTree();
-                    UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();   
-                    String url = "";
-                    if (selectedNode.category.equals(UPnPDeviceTreeNode.DEVICE)){
-                        UPnPDeviceTreeNode parent =  (UPnPDeviceTreeNode)selectedNode.getParent();
-                        while (parent.category!=UPnPDeviceTreeNode.ROOT_DEVICE)
-                             parent =  (UPnPDeviceTreeNode)parent.getParent();
-                        DeviceNode device =  (DeviceNode) parent.getUserObject();
-                        String udn = (String)device.getReference().getProperty(UPnPDevice.UDN);
-                        url = Mediator.getDriverProxy().resolveRelativeUrl(udn,data);
-                        return url;
-                    }                           
-                    else if (selectedNode.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE))
-                    {
-                        DeviceNode node =  (DeviceNode) selectedNode.getUserObject();
-                        String udn = (String)node.getReference().getProperty(UPnPDevice.UDN);
-                        url = Mediator.getDriverProxy().resolveRelativeUrl(udn,data);
-                        return url;
-                    }
-                }
-                return null;     
-            }
-        }
-	}
-	
-	public void setProperties(String[]name,String[]values){
-		dataModel.setData(name,values);
-	}
-	
-	public void setAction(UPnPAction action){
-		actionsPanel.setArguments(action);
-		
-	}
-	
-	public void showActionPanel(boolean show){
-		actionsPanel.setVisible(show);
-	}
-	
-	public void showSubscriptionPanel(boolean show){
-	    subscriptionPanel.setVisible(show);
-	}
-	
-	private void buildTable(){
-		dataModel = new DataModel();
-	    table = new JTable(dataModel);
-        table.setDefaultRenderer(table.getColumnClass(1), new LinkCellRenderer());
-	}
-
-
-}
-
-class DataModel extends  AbstractTableModel {
-	int size = 0;
-	String[] names = new String[]{""};
-	String[] values = new String[]{""};
-    String[] header = new String[]{"property key","value"};
-    
-    public String getColumnName(int col) { return header[col]; }
-	public int getColumnCount() { return 2; }
-    public int getRowCount() { return size;}
-    public Object getValueAt(int row, int col) { 
-    	if (col==0) return names[row];
-    	else return values[row];
-    }
-    
-    /*
-    public boolean isCellEditable(int rowIndex, int columnIndex) {
-        return false;
-    }
-    */
-    
-    public void setData(String[]names,String[]values){
-    	this.names=names;
-    	this.values=values;
-    	size = names.length;
-		this.fireTableChanged(new TableModelEvent(this));
-    }
-    
-}
-
-class LinkCellRenderer extends DefaultTableCellRenderer
-{
-    public LinkCellRenderer(){
-        super();
-    }
-    
-    public Component getTableCellRendererComponent(JTable table, Object value,
-            boolean isSelected, boolean hasFocus, int row, int column) {
-        super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
-        if (column==1){
-            String propertyName = (String)table.getModel().getValueAt(row,0);
-            if (propertyName.equalsIgnoreCase(UPnPDevice.PRESENTATION_URL)
-                ||propertyName.equalsIgnoreCase(UPnPDevice.MODEL_URL)
-                ||propertyName.equalsIgnoreCase(UPnPDevice.MANUFACTURER_URL))
-            {
-                if (!value.equals(""))
-                    setValue("<html><a href=''>"+value+"</a></html>");
-                return this;
-            }
-            if (((String) value).length()<4) return this;
-            String begin = ((String) value).substring(0,4);
-            if (begin.equalsIgnoreCase("http"))
-                setValue("<html><a href=''>"+value+"</a></html>");
-        }
-        return this;
-    }
- 
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.gui;
+
+
+
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.GridBagLayout;
+import java.awt.Point;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionListener;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTree;
+import javax.swing.event.TableModelEvent;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPDevice;
+
+import org.apache.felix.upnp.tester.Mediator;
+import org.apache.felix.upnp.tester.discovery.DeviceNode;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class PropertiesViewer extends JPanel {
+
+    ActionPanel actionsPanel;
+	SubscriptionPanel subscriptionPanel;
+	DataModel dataModel;
+	JTable table;
+	
+	public PropertiesViewer(){
+		super(new GridBagLayout());
+		buildTable();
+		actionsPanel = new ActionPanel();
+		subscriptionPanel = new SubscriptionPanel();
+		
+		JScrollPane scroll = new JScrollPane(table);
+		scroll.setPreferredSize(new Dimension(500,200));
+		//actionsPanel.setPreferredSize(new Dimension(500,100)); twa
+		actionsPanel.setPreferredSize(new Dimension(500,200));
+		add(scroll,Util.setConstrains(0,0,6,2,100,50));
+		add(actionsPanel,Util.setConstrains(0,2,6,1,100,20));
+		add(subscriptionPanel,Util.setConstrains(0,3,6,1,100,5));
+		showActionPanel(false);
+		showSubscriptionPanel(false);
+         
+        table.addMouseMotionListener(new MouseMotionListener(){
+           private final Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
+           
+           public void mouseDragged(MouseEvent e) {}
+           public void mouseMoved(MouseEvent e) {
+                String link = getDataLink(e.getPoint());
+                if (link != null)
+                    table.setCursor(handCursor);                       
+                else
+                    table.setCursor(Cursor.getDefaultCursor());
+           }
+
+        });
+        
+        table.addMouseListener(new MouseAdapter(){
+            public void mouseClicked(MouseEvent e){
+                String link = getDataLink(e.getPoint());
+                if (link != null)
+                    Util.openUrl(link);              
+            }
+        });
+
+    }   
+        
+    public String getDataLink(Point p) {
+        int col = table.columnAtPoint(p);
+        if (col != 1) 
+            return null;
+        else {
+            int row = table.rowAtPoint(p);
+            String data = (String) dataModel.getValueAt(row,col);
+            if (data == null) return null;
+            if (data.length()<4) return null;
+            String begin = data.substring(0,4);
+            if (begin.equalsIgnoreCase("http"))
+                return data;
+            else {
+                String propertyName= (String) dataModel.getValueAt(row,0);
+                if (propertyName.equalsIgnoreCase(UPnPDevice.PRESENTATION_URL)
+                    ||propertyName.equalsIgnoreCase(UPnPDevice.MANUFACTURER_URL)
+                    ||propertyName.equalsIgnoreCase(UPnPDevice.MODEL_URL) )
+                    {
+                    JTree tree = Mediator.getUPnPDeviceTree();
+                    UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();   
+                    String url = "";
+                    if (selectedNode.category.equals(UPnPDeviceTreeNode.DEVICE)){
+                        UPnPDeviceTreeNode parent =  (UPnPDeviceTreeNode)selectedNode.getParent();
+                        while (parent.category!=UPnPDeviceTreeNode.ROOT_DEVICE)
+                             parent =  (UPnPDeviceTreeNode)parent.getParent();
+                        DeviceNode device =  (DeviceNode) parent.getUserObject();
+                        String udn = (String)device.getReference().getProperty(UPnPDevice.UDN);
+                        url = Mediator.getDriverProxy().resolveRelativeUrl(udn,data);
+                        return url;
+                    }                           
+                    else if (selectedNode.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE))
+                    {
+                        DeviceNode node =  (DeviceNode) selectedNode.getUserObject();
+                        String udn = (String)node.getReference().getProperty(UPnPDevice.UDN);
+                        url = Mediator.getDriverProxy().resolveRelativeUrl(udn,data);
+                        return url;
+                    }
+                }
+                return null;     
+            }
+        }
+	}
+	
+	public void setProperties(String[]name,String[]values){
+		dataModel.setData(name,values);
+	}
+	
+	public void setAction(UPnPAction action){
+		actionsPanel.setArguments(action);
+		
+	}
+	
+	public void showActionPanel(boolean show){
+		actionsPanel.setVisible(show);
+	}
+	
+	public void showSubscriptionPanel(boolean show){
+	    subscriptionPanel.setVisible(show);
+	}
+	
+	private void buildTable(){
+		dataModel = new DataModel();
+	    table = new JTable(dataModel);
+        table.setDefaultRenderer(table.getColumnClass(1), new LinkCellRenderer());
+	}
+
+
+}
+
+class DataModel extends  AbstractTableModel {
+	int size = 0;
+	String[] names = new String[]{""};
+	String[] values = new String[]{""};
+    String[] header = new String[]{"property key","value"};
+    
+    public String getColumnName(int col) { return header[col]; }
+	public int getColumnCount() { return 2; }
+    public int getRowCount() { return size;}
+    public Object getValueAt(int row, int col) { 
+    	if (col==0) return names[row];
+    	else return values[row];
+    }
+    
+    /*
+    public boolean isCellEditable(int rowIndex, int columnIndex) {
+        return false;
+    }
+    */
+    
+    public void setData(String[]names,String[]values){
+    	this.names=names;
+    	this.values=values;
+    	size = names.length;
+		this.fireTableChanged(new TableModelEvent(this));
+    }
+    
+}
+
+class LinkCellRenderer extends DefaultTableCellRenderer
+{
+    public LinkCellRenderer(){
+        super();
+    }
+    
+    public Component getTableCellRendererComponent(JTable table, Object value,
+            boolean isSelected, boolean hasFocus, int row, int column) {
+        super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
+        if (column==1){
+            String propertyName = (String)table.getModel().getValueAt(row,0);
+            if (propertyName.equalsIgnoreCase(UPnPDevice.PRESENTATION_URL)
+                ||propertyName.equalsIgnoreCase(UPnPDevice.MODEL_URL)
+                ||propertyName.equalsIgnoreCase(UPnPDevice.MANUFACTURER_URL))
+            {
+                if (!value.equals(""))
+                    setValue("<html><a href=''>"+value+"</a></html>");
+                return this;
+            }
+            if (((String) value).length()<4) return this;
+            String begin = ((String) value).substring(0,4);
+            if (begin.equalsIgnoreCase("http"))
+                setValue("<html><a href=''>"+value+"</a></html>");
+        }
+        return this;
+    }
+ 
+}
+
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/SubscriptionPanel.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/SubscriptionPanel.java
index 410b7c4..847a400 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/SubscriptionPanel.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/SubscriptionPanel.java
@@ -1,155 +1,155 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.gui;
-
-
-
-import java.awt.event.ActionEvent;
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JTree;
-import javax.swing.SwingUtilities;
-
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPService;
-
-import org.apache.felix.upnp.tester.Activator;
-import org.apache.felix.upnp.tester.Mediator;
-import org.apache.felix.upnp.tester.UPnPSubscriber;
-import org.apache.felix.upnp.tester.discovery.DeviceNode;
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class SubscriptionPanel extends JPanel implements UPnPEventListener{
-	public SubscriptionPanel() {
-		super();
-		buildButtonPanel();
-	}
-
-	private void buildButtonPanel(){
-		JButton subscribeBtn = new JButton("Subscribe");
-		subscribeBtn.addActionListener(new AbstractAction(){
-			public void actionPerformed(ActionEvent e) {
-			    //System.out.println("subscribing ...");
-			    doSubscribe();
-			}
-		});		
-		JButton unsubscribeBtn = new JButton("Unsubscribe");
-		unsubscribeBtn.addActionListener(new AbstractAction(){
-			public void actionPerformed(ActionEvent e) {
-			    //System.out.println("unsubscribing ...");
-			    doUnsubscribe();
-				}
-		});		
-	    add(subscribeBtn);
-	    add(unsubscribeBtn);
-	}
-	
-	UPnPSubscriber subscriber;
-	public void doSubscribe()
-	{
-		if (subscriber == null)
-		    subscriber = new UPnPSubscriber(Activator.context,this);
-		
-		UPnPDeviceTreeNode selectedNode = getSelectedNode();
-		String serviceId = getServiceId(selectedNode);
-		String parentId = getDeviceId(selectedNode);
-		LogPanel.log("subscribing ... "+ "ServiceId ["+serviceId+"] of DeviceId ["+parentId +"]");
-		subscriber.subscribe(parentId,serviceId);
-		setSubscribedVariableOf(selectedNode);
-	}
-	
-	public void doUnsubscribe(){
-		UPnPDeviceTreeNode selectedNode = getSelectedNode();
-		String serviceId = getServiceId(selectedNode);
-		String parentId = getDeviceId(selectedNode);
-		LogPanel.log("unsubscribing ... "+ "ServiceId ["+serviceId+"] of DeviceId ["+parentId +"]");
-		subscriber.unsubscribe(parentId,serviceId);
-		setUnubscribedVariableOf(selectedNode);
-		}
-	
-	public void notifyUPnPEvent(final String deviceId, final String serviceId, final Dictionary events) {
-        // UPnP base driver notify are synchronous !!
-		Runnable doShowMsg = new Runnable() {
-       	 public void run() {
-			LogPanel.log("notifyUPnPEvent::[DeviceID "+deviceId+"][ServiceId "+serviceId+"]");
-			Enumeration elements = events.keys();
-			while (elements.hasMoreElements()){
-			    Object key = elements.nextElement();
-			    Object value = events.get(key);
-			    LogPanel.log("["+key+"][value "+value+"]");
-			}
-       	 }
-        };
-        SwingUtilities.invokeLater(doShowMsg);
-		
-	}
-	
-	private void setSubscribedVariableOf(UPnPDeviceTreeNode selectedNode){
-	    Enumeration list = selectedNode.children();
-	    while (list.hasMoreElements()){
-	        UPnPDeviceTreeNode node =  (UPnPDeviceTreeNode) list.nextElement();
-	        if (node.category == UPnPDeviceTreeNode.EVENTED_STATE)
-	            node.category = UPnPDeviceTreeNode.SUBSCRIBED_STATE;
-	    }
-	    JTree tree = Mediator.getUPnPDeviceTree();
-	    tree.validate();
-	    tree.repaint();
-	}
-	
-	private void setUnubscribedVariableOf(UPnPDeviceTreeNode selectedNode){
-	    Enumeration list = selectedNode.children();
-	    while (list.hasMoreElements()){
-	        UPnPDeviceTreeNode node =  (UPnPDeviceTreeNode) list.nextElement();
-	        if (node.category == UPnPDeviceTreeNode.SUBSCRIBED_STATE)
-	            node.category = UPnPDeviceTreeNode.EVENTED_STATE;
-	    }
-	    JTree tree = Mediator.getUPnPDeviceTree();
-	    tree.validate();
-	    tree.repaint();
-	}
-	
-	private  UPnPDeviceTreeNode getSelectedNode(){
-		JTree tree = Mediator.getUPnPDeviceTree();
-		UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();
-	    return selectedNode;
-	}
-	private  String getServiceId (UPnPDeviceTreeNode selectedNode){
-		Object userObj = selectedNode.getUserObject();
-	    String serviceId = ((UPnPService) userObj).getId();
-	    return serviceId;
-	}
-	private String getDeviceId (UPnPDeviceTreeNode selectedNode){
-	     UPnPDeviceTreeNode parent = (UPnPDeviceTreeNode)selectedNode.getParent();
-	     DeviceNode node =(DeviceNode)parent.getUserObject();
-	     String parentId = (String) node.getReference().getProperty(UPnPDevice.ID);
-	    return parentId;
-	}
-	
-	
-	
-}
-
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.gui;
+
+
+
+import java.awt.event.ActionEvent;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPService;
+
+import org.apache.felix.upnp.tester.Activator;
+import org.apache.felix.upnp.tester.Mediator;
+import org.apache.felix.upnp.tester.UPnPSubscriber;
+import org.apache.felix.upnp.tester.discovery.DeviceNode;
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class SubscriptionPanel extends JPanel implements UPnPEventListener{
+	public SubscriptionPanel() {
+		super();
+		buildButtonPanel();
+	}
+
+	private void buildButtonPanel(){
+		JButton subscribeBtn = new JButton("Subscribe");
+		subscribeBtn.addActionListener(new AbstractAction(){
+			public void actionPerformed(ActionEvent e) {
+			    //System.out.println("subscribing ...");
+			    doSubscribe();
+			}
+		});		
+		JButton unsubscribeBtn = new JButton("Unsubscribe");
+		unsubscribeBtn.addActionListener(new AbstractAction(){
+			public void actionPerformed(ActionEvent e) {
+			    //System.out.println("unsubscribing ...");
+			    doUnsubscribe();
+				}
+		});		
+	    add(subscribeBtn);
+	    add(unsubscribeBtn);
+	}
+	
+	UPnPSubscriber subscriber;
+	public void doSubscribe()
+	{
+		if (subscriber == null)
+		    subscriber = new UPnPSubscriber(Activator.context,this);
+		
+		UPnPDeviceTreeNode selectedNode = getSelectedNode();
+		String serviceId = getServiceId(selectedNode);
+		String parentId = getDeviceId(selectedNode);
+		LogPanel.log("subscribing ... "+ "ServiceId ["+serviceId+"] of DeviceId ["+parentId +"]");
+		subscriber.subscribe(parentId,serviceId);
+		setSubscribedVariableOf(selectedNode);
+	}
+	
+	public void doUnsubscribe(){
+		UPnPDeviceTreeNode selectedNode = getSelectedNode();
+		String serviceId = getServiceId(selectedNode);
+		String parentId = getDeviceId(selectedNode);
+		LogPanel.log("unsubscribing ... "+ "ServiceId ["+serviceId+"] of DeviceId ["+parentId +"]");
+		subscriber.unsubscribe(parentId,serviceId);
+		setUnubscribedVariableOf(selectedNode);
+		}
+	
+	public void notifyUPnPEvent(final String deviceId, final String serviceId, final Dictionary events) {
+        // UPnP base driver notify are synchronous !!
+		Runnable doShowMsg = new Runnable() {
+       	 public void run() {
+			LogPanel.log("notifyUPnPEvent::[DeviceID "+deviceId+"][ServiceId "+serviceId+"]");
+			Enumeration elements = events.keys();
+			while (elements.hasMoreElements()){
+			    Object key = elements.nextElement();
+			    Object value = events.get(key);
+			    LogPanel.log("["+key+"][value "+value+"]");
+			}
+       	 }
+        };
+        SwingUtilities.invokeLater(doShowMsg);
+		
+	}
+	
+	private void setSubscribedVariableOf(UPnPDeviceTreeNode selectedNode){
+	    Enumeration list = selectedNode.children();
+	    while (list.hasMoreElements()){
+	        UPnPDeviceTreeNode node =  (UPnPDeviceTreeNode) list.nextElement();
+	        if (node.category == UPnPDeviceTreeNode.EVENTED_STATE)
+	            node.category = UPnPDeviceTreeNode.SUBSCRIBED_STATE;
+	    }
+	    JTree tree = Mediator.getUPnPDeviceTree();
+	    tree.validate();
+	    tree.repaint();
+	}
+	
+	private void setUnubscribedVariableOf(UPnPDeviceTreeNode selectedNode){
+	    Enumeration list = selectedNode.children();
+	    while (list.hasMoreElements()){
+	        UPnPDeviceTreeNode node =  (UPnPDeviceTreeNode) list.nextElement();
+	        if (node.category == UPnPDeviceTreeNode.SUBSCRIBED_STATE)
+	            node.category = UPnPDeviceTreeNode.EVENTED_STATE;
+	    }
+	    JTree tree = Mediator.getUPnPDeviceTree();
+	    tree.validate();
+	    tree.repaint();
+	}
+	
+	private  UPnPDeviceTreeNode getSelectedNode(){
+		JTree tree = Mediator.getUPnPDeviceTree();
+		UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();
+	    return selectedNode;
+	}
+	private  String getServiceId (UPnPDeviceTreeNode selectedNode){
+		Object userObj = selectedNode.getUserObject();
+	    String serviceId = ((UPnPService) userObj).getId();
+	    return serviceId;
+	}
+	private String getDeviceId (UPnPDeviceTreeNode selectedNode){
+	     UPnPDeviceTreeNode parent = (UPnPDeviceTreeNode)selectedNode.getParent();
+	     DeviceNode node =(DeviceNode)parent.getUserObject();
+	     String parentId = (String) node.getReference().getProperty(UPnPDevice.ID);
+	    return parentId;
+	}
+	
+	
+	
+}
+
+
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/TreeViewer.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/TreeViewer.java
index ced75d4..ed81b6b 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/TreeViewer.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/TreeViewer.java
@@ -1,322 +1,322 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.gui;
-
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import javax.swing.AbstractAction;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.SwingUtilities;
-import javax.swing.ToolTipManager;
-import javax.swing.event.PopupMenuEvent;
-import javax.swing.event.PopupMenuListener;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.tester.Activator;
-import org.apache.felix.upnp.tester.Mediator;
-import org.apache.felix.upnp.tester.discovery.DeviceNode;
-import org.apache.felix.upnp.tester.discovery.DeviceNodeListener;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class TreeViewer extends JPanel 	implements DeviceNodeListener 
-{
-	
-	private UPnPDeviceTreeNode root;
-	private DefaultTreeModel treeModel;
-	private JTree tree;
-    final TreePopup popup ;
-	public TreeViewer(){
-		super(new BorderLayout());
-		Mediator.setTreeViewer(this);
-		root = new UPnPDeviceTreeNode("UPnP Devices");
-		treeModel= new DefaultTreeModel(root);
-		tree = new JTree(treeModel);
-		Mediator.setUPnPDeviceTree(tree);
-		tree.setCellRenderer(new TreeNodeCellRenderer() );
-		tree.putClientProperty("JTree.lineStyle", "Angled");
-        add(new JScrollPane(tree));
-		addTreeSelectionListener();
-        
-        
-        popup = new TreePopup(tree);
-        popup.setEnabled(false);
-        tree.addMouseListener(new MouseAdapter(){
-            public void mouseClicked(MouseEvent e){
-                if (SwingUtilities.isRightMouseButton(e)){
-                    TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY());
-                    tree.setSelectionPath(path);
-                    tree.scrollPathToVisible(path);
-                    popup.show(tree, e.getX(), e.getY());
-                }
-            }
-        });
-        ToolTipManager.sharedInstance().registerComponent(tree);
-         
-
-	}
-	
-    public void setPopupMenuEnabled(boolean driverControllerAvailable){
-        popup.getComponent(0).setEnabled(driverControllerAvailable);
-    }
-	public void deviceDetected(DeviceNode node) {
-		root.add(new UPnPDeviceTreeNode(node,Activator.context));
-		treeModel.nodeStructureChanged(root);
-	}
-	
-	public void rootDeviceUnplugged(String udn){
-		Enumeration list = root.children();
-		while (list.hasMoreElements()){
-			UPnPDeviceTreeNode node= (UPnPDeviceTreeNode)list.nextElement();
-			DeviceNode device = (DeviceNode)node.getUserObject();
-			if (udn.equals(device.toString())) {
-				node.removeFromParent();
-				treeModel.nodeStructureChanged(root);
-			}
-		}
-	}
-
-	private void addTreeSelectionListener(){
-		tree.addTreeSelectionListener(new TreeSelectionListener(){
-			public void valueChanged(TreeSelectionEvent e){
-				UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();				
-				doNodeAction(selectedNode);			
-			}		
-		});
-	}
-	
-	private void doNodeAction(UPnPDeviceTreeNode node){
-		if (node == null) {
-			clearPropertiesViewer();
-			return;
-		}
-		if (node.category.equals(UPnPDeviceTreeNode.ACTION))
-			Mediator.getPropertiesViewer().showActionPanel(true);
-		else
-			Mediator.getPropertiesViewer().showActionPanel(false);
-
-		if (node.category.equals(UPnPDeviceTreeNode.SERVICE))
-			Mediator.getPropertiesViewer().showSubscriptionPanel(true);
-		else
-			Mediator.getPropertiesViewer().showSubscriptionPanel(false);
-
-		if ( node.category.equals(UPnPDeviceTreeNode.DEVICE)
-			||node.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE)){
-			DeviceNode device = (DeviceNode) node.getUserObject();
-			UPnPDevice upnpDevice = device.getDevice(Activator.context);
-			makeProperties(upnpDevice);
-		} 
-		else if (node.category.equals(UPnPDeviceTreeNode.SERVICE)){
-			UPnPService service = (UPnPService) node.getUserObject();			
-			makeProperties(service);
-		}
-		else if (node.category.equals(UPnPDeviceTreeNode.ACTION)){
-			UPnPAction action = (UPnPAction) node.getUserObject();
-			makeProperties(action);
-			Mediator.getPropertiesViewer().setAction(action);
-		}
-		else if (node.category.equals(UPnPDeviceTreeNode.STATE)
-		        ||node.category.equals(UPnPDeviceTreeNode.EVENTED_STATE)
-		        ||node.category.equals(UPnPDeviceTreeNode.SUBSCRIBED_STATE)){
-			UPnPStateVariable state = (UPnPStateVariable) node.getUserObject();
-			makeProperties(state);
-		}
-		
-	}
-	
-	private void clearPropertiesViewer(){
-		String[] names = new String[]{};
-		String[] values = new String[]{};
-		PropertiesViewer viewer = Mediator.getPropertiesViewer();
-		viewer.setProperties(names,values);
-		viewer.showActionPanel(false);
-		viewer.showSubscriptionPanel(false);
-	}
-	
-	private void makeProperties(UPnPDevice upnpDevice){
-		Dictionary dict = upnpDevice.getDescriptions(null);
-		int size = dict.size();
-		String[] names = new String[size];
-		String[] values = new String[size];
-		Enumeration keys = dict.keys();
-		for (int i=0;i<size;i++){
-			names[i]= (String) keys.nextElement();
-			values[i]= Util.justString(dict.get(names[i]));
-		}
-		Mediator.getPropertiesViewer().setProperties(names,values);
-	}
-	
-	private void makeProperties(UPnPService service){
-		String[] names = new String[]{"Id","Type","Version"};
-		String[] values = new String[]{service.getId(),service.getType(),service.getType()};
-		Mediator.getPropertiesViewer().setProperties(names,values);
-	}
-	
-	private void makeProperties(UPnPAction action){
-		ArrayList names = new ArrayList();
-		ArrayList values = new ArrayList();
-		names.add("Name");
-		values.add(action.getName());
-		
-		String returnName = action.getReturnArgumentName();
-		if (returnName != null){
-			names.add("Return value name");
-			values.add(returnName);
-		}
-		String[] inArg = action.getInputArgumentNames();
-		if (inArg != null){
-			for (int i = 0; i<inArg.length;i++){
-				names.add("Input arg["+ (i+1)+"]");
-				values.add(inArg[i]);			
-			}
-		}
-		String[] outArg = action.getOutputArgumentNames();
-		if (outArg != null){
-			for (int i = 0; i<outArg.length;i++){
-				names.add("Output arg["+ (i+1)+"]");
-				values.add(outArg[i]);			
-			}
-		}
-		
-		Mediator.getPropertiesViewer().setProperties(
-				(String[])names.toArray(new String[]{}),
-				(String[])values.toArray(new String[]{})
-		);
-		
-	}
-	
-	private void makeProperties(UPnPStateVariable state){
-		ArrayList names = new ArrayList();
-		ArrayList values = new ArrayList();
-		names.add("Name");
-		values.add(state.getName());
-		names.add("Evented");
-		values.add(state.sendsEvents()? "yes":"no");
-		names.add("Default Value");
-		values.add(Util.justString(state.getDefaultValue()));
-		names.add("Java Data Type");
-		values.add(state.getJavaDataType().getName());
-		names.add("Java UPnP Type");
-		values.add(state.getUPnPDataType());
-		names.add("Minimum");
-		values.add(Util.justString(state.getMinimum()));
-		names.add("Maximum");
-		values.add(Util.justString(state.getMaximum()));
-		names.add("Step");
-		values.add(Util.justString(state.getStep()));		
-		String[] allowed = state.getAllowedValues();
-		if (allowed!=null){
-			for (int i=0;i<allowed.length;i++){
-				names.add("Allowed value["+i+1+"]");
-				values.add(allowed[i]);		
-			}			
-		}
-		Mediator.getPropertiesViewer().setProperties(
-				(String[])names.toArray(new String[]{}),
-				(String[])values.toArray(new String[]{})
-		);
-	}
-	
-	
-}
-
-class TreePopup extends JPopupMenu implements PopupMenuListener {
-    JTree tree;
-    JMenuItem item;
-
-    public TreePopup(final JTree tree){
-        super();
-        this.tree = tree;
-        (item = add(new AbstractAction(){
-            public void actionPerformed(ActionEvent e){
-                UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();   
-                String url = "";
-                if (selectedNode.category.equals(UPnPDeviceTreeNode.DEVICE)){
-                    UPnPDeviceTreeNode parent =  (UPnPDeviceTreeNode)selectedNode.getParent();
-                    while (parent.category!=UPnPDeviceTreeNode.ROOT_DEVICE)
-                         parent =  (UPnPDeviceTreeNode)parent.getParent();
-                    DeviceNode device =  (DeviceNode) parent.getUserObject();
-                    String udn = (String)device.getReference().getProperty(UPnPDevice.UDN);
-                    url = Mediator.getDriverProxy().getDeviceDescriptionURI(udn);
-                }
-                        
-                else if (selectedNode.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE))
-                {
-                    DeviceNode node =  (DeviceNode) selectedNode.getUserObject();
-                    String udn = (String)node.getReference().getProperty(UPnPDevice.UDN);
-                    url = Mediator.getDriverProxy().getDeviceDescriptionURI(udn);
-                }
-                else if (selectedNode.category.equals(UPnPDeviceTreeNode.SERVICE))
-                {
-                    UPnPDeviceTreeNode parent =  (UPnPDeviceTreeNode)selectedNode.getParent();
-                    while (parent.category!=UPnPDeviceTreeNode.ROOT_DEVICE)
-                         parent =  (UPnPDeviceTreeNode)parent.getParent();
-                    DeviceNode device =  (DeviceNode) parent.getUserObject();
-                    String udn = (String)device.getReference().getProperty(UPnPDevice.UDN);
-                    UPnPService service =  (UPnPService) selectedNode.getUserObject();
-                    url = Mediator.getDriverProxy().getServiceDescriptionURI(udn,service.getId());
-                }                    
-                Util.openUrl(url);   
-            }
-        })).setText("Show Description");
-        addPopupMenuListener(this);
-
-    }
-    
-    public void popupMenuCanceled(PopupMenuEvent e){}
-    public void popupMenuWillBecomeInvisible(PopupMenuEvent e){}
-    public void popupMenuWillBecomeVisible(PopupMenuEvent e){
-        if (Mediator.getDriverProxy().isDriverAvailable()){
-        UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();              
-            if (selectedNode.category.equals(UPnPDeviceTreeNode.DEVICE)
-                ||selectedNode.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE)
-                ||selectedNode.category.equals(UPnPDeviceTreeNode.SERVICE))
-            {
-                item.setEnabled(true);
-            } 
-            else
-                item.setEnabled(false);
-        }
-        else
-            item.setEnabled(false);
-           
-    }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.gui;
+
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import javax.swing.AbstractAction;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.tester.Activator;
+import org.apache.felix.upnp.tester.Mediator;
+import org.apache.felix.upnp.tester.discovery.DeviceNode;
+import org.apache.felix.upnp.tester.discovery.DeviceNodeListener;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class TreeViewer extends JPanel 	implements DeviceNodeListener 
+{
+	
+	private UPnPDeviceTreeNode root;
+	private DefaultTreeModel treeModel;
+	private JTree tree;
+    final TreePopup popup ;
+	public TreeViewer(){
+		super(new BorderLayout());
+		Mediator.setTreeViewer(this);
+		root = new UPnPDeviceTreeNode("UPnP Devices");
+		treeModel= new DefaultTreeModel(root);
+		tree = new JTree(treeModel);
+		Mediator.setUPnPDeviceTree(tree);
+		tree.setCellRenderer(new TreeNodeCellRenderer() );
+		tree.putClientProperty("JTree.lineStyle", "Angled");
+        add(new JScrollPane(tree));
+		addTreeSelectionListener();
+        
+        
+        popup = new TreePopup(tree);
+        popup.setEnabled(false);
+        tree.addMouseListener(new MouseAdapter(){
+            public void mouseClicked(MouseEvent e){
+                if (SwingUtilities.isRightMouseButton(e)){
+                    TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY());
+                    tree.setSelectionPath(path);
+                    tree.scrollPathToVisible(path);
+                    popup.show(tree, e.getX(), e.getY());
+                }
+            }
+        });
+        ToolTipManager.sharedInstance().registerComponent(tree);
+         
+
+	}
+	
+    public void setPopupMenuEnabled(boolean driverControllerAvailable){
+        popup.getComponent(0).setEnabled(driverControllerAvailable);
+    }
+	public void deviceDetected(DeviceNode node) {
+		root.add(new UPnPDeviceTreeNode(node,Activator.context));
+		treeModel.nodeStructureChanged(root);
+	}
+	
+	public void rootDeviceUnplugged(String udn){
+		Enumeration list = root.children();
+		while (list.hasMoreElements()){
+			UPnPDeviceTreeNode node= (UPnPDeviceTreeNode)list.nextElement();
+			DeviceNode device = (DeviceNode)node.getUserObject();
+			if (udn.equals(device.toString())) {
+				node.removeFromParent();
+				treeModel.nodeStructureChanged(root);
+			}
+		}
+	}
+
+	private void addTreeSelectionListener(){
+		tree.addTreeSelectionListener(new TreeSelectionListener(){
+			public void valueChanged(TreeSelectionEvent e){
+				UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();				
+				doNodeAction(selectedNode);			
+			}		
+		});
+	}
+	
+	private void doNodeAction(UPnPDeviceTreeNode node){
+		if (node == null) {
+			clearPropertiesViewer();
+			return;
+		}
+		if (node.category.equals(UPnPDeviceTreeNode.ACTION))
+			Mediator.getPropertiesViewer().showActionPanel(true);
+		else
+			Mediator.getPropertiesViewer().showActionPanel(false);
+
+		if (node.category.equals(UPnPDeviceTreeNode.SERVICE))
+			Mediator.getPropertiesViewer().showSubscriptionPanel(true);
+		else
+			Mediator.getPropertiesViewer().showSubscriptionPanel(false);
+
+		if ( node.category.equals(UPnPDeviceTreeNode.DEVICE)
+			||node.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE)){
+			DeviceNode device = (DeviceNode) node.getUserObject();
+			UPnPDevice upnpDevice = device.getDevice(Activator.context);
+			makeProperties(upnpDevice);
+		} 
+		else if (node.category.equals(UPnPDeviceTreeNode.SERVICE)){
+			UPnPService service = (UPnPService) node.getUserObject();			
+			makeProperties(service);
+		}
+		else if (node.category.equals(UPnPDeviceTreeNode.ACTION)){
+			UPnPAction action = (UPnPAction) node.getUserObject();
+			makeProperties(action);
+			Mediator.getPropertiesViewer().setAction(action);
+		}
+		else if (node.category.equals(UPnPDeviceTreeNode.STATE)
+		        ||node.category.equals(UPnPDeviceTreeNode.EVENTED_STATE)
+		        ||node.category.equals(UPnPDeviceTreeNode.SUBSCRIBED_STATE)){
+			UPnPStateVariable state = (UPnPStateVariable) node.getUserObject();
+			makeProperties(state);
+		}
+		
+	}
+	
+	private void clearPropertiesViewer(){
+		String[] names = new String[]{};
+		String[] values = new String[]{};
+		PropertiesViewer viewer = Mediator.getPropertiesViewer();
+		viewer.setProperties(names,values);
+		viewer.showActionPanel(false);
+		viewer.showSubscriptionPanel(false);
+	}
+	
+	private void makeProperties(UPnPDevice upnpDevice){
+		Dictionary dict = upnpDevice.getDescriptions(null);
+		int size = dict.size();
+		String[] names = new String[size];
+		String[] values = new String[size];
+		Enumeration keys = dict.keys();
+		for (int i=0;i<size;i++){
+			names[i]= (String) keys.nextElement();
+			values[i]= Util.justString(dict.get(names[i]));
+		}
+		Mediator.getPropertiesViewer().setProperties(names,values);
+	}
+	
+	private void makeProperties(UPnPService service){
+		String[] names = new String[]{"Id","Type","Version"};
+		String[] values = new String[]{service.getId(),service.getType(),service.getType()};
+		Mediator.getPropertiesViewer().setProperties(names,values);
+	}
+	
+	private void makeProperties(UPnPAction action){
+		ArrayList names = new ArrayList();
+		ArrayList values = new ArrayList();
+		names.add("Name");
+		values.add(action.getName());
+		
+		String returnName = action.getReturnArgumentName();
+		if (returnName != null){
+			names.add("Return value name");
+			values.add(returnName);
+		}
+		String[] inArg = action.getInputArgumentNames();
+		if (inArg != null){
+			for (int i = 0; i<inArg.length;i++){
+				names.add("Input arg["+ (i+1)+"]");
+				values.add(inArg[i]);			
+			}
+		}
+		String[] outArg = action.getOutputArgumentNames();
+		if (outArg != null){
+			for (int i = 0; i<outArg.length;i++){
+				names.add("Output arg["+ (i+1)+"]");
+				values.add(outArg[i]);			
+			}
+		}
+		
+		Mediator.getPropertiesViewer().setProperties(
+				(String[])names.toArray(new String[]{}),
+				(String[])values.toArray(new String[]{})
+		);
+		
+	}
+	
+	private void makeProperties(UPnPStateVariable state){
+		ArrayList names = new ArrayList();
+		ArrayList values = new ArrayList();
+		names.add("Name");
+		values.add(state.getName());
+		names.add("Evented");
+		values.add(state.sendsEvents()? "yes":"no");
+		names.add("Default Value");
+		values.add(Util.justString(state.getDefaultValue()));
+		names.add("Java Data Type");
+		values.add(state.getJavaDataType().getName());
+		names.add("Java UPnP Type");
+		values.add(state.getUPnPDataType());
+		names.add("Minimum");
+		values.add(Util.justString(state.getMinimum()));
+		names.add("Maximum");
+		values.add(Util.justString(state.getMaximum()));
+		names.add("Step");
+		values.add(Util.justString(state.getStep()));		
+		String[] allowed = state.getAllowedValues();
+		if (allowed!=null){
+			for (int i=0;i<allowed.length;i++){
+				names.add("Allowed value["+i+1+"]");
+				values.add(allowed[i]);		
+			}			
+		}
+		Mediator.getPropertiesViewer().setProperties(
+				(String[])names.toArray(new String[]{}),
+				(String[])values.toArray(new String[]{})
+		);
+	}
+	
+	
+}
+
+class TreePopup extends JPopupMenu implements PopupMenuListener {
+    JTree tree;
+    JMenuItem item;
+
+    public TreePopup(final JTree tree){
+        super();
+        this.tree = tree;
+        (item = add(new AbstractAction(){
+            public void actionPerformed(ActionEvent e){
+                UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();   
+                String url = "";
+                if (selectedNode.category.equals(UPnPDeviceTreeNode.DEVICE)){
+                    UPnPDeviceTreeNode parent =  (UPnPDeviceTreeNode)selectedNode.getParent();
+                    while (parent.category!=UPnPDeviceTreeNode.ROOT_DEVICE)
+                         parent =  (UPnPDeviceTreeNode)parent.getParent();
+                    DeviceNode device =  (DeviceNode) parent.getUserObject();
+                    String udn = (String)device.getReference().getProperty(UPnPDevice.UDN);
+                    url = Mediator.getDriverProxy().getDeviceDescriptionURI(udn);
+                }
+                        
+                else if (selectedNode.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE))
+                {
+                    DeviceNode node =  (DeviceNode) selectedNode.getUserObject();
+                    String udn = (String)node.getReference().getProperty(UPnPDevice.UDN);
+                    url = Mediator.getDriverProxy().getDeviceDescriptionURI(udn);
+                }
+                else if (selectedNode.category.equals(UPnPDeviceTreeNode.SERVICE))
+                {
+                    UPnPDeviceTreeNode parent =  (UPnPDeviceTreeNode)selectedNode.getParent();
+                    while (parent.category!=UPnPDeviceTreeNode.ROOT_DEVICE)
+                         parent =  (UPnPDeviceTreeNode)parent.getParent();
+                    DeviceNode device =  (DeviceNode) parent.getUserObject();
+                    String udn = (String)device.getReference().getProperty(UPnPDevice.UDN);
+                    UPnPService service =  (UPnPService) selectedNode.getUserObject();
+                    url = Mediator.getDriverProxy().getServiceDescriptionURI(udn,service.getId());
+                }                    
+                Util.openUrl(url);   
+            }
+        })).setText("Show Description");
+        addPopupMenuListener(this);
+
+    }
+    
+    public void popupMenuCanceled(PopupMenuEvent e){}
+    public void popupMenuWillBecomeInvisible(PopupMenuEvent e){}
+    public void popupMenuWillBecomeVisible(PopupMenuEvent e){
+        if (Mediator.getDriverProxy().isDriverAvailable()){
+        UPnPDeviceTreeNode selectedNode = (UPnPDeviceTreeNode)tree.getLastSelectedPathComponent();              
+            if (selectedNode.category.equals(UPnPDeviceTreeNode.DEVICE)
+                ||selectedNode.category.equals(UPnPDeviceTreeNode.ROOT_DEVICE)
+                ||selectedNode.category.equals(UPnPDeviceTreeNode.SERVICE))
+            {
+                item.setEnabled(true);
+            } 
+            else
+                item.setEnabled(false);
+        }
+        else
+            item.setEnabled(false);
+           
+    }
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/UPnPDeviceTreeNode.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/UPnPDeviceTreeNode.java
index c5bb6bc..88fa626 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/UPnPDeviceTreeNode.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/UPnPDeviceTreeNode.java
@@ -1,236 +1,236 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.gui;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.image.ImageObserver;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JToolTip;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.tester.discovery.DeviceNode;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPDeviceTreeNode extends DefaultMutableTreeNode {
-	public final static String ROOT_DEVICE = "RootDeviceNode";
-	public final static String DEVICE = "DeviceNode";
-	public final static String SERVICE = "UPnPService";
-	public final static String ACTION = "UPnPAction";
-	public final static String STATE = "UPnPStateVariable";
-	public final static String EVENTED_STATE = "EventedStateVariable";
-	public final static String SUBSCRIBED_STATE = "SubscribedStateVariable";
-	
-	protected String category;
-	public UPnPDeviceTreeNode(String obj) {
-		super(obj);
-		category = obj.getClass().getName();
-	}
-	
-	public UPnPDeviceTreeNode(DeviceNode obj, BundleContext ctx) {
-		super(obj);
-		
-		if (obj.isRoot()) category = ROOT_DEVICE;
-		else category = DEVICE;
-		
-		UPnPDevice device = (UPnPDevice)ctx.getService(obj.getReference());
-		UPnPService[] services = device.getServices();
-		
-		Collection nodeChildren = obj.getChildren();
-		if (nodeChildren != null){		
-			Iterator list = nodeChildren.iterator();
-			while (list.hasNext()){
-				DeviceNode node = (DeviceNode)list.next();
-				this.add(new UPnPDeviceTreeNode(node,ctx));
-			}
-		}
-		if (services != null){
-			for (int i=0;i<services.length;i++)
-				this.add(new UPnPDeviceTreeNode(services[i]));
-		}
-		
-	}
-	
-	public UPnPDeviceTreeNode(UPnPService obj) {
-		super(obj);
-		category = SERVICE;
-		UPnPStateVariable[] variables = obj.getStateVariables();
-		if (variables != null){
-			for (int i=0;i<variables.length;i++)
-				this.add(new UPnPDeviceTreeNode(variables[i]));
-		}
-		UPnPAction[] actions = obj.getActions();
-		if (actions != null){
-			for (int i=0;i<actions.length;i++)
-				this.add(new UPnPDeviceTreeNode(actions[i]));
-		}
-	}
-	public UPnPDeviceTreeNode(UPnPAction obj) {
-		super(obj);
-		category = ACTION;
-	}
-	
-	public UPnPDeviceTreeNode(UPnPStateVariable obj) {
-		super(obj);
-		if (obj.sendsEvents()) category = EVENTED_STATE;
-		else category = STATE;
-	}
-	
-	public String toString() {
-		if (category.equals(DEVICE)||category.equals(ROOT_DEVICE)){
-			DeviceNode node =  (DeviceNode) getUserObject();
-			return node.toString();
-		}
-		else if (category.equals(SERVICE)){
-			UPnPService node =  (UPnPService) getUserObject();
-			return node.getType();
-		}
-		else if (category.equals(ACTION)){
-			UPnPAction node =  (UPnPAction) getUserObject();
-			return node.getName();
-		}
-		else if (category.equals(STATE) ||category.equals(EVENTED_STATE)||category.equals(SUBSCRIBED_STATE)){
-			UPnPStateVariable node =  (UPnPStateVariable) getUserObject();
-			return node.getName();
-		}
-		else
-			return getUserObject().toString();
-	}
-}
-
-//   local class for JTree icon renderer
-class TreeNodeCellRenderer extends DefaultTreeCellRenderer implements ImageObserver{
-	
-	private HashMap icons ;
-	ImageIcon image;
-	public TreeNodeCellRenderer() {
-		super();
-		icons = new HashMap();
-		try {
-			icons.put(UPnPDeviceTreeNode.EVENTED_STATE, loadIcon(UPnPDeviceTreeNode.EVENTED_STATE));
-			image =  loadIcon(UPnPDeviceTreeNode.SUBSCRIBED_STATE);
-			// to use animate gif
-			//image.setImageObserver(this);
- 			icons.put(UPnPDeviceTreeNode.SUBSCRIBED_STATE, image);
-
- 			icons.put(UPnPDeviceTreeNode.ROOT_DEVICE, loadIcon(UPnPDeviceTreeNode.ROOT_DEVICE));
-			icons.put(UPnPDeviceTreeNode.DEVICE, loadIcon(UPnPDeviceTreeNode.DEVICE));
-			icons.put(UPnPDeviceTreeNode.SERVICE, loadIcon(UPnPDeviceTreeNode.SERVICE));
-			icons.put(UPnPDeviceTreeNode.ACTION, loadIcon(UPnPDeviceTreeNode.ACTION));
-			icons.put(UPnPDeviceTreeNode.STATE, loadIcon(UPnPDeviceTreeNode.STATE));
-		} catch (Exception ex) {
-			System.out.println(ex);
-		}
-
-	}
-    
-    public JToolTip createToolTip() {
-        JToolTip tip = super.createToolTip();
-        tip.setBackground(Color.yellow);
-        return tip;
-    }
-
-	//test to display animated gif
-	/* 
-	 public boolean imageUpdate(Image img, int infoflags,
-		       int x, int y, int width, int height){
-	       	//System.out.println("image update");
-	        Mediator.getUPnPDeviceTree().validate();
-	        Mediator.getUPnPDeviceTree().repaint();
-	        return true;
-	   }
-	 */
-
-	public Component getTreeCellRendererComponent(JTree tree, Object value,
-			boolean sel, boolean expanded, boolean leaf, int row,
-			boolean hasFocus) {
-		Icon icon = selectIcon((UPnPDeviceTreeNode) value);
-        setToolTip((UPnPDeviceTreeNode) value);
-		if (icon != null) {
-			setOpenIcon(icon);
-			setClosedIcon(icon);
-			setLeafIcon(icon);
-		} else {
-			setOpenIcon(getDefaultOpenIcon());
-			setClosedIcon(getDefaultClosedIcon());
-			setLeafIcon(getDefaultLeafIcon());
-		}
-		return super.getTreeCellRendererComponent(tree, value, sel, expanded,
-				leaf, row, hasFocus);
-	}
-	
-    public Icon selectIcon(UPnPDeviceTreeNode node) {
-        Icon icon = null;
-        try {
-                String tag = node.category;
-                icon = (Icon) icons.get(tag);
-        } catch (Exception ex) {
-            System.out.println("getTreeCellRendererComponent Exception:" + ex);
-        }
-        return icon;
-    }
-    
-    public void setToolTip(UPnPDeviceTreeNode node) {
-        String tag = node.category;
-        if (tag.equals(UPnPDeviceTreeNode.ROOT_DEVICE)
-             ||tag.equals(UPnPDeviceTreeNode.DEVICE))
-        {
-            DeviceNode device = (DeviceNode) node.getUserObject();
-            setToolTipText("<html><TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' ><TR BGCOLOR='#F9FF79' ><TD>" 
-                    + device.getReference().getProperty(UPnPDevice.FRIENDLY_NAME).toString()
-                    +"</TD></TR></TABLE ></html>");
-        }
-        else
-            setToolTipText(null);
-     }
-	
-    public  static ImageIcon loadIcon(String name)
-    {
-        try {
-            /*
-            System.out.println("loading image ..."+name);
-            System.out.println("from "+"IMAGES/" + name + ".gif");
-            */
-            URL eventIconUrl = UPnPDeviceTreeNode.class.getResource("IMAGES/" + name + ".gif");           
-            return new ImageIcon(eventIconUrl,name);
-        }
-        catch (Exception ex){
-		        System.out.println("Resource:" + name + " not found : " + ex.toString());
-            return null;
-        }
-    }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.gui;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.image.ImageObserver;
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JToolTip;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.tester.discovery.DeviceNode;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPDeviceTreeNode extends DefaultMutableTreeNode {
+	public final static String ROOT_DEVICE = "RootDeviceNode";
+	public final static String DEVICE = "DeviceNode";
+	public final static String SERVICE = "UPnPService";
+	public final static String ACTION = "UPnPAction";
+	public final static String STATE = "UPnPStateVariable";
+	public final static String EVENTED_STATE = "EventedStateVariable";
+	public final static String SUBSCRIBED_STATE = "SubscribedStateVariable";
+	
+	protected String category;
+	public UPnPDeviceTreeNode(String obj) {
+		super(obj);
+		category = obj.getClass().getName();
+	}
+	
+	public UPnPDeviceTreeNode(DeviceNode obj, BundleContext ctx) {
+		super(obj);
+		
+		if (obj.isRoot()) category = ROOT_DEVICE;
+		else category = DEVICE;
+		
+		UPnPDevice device = (UPnPDevice)ctx.getService(obj.getReference());
+		UPnPService[] services = device.getServices();
+		
+		Collection nodeChildren = obj.getChildren();
+		if (nodeChildren != null){		
+			Iterator list = nodeChildren.iterator();
+			while (list.hasNext()){
+				DeviceNode node = (DeviceNode)list.next();
+				this.add(new UPnPDeviceTreeNode(node,ctx));
+			}
+		}
+		if (services != null){
+			for (int i=0;i<services.length;i++)
+				this.add(new UPnPDeviceTreeNode(services[i]));
+		}
+		
+	}
+	
+	public UPnPDeviceTreeNode(UPnPService obj) {
+		super(obj);
+		category = SERVICE;
+		UPnPStateVariable[] variables = obj.getStateVariables();
+		if (variables != null){
+			for (int i=0;i<variables.length;i++)
+				this.add(new UPnPDeviceTreeNode(variables[i]));
+		}
+		UPnPAction[] actions = obj.getActions();
+		if (actions != null){
+			for (int i=0;i<actions.length;i++)
+				this.add(new UPnPDeviceTreeNode(actions[i]));
+		}
+	}
+	public UPnPDeviceTreeNode(UPnPAction obj) {
+		super(obj);
+		category = ACTION;
+	}
+	
+	public UPnPDeviceTreeNode(UPnPStateVariable obj) {
+		super(obj);
+		if (obj.sendsEvents()) category = EVENTED_STATE;
+		else category = STATE;
+	}
+	
+	public String toString() {
+		if (category.equals(DEVICE)||category.equals(ROOT_DEVICE)){
+			DeviceNode node =  (DeviceNode) getUserObject();
+			return node.toString();
+		}
+		else if (category.equals(SERVICE)){
+			UPnPService node =  (UPnPService) getUserObject();
+			return node.getType();
+		}
+		else if (category.equals(ACTION)){
+			UPnPAction node =  (UPnPAction) getUserObject();
+			return node.getName();
+		}
+		else if (category.equals(STATE) ||category.equals(EVENTED_STATE)||category.equals(SUBSCRIBED_STATE)){
+			UPnPStateVariable node =  (UPnPStateVariable) getUserObject();
+			return node.getName();
+		}
+		else
+			return getUserObject().toString();
+	}
+}
+
+//   local class for JTree icon renderer
+class TreeNodeCellRenderer extends DefaultTreeCellRenderer implements ImageObserver{
+	
+	private HashMap icons ;
+	ImageIcon image;
+	public TreeNodeCellRenderer() {
+		super();
+		icons = new HashMap();
+		try {
+			icons.put(UPnPDeviceTreeNode.EVENTED_STATE, loadIcon(UPnPDeviceTreeNode.EVENTED_STATE));
+			image =  loadIcon(UPnPDeviceTreeNode.SUBSCRIBED_STATE);
+			// to use animate gif
+			//image.setImageObserver(this);
+ 			icons.put(UPnPDeviceTreeNode.SUBSCRIBED_STATE, image);
+
+ 			icons.put(UPnPDeviceTreeNode.ROOT_DEVICE, loadIcon(UPnPDeviceTreeNode.ROOT_DEVICE));
+			icons.put(UPnPDeviceTreeNode.DEVICE, loadIcon(UPnPDeviceTreeNode.DEVICE));
+			icons.put(UPnPDeviceTreeNode.SERVICE, loadIcon(UPnPDeviceTreeNode.SERVICE));
+			icons.put(UPnPDeviceTreeNode.ACTION, loadIcon(UPnPDeviceTreeNode.ACTION));
+			icons.put(UPnPDeviceTreeNode.STATE, loadIcon(UPnPDeviceTreeNode.STATE));
+		} catch (Exception ex) {
+			System.out.println(ex);
+		}
+
+	}
+    
+    public JToolTip createToolTip() {
+        JToolTip tip = super.createToolTip();
+        tip.setBackground(Color.yellow);
+        return tip;
+    }
+
+	//test to display animated gif
+	/* 
+	 public boolean imageUpdate(Image img, int infoflags,
+		       int x, int y, int width, int height){
+	       	//System.out.println("image update");
+	        Mediator.getUPnPDeviceTree().validate();
+	        Mediator.getUPnPDeviceTree().repaint();
+	        return true;
+	   }
+	 */
+
+	public Component getTreeCellRendererComponent(JTree tree, Object value,
+			boolean sel, boolean expanded, boolean leaf, int row,
+			boolean hasFocus) {
+		Icon icon = selectIcon((UPnPDeviceTreeNode) value);
+        setToolTip((UPnPDeviceTreeNode) value);
+		if (icon != null) {
+			setOpenIcon(icon);
+			setClosedIcon(icon);
+			setLeafIcon(icon);
+		} else {
+			setOpenIcon(getDefaultOpenIcon());
+			setClosedIcon(getDefaultClosedIcon());
+			setLeafIcon(getDefaultLeafIcon());
+		}
+		return super.getTreeCellRendererComponent(tree, value, sel, expanded,
+				leaf, row, hasFocus);
+	}
+	
+    public Icon selectIcon(UPnPDeviceTreeNode node) {
+        Icon icon = null;
+        try {
+                String tag = node.category;
+                icon = (Icon) icons.get(tag);
+        } catch (Exception ex) {
+            System.out.println("getTreeCellRendererComponent Exception:" + ex);
+        }
+        return icon;
+    }
+    
+    public void setToolTip(UPnPDeviceTreeNode node) {
+        String tag = node.category;
+        if (tag.equals(UPnPDeviceTreeNode.ROOT_DEVICE)
+             ||tag.equals(UPnPDeviceTreeNode.DEVICE))
+        {
+            DeviceNode device = (DeviceNode) node.getUserObject();
+            setToolTipText("<html><TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' ><TR BGCOLOR='#F9FF79' ><TD>" 
+                    + device.getReference().getProperty(UPnPDevice.FRIENDLY_NAME).toString()
+                    +"</TD></TR></TABLE ></html>");
+        }
+        else
+            setToolTipText(null);
+     }
+	
+    public  static ImageIcon loadIcon(String name)
+    {
+        try {
+            /*
+            System.out.println("loading image ..."+name);
+            System.out.println("from "+"IMAGES/" + name + ".gif");
+            */
+            URL eventIconUrl = UPnPDeviceTreeNode.class.getResource("IMAGES/" + name + ".gif");           
+            return new ImageIcon(eventIconUrl,name);
+        }
+        catch (Exception ex){
+		        System.out.println("Resource:" + name + " not found : " + ex.toString());
+            return null;
+        }
+    }
+
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/Util.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/Util.java
index 67a6506..965e771 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/Util.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/gui/Util.java
@@ -1,104 +1,104 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester.gui;
-
-import java.awt.GridBagConstraints;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class Util {
-	final static GridBagConstraints constrains = new GridBagConstraints();
-
-	public  static GridBagConstraints setConstrains(int x,int y,int w,int h,int wx, int wy)
-    {
-        constrains.insets.left=5;
-        constrains.insets.right=5;
-        constrains.insets.bottom=3;
-        constrains.fill=GridBagConstraints.BOTH;
-        constrains.anchor=GridBagConstraints.WEST;
-        constrains.gridx=x;
-        constrains.gridy=y;
-        constrains.gridwidth=w;
-        constrains.gridheight=h;
-        constrains.weightx=wx;
-        constrains.weighty=wy;
-        return constrains;
-    }
-    
-    public static String justString(Object obj){
-        if (obj == null) return "";
-        else if (obj instanceof String[]){
-            String[] items = (String[])obj;
-            String tmp = "";
-            for (int i = 0; i < items.length; i++) {
-                tmp+=items[i]+"; ";
-            }
-            return tmp;
-        }
-        return obj.toString();
-    }
-
-    public static void openUrl(String url) {
-        try {
-            if (url == null) return;
-            String os=System.getProperty("os.name","").toLowerCase();
-            Process p = null;
-            if(os.indexOf("windows")!=-1){
-                String cmd = null;
-                cmd = "cmd.exe /C start "+url;
-                LogPanel.log("[Executing cmd] " +cmd);
-                p = Runtime.getRuntime().exec(cmd);
-                
-            }else if(os.indexOf("linux")!=-1){
-            	String[] cmd = new String[]{
-                		"/bin/sh",
-                		"-c",
-                		"( $BROWSER " + url + " || mozilla-firefox '" + url + "' || firefox '" + url 
-                		+ "' || mozilla '" + url + "' || konqueror '" + url + "' || opera '" + url + "' )"
-                };
-            	StringBuffer sb = new StringBuffer();
-            	for (int i = 0; i < cmd.length; i++) {
-					sb.append(" ").append(cmd[i]);
-					
-				}
-                LogPanel.log("[Executing cmd] " +sb.toString());
-                p = Runtime.getRuntime().exec(cmd);
-            }            
-            BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-            BufferedReader out = new BufferedReader(new InputStreamReader(p.getInputStream()));            
-            while (true) {
-            	while(err.ready()) System.err.println(err.readLine());
-            	while(out.ready()) System.out.println(out.readLine());            	
-            	try{
-            		p.exitValue();
-            		break;
-            	}catch (IllegalThreadStateException e) {
-				}
-			}
-        } catch (Exception ex){
-            System.out.println(ex);
-        }
-    }
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester.gui;
+
+import java.awt.GridBagConstraints;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class Util {
+	final static GridBagConstraints constrains = new GridBagConstraints();
+
+	public  static GridBagConstraints setConstrains(int x,int y,int w,int h,int wx, int wy)
+    {
+        constrains.insets.left=5;
+        constrains.insets.right=5;
+        constrains.insets.bottom=3;
+        constrains.fill=GridBagConstraints.BOTH;
+        constrains.anchor=GridBagConstraints.WEST;
+        constrains.gridx=x;
+        constrains.gridy=y;
+        constrains.gridwidth=w;
+        constrains.gridheight=h;
+        constrains.weightx=wx;
+        constrains.weighty=wy;
+        return constrains;
+    }
+    
+    public static String justString(Object obj){
+        if (obj == null) return "";
+        else if (obj instanceof String[]){
+            String[] items = (String[])obj;
+            String tmp = "";
+            for (int i = 0; i < items.length; i++) {
+                tmp+=items[i]+"; ";
+            }
+            return tmp;
+        }
+        return obj.toString();
+    }
+
+    public static void openUrl(String url) {
+        try {
+            if (url == null) return;
+            String os=System.getProperty("os.name","").toLowerCase();
+            Process p = null;
+            if(os.indexOf("windows")!=-1){
+                String cmd = null;
+                cmd = "cmd.exe /C start "+url;
+                LogPanel.log("[Executing cmd] " +cmd);
+                p = Runtime.getRuntime().exec(cmd);
+                
+            }else if(os.indexOf("linux")!=-1){
+            	String[] cmd = new String[]{
+                		"/bin/sh",
+                		"-c",
+                		"( $BROWSER " + url + " || mozilla-firefox '" + url + "' || firefox '" + url 
+                		+ "' || mozilla '" + url + "' || konqueror '" + url + "' || opera '" + url + "' )"
+                };
+            	StringBuffer sb = new StringBuffer();
+            	for (int i = 0; i < cmd.length; i++) {
+					sb.append(" ").append(cmd[i]);
+					
+				}
+                LogPanel.log("[Executing cmd] " +sb.toString());
+                p = Runtime.getRuntime().exec(cmd);
+            }            
+            BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+            BufferedReader out = new BufferedReader(new InputStreamReader(p.getInputStream()));            
+            while (true) {
+            	while(err.ready()) System.err.println(err.readLine());
+            	while(out.ready()) System.out.println(out.readLine());            	
+            	try{
+            		p.exitValue();
+            		break;
+            	}catch (IllegalThreadStateException e) {
+				}
+			}
+        } catch (Exception ex){
+            System.out.println(ex);
+        }
+    }
+
+}
diff --git a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/test.java b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/test.java
index 7eb1bb8..c73d5af 100644
--- a/upnp/tester/src/main/java/org/apache/felix/upnp/tester/test.java
+++ b/upnp/tester/src/main/java/org/apache/felix/upnp/tester/test.java
@@ -1,79 +1,79 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.tester;
-
-import java.awt.Image;
-import java.net.URL;
-
-import javax.swing.ImageIcon;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-public class test extends JFrame {
-
-   Image image;
-
-   public test(String filename) {
-     super(filename);
-     setDefaultCloseOperation(EXIT_ON_CLOSE);
-     //image = getToolkit().getImage(filename);
-     ImageIcon image =loadIcon("EventedStateVariable");
-     //image.setImageObserver(this);
-     JPanel panel = new JPanel();
-     
-     panel.add(new JLabel(image));
-     JLabel lab = new JLabel();
-     lab.setIcon(image);
-     panel.add(lab);
-     this.getContentPane().add(panel);
-       }
-
-   /*public void paint(Graphics g) {
-     super.paint(g);
-     g.drawImage(image, 25, 25, this);
-   }*/
-
-   public static void main(String args[]) {
-     if (args.length > 0) {
-       JFrame f = new test(args[0]);
-       f.setSize(300, 300);
-       f.show();
-     } else {
-       System.err.println(
-        "You must specify an image filename to display");
-     }
-   }
-   
-   
-   public  static ImageIcon loadIcon(String name)
-   {
-       try {
-           //System.out.println("loading image ..."+path);
-           URL eventIconUrl = test.class.getResource("images/" + name + ".gif");           
-           return new ImageIcon(eventIconUrl,name);
-       }
-       catch (Exception ex){
-		        System.out.println("Resource:" + name + " not found : " + ex.toString());
-           return null;
-       }
-   }
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.tester;
+
+import java.awt.Image;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+public class test extends JFrame {
+
+   Image image;
+
+   public test(String filename) {
+     super(filename);
+     setDefaultCloseOperation(EXIT_ON_CLOSE);
+     //image = getToolkit().getImage(filename);
+     ImageIcon image =loadIcon("EventedStateVariable");
+     //image.setImageObserver(this);
+     JPanel panel = new JPanel();
+     
+     panel.add(new JLabel(image));
+     JLabel lab = new JLabel();
+     lab.setIcon(image);
+     panel.add(lab);
+     this.getContentPane().add(panel);
+       }
+
+   /*public void paint(Graphics g) {
+     super.paint(g);
+     g.drawImage(image, 25, 25, this);
+   }*/
+
+   public static void main(String args[]) {
+     if (args.length > 0) {
+       JFrame f = new test(args[0]);
+       f.setSize(300, 300);
+       f.show();
+     } else {
+       System.err.println(
+        "You must specify an image filename to display");
+     }
+   }
+   
+   
+   public  static ImageIcon loadIcon(String name)
+   {
+       try {
+           //System.out.println("loading image ..."+path);
+           URL eventIconUrl = test.class.getResource("images/" + name + ".gif");           
+           return new ImageIcon(eventIconUrl,name);
+       }
+       catch (Exception ex){
+		        System.out.println("Resource:" + name + " not found : " + ex.toString());
+           return null;
+       }
+   }
+
 }
