Class ResourceUtils
java.lang.Object
aQute.bnd.osgi.resource.ResourceUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.osgi.resource.Resourcestatic final Comparator<? super org.osgi.resource.Resource> A comparator that compares the identity versionsstatic final Comparator<org.osgi.resource.Requirement> static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends org.osgi.resource.Capability>
Tstatic <T extends org.osgi.resource.Requirement>
Tstatic <CAPABILITY extends org.osgi.resource.Capability, COLLECTION extends Collection<CAPABILITY>>
voidcapabilitiesAccumulator(COLLECTION collection, CAPABILITY capability) static <CAPABILITY extends org.osgi.resource.Capability, COLLECTION extends Collection<CAPABILITY>>
COLLECTIONcapabilitiesCombiner(COLLECTION leftCollection, COLLECTION rightCollection) static Stream<org.osgi.resource.Capability> capabilityStream(org.osgi.resource.Resource resource, String namespace) static <T extends org.osgi.resource.Capability>
Stream<T> capabilityStream(org.osgi.resource.Resource resource, String namespace, Class<T> type) static intcompareTo(org.osgi.resource.Resource a, org.osgi.resource.Resource b) Compare two resources.static org.osgi.resource.Requirementstatic Map<org.osgi.resource.Requirement, Collection<org.osgi.resource.Capability>> emptyProviders(Collection<? extends org.osgi.resource.Requirement> requirements) static Predicate<org.osgi.resource.Capability> filterMatcher(org.osgi.resource.Requirement requirement) static Predicate<org.osgi.resource.Capability> filterMatcher(org.osgi.resource.Requirement requirement, Function<String, Predicate<Map<String, Object>>> filter) filterPredicate(String filterString) static <CAPABILITY extends org.osgi.resource.Capability, COLLECTION extends Collection<CAPABILITY>>
Map<org.osgi.resource.Requirement, Collection<org.osgi.resource.Capability>> findProviders(Collection<? extends org.osgi.resource.Requirement> requirements, Function<? super org.osgi.resource.Requirement, COLLECTION> provider) static List<org.osgi.resource.Capability> findProviders(org.osgi.resource.Requirement requirement, Collection<? extends org.osgi.resource.Capability> capabilities) static Set<org.osgi.resource.Resource> getAllResources(org.osgi.service.repository.Repository repository) Return all resources from a repository as returned by the wildcard requirement, seecreateWildcardRequirement()static ResourceUtils.BundleCapgetBundleCapability(org.osgi.resource.Resource resource) static BundleIdgetBundleId(org.osgi.resource.Resource resource) static List<ResourceUtils.ContentCapability> getContentCapabilities(org.osgi.resource.Resource resource) getContentCapability(org.osgi.resource.Resource resource) static StringgetEffective(Map<String, String> directives) static StringgetIdentity(org.osgi.resource.Capability identityCapability) static StringgetIdentity(org.osgi.resource.Resource resource) getIdentityCapability(org.osgi.resource.Resource resource) static StringgetIdentityVersion(org.osgi.resource.Resource resource) getIndexedByResource(Collection<? extends org.osgi.resource.Capability> providers) getLocations(org.osgi.resource.Resource resource) static ResolutionDirectivegetResolution(org.osgi.resource.Requirement requirement) static Set<org.osgi.resource.Resource> getResources(Collection<? extends org.osgi.resource.Capability> providers) static URIgetURI(org.osgi.resource.Capability contentCapability) getURI(org.osgi.resource.Resource resource) static VersiongetVersion(org.osgi.resource.Capability cap) static VersiongetVersion(org.osgi.resource.Resource resource) static StringgetVersionAttributeForNamespace(String namespace) static booleanisEffective(org.osgi.resource.Requirement r, org.osgi.resource.Capability c) static booleanisFragment(org.osgi.resource.Resource resource) static booleanisInitialRequirement(org.osgi.resource.Resource resource) static Predicate<org.osgi.resource.Capability> matcher(org.osgi.resource.Requirement requirement) static Predicate<org.osgi.resource.Capability> matcher(org.osgi.resource.Requirement requirement, Function<String, Predicate<Map<String, Object>>> filter) static booleanmatches(org.osgi.resource.Requirement requirement, org.osgi.resource.Capability capability) static booleanmatches(org.osgi.resource.Requirement requirement, org.osgi.resource.Resource resource) static List<org.osgi.resource.Resource> sort(Collection<org.osgi.resource.Resource> resources) static List<org.osgi.resource.Resource> sortByNameVersion(Collection<org.osgi.resource.Resource> resources) Sort the resources by symbolic name and versionstatic StringstripDirective(String name) static <CAPABILITY extends org.osgi.resource.Capability>
Collector<CAPABILITY, List<CAPABILITY>, List<CAPABILITY>> static StringtoProvideCapability(org.osgi.resource.Capability capability) static StringtoRequireCapability(org.osgi.resource.Requirement requirement) static Versionstatic VersionedClausetoVersionClause(org.osgi.resource.Resource resource) Create a VersionedClause by applying a version range mask to the resource! Masks are defined byMacro._range(String[]).static VersionedClausetoVersionClause(org.osgi.resource.Resource resource, String mask) static List<VersionedClause> toVersionedClauses(Collection<org.osgi.resource.Resource> resources)
-
Field Details
-
REQUIREMENT_COMPARATOR
-
IDENTITY_VERSION_COMPARATOR
A comparator that compares the identity versions -
DUMMY_RESOURCE
public static final org.osgi.resource.Resource DUMMY_RESOURCE -
WORKSPACE_NAMESPACE
- See Also:
-
-
Constructor Details
-
ResourceUtils
public ResourceUtils()
-
-
Method Details
-
capabilityStream
-
capabilityStream
-
getContentCapability
public static ResourceUtils.ContentCapability getContentCapability(org.osgi.resource.Resource resource) -
getURI
-
getContentCapabilities
public static List<ResourceUtils.ContentCapability> getContentCapabilities(org.osgi.resource.Resource resource) -
getIdentityCapability
public static ResourceUtils.IdentityCapability getIdentityCapability(org.osgi.resource.Resource resource) -
getBundleId
-
getIdentityVersion
-
getBundleCapability
-
toVersion
-
getVersion
-
getURI
-
getVersionAttributeForNamespace
-
as
public static <T extends org.osgi.resource.Capability> T as(org.osgi.resource.Capability cap, Class<T> type) -
as
public static <T extends org.osgi.resource.Requirement> T as(org.osgi.resource.Requirement req, Class<T> type) -
getResources
public static Set<org.osgi.resource.Resource> getResources(Collection<? extends org.osgi.resource.Capability> providers) -
getIndexedByResource
public static Map<org.osgi.resource.Resource, List<org.osgi.resource.Capability>> getIndexedByResource(Collection<? extends org.osgi.resource.Capability> providers) -
createWildcardRequirement
public static org.osgi.resource.Requirement createWildcardRequirement() -
isEffective
public static boolean isEffective(org.osgi.resource.Requirement r, org.osgi.resource.Capability c) -
filterPredicate
-
matches
public static boolean matches(org.osgi.resource.Requirement requirement, org.osgi.resource.Resource resource) -
matches
public static boolean matches(org.osgi.resource.Requirement requirement, org.osgi.resource.Capability capability) -
matcher
public static Predicate<org.osgi.resource.Capability> matcher(org.osgi.resource.Requirement requirement) -
matcher
-
filterMatcher
public static Predicate<org.osgi.resource.Capability> filterMatcher(org.osgi.resource.Requirement requirement) -
filterMatcher
-
getEffective
-
getResolution
-
toRequireCapability
-
toProvideCapability
-
getLocations
-
findProviders
public static List<org.osgi.resource.Capability> findProviders(org.osgi.resource.Requirement requirement, Collection<? extends org.osgi.resource.Capability> capabilities) -
isFragment
public static boolean isFragment(org.osgi.resource.Resource resource) -
stripDirective
-
getIdentity
public static String getIdentity(org.osgi.resource.Capability identityCapability) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getIdentity
public static String getIdentity(org.osgi.resource.Resource resource) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getVersion
public static Version getVersion(org.osgi.resource.Resource resource) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
toVersionClause
Create a VersionedClause by applying a version range mask to the resource! Masks are defined byMacro._range(String[]). If the resource should represent a project in the bnd workspace, then instead the VersionClause will refer to it as a snapshot version: e.g.;version=snapshot -
toVersionClause
-
toVersionedClauses
public static List<VersionedClause> toVersionedClauses(Collection<org.osgi.resource.Resource> resources) -
getAllResources
public static Set<org.osgi.resource.Resource> getAllResources(org.osgi.service.repository.Repository repository) Return all resources from a repository as returned by the wildcard requirement, seecreateWildcardRequirement()- Parameters:
repository- the repository to use- Returns:
- a set of resources from the repository.
-
compareTo
public static int compareTo(org.osgi.resource.Resource a, org.osgi.resource.Resource b) Compare two resources. This can be used to act as a comparator. The comparison is first done on name and then version.- Parameters:
a- the left resourceb- the right resource- Returns:
- 0 if equal bame and version, 1 if left has a higher name or same name and higher version, -1 otherwise
-
sort
public static List<org.osgi.resource.Resource> sort(Collection<org.osgi.resource.Resource> resources) -
sortByNameVersion
public static List<org.osgi.resource.Resource> sortByNameVersion(Collection<org.osgi.resource.Resource> resources) Sort the resources by symbolic name and version- Parameters:
resources- the set of resources to sort- Returns:
- a sorted set of resources
-
isInitialRequirement
public static boolean isInitialRequirement(org.osgi.resource.Resource resource) -
toCapabilities
-
capabilitiesAccumulator
public static <CAPABILITY extends org.osgi.resource.Capability, COLLECTION extends Collection<CAPABILITY>> void capabilitiesAccumulator(COLLECTION collection, CAPABILITY capability) -
capabilitiesCombiner
public static <CAPABILITY extends org.osgi.resource.Capability, COLLECTION extends Collection<CAPABILITY>> COLLECTION capabilitiesCombiner(COLLECTION leftCollection, COLLECTION rightCollection) -
findProviders
public static <CAPABILITY extends org.osgi.resource.Capability, COLLECTION extends Collection<CAPABILITY>> Map<org.osgi.resource.Requirement, Collection<org.osgi.resource.Capability>> findProviders(Collection<? extends org.osgi.resource.Requirement> requirements, Function<? super org.osgi.resource.Requirement, COLLECTION> provider) -
emptyProviders
public static Map<org.osgi.resource.Requirement, Collection<org.osgi.resource.Capability>> emptyProviders(Collection<? extends org.osgi.resource.Requirement> requirements)
-