Package org.osgi.framework

Examples of org.osgi.framework.Filter.match()


                {
                Constants.OBJECTCLASS, Device.class.getName(),
                org.osgi.service.device.Constants.DEVICE_CATEGORY, "*"
                }
            );
            return device.match( ref );
        }
        catch ( Exception e )
        {
            e.printStackTrace();
        }
View Full Code Here


    {
        try
        {
            Filter device = createFilter( "(%s=%s)", new Object[]
                { Constants.OBJECTCLASS, Device.class.getName() } );
            return device.match( ref );
        }
        catch ( Exception e )
        {
            e.printStackTrace();
        }
View Full Code Here

                                config.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION ) } );
                    continue;
                }

                // check filter
                if ( filter == null || filter.match( config ) )
                {
                    // ensure the service.pid and returned a cached config if available
                    ConfigurationImpl cfg = getCachedConfiguration( pid );
                    if ( cfg == null )
                    {
View Full Code Here

        }
        // Compute expression
        try
        {
            Filter filter = FrameworkUtil.createFilter(expr);
            return filter.match(dict);
        }
        catch (Exception ex)
        {
            throw new BundleException(
                "Error evaluating filter expression: " + expr, ex);
View Full Code Here

            EasyMock.expect(bc.getService(sr)).andReturn(dst).anyTimes();
           
            // set up the mock filter behaviour
            Dictionary<String, Object> d1 = new Hashtable<String, Object>();
            d1.put("blah", "5");
            EasyMock.expect(mockFilter.match(d1)).andReturn(true).anyTimes();
            Dictionary<String, Object> d2 = new Hashtable<String, Object>();
            d2.put("blah", "3");
            d2.put("boo", "hello");
            EasyMock.expect(mockFilter.match(d2)).andReturn(true).anyTimes();
           
View Full Code Here

            d1.put("blah", "5");
            EasyMock.expect(mockFilter.match(d1)).andReturn(true).anyTimes();
            Dictionary<String, Object> d2 = new Hashtable<String, Object>();
            d2.put("blah", "3");
            d2.put("boo", "hello");
            EasyMock.expect(mockFilter.match(d2)).andReturn(true).anyTimes();
           
            control.replay();
   
            // create the local discovery service
            LocalDiscoveryService lds = new LocalDiscoveryService(bc);
View Full Code Here

            while (matchedFilters.hasNext() && !matched) {
                String filterString = (String)matchedFilters.next();
                try {
                    Filter filter = context.createFilter(filterString);
                    matched =
                        filter.match(getProperties(notification, currInterface));
                } catch (InvalidSyntaxException ise) {
                    LOG.warning("invalid filter syntax: " + filterString);
                }
                if (matched) {
                    matches.add(currInterface);
View Full Code Here

    private boolean filterMatches(String filterValue,
                                  ServiceEndpointDescription sd) {
        Filter filter = createFilter(filterValue);
        return filter != null
               ? filter.match(getServiceProperties(null, sd))
               : false;
    }

    @SuppressWarnings("unchecked")
    private Dictionary<String, Object> getServiceProperties(String interfaceName,
View Full Code Here

        if (matchingInterfaces.size() == 0 && matchingFilters.size() > 0) {
            Iterator filters = matchingFilters.iterator();
            while (filters.hasNext()) {
                Filter f = control.createMock(Filter.class);
                dswContext.addFilter((String)filters.next(), f);
                f.match(EasyMock.isA(Dictionary.class));
                EasyMock.expectLastCall().andReturn(true);
            }
        }

        control.replay();
View Full Code Here

        Filter f = FrameworkUtil.createFilter(filter);
       
        Dictionary m = new Hashtable();
        m.put("a", "b");
       
        assertTrue(filter+" filter must match as uuid is missing",f.match(m));     
        m.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID , "MyUUID");
        assertFalse(filter+" filter must NOT match as uuid is the local one",f.match(m));
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.