Package org.apache.felix.prefs.impl
Class PreferencesManager
java.lang.Object
org.apache.felix.prefs.impl.PreferencesManager
- All Implemented Interfaces:
EventListener,BackingStoreManager,org.osgi.framework.BundleActivator,org.osgi.framework.BundleListener,org.osgi.framework.ServiceFactory<org.osgi.service.prefs.PreferencesService>
public class PreferencesManager
extends Object
implements org.osgi.framework.BundleActivator, org.osgi.framework.BundleListener, org.osgi.framework.ServiceFactory<org.osgi.service.prefs.PreferencesService>, BackingStoreManager
This activator registers itself as a service factory for the
preferences service.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.osgi.framework.BundleContextThe bundle context.protected BackingStoreThe default store which is used if no service can be found.protected final Map<Long, PreferencesServiceImpl> The map of already created services.protected org.osgi.util.tracker.ServiceTracker<BackingStore, BackingStore> The backing store service tracker.protected intTracking count for the store tracker to detect changes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbundleChanged(org.osgi.framework.BundleEvent event) protected voidcleanupStore(BackingStore store) Clean up the store and remove preferences for deleted bundles.org.osgi.service.prefs.PreferencesServicegetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<org.osgi.service.prefs.PreferencesService> reg) getStore()Return the current backing store.protected voidsave(PreferencesServiceImpl service) Save all preferences for this service.voidstart(org.osgi.framework.BundleContext context) voidstop(org.osgi.framework.BundleContext context) voidungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<org.osgi.service.prefs.PreferencesService> reg, org.osgi.service.prefs.PreferencesService s)
-
Field Details
-
services
The map of already created services. For each client bundle a new service is created. -
context
protected org.osgi.framework.BundleContext contextThe bundle context. -
storeTracker
The backing store service tracker. -
defaultStore
The default store which is used if no service can be found. -
storeTrackingCount
protected int storeTrackingCountTracking count for the store tracker to detect changes.
-
-
Constructor Details
-
PreferencesManager
public PreferencesManager()
-
-
Method Details
-
bundleChanged
public void bundleChanged(org.osgi.framework.BundleEvent event) - Specified by:
bundleChangedin interfaceorg.osgi.framework.BundleListener- See Also:
-
start
- Specified by:
startin interfaceorg.osgi.framework.BundleActivator- Throws:
Exception- See Also:
-
stop
- Specified by:
stopin interfaceorg.osgi.framework.BundleActivator- Throws:
Exception- See Also:
-
getService
public org.osgi.service.prefs.PreferencesService getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<org.osgi.service.prefs.PreferencesService> reg) - Specified by:
getServicein interfaceorg.osgi.framework.ServiceFactory<org.osgi.service.prefs.PreferencesService>- See Also:
-
ungetService
public void ungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<org.osgi.service.prefs.PreferencesService> reg, org.osgi.service.prefs.PreferencesService s) - Specified by:
ungetServicein interfaceorg.osgi.framework.ServiceFactory<org.osgi.service.prefs.PreferencesService>- See Also:
-
save
Save all preferences for this service.- Parameters:
service-
-
getStore
Description copied from interface:BackingStoreManagerReturn the current backing store.- Specified by:
getStorein interfaceBackingStoreManager- Throws:
org.osgi.service.prefs.BackingStoreException- See Also:
-
cleanupStore
Clean up the store and remove preferences for deleted bundles.- Parameters:
store-
-