felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From furf...@apache.org
Subject svn commit: r416694 - in /incubator/felix/trunk: org.apache.felix.upnp.sample.binaryLight/src/main/java/org/apache/felix/upnp/sample/binaryLight/ org.apache.felix.upnp.sample.clock/src/main/java/org/apache/felix/upnp/sample/clock/ org.apache.felix.upnp...
Date Fri, 23 Jun 2006 12:15:55 GMT
Author: furfari
Date: Fri Jun 23 05:15:54 2006
New Revision: 416694

URL: http://svn.apache.org/viewvc?rev=416694&view=rev
Log:
Implemented ServiceEvent.MODIFIED for tracking UPnPEventListeners in the UPnP examples  (Felix-68)

Modified:
    incubator/felix/trunk/org.apache.felix.upnp.sample.binaryLight/src/main/java/org/apache/felix/upnp/sample/binaryLight/UPnPEventNotifier.java
    incubator/felix/trunk/org.apache.felix.upnp.sample.clock/src/main/java/org/apache/felix/upnp/sample/clock/UPnPEventNotifier.java
    incubator/felix/trunk/org.apache.felix.upnp.sample.tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPEventNotifier.java

Modified: incubator/felix/trunk/org.apache.felix.upnp.sample.binaryLight/src/main/java/org/apache/felix/upnp/sample/binaryLight/UPnPEventNotifier.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.upnp.sample.binaryLight/src/main/java/org/apache/felix/upnp/sample/binaryLight/UPnPEventNotifier.java?rev=416694&r1=416693&r2=416694&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.upnp.sample.binaryLight/src/main/java/org/apache/felix/upnp/sample/binaryLight/UPnPEventNotifier.java
(original)
+++ incubator/felix/trunk/org.apache.felix.upnp.sample.binaryLight/src/main/java/org/apache/felix/upnp/sample/binaryLight/UPnPEventNotifier.java
Fri Jun 23 05:15:54 2006
@@ -47,13 +47,17 @@
 	Properties UPnPTargetListener;
 	String serviceId;
 	Vector upnpListeners = new Vector();
+	private String serviceType;
+	private String deviceType;
 	
 	public UPnPEventNotifier(BundleContext context,String deviceId,UPnPService service,EventSource
source){
 		this.context=context;
-		this.deviceId=deviceId;
 		this.service=service;
 		this.source=source;
+		this.deviceId=deviceId;
+		this.deviceType = "urn:schemas-upnp-org:device:BinaryLight:1";
 		this.serviceId=service.getId();
+		this.serviceType = service.getType();
 		setupUPnPListenerHouseKeeping(deviceId);
 	}
 	
@@ -64,6 +68,8 @@
 		UPnPTargetListener = new Properties();
 		UPnPTargetListener.put(UPnPDevice.ID,deviceId);
 		UPnPTargetListener.put(UPnPService.ID,serviceId);
+		UPnPTargetListener.put(UPnPService.TYPE,serviceType);
+		UPnPTargetListener.put(UPnPDevice.TYPE,deviceType);
 		String ANY_UPnPEventListener = "("+Constants.OBJECTCLASS+"="+UPnPEventListener.class.getName()+")";
 		
 		ServiceReference[] listeners = null; 
@@ -150,6 +156,15 @@
 			};break;
 			
 			case ServiceEvent.MODIFIED:{				
+	               ServiceReference sr = e.getServiceReference();
+	               Filter filter = (Filter)	sr.getProperty(UPnPEventListener.UPNP_FILTER);
+	               removeListener(sr);
+	               if (filter == null)
+	                   addNewListener(sr);
+	               else {
+	                   if (filter.match(UPnPTargetListener))
+	                       addNewListener(sr);
+	               }
 			};break;
 			
 			case ServiceEvent.UNREGISTERING:{	

Modified: incubator/felix/trunk/org.apache.felix.upnp.sample.clock/src/main/java/org/apache/felix/upnp/sample/clock/UPnPEventNotifier.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.upnp.sample.clock/src/main/java/org/apache/felix/upnp/sample/clock/UPnPEventNotifier.java?rev=416694&r1=416693&r2=416694&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.upnp.sample.clock/src/main/java/org/apache/felix/upnp/sample/clock/UPnPEventNotifier.java
(original)
+++ incubator/felix/trunk/org.apache.felix.upnp.sample.clock/src/main/java/org/apache/felix/upnp/sample/clock/UPnPEventNotifier.java
Fri Jun 23 05:15:54 2006
@@ -156,6 +156,15 @@
 			};break;
 			
 			case ServiceEvent.MODIFIED:{				
+	               ServiceReference sr = e.getServiceReference();
+	               Filter filter = (Filter)	sr.getProperty(UPnPEventListener.UPNP_FILTER);
+	               removeListener(sr);
+	               if (filter == null)
+	                   addNewListener(sr);
+	               else {
+	                   if (filter.match(UPnPTargetListener))
+	                       addNewListener(sr);
+	               }
 			};break;
 			
 			case ServiceEvent.UNREGISTERING:{	

Modified: incubator/felix/trunk/org.apache.felix.upnp.sample.tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPEventNotifier.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.upnp.sample.tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPEventNotifier.java?rev=416694&r1=416693&r2=416694&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.upnp.sample.tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPEventNotifier.java
(original)
+++ incubator/felix/trunk/org.apache.felix.upnp.sample.tv/src/main/java/org/apache/felix/upnp/sample/tv/UPnPEventNotifier.java
Fri Jun 23 05:15:54 2006
@@ -156,6 +156,15 @@
 			};break;
 			
 			case ServiceEvent.MODIFIED:{				
+	               ServiceReference sr = e.getServiceReference();
+	               Filter filter = (Filter)	sr.getProperty(UPnPEventListener.UPNP_FILTER);
+	               removeListener(sr);
+	               if (filter == null)
+	                   addNewListener(sr);
+	               else {
+	                   if (filter.match(UPnPTargetListener))
+	                       addNewListener(sr);
+	               }
 			};break;
 			
 			case ServiceEvent.UNREGISTERING:{	



Mime
View raw message