Package org.osgi.framework

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


           
            List matchingRoles = new ArrayList();
            Iterator rolesIter = roles.iterator();
            while (rolesIter.hasNext()) {
                Role role = (Role) rolesIter.next();
                if ((filter == null) || filter.match(role.getProperties())) {
                    matchingRoles.add(role);
                }
            }

            Role[] result = new Role[matchingRoles.size()];
View Full Code Here


        List matchingRoles = new ArrayList();
        Iterator rolesIter = roles.iterator();
        while (rolesIter.hasNext()) {
            Role role = (Role) rolesIter.next();
            if ((filter == null) || filter.match(role.getProperties())) {
                matchingRoles.add(role);
            }
        }

        Role[] result = new Role[matchingRoles.size()];
View Full Code Here

        }
        catch (Exception ex)
        {
            assertTrue("Filter should parse: " + ex, false);
        }
        assertFalse("Filter should not match: " + filter, filter.match(dict));
    }
}
View Full Code Here

      Filter filter = Util.createFilter("(%s=%s)", data);
     
     
      Properties matching = new Properties();
      matching.put(Constants.DEVICE_CATEGORY, new String[]{"dummy", "nonsense"});
      Assert.assertTrue("matching filter does not match", filter.match(matching));
     
      Properties notmatching = new Properties();
      notmatching.put(Constants.DEVICE_CATEGORY, new String[]{"lummy", "nonsense"});
      Assert.assertFalse("notmatching filter does match", filter.match(notmatching));
View Full Code Here

      matching.put(Constants.DEVICE_CATEGORY, new String[]{"dummy", "nonsense"});
      Assert.assertTrue("matching filter does not match", filter.match(matching));
     
      Properties notmatching = new Properties();
      notmatching.put(Constants.DEVICE_CATEGORY, new String[]{"lummy", "nonsense"});
      Assert.assertFalse("notmatching filter does match", filter.match(notmatching));

     
    }
   
View Full Code Here

            Filter f = getBundleContext().createFilter(filter);
            ArrayList list = new ArrayList(allBundles.length);
            final String localeString = locale.toString();
            for (int i = 0, size = allBundles.length; i < size; i++)
            {
                if (f.match(allBundles[i].getHeaders(localeString)))
                {
                    list.add(allBundles[i]);
                }
            }
            bundles = new Bundle[list.size()];
View Full Code Here

        List matchingRoles = new ArrayList();
        Iterator rolesIter = roles.iterator();
        while (rolesIter.hasNext()) {
            Role role = (Role) rolesIter.next();
            if ((filter == null) || filter.match(role.getProperties())) {
                matchingRoles.add(role);
            }
        }

        Role[] result = new Role[matchingRoles.size()];
View Full Code Here

            }
            else
            {
                final Dictionary props = new Hashtable();
                props.put( type, pid );
                if ( filter.match( props ) )
                {
                    pidMap.put( pid, ocd.getName() );
                }
            }
        }
View Full Code Here

        {
            resources = repos[repoIdx].getResources();
            for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++)
            {
                dict.setSourceMap(resources[resIdx].getProperties());
                if (filter == null || filter.match(dict))
                {
                    matchList.add(resources[resIdx]);
                }
            }
        }
View Full Code Here

        DBCursor cursor = coll.find();
        try {
            while (cursor.hasNext()) {
                // Hmm, there might be a more clever way of doing this...
                Role role = m_helper.deserialize(cursor.next());
                if ((filter == null) || filter.match(role.getProperties())) {
                    roles.add(role);
                }
            }
        } finally {
            cursor.close();
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.