You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by le...@apache.org on 2008/09/10 22:48:03 UTC

svn commit: r693975 - in /felix/trunk/upnp: basedriver/ samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/ samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/ samples/binarylight/src/main/java/or...

Author: lenzi
Date: Wed Sep 10 13:48:02 2008
New Revision: 693975

URL: http://svn.apache.org/viewvc?rev=693975&view=rev
Log:
Sample devices where missing properties for service when the UPnPDevice service is registered
Fixed dependencies for tester
Added profile inside the BaseDriver to be able to compile against the CyberLink library 
(at the moment it requires the FELIX-684 to be fixed, so it can't be used)


Modified:
    felix/trunk/upnp/basedriver/pom.xml
    felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java
    felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
    felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java
    felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
    felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
    felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
    felix/trunk/upnp/tester/pom.xml

Modified: felix/trunk/upnp/basedriver/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/pom.xml?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/basedriver/pom.xml (original)
+++ felix/trunk/upnp/basedriver/pom.xml Wed Sep 10 13:48:02 2008
@@ -33,6 +33,85 @@
   </repositories>
   <!-- <url>http://maven.apache.org</url> -->
 
+  <profiles>
+    <profile>
+      <id>cyberlink</id>
+      <activation>
+      	<property>
+	  <name>cyberlink</name><value>true</value>
+	</property>	
+      </activation>
+
+      <repositories>
+        <repository>
+          <id>release.cgupnpjava.sourceforge.net</id>
+          <name>CyberLink for Java Repository</name>
+          <url>http://cgupnpjava.sourceforge.net/repository/</url>
+          <snapshots><enabled>false</enabled></snapshots>
+        </repository>
+        <repository>
+          <id>snapshot.cgupnpjava.sourceforge.net</id>
+          <name>CyberLink for Java Development Repository</name>
+          <url>http://cgupnpjava.sourceforge.net/snapshots-repository/</url>
+          <releases><enabled>false</enabled></releases>
+        </repository>
+      </repositories>
+
+      <build>
+        <plugins>
+	  <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>1.5.0-SNAPSHOT</version>
+            <executions>
+              <execution>
+                <id>cyberlink</id>
+                <goals><goal>bundle</goal></goals>
+                <configuration>
+                  <classifier>cyberlink</classifier>
+                  <manifestLocation>${project.build.outputDirectory}/META-INF-cyberlink</manifestLocation>
+                  <excludeDependencies>it.cnr.isti.domoware.cyberdomo:upnp-stack,it.cnr.isti.domoware.cyberdomo:upnp-stack-jdk13</excludeDependencies>
+                  <instructions>
+                    <Export-Package>
+                      org.apache.felix.upnp.basedriver.controller;version=0.1.0,
+                      org.apache.felix.upnp.basedriver.util;version=0.3.0,
+                      org.apache.felix.upnp.basedriver.resources;version=0.3.0
+                    </Export-Package>
+                    <Import-Package>
+                      org.osgi.*, javax.xml.parsers, org.w3c.dom, org.xml.sax,
+		      !org.kxml2.io, !org.xmlpull.v1, !org.apache.xerces.parsers
+                    </Import-Package>
+                    <Private-Package>
+                      org.apache.felix.upnp.basedriver.*;-split-package:=merge-first,
+                      org.cybergarage.*,
+                      org.apache.xerces.impl.dv.util
+                    </Private-Package>
+                  </instructions>
+                </configuration>
+              </execution>
+            </executions>
+	  </plugin>
+	</plugins>
+      </build>
+      
+      <dependencies>
+        <dependency>
+          <groupId>org.cybergarage.cyberlink</groupId>
+          <artifactId>upnp-stack</artifactId>
+          <version>1.8.0-SNAPSHOT</version>
+          <optional>true</optional>
+	  <exclusions>
+	    <exclusion>
+              <groupId>xerces</groupId>
+              <artifactId>xercesImpl</artifactId>
+	    </exclusion>
+	  </exclusions>
+	</dependency>
+      </dependencies>
+
+    </profile>
+  </profiles>
+  
   <build>
     <plugins>
       <plugin>
@@ -41,6 +120,7 @@
         <version>1.4.0</version>
         <extensions>true</extensions>
         <configuration>
+	  <excludeDependencies>org.cybergarage.cyberlink:upnp-stack,upnp-stack-jdk13</excludeDependencies>
           <instructions>
             <Bundle-Name>${pom.name}</Bundle-Name>
             <Bundle-Activator>
@@ -71,7 +151,6 @@
               org.apache.xerces.impl.dv.util
             </Private-Package>
           </instructions>
-	  <excludeDependencies>upnp-stack-jdk13</excludeDependencies>
         </configuration>
 	<executions>
 	  <execution>
@@ -101,19 +180,37 @@
 	  </execution>
 	</executions>
       </plugin>      
+      <!--plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>minijar-maven-plugin</artifactId>
+        <version>1.0-alpha-3</version>
+	<executions>
+	  <execution>
+	    <id>ueberjar</id>
+	    <phase>package</phase>
+	    <goals><goal>ueberjar</goal></goals>
+            <configuration>
+	      <stripUnusedClasses>true</stripUnusedClasses>
+	      <includeDependencies>
+	        <param>none:dependency</param>
+	      </includeDependencies>
+            </configuration>
+	  </execution>
+	</executions>
+      </plugin-->
     </plugins>
   </build>
 
 
   <dependencies>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.osgi.core</artifactId>
       <version>1.0.0</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.osgi.compendium</artifactId>
       <version>1.0.0</version>
     </dependency>
@@ -130,4 +227,4 @@
       <optional>true</optional>
     </dependency>
   </dependencies>
-</project>
\ No newline at end of file
+</project>

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java Wed Sep 10 13:48:02 2008
@@ -40,6 +40,7 @@
 public class Activator implements BundleActivator {
 
 	static BundleContext context;
+	
 	private ServiceRegistration serviceRegistration;
 	private LightDevice light;
 	private HttpService httpServ;

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java Wed Sep 10 13:48:02 2008
@@ -22,6 +22,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Dictionary;
+import java.util.HashSet;
 import java.util.Properties;
 import java.util.Random;
 
@@ -75,11 +76,9 @@
 		dictionary = new Properties();
 		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
 		dictionary.put(
-		        org.osgi.service
-		        	.device.Constants.DEVICE_CATEGORY,
+		        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");
@@ -92,16 +91,24 @@
 		try {
 			inet = InetAddress.getLocalHost();
 	        String hostname = inet.getHostName();
-            //String hostname = inet.getHostAddress();
-		dictionary.put(UPnPDevice.PRESENTATION_URL,"http://"+hostname + ":"+port+"/upnp/binaryLight/");
+	        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");
+
+		HashSet types = new HashSet(services.length+5);
+		String[] ids = new String[services.length];
+		for (int i = 0; i < services.length; i++) {
+			ids[i]=services[i].getId();
+			types.add(services[i].getType());
+		}
+		
+		dictionary.put(UPnPService.TYPE, types.toArray(new String[]{}));
+		dictionary.put(UPnPService.ID, ids);		
 	}
 	
 	

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/services/PowerSwitchService.java Wed Sep 10 13:48:02 2008
@@ -38,9 +38,10 @@
 
 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";
+	final static private String SERVICE_ID = "urn:upnp-org:serviceId:SwitchPower:1";
+	final static private String SERVICE_TYPE = "urn:schemas-upnp-org:service:SwitchPower:"
+		+ PowerSwitchService.VERSION;
+	final static private String VERSION = "1";
 
 	private LightModel model;
 	private UPnPStateVariable status,target;

Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java Wed Sep 10 13:48:02 2008
@@ -23,6 +23,8 @@
 import java.beans.PropertyChangeEvent;
 import java.util.Calendar;
 import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Properties;
 import java.util.Random;
 
@@ -62,11 +64,10 @@
 		dictionary = new Properties();
 		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
 		dictionary.put(
-		        org.osgi.service
-		        	.device.Constants.DEVICE_CATEGORY,
+		        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");
@@ -74,12 +75,20 @@
 		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");
+		
+		HashSet types = new HashSet(services.length+5);
+		String[] ids = new String[services.length];
+		for (int i = 0; i < services.length; i++) {
+			ids[i]=services[i].getId();
+			types.add(services[i].getType());
+		}
+		
+		dictionary.put(UPnPService.TYPE, types.toArray(new String[]{}));
+		dictionary.put(UPnPService.ID, ids);
 	}
 	
 	

Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java Wed Sep 10 13:48:02 2008
@@ -30,9 +30,10 @@
 */
 
 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";
+	final static private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:timer:1";
+	final static private String SERVICE_TYPE = "urn:schemas-upnp-org:service:timer:" 
+		+ TimerService.VERSION;
+	final static private String VERSION = "1";
 
 	private UPnPStateVariable time,result;
 	private UPnPStateVariable[] states;

Modified: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java (original)
+++ felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java Wed Sep 10 13:48:02 2008
@@ -23,6 +23,7 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Dictionary;
+import java.util.HashSet;
 import java.util.Properties;
 import java.util.Random;
 
@@ -94,11 +95,8 @@
 	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,
+	        org.osgi.service.device.Constants.DEVICE_CATEGORY,
         	new String[]{UPnPDevice.DEVICE_CATEGORY}
         );
 		dictionary.put(UPnPDevice.FRIENDLY_NAME,"Felix Sample Tv");
@@ -108,12 +106,20 @@
 		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");
+
+		HashSet types = new HashSet(services.length+5);
+		String[] ids = new String[services.length];
+		for (int i = 0; i < services.length; i++) {
+			ids[i]=services[i].getId();
+			types.add(services[i].getType());
+		}
+		
+		dictionary.put(UPnPService.TYPE, types.toArray(new String[]{}));
+		dictionary.put(UPnPService.ID, ids);		
 	}
 	
 	

Modified: felix/trunk/upnp/tester/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/tester/pom.xml?rev=693975&r1=693974&r2=693975&view=diff
==============================================================================
--- felix/trunk/upnp/tester/pom.xml (original)
+++ felix/trunk/upnp/tester/pom.xml Wed Sep 10 13:48:02 2008
@@ -24,12 +24,14 @@
     <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>
@@ -54,15 +56,16 @@
       </plugin>
     </plugins>
   </build>
+
   <dependencies>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.osgi.core</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
+      <version>1.0.0</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.osgi.compendium</artifactId>
       <version>1.0.0</version>
       <scope>provided</scope>
@@ -71,9 +74,8 @@
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.upnp.basedriver</artifactId>
       <version>0.8.0</version>
-      <scope>provided</scope>
     </dependency>
-     <!-- 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>