Package org.apache.felix.framework.capabilityset

Examples of org.apache.felix.framework.capabilityset.CapabilitySet


    m_fwkExecEnvStr = (fwkExecEnvStr != null) ? fwkExecEnvStr.trim() : null;
    m_fwkExecEnvSet = parseExecutionEnvironments(fwkExecEnvStr);

    List<String> indices = new ArrayList<String>();
    indices.add(BundleRevision.BUNDLE_NAMESPACE);
    m_capSets.put(BundleRevision.BUNDLE_NAMESPACE, new CapabilitySet(indices, true));

    indices = new ArrayList<String>();
    indices.add(BundleRevision.PACKAGE_NAMESPACE);
    m_capSets.put(BundleRevision.PACKAGE_NAMESPACE, new CapabilitySet(indices, true));

    indices = new ArrayList<String>();
    indices.add(BundleRevision.HOST_NAMESPACE);
    m_capSets.put(BundleRevision.HOST_NAMESPACE, new CapabilitySet(indices, true));
  }
View Full Code Here


      for (BundleCapability cap : caps) {
        // If the capability is from a different revision, then
        // don't index it since it is a capability from a fragment.
        // In that case, the fragment capability is still indexed.
        if (cap.getRevision() == br) {
          CapabilitySet capSet = m_capSets.get(cap.getNamespace());
          if (capSet == null) {
            capSet = new CapabilitySet(null, true);
            m_capSets.put(cap.getNamespace(), capSet);
          }
          capSet.addCapability(cap);
        }
      }
    }

    if (Util.isFragment(br)) {
View Full Code Here

      // We only need be concerned with declared capabilities here,
      // because resolved capabilities will be a subset.
      List<BundleCapability> caps = br.getDeclaredCapabilities(null);
      if (caps != null) {
        for (BundleCapability cap : caps) {
          CapabilitySet capSet = m_capSets.get(cap.getNamespace());
          if (capSet != null) {
            capSet.removeCapability(cap);
          }
        }
      }

      if (Util.isFragment(br)) {
View Full Code Here

     */
  public synchronized SortedSet<BundleCapability> getCandidates(BundleRequirement req, boolean obeyMandatory) {
//    BundleRevision reqRevision = req.getRevision();
    SortedSet<BundleCapability> result = new TreeSet<BundleCapability>(new CandidateComparator());

    CapabilitySet capSet = m_capSets.get(req.getNamespace());
    if (capSet != null) {
      // Get the requirement's filter; if this is our own impl we
      // have a shortcut to get the already parsed filter, otherwise
      // we must parse it from the directive.
      SimpleFilter sf = null;
      if (req instanceof BundleRequirementImpl) {
        sf = ((BundleRequirementImpl) req).getFilter();
      } else {
        String filter = req.getDirectives().get(
            Constants.FILTER_DIRECTIVE);
        if (filter == null) {
          sf = new SimpleFilter(null, null, SimpleFilter.MATCH_ALL);
        } else {
          sf = SimpleFilter.parse(filter);
        }
      }

      // Find the matching candidates.
      Set<BundleCapability> matches = capSet.match(sf, obeyMandatory);
      for (BundleCapability cap : matches) {
        /* TODO: karl - is this correct?
         * if (System.getSecurityManager() != null) {
          if (req.getNamespace().equals(
              BundleRevision.PACKAGE_NAMESPACE)
View Full Code Here

    m_fwkExecEnvStr = (fwkExecEnvStr != null) ? fwkExecEnvStr.trim() : null;
    m_fwkExecEnvSet = parseExecutionEnvironments(fwkExecEnvStr);

    List<String> indices = new ArrayList<String>();
    indices.add(BundleRevision.BUNDLE_NAMESPACE);
    m_capSets.put(BundleRevision.BUNDLE_NAMESPACE, new CapabilitySet(indices, true));

    indices = new ArrayList<String>();
    indices.add(BundleRevision.PACKAGE_NAMESPACE);
    m_capSets.put(BundleRevision.PACKAGE_NAMESPACE, new CapabilitySet(indices, true));

    indices = new ArrayList<String>();
    indices.add(BundleRevision.HOST_NAMESPACE);
    m_capSets.put(BundleRevision.HOST_NAMESPACE, new CapabilitySet(indices, true));
  }
View Full Code Here

      for (BundleCapability cap : caps) {
        // If the capability is from a different revision, then
        // don't index it since it is a capability from a fragment.
        // In that case, the fragment capability is still indexed.
        if (cap.getRevision() == br) {
          CapabilitySet capSet = m_capSets.get(cap.getNamespace());
          if (capSet == null) {
            capSet = new CapabilitySet(null, true);
            m_capSets.put(cap.getNamespace(), capSet);
          }
          capSet.addCapability(cap);
        }
      }
    }

    if (Util.isFragment(br)) {
View Full Code Here

      // We only need be concerned with declared capabilities here,
      // because resolved capabilities will be a subset.
      List<BundleCapability> caps = br.getDeclaredCapabilities(null);
      if (caps != null) {
        for (BundleCapability cap : caps) {
          CapabilitySet capSet = m_capSets.get(cap.getNamespace());
          if (capSet != null) {
            capSet.removeCapability(cap);
          }
        }
      }

      if (Util.isFragment(br)) {
View Full Code Here

     */
  public synchronized SortedSet<BundleCapability> getCandidates(BundleRequirement req, boolean obeyMandatory) {
//    BundleRevision reqRevision = req.getRevision();
    SortedSet<BundleCapability> result = new TreeSet<BundleCapability>(new CandidateComparator());

    CapabilitySet capSet = m_capSets.get(req.getNamespace());
    if (capSet != null) {
      // Get the requirement's filter; if this is our own impl we
      // have a shortcut to get the already parsed filter, otherwise
      // we must parse it from the directive.
      SimpleFilter sf = null;
      if (req instanceof BundleRequirementImpl) {
        sf = ((BundleRequirementImpl) req).getFilter();
      } else {
        String filter = req.getDirectives().get(
            Constants.FILTER_DIRECTIVE);
        if (filter == null) {
          sf = new SimpleFilter(null, null, SimpleFilter.MATCH_ALL);
        } else {
          sf = SimpleFilter.parse(filter);
        }
      }

      // Find the matching candidates.
      Set<BundleCapability> matches = capSet.match(sf, obeyMandatory);
      for (BundleCapability cap : matches) {
        /* TODO: karl - is this correct?
         * if (System.getSecurityManager() != null) {
          if (req.getNamespace().equals(
              BundleRevision.PACKAGE_NAMESPACE)
View Full Code Here

        m_fwkExecEnvStr = (fwkExecEnvStr != null) ? fwkExecEnvStr.trim() : null;
        m_fwkExecEnvSet = parseExecutionEnvironments(fwkExecEnvStr);

        List<String> indices = new ArrayList<String>();
        indices.add(BundleRevision.BUNDLE_NAMESPACE);
        m_capSets.put(BundleRevision.BUNDLE_NAMESPACE, new CapabilitySet(indices, true));

        indices = new ArrayList<String>();
        indices.add(BundleRevision.PACKAGE_NAMESPACE);
        m_capSets.put(BundleRevision.PACKAGE_NAMESPACE, new CapabilitySet(indices, true));

        indices = new ArrayList<String>();
        indices.add(BundleRevision.HOST_NAMESPACE);
        m_capSets.put(BundleRevision.HOST_NAMESPACE,  new CapabilitySet(indices, true));
    }
View Full Code Here

    synchronized List<BundleCapability> findProvidersInternal(
        ResolverHookRecord record, BundleRequirement req, boolean obeyMandatory)
    {
        List<BundleCapability> result = new ArrayList<BundleCapability>();

        CapabilitySet capSet = m_capSets.get(req.getNamespace());
        if (capSet != null)
        {
            // Get the requirement's filter; if this is our own impl we
            // have a shortcut to get the already parsed filter, otherwise
            // we must parse it from the directive.
            SimpleFilter sf;
            if (req instanceof BundleRequirementImpl)
            {
                sf = ((BundleRequirementImpl) req).getFilter();
            }
            else
            {
                String filter = req.getDirectives().get(Constants.FILTER_DIRECTIVE);
                if (filter == null)
                {
                    sf = new SimpleFilter(null, null, SimpleFilter.MATCH_ALL);
                }
                else
                {
                    sf = SimpleFilter.parse(filter);
                }
            }

            // Find the matching candidates.
            Set<BundleCapability> matches = capSet.match(sf, obeyMandatory);
            // Filter matching candidates.
            for (BundleCapability cap : matches)
            {
                // Filter according to security.
                if (filteredBySecurity(req, cap))
View Full Code Here

TOP

Related Classes of org.apache.felix.framework.capabilityset.CapabilitySet

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.