Package org.osgi.framework

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


        public void add(ServiceReference ref, ResourceHandler handler) {
            String filterString = (String) ref.getProperty("filter");
            try {
                Filter filter = m_context.createFilter(filterString);
                for (int i = 0; i < m_resources.length; i++) {
                    if (filter.match(ResourceUtil.createProperties(m_resources[i]))) {
                        handler.added(m_resources[i]);
                    }
                }
            }
            catch (InvalidSyntaxException e) {
View Full Code Here


        public void remove(ServiceReference ref, ResourceHandler handler) {
            String filterString = (String) ref.getProperty("filter");
            try {
                Filter filter = m_context.createFilter(filterString);
                for (int i = 0; i < m_resources.length; i++) {
                    if (filter.match(ResourceUtil.createProperties(m_resources[i]))) {
                        handler.removed(m_resources[i]);
                    }
                }
            }
            catch (InvalidSyntaxException e) {
View Full Code Here

            }
            synchronized (m_handlers) {
                m_handlers.put(handler, filter);
            }
            for (int i = 0; i < m_resources.length; i++) {
                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
                    handler.added(m_resources[i]);
                }
            }
        }
View Full Code Here

            }
            synchronized (m_handlers) {
                m_handlers.put(handler, filter);
            }
            for (int i = 0; i < m_resources.length; i++) {
                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
                    handler.added(m_resources[i]);
                }
            }
        }
View Full Code Here

            }
            synchronized (m_handlers) {
                m_handlers.put(handler, filter);
            }
            for (int i = 0; i < m_resources.length; i++) {
                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
                    System.out.println("ResourceProvider: calling handled.added(" + m_resources[i] + ")");
                    handler.added(m_resources[i], null);
                }
            }
        }
View Full Code Here

            // write back the byte if it needs to be included in the key or the value.
            bytes[current++] = bytes[i];
          }
        }
                if ((filter == null)
                        || filter.match(new MapToDictionary(headers)))
                {
                    bundles.add(new BundleDescriptor(loader, getParentURL(manifestURL),
                            headers));
                }
            }
View Full Code Here

       
        Dictionary<String, Object> props =
            new Hashtable<String, Object>(ed.getProperties());
       
        return filter != null
            ? filter.match(props)
            : false;
    }
   
    private Filter createFilter(String filterValue) {       
        if (filterValue == null) {
View Full Code Here

                // Determine if the registered services matches the search
                // criteria.
                boolean matched = false;

                // If className is null, then look at filter only.
                if ((className == null) && ((filter == null) || filter.match(reg.getProperties()))) {
                    matched = true;
                } else if (className != null) {
                    // If className is not null, then first match the
                    // objectClass property before looking at the
                    // filter.
View Full Code Here

                    // objectClass property before looking at the
                    // filter.
                    Dictionary props = ((ServiceRegistrationImpl) reg).getProperties();
                    String[] objectClass = (String[]) props.get(Constants.OBJECTCLASS);
                    for (int classIdx = 0; classIdx < objectClass.length; classIdx++) {
                        if (objectClass[classIdx].equals(className) && ((filter == null) || filter.match(props))) {
                            matched = true;
                            break;
                        }
                    }
                }
View Full Code Here

                            Set<Map.Entry<String, Object>> entries = props.entrySet();
                            for (Map.Entry<String, Object> entry : entries) {
                                d.put(entry.getKey(), entry.getValue());
                            }

                            if (f.match(d)) {
                                LOG.fine("MATCHED " + epd + "against " + currentScope);
                                LOG.info("calling EndpointListener endpointRemoved: " + epl + "from bundle "
                                         + sref.getBundle().getSymbolicName() + " for endpoint: " + epd);

                                epl.endpointRemoved(epd, currentScope);
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.