|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.prefs.impl.PreferencesManager
public class PreferencesManager
This activator registers itself as a service factory for the preferences service.
Field Summary | |
---|---|
protected BundleContext |
context
The bundle context. |
protected BackingStore |
defaultStore
The default store which is used if no service can be found. |
protected ServiceTracker |
logTracker
The service tracker for the log service. |
protected Map |
services
The map of already created services. |
protected ServiceTracker |
storeTracker
The backing store service tracker. |
protected int |
storeTrackingCount
Tracking count for the store tracker to detect changes. |
Constructor Summary | |
---|---|
PreferencesManager()
|
Method Summary | |
---|---|
void |
bundleChanged(BundleEvent event)
Receives notification that a bundle has had a lifecycle change. |
protected void |
cleanupStore(BackingStore store)
Clean up the store and remove preferences for deleted bundles. |
Object |
getService(Bundle bundle,
ServiceRegistration reg)
Creates a new service object. |
BackingStore |
getStore()
Return the current backing store. |
protected void |
log(int level,
String message,
Throwable t)
|
protected void |
save(PreferencesServiceImpl service)
Save all preferences for this service. |
void |
start(BundleContext context)
Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start this bundle. |
void |
stop(BundleContext context)
Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary to stop the bundle. |
void |
ungetService(Bundle bundle,
ServiceRegistration reg,
Object s)
Releases a service object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Map services
protected BundleContext context
protected ServiceTracker storeTracker
protected ServiceTracker logTracker
protected BackingStore defaultStore
protected int storeTrackingCount
Constructor Detail |
---|
public PreferencesManager()
Method Detail |
---|
public void bundleChanged(BundleEvent event)
BundleListener
bundleChanged
in interface BundleListener
event
- The BundleEvent
.BundleListener.bundleChanged(org.osgi.framework.BundleEvent)
public void start(BundleContext context) throws Exception
BundleActivator
This method must complete and return to its caller in a timely manner.
start
in interface BundleActivator
context
- The execution context of the bundle being started.
Exception
- If this method throws an exception, this
bundle is marked as stopped and the Framework will remove this
bundle's listeners, unregister all services registered by this
bundle, and release all services used by this bundle.BundleActivator.start(org.osgi.framework.BundleContext)
public void stop(BundleContext context) throws Exception
BundleActivator
BundleActivator.start
method started. There should be no active threads that were started by
this bundle when this bundle returns. A stopped bundle must not call any
Framework objects.
This method must complete and return to its caller in a timely manner.
stop
in interface BundleActivator
context
- The execution context of the bundle being stopped.
Exception
- If this method throws an exception, the
bundle is still marked as stopped, and the Framework will remove
the bundle's listeners, unregister all services registered by the
bundle, and release all services used by the bundle.BundleActivator.stop(org.osgi.framework.BundleContext)
public Object getService(Bundle bundle, ServiceRegistration reg)
ServiceFactory
The Framework invokes this method the first time the specified
bundle
requests a service object using the
BundleContext.getService(ServiceReference)
method. The
service factory can then return a specific service object for each
bundle.
The Framework caches the value returned (unless it is null
),
and will return the same service object on any future call to
BundleContext.getService
for the same bundle. This means the
Framework must not allow this method to be concurrently called for the
same bundle.
The Framework will check if the returned service object is an instance of
all the classes named when the service was registered. If not, then
null
is returned to the bundle.
getService
in interface ServiceFactory
bundle
- The bundle using the service.reg
- The ServiceRegistration
object for the
service.
ServiceFactory.getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration)
public void ungetService(Bundle bundle, ServiceRegistration reg, Object s)
ServiceFactory
The Framework invokes this method when a service has been released by a bundle. The service object may then be destroyed.
ungetService
in interface ServiceFactory
bundle
- The bundle releasing the service.reg
- The ServiceRegistration
object for the
service.s
- The service object returned by a previous call to the
ServiceFactory.getService
method.ServiceFactory.ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object)
protected void save(PreferencesServiceImpl service)
service
- protected void log(int level, String message, Throwable t)
public BackingStore getStore()
BackingStoreManager
getStore
in interface BackingStoreManager
BackingStoreManager.getStore()
protected void cleanupStore(BackingStore store)
store
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |