Package org.osgi.service.repository
Interface Repository
-
@ProviderType public interface Repository
A repository service that containsresources
.Repositories may be registered as services and may be used as by a resolve context during resolver operations.
Repositories registered as services may be filtered using standard service properties.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
URL
Service property to provide URLs related to this repository.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Map<org.osgi.resource.Requirement,java.util.Collection<org.osgi.resource.Capability>>
findProviders(java.util.Collection<? extends org.osgi.resource.Requirement> requirements)
Find the capabilities that match the specified requirements.Promise<java.util.Collection<org.osgi.resource.Resource>>
findProviders(RequirementExpression expression)
Find the resources that match the specified requirement expression.ExpressionCombiner
getExpressionCombiner()
Return an expression combiner.RequirementBuilder
newRequirementBuilder(java.lang.String namespace)
Return a newRequirementBuilder
which provides a convenient way to create a requirement.
-
-
-
Field Detail
-
URL
static final java.lang.String URL
Service property to provide URLs related to this repository.The value of this property must be of type
String
,String[]
, orCollection<String>
.- See Also:
- Constant Field Values
-
-
Method Detail
-
findProviders
java.util.Map<org.osgi.resource.Requirement,java.util.Collection<org.osgi.resource.Capability>> findProviders(java.util.Collection<? extends org.osgi.resource.Requirement> requirements)
Find the capabilities that match the specified requirements.- Parameters:
requirements
- The requirements for which matching capabilities should be returned. Must not benull
.- Returns:
- A map of matching capabilities for the specified requirements.
Each specified requirement must appear as a key in the map. If
there are no matching capabilities for a specified requirement,
then the value in the map for the specified requirement must be
an empty collection. The returned map is the property of the
caller and can be modified by the caller. The returned map may be
lazily populated, so calling
size()
may result in a long running operation.
-
findProviders
Promise<java.util.Collection<org.osgi.resource.Resource>> findProviders(RequirementExpression expression)
Find the resources that match the specified requirement expression.- Parameters:
expression
- TheRequirementExpression
for which matching capabilities should be returned. Must not benull
.- Returns:
- A promise to a collection of matching
Resource
s. If there are no matching resources, an empty collection is returned. The returned collection is the property of the caller and can be modified by the caller. The returned collection may be lazily populated, so callingsize()
may result in a long running operation. - Since:
- 1.1
-
getExpressionCombiner
ExpressionCombiner getExpressionCombiner()
Return an expression combiner. An expression combiner can be used to combine multiple requirement expressions into more complex requirement expressions usingand
,or
andnot
operators.- Returns:
- An
ExpressionCombiner
. - Since:
- 1.1
-
newRequirementBuilder
RequirementBuilder newRequirementBuilder(java.lang.String namespace)
Return a newRequirementBuilder
which provides a convenient way to create a requirement.For example:
Requirement myReq = repository.newRequirementBuilder("org.foo.ns1"). addDirective("filter", "(org.foo.ns1=val1)"). addDirective("cardinality", "multiple").build();
- Parameters:
namespace
- The namespace for the requirement to be created.- Returns:
- A new requirement builder for a requirement in the specified namespace.
- Since:
- 1.1
-
-