Package org.osgi.framework

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


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


      throw new RuntimeException("Invalid filter: " + e.getFilter(), e);
    }
    Dictionary<String, String> matchProps = new Hashtable<String, String>(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

        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

                    Filter filter = FrameworkUtil.createFilter(filterString);
                    Collection<ServiceReference<?>> result = new ArrayList<ServiceReference<?>>();
                    synchronized (serviceReferences) {
                        for (Map.Entry<ServiceReference<?>, Dictionary<String, Object>> entry : serviceReferences
                            .entrySet()) {
                            if (filter.match(entry.getValue())) {
                                result.add(entry.getKey());
                            }
                        }
                        if (result.isEmpty()) {
                            return null;
View Full Code Here

    public void updateServiceListeners(int eventType, final ServiceReference<?> serviceReference,
            Dictionary<String, Object> dict) {
        synchronized (listeners) {
            for (Entry<ServiceListener, Filter> entry : listeners.entrySet()) {
                Filter filter = entry.getValue();
                if (filter == null || filter.match(dict)) {
                    entry.getKey().serviceChanged(new ServiceEvent(eventType, serviceReference));
                }
            }
        }
    }
View Full Code Here

                   
          Filter flt = getFilter();
          if( flt == null )
            return false;
         
          if( !flt.match( props ) )
            return false;
        }
      }
     
      if( !actionsVector.containsAll( other.actionsVector ) )
View Full Code Here

        Iterator<ServiceData> it = data.iterator();
       
        while (it.hasNext()) {
          ServiceData sd = it.next();
         
          if (!!!f.match(sd.getProperties())) it.remove();
        }
      }
     
      if (data.isEmpty()) return null;
     
View Full Code Here

        final AtomicReference<URLStreamHandlerService> serviceRef = new AtomicReference<URLStreamHandlerService>();
        ServiceTracker<URLStreamHandlerService, URLStreamHandlerService> tracker = new ServiceTracker<URLStreamHandlerService, URLStreamHandlerService>(bundleContext, URLStreamHandlerService.class, null) {
            @Override
            public URLStreamHandlerService addingService(ServiceReference<URLStreamHandlerService> sref) {
                URLStreamHandlerService service = super.addingService(sref);
                if (srvfilter == null || srvfilter.match(sref)) {
                    serviceRef.set(bundleContext.getService(sref));
                    latch.countDown();
                }
                return service;
            }
View Full Code Here

        final AtomicReference<T> serviceRef = new AtomicReference<T>();
        ServiceTracker<T, T> tracker = new ServiceTracker<T, T>(bundleContext, type, null) {
            @Override
            public T addingService(ServiceReference<T> sref) {
                T service = super.addingService(sref);
                if (srvfilter == null || srvfilter.match(sref)) {
                    serviceRef.set(bundleContext.getService(sref));
                    latch.countDown();
                }
                return service;
            }
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

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.