Package org.apache.felix.prefs.impl
Class DataFileBackingStoreImpl
java.lang.Object
org.apache.felix.prefs.impl.StreamBackingStoreImpl
org.apache.felix.prefs.impl.DataFileBackingStoreImpl
- All Implemented Interfaces:
BackingStore
This implementating of the backing store uses the bundle mechanism to store
binary data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FileThe root directory (or null if not available)Fields inherited from class org.apache.felix.prefs.impl.StreamBackingStoreImpl
bundleContext -
Constructor Summary
ConstructorsConstructorDescriptionDataFileBackingStoreImpl(org.osgi.framework.BundleContext context) DataFileBackingStoreImpl(org.osgi.framework.BundleContext context, File rootDirectory) -
Method Summary
Modifier and TypeMethodDescriptionLong[]Return all bundle ids for which preferences are stored..protected voidThis method is invoked to check if the backing store is accessible right now.private static BooleanfileExists(File file) protected PreferencesDescriptiongetDescription(File file) protected FileGet the file fo the preferences tree.private static FileInputStreamgetFileInputStream(File file) private static FileOutputStreamgetFileOutputStream(File file) private static File[]getFilesList(File file) protected OutputStreamGet the output stream to write the preferences.load(BackingStoreManager manager, PreferencesDescription desc) Load the preferences for the given description.loadAll(BackingStoreManager manager, Long bundleId) Load all preferences for this bundle.voidRemove all preferences stored for this bundle.Methods inherited from class org.apache.felix.prefs.impl.StreamBackingStoreImpl
hasChanges, read, readPreferences, store, update, write, writePreferences
-
Field Details
-
rootDirectory
The root directory (or null if not available)
-
-
Constructor Details
-
DataFileBackingStoreImpl
public DataFileBackingStoreImpl(org.osgi.framework.BundleContext context) -
DataFileBackingStoreImpl
-
-
Method Details
-
checkAccess
protected void checkAccess() throws org.osgi.service.prefs.BackingStoreExceptionDescription copied from class:StreamBackingStoreImplThis method is invoked to check if the backing store is accessible right now.- Specified by:
checkAccessin classStreamBackingStoreImpl- Throws:
org.osgi.service.prefs.BackingStoreException- See Also:
-
getOutputStream
Description copied from class:StreamBackingStoreImplGet the output stream to write the preferences.- Specified by:
getOutputStreamin classStreamBackingStoreImpl- Throws:
IOException- See Also:
-
availableBundles
Description copied from interface:BackingStoreReturn all bundle ids for which preferences are stored..- Returns:
- Return an array of bundle ids or an empty array.
- See Also:
-
getDescription
-
remove
Description copied from interface:BackingStoreRemove all preferences stored for this bundle.- Parameters:
bundleId- The bundle id.- Throws:
org.osgi.service.prefs.BackingStoreException- See Also:
-
loadAll
public PreferencesImpl[] loadAll(BackingStoreManager manager, Long bundleId) throws org.osgi.service.prefs.BackingStoreException Description copied from interface:BackingStoreLoad 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:
-
load
public PreferencesImpl load(BackingStoreManager manager, PreferencesDescription desc) throws org.osgi.service.prefs.BackingStoreException Description copied from interface:BackingStoreLoad the preferences for the given description.- Parameters:
manager- The backing store manager which should be passed to new preferences implementations.desc-- Returns:
- A new preferences object or null if it's not available in the backing store.
- Throws:
org.osgi.service.prefs.BackingStoreException- See Also:
-
getFile
Get the file fo the preferences tree.- Parameters:
desc-- Returns:
-
getFilesList
-
fileExists
-
getFileInputStream
- Throws:
IOException
-
getFileOutputStream
- Throws:
IOException
-