Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Austrian Association for Software Tool Integration (AASTI) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The AASTI licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.openengsb.core.persistence.internal;
 
 
Service factory managed by Configuration and Fileinstall OSGi services in play.
 
 
     private BundleContext bundleContext;
     private OsgiUtilsService serviceUtils;
 
         new HashMap<StringServiceRegistration>();
 
     @Override
     public String getName() {
         return "Configuration Persistence Service Factory";
     }
 
     @Override
     @SuppressWarnings({ "rawtypes" })
     public synchronized void updated(String pidDictionary propertiesthrows ConfigurationException {
         preconditionPropertyExists(.properties);
         deleted(pid);
         setupConfigPersistenceService(pidproperties);
     }
 
     @SuppressWarnings({ "rawtypes""unchecked" })
     private void setupConfigPersistenceService(String pidDictionary propertiesthrows ConfigurationException {
         ConfigPersistenceBackendService backendService = retrieveBackendService(properties);
         DefaultConfigPersistenceService configPersistenceService = new DefaultConfigPersistenceService(backendService);
         Dictionary exportProperties = new Hashtable();
         exportProperties.put(.properties.get(.));
         ServiceRegistration registration =
             .registerService(ConfigPersistenceService.class.getName(), configPersistenceService,
                 exportProperties);
         .put(pidregistration);
     }
 
     @SuppressWarnings("rawtypes")
         throws ConfigurationException {
         try {
             Filter serviceProxyFilter = .makeFilter(ConfigPersistenceBackendService.class,
                 String.format("(%s=%s)".properties.get(.)));
             return .getOsgiServiceProxy(serviceProxyFilterConfigPersistenceBackendService.class);
         } catch (OsgiServiceNotAvailableException e) {
             throw new ConfigurationException(., String.format(
                 "backend service %s could not be found; please recheck documentation",
                 properties.get(.)), e);
         }
     }
 
     @SuppressWarnings("rawtypes")
     private void preconditionPropertyExists(String keyDictionary propertiesthrows ConfigurationException {
         if (properties.get(key) == null) {
             throw new ConfigurationException(key,
                 String.format("Property %s is required to configure a ConfigPersistenceService correctly"key));
         }
     }
 
     @Override
     public synchronized void deleted(String pid) {
         if (!.containsKey(pid)) {
             return;
         }
        .get(pid).unregister();
    }
    public void setBundleContext(BundleContext bundleContext) {
        this. = bundleContext;
        DefaultOsgiUtilsService defaultOsgiUtilsService = new DefaultOsgiUtilsService();
        defaultOsgiUtilsService.setBundleContext(bundleContext);
         = defaultOsgiUtilsService;
    }
New to GrepCode? Check out our FAQ X