org.apache.felix.prefs.impl
Class DataFileBackingStoreImpl

java.lang.Object
  extended by org.apache.felix.prefs.impl.StreamBackingStoreImpl
      extended by org.apache.felix.prefs.impl.DataFileBackingStoreImpl
All Implemented Interfaces:
BackingStore

public class DataFileBackingStoreImpl
extends StreamBackingStoreImpl

This implementating of the backing store uses the bundle mechanism to store binary data.


Field Summary
protected  java.io.File rootDirectory
          The root directory (or null if not available)
 
Fields inherited from class org.apache.felix.prefs.impl.StreamBackingStoreImpl
bundleContext
 
Constructor Summary
DataFileBackingStoreImpl(org.osgi.framework.BundleContext context)
           
 
Method Summary
 java.lang.Long[] availableBundles()
          Return all bundle ids for which preferences are stored..
protected  void checkAccess()
          This method is invoked to check if the backing store is accessible right now.
protected  PreferencesDescription getDescription(java.io.File file)
           
protected  java.io.File getFile(PreferencesDescription desc)
          Get the file fo the preferences tree.
protected  java.io.OutputStream getOutputStream(PreferencesDescription desc)
          Get the output stream to write the preferences.
 PreferencesImpl load(BackingStoreManager manager, PreferencesDescription desc)
          Load the preferences for the given description.
 PreferencesImpl[] loadAll(BackingStoreManager manager, java.lang.Long bundleId)
          Load all preferences for this bundle.
 void remove(java.lang.Long bundleId)
          Remove all preferences stored for this bundle.
 
Methods inherited from class org.apache.felix.prefs.impl.StreamBackingStoreImpl
hasChanges, read, readPreferences, store, update, write, writePreferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootDirectory

protected final java.io.File rootDirectory
The root directory (or null if not available)

Constructor Detail

DataFileBackingStoreImpl

public DataFileBackingStoreImpl(org.osgi.framework.BundleContext context)
Method Detail

checkAccess

protected void checkAccess()
                    throws org.osgi.service.prefs.BackingStoreException
Description copied from class: StreamBackingStoreImpl
This method is invoked to check if the backing store is accessible right now.

Specified by:
checkAccess in class StreamBackingStoreImpl
Throws:
org.osgi.service.prefs.BackingStoreException
See Also:
org.apache.felix.sandbox.preferences.impl.StreamBackingStoreImpl#checkAccess()

getOutputStream

protected java.io.OutputStream getOutputStream(PreferencesDescription desc)
                                        throws java.io.IOException
Description copied from class: StreamBackingStoreImpl
Get the output stream to write the preferences.

Specified by:
getOutputStream in class StreamBackingStoreImpl
Throws:
java.io.IOException
See Also:
org.apache.felix.sandbox.preferences.impl.StreamBackingStoreImpl#getOutputStream(org.apache.felix.sandbox.preferences.PreferencesDescription)

availableBundles

public java.lang.Long[] availableBundles()
Description copied from interface: BackingStore
Return all bundle ids for which preferences are stored..

Returns:
Return an array of bundle ids or an empty array.
See Also:
BackingStore.availableBundles()

getDescription

protected PreferencesDescription getDescription(java.io.File file)

remove

public void remove(java.lang.Long bundleId)
            throws org.osgi.service.prefs.BackingStoreException
Description copied from interface: BackingStore
Remove all preferences stored for this bundle.

Parameters:
bundleId - The bundle id.
Throws:
org.osgi.service.prefs.BackingStoreException
See Also:
BackingStore.remove(java.lang.Long)

loadAll

public PreferencesImpl[] loadAll(BackingStoreManager manager,
                                 java.lang.Long bundleId)
                          throws org.osgi.service.prefs.BackingStoreException
Description copied from interface: BackingStore
Load all preferences for this bundle.

Parameters:
manager - The backing store manager which should be passed to new preferences implementations.
bundleId - The bundle id.
Returns:
An array with the preferences or an empty array.
Throws:
org.osgi.service.prefs.BackingStoreException
See Also:
BackingStore.loadAll(org.apache.felix.prefs.BackingStoreManager, java.lang.Long)

load

public PreferencesImpl load(BackingStoreManager manager,
                            PreferencesDescription desc)
                     throws org.osgi.service.prefs.BackingStoreException
Description copied from interface: BackingStore
Load the preferences for the given description.

Parameters:
manager - The backing store manager which should be passed to new preferences implementations.
Returns:
A new preferences object or null if it's not available in the backing store.
Throws:
org.osgi.service.prefs.BackingStoreException
See Also:
BackingStore.load(org.apache.felix.prefs.BackingStoreManager, org.apache.felix.prefs.PreferencesDescription)

getFile

protected java.io.File getFile(PreferencesDescription desc)
Get the file fo the preferences tree.

Parameters:
desc -
Returns: