Package org.apache.felix.prefs.impl
Class StreamBackingStoreImpl
java.lang.Object
org.apache.felix.prefs.impl.StreamBackingStoreImpl
- All Implemented Interfaces:
BackingStore
- Direct Known Subclasses:
DataFileBackingStoreImpl
This is an abstract implementation of a backing store
which uses streams to read/write the preferences and
stores a complete preferences tree in a single stream.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.osgi.framework.BundleContextThe bundle context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidThis method is invoked to check if the backing store is accessible right now.protected abstract OutputStreamGet the output stream to write the preferences.protected booleanhasChanges(PreferencesImpl prefs) Has the tree changes?protected voidread(PreferencesImpl prefs, InputStream is) Read the preferences recursively from the input stream.protected voidreadPreferences(PreferencesImpl prefs, InputStream in) Load this preferences from an input stream.voidstore(PreferencesImpl prefs) Store the current preferences and its children in the backing store.voidupdate(PreferencesImpl prefs) Update the current preferences and its children from the backing store.protected voidwrite(PreferencesImpl prefs, OutputStream os) Write the preferences recursively to the output stream.protected voidwritePreferences(PreferencesImpl prefs, OutputStream out) Save this preferences to an output stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.felix.prefs.BackingStore
availableBundles, load, loadAll, remove
-
Field Details
-
bundleContext
protected final org.osgi.framework.BundleContext bundleContextThe bundle context.
-
-
Constructor Details
-
StreamBackingStoreImpl
public StreamBackingStoreImpl(org.osgi.framework.BundleContext context)
-
-
Method Details
-
checkAccess
protected abstract void checkAccess() throws org.osgi.service.prefs.BackingStoreExceptionThis method is invoked to check if the backing store is accessible right now.- Throws:
org.osgi.service.prefs.BackingStoreException
-
getOutputStream
Get the output stream to write the preferences.- Throws:
IOException
-
store
Description copied from interface:BackingStoreStore the current preferences and its children in the backing store. The store should check, if the preferences have changed, it should also check all children.- Specified by:
storein interfaceBackingStore- Parameters:
prefs- The preferences.- Throws:
org.osgi.service.prefs.BackingStoreException- See Also:
-
hasChanges
Has the tree changes? -
update
Description copied from interface:BackingStoreUpdate the current preferences and its children from the backing store.- Specified by:
updatein interfaceBackingStore- Throws:
org.osgi.service.prefs.BackingStoreException- See Also:
-
write
Write the preferences recursively to the output stream.- Parameters:
prefs-os-- Throws:
IOException
-
read
Read the preferences recursively from the input stream.- Parameters:
prefs-is-- Throws:
IOException
-
readPreferences
Load this preferences from an input stream. Currently the prefs are read from an object input stream and the serialization is done by hand. The changeSet is neither updated nor cleared in order to provide an update/sync functionality. This has to be done at a higher level.- Throws:
IOException
-
writePreferences
Save this preferences to an output stream. Currently the prefs are written through an object output stream with handmade serialization of strings. The changeSet is neither updated nor cleared in order to provide an update/sync functionality. This has to be done at a higher level.- Throws:
IOException
-