Search in sources :

Example 1 with MarketplaceStorageService

use of org.eclipse.epp.internal.mpc.core.service.MarketplaceStorageService in project epp.mpc by eclipse.

the class ServiceLocator method registerStorageService.

public IMarketplaceStorageService registerStorageService(String marketplaceBaseUrl, String apiServerUrl, String apiKey) {
    MarketplaceStorageService marketplaceStorageService = new MarketplaceStorageService();
    Hashtable<String, Object> config = new Hashtable<String, Object>();
    config.put(IMarketplaceStorageService.STORAGE_SERVICE_URL_PROPERTY, apiServerUrl);
    if (apiKey != null) {
        config.put(IMarketplaceStorageService.APPLICATION_TOKEN_PROPERTY, apiKey);
    }
    ServiceRegistration<IMarketplaceStorageService> registration = registerService(marketplaceBaseUrl, IMarketplaceStorageService.class, marketplaceStorageService, config);
    BundleContext bundleContext = ServiceUtil.getBundleContext(registration);
    if (bundleContext != null) {
        marketplaceStorageService.activate(bundleContext, config);
    }
    return marketplaceStorageService;
}
Also used : Hashtable(java.util.Hashtable) MarketplaceStorageService(org.eclipse.epp.internal.mpc.core.service.MarketplaceStorageService) IMarketplaceStorageService(org.eclipse.epp.mpc.core.service.IMarketplaceStorageService) IMarketplaceStorageService(org.eclipse.epp.mpc.core.service.IMarketplaceStorageService) BundleContext(org.osgi.framework.BundleContext)

Aggregations

Hashtable (java.util.Hashtable)1 MarketplaceStorageService (org.eclipse.epp.internal.mpc.core.service.MarketplaceStorageService)1 IMarketplaceStorageService (org.eclipse.epp.mpc.core.service.IMarketplaceStorageService)1 BundleContext (org.osgi.framework.BundleContext)1