Package org.osgi.framework

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


                            d.put(entry.getKey(), entry.getValue());
                        }

                        LOG.fine("matching " + epd + " against " + currentScope);

                        if (f.match(d)) {
                            LOG.fine("MATCHED " + epd + "against " + currentScope);

                            LOG.info("scheduling EndpointListener call for listener ; " + epl
                                     + "  from bundle  " + sref.getBundle().getSymbolicName()
                                     + " based on scope [" + currentScope + "]");
View Full Code Here


            boolean matched;
            if (f == null) {
                matched = true;
            } else {
                matched = f.match(properties);
            }


            if (matched) {
                matchedList.add(configuration);
View Full Code Here

        // walking through all of the ones that have 'service.guard'.
        for (Configuration config : getServiceGuardConfigs()) {
            Object guardFilter = config.getProperties().get(SERVICE_GUARD_KEY);
            if (guardFilter instanceof String) {
                Filter filter = myBundleContext.createFilter((String) guardFilter);
                if (filter.match(serviceReference)) {
                    definitionFound = true;
                    for (Enumeration<String> e = config.getProperties().keys(); e.hasMoreElements(); ) {
                        String key = e.nextElement();
                        String bareKey = key;
                        int idx = bareKey.indexOf('(');
View Full Code Here

            // walking through all of the ones that have 'service.guard'.
            for (Configuration config : getServiceGuardConfigs()) {
                Object guardFilter = config.getProperties().get(SERVICE_GUARD_KEY);
                if (guardFilter instanceof String) {
                    Filter filter = myBundleContext.createFilter((String) guardFilter);
                    if (filter.match(serviceReference)) {
                        foundMatchingConfig = true;
                        List<String> roles = new ArrayList<String>();
                        Specificity s = ACLConfigurationParser.
                                getRolesForInvocation(m.getName(), args, sig, config.getProperties(), roles);
                        if (s != Specificity.NO_MATCH) {
View Full Code Here

          for (Map.Entry<String, String> propertyPair : props.entrySet()) {
            hash.put(propertyPair.getKey(), propertyPair.getValue());
          }
        }

        result = f.match(hash);
      } catch (InvalidSyntaxException e) {
        logger.error(e.getMessage());
      }
    }
    logger.debug(LOG_EXIT,"isSatisfied", result );
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

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

      synchronized (analyzers) {
        for (Pair<ResourceAnalyzer, Filter> entry : analyzers) {
          ResourceAnalyzer analyzer = entry.getFirst();
          Filter filter = entry.getSecond();
         
          if (filter == null || filter.match(resource.getProperties())) {
            try {
              analyzer.analyzeResource(resource, caps, reqs);
            } catch (Exception e) {
              log(LogService.LOG_ERROR, MessageFormat.format("Error calling analyzer \"{0}\" on resource {1}.", analyzer.getClass().getName(), resource.getLocation()), e);
            }
View Full Code Here

        dictionary.put("SeRvIcE.pId", "USB-1232312452");
        dictionary.put("VeNdOr", "ericssin01");

        filter = new DefaultFilter(parser.parse("(&(service.pid=USB-1232312452)(|(vendor~=ericssin01)(vendor~=ibm))(!(vendor=ibm)))"));

        Assert.assertTrue(filter.match(dictionary));
    }
}
View Full Code Here

      throw new RuntimeException("Invalid filter: " + e.getFilter(), e);
    }
    Hashtable matchProps = new Hashtable(2);
    matchProps.put("location", bundleLocation);
    boolean negate = (args.length == 2) ? "!".equals(args[1]) : false;
    return (negate ^ filter.match(matchProps)) ? Condition.TRUE
        : Condition.FALSE;
  }

  private BundleLocationCondition() {
    // private constructor to prevent objects of this type
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.