ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | oscar List | January 2006 Index

<--  Date Index  --> <--  Thread Index  -->

Re:RE: [oscar] UPnPEventListener and Filter


Hi André,
yes, your IDE didn't see any error because it takes the default toString() method of the basic Object class, but the toString() method in the Filter interface has a specific meaning. At this point, if you need to create filters on fly, look at the OSGi utility BundleContext.createFilter(String filter).

The Domoware base driver first does some checking in order to avoid ClassCast Exceptions ...


ciao
francesco


BOTTARO Andre RD-MAPS-GRE wrote:
OK, I understand now. The toString method is abstract in 
org.osgi.framework.Filter interface. So I had to implement it even if my IDE 
didn't see any error... It works fine now.

For your information, there wasn't any thrown exception with another UPnP 
Base Driver, that's why I was surprised by the behaviour of Domoware one.

André


-----Message d'origine-----
De : Richard S. Hall [mailto:heavy@xxxxxxxxxxxxxx] Envoyé : vendredi 23 décembre 2005 20:09
À : oscar@xxxxxxxxxxxxx
Objet : Re: [oscar] UPnPEventListener and Filter

BOTTARO Andre RD-MAPS-GRE wrote:

Yes, it seems that the Domoware driver misuses the oscar framework.


Actually, it seems that the filter implementation in your code doesn't fully 
implement the interface contract. :-)

-> richard


-----Message d'origine-----
De : Richard S. Hall [mailto:heavy@xxxxxxxxxxxxxx] Envoyé : vendredi 23 décembre 2005 16:10 À : oscar@xxxxxxxxxxxxx Objet : Re: [oscar] UPnPEventListener and Filter

Just a guess, but it looks like the UPnP code does a "toString()" on your 
filter and then passes it into Oscar's FilterImpl to reparse it, which gives you the 
parsing error, because that code it in the FilterImpl constructor.

-> richard

BOTTARO Andre RD-MAPS-GRE wrote:

I would like to listen to UPnP events coming from a Service with a given ID. I wrote the following Java code with respect to OSGi R3 spec but I got this exception at runtime with Domoware UPnP Base Driver
3.0.1 above Oscar 1.0.5:

org.osgi.framework.InvalidSyntaxException: expected filtercomp
       at org.ungoverned.oscar.FilterImpl.<init>(FilterImpl.java:88)
       at
org.ungoverned.oscar.Oscar.getServiceReferences(Oscar.java:2792)
       at
org.ungoverned.oscar.BundleContextImpl.getServiceReferences(BundleCon
t
ex
tImpl.java:246)
       at
it.cnr.isti.niche.osgi.upnp.basedriver.importer.core.MyCtrlPoint.serv
i
ce
Changed(MyCtrlPoint.java:450)
       at
org.ungoverned.oscar.util.ServiceListenerWrapper.serviceChanged(Servi
c
eL
istenerWrapper.java:129)
       at org.ungoverned.oscar.Oscar$7.dispatch(Oscar.java:3584)
       at
org.ungoverned.oscar.util.OscarDispatchQueue.dispatch(OscarDispatchQu
e
ue
.java:92)
       at org.ungoverned.oscar.Oscar.fireServiceEvent(Oscar.java:3590)
       at org.ungoverned.oscar.Oscar.registerService(Oscar.java:2755)
       at
org.ungoverned.oscar.BundleContextImpl.registerService(BundleContextI
m
pl
.java:143)
       at
org.ungoverned.oscar.BundleContextImpl.registerService(BundleContextI
m
pl
.java:137)
       at
com.francetelecom.upnp.controlpoint.UPnPEventTest.test(UPnPEventTest.
j
av
a:1259)


Source code:
                UPnPEventListener listener = new UPnPEventListener(){
                        public void notifyUPnPEvent(String arg0, String arg1, 
Dictionary
arg2) {
                        }
                };
                Properties p = new Properties();
                p.put(UPnPEventListener.UPNP_FILTER, new Filter(){
                        public boolean match(ServiceReference ref) {
                                System.out.println("?????? Matching Service 
Reference:" + ref);
                                return false;
                        }
                        public boolean match(Dictionary dict) {
                                boolean matchesService =
dict.get(UPnPService.ID).equals(s.getService().getId());
                                if(matchesService){
                                        return true;
                                }
                                return false;
                        }}
                );
        
context.getBundleContext().registerService(UPnPEventListener.class.ge
t Na me(), listener, p); // UPnPEventTest.java:1259

        

---------------------------------------------------------------------
-
--


--
You receive this message as a subscriber of the oscar@xxxxxxxxxxxxx mailing 
list.
To unsubscribe: mailto:oscar-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


----------------------------------------------------------------------
--


--
You receive this message as a subscriber of the oscar@xxxxxxxxxxxxx mailing 
list.
To unsubscribe: mailto:oscar-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws




------------------------------------------------------------------------


--
You receive this message as a subscriber of the oscar@xxxxxxxxxxxxx mailing 
list.
To unsubscribe: mailto:oscar-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws






<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.