ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | oscar List | December 2005 Index

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

Re: [oscar] UPnPEventListener and Filter


Dear Andre, Richard, all
fisrt of all Merry Chrismas and all the best for the new year.

At a first glance, it seems that your filter doesn't implement the toString() method.
You should return a valid LDAP filter expression like:
String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.TYPE + "=" + serviceType + "))";

The parser fails because it reparses a filter composed with your filter:
           ServiceReference serRef = event.getServiceReference();
           Object obj = serRef.getProperty(UPnPEventListener.UPNP_FILTER);
           /* obtain interested devices for the listener */
           ServiceReference[] devicesRefs = null;
           if (obj != null) {
               Filter filter = (Filter) obj;
               String filtra = filter.toString();    <---- YOUR FILTER

String newfilter = "(&" + filtra + IMPORT_FLTR + ")"; try { devicesRefs = context.getServiceReferences(UPnPDevice.class.getName(), newfilter); <-- here generates the error ......


We invoke indirectly the OSCAR's Filter implementation (see getServiceReferences(classname, filterstring));
so I guess it is the new composed filter the source of the error.

try to add a toString() method to your code.
Let me know  if it works ....

ciao
francesco









Richard S. Hall ha scritto:

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(BundleContex
tImpl.java:246)
        at
it.cnr.isti.niche.osgi.upnp.basedriver.importer.core.MyCtrlPoint.service
Changed(MyCtrlPoint.java:450)
        at
org.ungoverned.oscar.util.ServiceListenerWrapper.serviceChanged(ServiceL
istenerWrapper.java:129)
        at org.ungoverned.oscar.Oscar$7.dispatch(Oscar.java:3584)
        at
org.ungoverned.oscar.util.OscarDispatchQueue.dispatch(OscarDispatchQueue
.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(BundleContextImpl
.java:143)
        at
org.ungoverned.oscar.BundleContextImpl.registerService(BundleContextImpl
.java:137)
        at
com.francetelecom.upnp.controlpoint.UPnPEventTest.test(UPnPEventTest.jav
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.getNa
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




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

Reply via email to:

Powered by MHonArc.

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