felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r674879 [4/12] - in /felix/trunk/upnp: ./ basedriver/ basedriver/src/main/java/org/apache/felix/upnp/basedriver/ basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/ basedriver/src/main/java/org/apache/felix/upnp/basedriver...
Date Tue, 08 Jul 2008 16:59:57 GMT
Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java Tue Jul  8 09:59:54 2008
@@ -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());
+		}
+
+	}
+
+}

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPActionImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java Tue Jul  8 09:59:54 2008
@@ -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);
+
+	}
+
 }

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPDeviceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java Tue Jul  8 09:59:54 2008
@@ -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();
+	}
+
+}

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPIconImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java Tue Jul  8 09:59:54 2008
@@ -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;
+	}
+
 }

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPServiceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java Tue Jul  8 09:59:54 2008
@@ -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();
+	}
+
+
+}

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/core/upnp/UPnPStateVariableImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java Tue Jul  8 09:59:54 2008
@@ -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);
+
+	
+	}
+
 }

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/DeviceSetup.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java Tue Jul  8 09:59:54 2008
@@ -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));
+		 */
+
+	}
+
 }

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/HTTPRequestForIcon.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java Tue Jul  8 09:59:54 2008
@@ -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;		
+	}
+}

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseLocation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java (original)
+++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java Tue Jul  8 09:59:54 2008
@@ -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;
+	}
+	
 }

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/ParseUSN.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/StringSplitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/StringSplitter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/importer/util/StringSplitter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message