Skip to content
Permalink
Browse files
Sample devices where missing properties for service when the UPnPDevi…
…ce 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)



git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@693975 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Stefano Lenzi committed Sep 10, 2008
1 parent 3cb8017 commit a847fdb5166551c0492fc701563d789e56a9b20f
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 32 deletions.
@@ -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>
</project>
@@ -40,6 +40,7 @@
public class Activator implements BundleActivator {

static BundleContext context;

private ServiceRegistration serviceRegistration;
private LightDevice light;
private HttpService httpServ;
@@ -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 @@ private void setupDeviceProperties(){
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 @@ private void setupDeviceProperties(){
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);
}


@@ -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;
@@ -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,24 +64,31 @@ private void setupDeviceProperties(){
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");
dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A CyberLink Clock device clone to test OSGi to UPnP service export");
dictionary.put(UPnPDevice.MODEL_NAME,"DolceDormire");
dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
dictionary.put(UPnPDevice.MODEL_URL,"http://felix.apache.org/site/upnp-examples.html");
//dictionary.put(UPnPDevice.PRESENTATION_URL,"http://felix.apache.org/dolceDormire/presentation");
dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:clock:1");
dictionary.put(UPnPDevice.UDN,DEVICE_ID);
//dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
dictionary.put(UPnPDevice.UPC,"1213456789");

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);
}


@@ -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;
@@ -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 buildEventNotifyer() {
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 @@ private void setupDeviceProperties(){
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);
}


@@ -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>

0 comments on commit a847fdb

Please sign in to comment.