Package aQute.bnd.build
Class WorkspaceClassIndex
- java.lang.Object
-
- aQute.bnd.build.WorkspaceClassIndex
-
- All Implemented Interfaces:
java.lang.AutoCloseable
class WorkspaceClassIndex extends java.lang.Object implements java.lang.AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description WorkspaceClassIndex(Workspace workspace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddLongestMatchingPackagePrefix(java.lang.String packageName, java.util.List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId,java.lang.String> result)voidclose()private java.lang.StringcreateFilter(java.lang.String packageName, java.lang.String className)private java.util.Map<org.osgi.resource.Resource,java.util.List<org.osgi.resource.Capability>>getMatchingResources(java.lang.String filter)private java.lang.StringmatchClassNameAgainstResource(java.lang.String binaryClassName, java.util.List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId,java.lang.String> result)(package private) Result<java.util.Map<java.lang.String,java.util.List<BundleId>>,java.lang.String>search(java.lang.String partialFqn)Search for the bundles that export the given partialFqn.Result<java.util.Map<java.lang.String,java.util.List<BundleId>>,java.lang.String>search(java.lang.String packageName, java.lang.String className)Search for the bundles that export the given class from the specified package.
-
-
-
Field Detail
-
workspace
final Workspace workspace
-
-
Constructor Detail
-
WorkspaceClassIndex
WorkspaceClassIndex(Workspace workspace)
-
-
Method Detail
-
search
Result<java.util.Map<java.lang.String,java.util.List<BundleId>>,java.lang.String> search(java.lang.String partialFqn) throws java.lang.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:
java.lang.Exception- See Also:
search(String, String)
-
search
public Result<java.util.Map<java.lang.String,java.util.List<BundleId>>,java.lang.String> search(java.lang.String packageName, java.lang.String className) throws java.lang.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:
java.lang.Exception- See Also:
search(String)
-
matchClassNameAgainstResource
private java.lang.String matchClassNameAgainstResource(java.lang.String binaryClassName, java.util.List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId,java.lang.String> result)
-
addLongestMatchingPackagePrefix
private void addLongestMatchingPackagePrefix(java.lang.String packageName, java.util.List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId,java.lang.String> result)
-
getMatchingResources
private java.util.Map<org.osgi.resource.Resource,java.util.List<org.osgi.resource.Capability>> getMatchingResources(java.lang.String filter) throws java.lang.Exception- Throws:
java.lang.Exception
-
createFilter
private java.lang.String createFilter(java.lang.String packageName, java.lang.String className)
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-