Package org.osgi.framework

Examples of org.osgi.framework.Filter


     */
    public Osgi2Jini() throws Exception {
        try {
            RMICodeBaseService.getRMICodeBaseService("/RMI");

            Filter filter = Activator.bc.createFilter("(&(" +
                    org.osgi.service.device.Constants.DEVICE_CATEGORY + "=" +
                    JiniDriver.DEVICE_CATEGORY + ")(" + JiniDriver.EXPORT +
                    "=*))");
            ServiceTrackerCustomizer serviceTrackerCustomizer = new JiniExporter();
            serviceTracker = new ServiceTracker(Activator.bc, filter,
View Full Code Here


    filterC.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          String filterS = filterC.getText().trim();
          try {
            if(filterS.length() > 0) {
              Filter f = org.knopflerfish.bundle.desktop.swing.Activator.getBC().createFilter(filterS);
            }
            filterC.setToolTipText("Event filter");
            filterC.setForeground(txtColor);
            JEventPanel.this.model.clear();
            JEventPanel.this.model.getDispatcher().setFilter(filterS);
View Full Code Here

            return null;
        }
        Filter[] filters = new Filter[selection.length];
        for (int i = 0; i < selection.length; ++i) {
            String current = selection[i];
            Filter filter = null;
            if (isInteger(current)) {
                filter = tryToCreateFilterFromIndex(session, current);
            } else if (startsWithParenthesis(current)) {
                filter = tryToCreateFilterFromLdapExpression(current);
            } else {
View Full Code Here

              }
              if (filterString == null) {
                matchingConfigurations.addElement(new ConfigurationImpl(d));
              }
              else {
                Filter filter = Activator.bc.createFilter(filterString);
                if (filter.match(d)) {                        if(callingBundleLocation == null){
                  matchingConfigurations.addElement(new ConfigurationImpl(d));
                }
                else{
                  if(callingBundleLocation.equals((String) d.get(ConfigurationAdmin.SERVICE_BUNDLELOCATION))){
                    matchingConfigurations.addElement(new ConfigurationImpl(d));
View Full Code Here

        }

        List sf = (List)params.get(Constants.SELECTION_FILTER_ATTRIBUTE);
        if (sf != null) {
          if (sf.size() == 1) {
            Filter filter = null;
            try {
              filter = bc.createFilter((String)sf.get(0));
            } catch (InvalidSyntaxException e) {
              // I really hate checked exceptions
              throw new RuntimeException("wtf", e);
            }
            if (!filter.match(fwprops)) {
              continue;
            }
          } else {
            //NYI! complain about faulty selection
          }
View Full Code Here

  private class Subscription implements UPnPEventListener{
      ServiceRegistration registration;
     
      Subscription(String keys){
       try {
        Filter filter = context.createFilter(keys);
        Properties props = new Properties();
        props.put(UPnPEventListener.UPNP_FILTER, filter);
        registration = context.registerService(UPnPEventListener.class.getName(), this, props);
      }catch (Exception ex){
        System.out.println(ex);
View Full Code Here

      try {
        listeners = context.getServiceReferences(UPnPEventListener.class.getName(),null);
        if (listeners != null){
          for (int i = 0;i<listeners.length;i++){
            ServiceReference sr = listeners[i];
            Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
            if (filter == null) upnpListeners.add(sr);
            else {       
              if (filter.match(UPnPTargetListener))
                addNewListener(sr);
            }
          }
        }
      } catch (Exception ex) {
View Full Code Here

  public void serviceChanged(ServiceEvent e) {
    ServiceReference sr = e.getServiceReference();   
    synchronized (LOCK) {     
      switch(e.getType()){
        case ServiceEvent.REGISTERED:{
          Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
          if (filter == null) {
            addNewListener(sr);
            doNotify(sr);
          }
          else {       
            if (filter.match(UPnPTargetListener)){
              addNewListener(sr);
              doNotify(sr);
            }
          }
        };break;
       
        case ServiceEvent.MODIFIED:{       
                   Filter filter = (Filtersr.getProperty(UPnPEventListener.UPNP_FILTER);
                   removeListener(sr);
                   if (filter == null)
                       addNewListener(sr);
                   else {
                       if (filter.match(UPnPTargetListener))
                           addNewListener(sr);
                   }
        };break;
       
        case ServiceEvent.UNREGISTERING:
View Full Code Here

      } else {
        Hashtable props = new Hashtable();
        props.put("pid", other.applicationDescriptor.getApplicationId());
        props.put("signer", new SignerWrapper(other.applicationDescriptor));

        Filter flt = getFilter();
        if (flt == null)
          return false;

        if (!flt.match(props))
          return false;
      }
    }

    if (!actionsVector.containsAll(other.actionsVector))
View Full Code Here

    if ((effective & desired) != desired) {
      return false;
    }

    /* Get our filter */
    Filter f = filter;
    if (f == null) {
      // it's "*"
      return true;
    }
    /* is requested a wildcard filter? */
    if (requested.subsystem == null) {
      return false;
    }
    Map<String, Object> requestedProperties = requested.getProperties();
    if (requestedProperties == null) {
      /*
       * If the requested properties are null, then we have detected a
       * recursion getting the subsystem location. So we return true to
       * permit the subsystem location request in the SubsystemPermission
       * check up the stack to succeed.
       */
      return true;
    }
    return f.matches(requestedProperties);
  }
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.