Knopflerfish OSGi 6.0.0

org.knopflerfish.service.repositorymanager
Interface RepositoryManager


public interface RepositoryManager

KF repository manager service for interaction with OSGI repositories. Registered as service factory. The service factory has two properties num_repositories that tells how many repositories are available and change_count that tells how many times the configuration of repositories has changed. The services is updated whenever there is change in any repository. When a service is fetched you get a service local configuration of how the repositories are used and searched.


Nested Class Summary
static class RepositoryManager.InstallationResult
          Return value from the install operation.
 
Field Summary
static java.lang.String CHANGE_COUNT
          Service property that is incremented whenever the configuration changes.
static java.lang.String NUM_REPOSITORIES
          Service property that tells the number of available repositories.
 
Method Summary
 RepositoryInfo addXmlRepository(java.lang.String url, java.util.Dictionary<java.lang.String,java.lang.Object> props)
          Add a repository based on a repository XML file.
 java.util.List<Capability> findProviders(Requirement requirement)
          Find providers for a requirement.
 java.util.Set<Resource> findResolution(java.util.List<Resource> resources)
          Find a set of resources given the current state of the framework and using the currently enabled Repositories that will allow the given list of resources to resolve.
 java.util.SortedSet<RepositoryInfo> getAllRepositories()
          Get all repositories available.
 java.util.SortedSet<RepositoryInfo> getRepositories()
          Get all enabled repositories.
 RepositoryManager.InstallationResult install(java.util.List<Resource> resources, boolean resolve, boolean start)
          Install, and optionally start, a list of Resource, and optionally try to find, install and start any Resource needed for them to resolve.
 boolean isEnabled(RepositoryInfo ri)
          Check if repository is enabled.
 boolean resolverAvailable()
          Check if the Repository Manager has access to a Resolver service.
 boolean setRepositoryEnabled(RepositoryInfo ri, boolean enabled)
          Enable or disable repository.
 boolean setRepositoryRank(RepositoryInfo ri, int rank)
          Change ranking of a repository.
 

Field Detail

CHANGE_COUNT

static final java.lang.String CHANGE_COUNT
Service property that is incremented whenever the configuration changes. Value type is Integer.

See Also:
Constant Field Values

NUM_REPOSITORIES

static final java.lang.String NUM_REPOSITORIES
Service property that tells the number of available repositories. Value type is Integer.

See Also:
Constant Field Values
Method Detail

findProviders

java.util.List<Capability> findProviders(Requirement requirement)
Find providers for a requirement.

Parameters:
requirement - Requirement to find providers for.
Returns:
See Also:
org.osgi.service.resolve.ResolverContext.findProviders

findResolution

java.util.Set<Resource> findResolution(java.util.List<Resource> resources)
                                       throws java.lang.Exception
Find a set of resources given the current state of the framework and using the currently enabled Repositories that will allow the given list of resources to resolve.

Parameters:
resources - List of Resource to find a resolution for.
Returns:
A Set of Resource that will allow the given list of resources to resolve.
Throws:
java.lang.Exception - If we failed to find a resolution.

install

RepositoryManager.InstallationResult install(java.util.List<Resource> resources,
                                             boolean resolve,
                                             boolean start)
                                             throws java.lang.Exception
Install, and optionally start, a list of Resource, and optionally try to find, install and start any Resource needed for them to resolve.

Parameters:
resources - List of Resource to install and optionally start and/or find a resolution for.
resolve - If true try to find a resolution for the given resources.
start - If true start all resources and any dependencies found during resolution.
Returns:
An InstallationResult containing a set of resources installed and a list of messages suitable for user feedback.
Throws:
java.lang.Exception - If we failed to find a resolution or if install or start operations failed.

addXmlRepository

RepositoryInfo addXmlRepository(java.lang.String url,
                                java.util.Dictionary<java.lang.String,java.lang.Object> props)
                                throws java.lang.Exception
Add a repository based on a repository XML file.

Parameters:
url - The URL to the repository file.
props - Optional service properties that are registered with the Repository service. If null then no extra properties are added.
Returns:
A RepositoryInfo entry for the added repository.
Throws:
java.lang.Exception - If we failed to get or parse the XML file.

getAllRepositories

java.util.SortedSet<RepositoryInfo> getAllRepositories()
Get all repositories available.

Returns:
A sorted set with all available repositories. The first element is this the highest ranked with the lowest id.

getRepositories

java.util.SortedSet<RepositoryInfo> getRepositories()
Get all enabled repositories.

Returns:
A sorted set with all enabled repositories. The first element is this the highest ranked with the lowest id.

isEnabled

boolean isEnabled(RepositoryInfo ri)
Check if repository is enabled.

Parameters:
ri - Repository to check.
Returns:
True if repository is enabled, otherwise false if repository is disabled or wasn't found.

setRepositoryEnabled

boolean setRepositoryEnabled(RepositoryInfo ri,
                             boolean enabled)
Enable or disable repository.

Parameters:
ri -
enabled -
Returns:
True if repository was enabled/disabled, otherwise false if repository wasn't found.

setRepositoryRank

boolean setRepositoryRank(RepositoryInfo ri,
                          int rank)
Change ranking of a repository.

Parameters:
ri - Repository to update, this RepositoryInfo will become defunct if rank change succeed.
rank - New rank for repository.
Returns:
True if repository was updated with new rank, otherwise false if repository wasn't found.

resolverAvailable

boolean resolverAvailable()
Check if the Repository Manager has access to a Resolver service.

Returns:
True if repository has access to a Resolver service, false otherwise.

Knopflerfish OSGi 6.0.0