Search in sources :

Example 1 with ArrayServiceList

use of org.apache.aries.application.utils.service.ArrayServiceList in project aries by apache.

the class BundleRepositoryManagerImpl method getAllBundleRepositories.

public Collection<BundleRepository> getAllBundleRepositories() {
    LOGGER.debug(LOG_ENTRY, "getAllBundleRepositories");
    ServiceCollection<BundleRepository> providers = new ArrayServiceList<BundleRepository>(bc);
    try {
        ServiceReference[] refs = bc.getServiceReferences(BundleRepository.class.getName(), null);
        if (refs != null) {
            for (ServiceReference ref : refs) {
                providers.addService(ref);
            }
        }
    } catch (InvalidSyntaxException e) {
        LOGGER.error(LOG_EXCEPTION, e);
    }
    LOGGER.debug(LOG_EXIT, "getAllBundleRepositories");
    return providers;
}
Also used : InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) ArrayServiceList(org.apache.aries.application.utils.service.ArrayServiceList) BundleRepository(org.apache.aries.application.management.spi.repository.BundleRepository) ServiceReference(org.osgi.framework.ServiceReference)

Example 2 with ArrayServiceList

use of org.apache.aries.application.utils.service.ArrayServiceList in project aries by apache.

the class BundleRepositoryManagerImpl method getBundleRepositoryCollection.

public Collection<BundleRepository> getBundleRepositoryCollection(String appName, String appVersion) {
    LOGGER.debug(LOG_ENTRY, "getBundleRepositoryCollection", new Object[] { appName, appVersion });
    ServiceCollection<BundleRepository> providers = new ArrayServiceList<BundleRepository>(bc);
    String appScope = appName + "_" + appVersion;
    String filter = "(|(" + BundleRepository.REPOSITORY_SCOPE + "=" + BundleRepository.GLOBAL_SCOPE + ")(" + BundleRepository.REPOSITORY_SCOPE + "=" + appScope + "))";
    try {
        ServiceReference[] refs = bc.getServiceReferences(BundleRepository.class.getName(), filter);
        if (refs != null) {
            for (ServiceReference ref : refs) {
                providers.addService(ref);
            }
        }
    } catch (InvalidSyntaxException e) {
        LOGGER.error(LOG_EXCEPTION, e);
    }
    LOGGER.debug(LOG_EXIT, "getBundleRepositoryCollection");
    return providers;
}
Also used : InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) ArrayServiceList(org.apache.aries.application.utils.service.ArrayServiceList) BundleRepository(org.apache.aries.application.management.spi.repository.BundleRepository) ServiceReference(org.osgi.framework.ServiceReference)

Aggregations

BundleRepository (org.apache.aries.application.management.spi.repository.BundleRepository)2 ArrayServiceList (org.apache.aries.application.utils.service.ArrayServiceList)2 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)2 ServiceReference (org.osgi.framework.ServiceReference)2