Fixed FELIX-2579 by adding a new method extractDeviceType and calling it for root device and its children
Fixed FELIX-2588 by merging org.osgi.service.upnp classes into the bundle during the packaging phase
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@995403 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/upnp/basedriver/pom.xml b/upnp/basedriver/pom.xml
index 1ed13aa..667f21f 100644
--- a/upnp/basedriver/pom.xml
+++ b/upnp/basedriver/pom.xml
@@ -12,13 +12,42 @@
<artifactId>org.apache.felix.upnp.basedriver</artifactId>
<version>0.9.0-SNAPSHOT</version>
+ <properties>
+ <cyberdomo.jdk14.version>1.8.0</cyberdomo.jdk14.version>
+ <cyberdomo.jdk13.version>1.8.0</cyberdomo.jdk13.version>
+ <cyberlink.jdk14.version>1.7.0</cyberlink.jdk14.version>
+ </properties>
+
<profiles>
<profile>
+ <id>LATEST</id>
+ <repositories>
+ <repository>
+ <id>release.domoware.isti.cnr.it</id>
+ <name>Domoware Java Repository</name>
+ <url>http://domoware.isti.cnr.it/maven2/</url>
+ <snapshots><enabled>false</enabled></snapshots>
+ </repository>
+ <repository>
+ <id>snapshot.domoware.isti.cnr.it</id>
+ <name>Domoware Java Snapshot Repository</name>
+ <url>http://domoware.isti.cnr.it/maven2-snap/</url>
+ <releases><enabled>false</enabled></releases>
+ </repository>
+ </repositories>
+ <properties>
+ <cyberdomo.jdk14.version>1.9.0-SNAPSHOT</cyberdomo.jdk14.version>
+ <cyberdomo.jdk13.version>1.8.1-SNAPSHOT</cyberdomo.jdk13.version>
+ <cyberlink.jdk14.version>1.8.0-SNAPSHOT</cyberlink.jdk14.version>
+ </properties>
+ </profile>
+
+ <profile>
<id>cyberlink</id>
<activation>
<property>
- <name>cyberlink</name><value>true</value>
- </property>
+ <name>cyberlink</name><value>true</value>
+ </property>
</activation>
<repositories>
@@ -53,7 +82,8 @@
<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
+ org.apache.felix.upnp.basedriver.resources;version=0.3.0,
+ org.osgi.service.upnp;version=1.1.0
</Export-Package>
<Import-Package>
org.osgi.*, javax.xml.parsers, org.w3c.dom, org.xml.sax,
@@ -117,7 +147,8 @@
<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
+ org.apache.felix.upnp.basedriver.resources;version=0.3.0,
+ org.osgi.service.upnp;version=1.1.0
</Export-Package>
<Import-Package>
org.osgi.*, javax.xml.parsers, org.w3c.dom, org.xml.sax
@@ -141,7 +172,8 @@
<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
+ org.apache.felix.upnp.basedriver.resources;version=0.3.0,
+ org.osgi.service.upnp;version=1.1.0
</Export-Package>
<Import-Package>
org.osgi.*
@@ -202,13 +234,13 @@
<dependency>
<groupId>it.cnr.isti.domoware.cyberdomo</groupId>
<artifactId>upnp-stack</artifactId>
- <version>1.8.0</version>
+ <version>${cyberdomo.jdk14.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.cnr.isti.domoware.cyberdomo</groupId>
<artifactId>upnp-stack-jdk13</artifactId>
- <version>1.8.0</version>
+ <version>${cyberdomo.jdk13.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
diff --git a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java
index a0334e6..afc0628 100644
--- a/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java
+++ b/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/export/BuildDevice.java
@@ -59,21 +59,11 @@
root.addNode(spec);
return root;
}
-
- private static Device buildRootDeviceNode(Node root,ServiceReference sr){
- Node dev = new Node(Device.ELEM_NAME);
- root.addNode(dev);
- DeviceData dd = new DeviceData();
- dd.setDescriptionURI("/gen-desc.xml");
- dev.setUserData(dd);
- Device devUPnP = new Device(root,dev);
-
+ private static String extractDeviceType(ServiceReference sr) {
Object aux = sr.getProperty(UPnPDevice.TYPE);
- if(aux==null){
- devUPnP.setDeviceType(null);
- }else if(aux instanceof String){
- devUPnP.setDeviceType((String) aux);
+ if(aux instanceof String){
+ return (String) aux;
}else if(aux instanceof String[]){
//The property key UPnP.device.type should be a String
String[] v = (String[]) aux;
@@ -87,9 +77,21 @@
maxindex=i;
}
}
- devUPnP.setDeviceType(v[maxindex]);
+ return v[maxindex];
+ }else{
+ return "";
}
-
+ }
+
+ private static Device buildRootDeviceNode(Node root, ServiceReference sr){
+ Node dev = new Node(Device.ELEM_NAME);
+ root.addNode(dev);
+ DeviceData dd = new DeviceData();
+ dd.setDescriptionURI("/gen-desc.xml");
+ dev.setUserData(dd);
+ Device devUPnP = new Device(root,dev);
+
+ devUPnP.setDeviceType(extractDeviceType(sr));
devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
devUPnP.setManufactureURL((String) sr.getProperty(UPnPDevice.MANUFACTURER_URL));
@@ -139,6 +141,7 @@
Device devUPnP = new Device(dev);
+ devUPnP.setDeviceType(extractDeviceType(sr));
devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
devUPnP.setManufactureURL((String) sr.getProperty(UPnPDevice.MANUFACTURER_URL));