Package org.osgi.framework

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


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


                    else if ("selection-filter".equals(key))
                    {
                        try
                        {
                            Filter selectionFilter = new DefaultFilter(framework.getParser().parse((String) parameters.get(key)));
                            if (!selectionFilter.match(framework.getProperties())) continue nextDescription;
                        }
                        catch (InvalidSyntaxException ise)
                        {
                            throw new BundleException("Invalid selection filter", ise);
                        }
View Full Code Here

    try {
      Filter f = filter == null ? null : ctx.createFilter(filter);
     
      for ( RegistryServiceReference ref : references.values() ) {
        if ( clazz == null || clazz.equals( ref.getInterface() ) ) {
          if ( f == null || f.match( new Hashtable(ref.getProperties()) ) ) {
            refs.add( ref );
          }
        }
      }
    } catch (InvalidSyntaxException e) {
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

        Filter filter = OSGiHelper.createFilter(context, filterValue);
        Hashtable<String, Object> props = new Hashtable<String, Object>(sd.getProperties());
        // Add two faked properties to make the filter match
        props.put(Constants.OBJECTCLASS, sd.getInterfaces());
        props.put(RemoteConstants.SERVICE_IMPORTED, "true");
        return filter != null ? filter.match(props) : false;
    }

    private Collection<String> removeTracker(EndpointListener listener) {
        return listenersToFilters.remove(listener);
    }
View Full Code Here

                // Skip system bundles
                continue;
            }
            try {
                Filter filter = listener.getBundleContext().createFilter(matchedFilter);
                if (!filter.match(new Hashtable<String, Object>(endpoint.getProperties()))) {
                    continue;
                }
            } catch (InvalidSyntaxException ex) {
                logger.log(Level.SEVERE, ex.getMessage(), ex);
                continue;
View Full Code Here

            f = FrameworkUtil.createFilter(filter);
        } catch (InvalidSyntaxException e) {
            throw new IllegalArgumentException(e);
        }
        Hashtable<String, Object> props = new Hashtable<String, Object>(endpointDescription.getProperties());
        return f.match(props);
    }

    private void importEndpoint(ListenerInfo listener, EndpointDescription ep) {
        ImportAction request = new ImportAction(ImportAction.Type.Add, listener, ep);
        try {
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 flt = getFilter();
          if( flt == null )
            return false;
         
          if( !flt.match( props ) )
            return false;
        }
      }
     
      if( !actionsVector.containsAll( other.actionsVector ) )
View Full Code Here

  public Configuration[] listConfigurations(String filterStr) throws IOException, InvalidSyntaxException {
    Filter filter = filterStr != null ? FrameworkUtil.createFilter(filterStr) : null;
   
    List<StaticConfiguration> result = new ArrayList<StaticConfiguration>(configsMap.size());
    for (StaticConfiguration config : configsMap.values()) {
      if (filter == null || filter.match(config.getProperties()))
        result.add(config);
    }
   
    return result.toArray(new Configuration[result.size()]);
  }
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.