Class WorkspaceClassIndex

java.lang.Object
aQute.bnd.build.WorkspaceClassIndex
All Implemented Interfaces:
AutoCloseable

class WorkspaceClassIndex extends Object implements AutoCloseable
  • Field Details

  • Constructor Details

    • WorkspaceClassIndex

      WorkspaceClassIndex(Workspace workspace)
  • Method Details

    • search

      Result<Map<String,List<BundleId>>,String> search(String partialFqn) throws Exception
      Search for the bundles that export the given partialFqn. A partialFqn is either a package name, package prefix or a full FQN class name.

      The result is a map that has the full class name (FQN) as the key and a list of bundle ids as value.

      This method uses a heuristic to split the FQN into its package and class portion - the first element that starts with a capital letter is taken to be the top-level class - everything after that is nested classes, everything before that is the package hierarchy. This method is pretty good for most cases, but not perfect. If your calling context has a more reliable way to split the FQN into the package and class name portions, you will get more accurate results by using the search(String, String) method.

      Parameters:
      partialFqn - package and/or class name
      Returns:
      a multimap of fqn|pack->bundleid
      Throws:
      Exception
      See Also:
    • search

      public Result<Map<String,List<BundleId>>,String> search(String packageName, String className) throws Exception
      Search for the bundles that export the given class from the specified package.

      The result is a map that has the full class name (FQN) as the key and a list of bundle ids as value.

      Parameters:
      packageName - the package in which to search for the matching class.
      className - the name of the class to search for.
      Returns:
      a multimap of fqn|pack->bundleid
      Throws:
      Exception
      See Also:
    • matchClassNameAgainstResource

      private String matchClassNameAgainstResource(String binaryClassName, List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId,String> result)
    • addLongestMatchingPackagePrefix

      private void addLongestMatchingPackagePrefix(String packageName, List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId,String> result)
    • getMatchingResources

      private Map<org.osgi.resource.Resource,List<org.osgi.resource.Capability>> getMatchingResources(String filter) throws Exception
      Throws:
      Exception
    • createFilter

      private String createFilter(String packageName, String className)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable