Package org.osgi.framework

Examples of org.osgi.framework.Filter


      }

      for (int i = 0; i < listeners.length; i++) {
        UPnPEventListener listener = (UPnPEventListener) context
            .getService(listeners[i]);
        Filter filter = (Filter) listeners[i]
            .getProperty(UPnPEventListener.UPNP_FILTER);
        if (filter == null) {
          for (int j = 0; j < eventedSers.size(); j++) {
            Service ser = (Service) eventedSers.elementAt(j);
            subQueue.enqueue(new FirstMessage(ser, listener));
          }
        } else {
          for (int j = 0; j < eventedSers.size(); j++) {
            Service ser = (Service) eventedSers.elementAt(j);
            serviceID = ser.getServiceID();
            serviceType = ser.getServiceType();
            hash.put(UPnPService.ID, serviceID);
            hash.put(UPnPService.TYPE, serviceType);
            boolean bool = filter.match(hash);
            if (bool) {
              subQueue.enqueue(new FirstMessage(ser, listener));
            }

          }
View Full Code Here


        }

        public Role[] getRoles(String filterValue) throws Exception {
            Collection roles = m_entries.values();

            Filter filter = null;
            if (filterValue != null) {
                filter = FrameworkUtil.createFilter(filterValue);
            }
           
            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

    }

    public Role[] getRoles(String filterValue) throws Exception {
        Collection roles = m_entries.values();

        Filter filter = null;
        if (filterValue != null) {
            filter = FrameworkUtil.createFilter(filterValue);
        }

        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

     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
     */
    public final void start(BundleContext context) throws Exception
    {
        this.context = context;
        Filter filter = context.createFilter("(|" //$NON-NLS-1$
            + '(' + OBJECTCLASS + "=org.osgi.service.obr.RepositoryAdmin)" //$NON-NLS-1$
            + '(' + OBJECTCLASS + "=org.apache.felix.bundlerepository.RepositoryAdmin)" //$NON-NLS-1$
            + ')');
        this.tracker = new ServiceTracker(context, filter, this);
        this.tracker.open();
View Full Code Here

        passwordQuery = PropertiesUtil.toString(conf.get(PROP_PWD_QUERY),
            DEFAULT_PWD_QUERY);
        roleQuery = PropertiesUtil.toString(conf.get(PROP_ROLE_QUERY), DEFAULT_ROLE_QUERY);
        datasourceName = PropertiesUtil.toString(conf.get(PROP_DS_NAME), DEFAULT_DS_NAME);

        Filter filter = context.createFilter("(&(objectClass=javax.sql.DataSource)"
            + "(dataSourceName=" + datasourceName + "))");
        dataSourceTracker = new ServiceTracker(context, filter, null);
        dataSourceTracker.open();
        registerLoginModuleFactory(context, conf);
    }
View Full Code Here

            synchronized (this) {
                isListening = m_isListening;
            }

            // Check if the subscriber's topic and filter match
            Filter filter = subscriberMetadata.getFilter();

            if (EventUtil.matches(topic, subscriberMetadata.getTopics())
                    && (filter == null || event.matches(filter))) {

                String name = subscriberMetadata.getName();
View Full Code Here

                "Listener not of type " + clazz.getName());
        }

        // See if we can simply update the listener, if so then
        // return immediately.
        Filter oldFilter = updateListener(bc, clazz, l, filter);
        if (oldFilter != null)
        {
            return oldFilter;
        }
View Full Code Here

                    if (info.getBundleContext().equals(bc) &&
                        (info.getListenerClass() == clazz) &&
                        (info.getListener() == l))
                    {
                        // The spec says to update the filter in this case.
                        Filter oldFilter = info.getParsedFilter();
                        ListenerInfo newInfo = new ListenerInfo(
                            info.getBundle(),
                            info.getBundleContext(),
                            info.getListenerClass(),
                            info.getListener(),
View Full Code Here

            {
                for (ListenerInfo info : entry.getValue())
                {
                    Bundle bundle = info.getBundle();
                    EventListener l = info.getListener();
                    Filter filter = info.getParsedFilter();
                    Object acc = info.getSecurityContext();

                    try
                    {
                        if (type == Request.FRAMEWORK_EVENT)
View Full Code Here

    {
        Dictionary dict = new Hashtable();
        dict.put("one", "one-value");
        dict.put("two", "two-value");
        dict.put("three", "three-value");
        Filter filter = null;
        try
        {
            filter = FrameworkUtil.createFilter("(missing=value)");
        }
        catch (Exception ex)
        {
            assertTrue("Filter should parse: " + ex, false);
        }
        assertFalse("Filter should not match: " + filter, filter.match(dict));
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.Filter

Copyright © 2018 www.massapicom. 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.