Package org.osgi.service.repository
Interface Repository
@ProviderType
public interface Repository
A repository service that contains
resources
.
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.
- "ThreadSafe"
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindProviders
(Collection<? extends Requirement> requirements) Find the capabilities that match the specified requirements.findProviders
(RequirementExpression expression) Find the resources that match the specified requirement expression.Return an expression combiner.newRequirementBuilder
(String namespace) Return a newRequirementBuilder
which provides a convenient way to create a requirement.
-
Field Details
-
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:
-
-
Method Details
-
findProviders
Map<Requirement,Collection<Capability>> findProviders(Collection<? extends 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
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
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
-