Knopflerfish OSGi 5.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.


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.SortedSet<RepositoryInfo> getAllRepositories()
          Get all repositories available.
 java.util.SortedSet<RepositoryInfo> getRepositories()
          Get all enabled repositories.
 boolean isEnabled(RepositoryInfo ri)
          Check if repository is enabled.
 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

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.

Knopflerfish OSGi 5.0.0