Class StreamBackingStoreImpl

java.lang.Object
org.apache.felix.prefs.impl.StreamBackingStoreImpl
All Implemented Interfaces:
BackingStore
Direct Known Subclasses:
DataFileBackingStoreImpl

public abstract class StreamBackingStoreImpl extends Object implements BackingStore
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 Details

    • bundleContext

      protected final org.osgi.framework.BundleContext bundleContext
      The bundle context.
  • Constructor Details

    • StreamBackingStoreImpl

      public StreamBackingStoreImpl(org.osgi.framework.BundleContext context)
  • Method Details

    • checkAccess

      protected abstract void checkAccess() throws org.osgi.service.prefs.BackingStoreException
      This method is invoked to check if the backing store is accessible right now.
      Throws:
      org.osgi.service.prefs.BackingStoreException
    • getOutputStream

      protected abstract OutputStream getOutputStream(PreferencesDescription desc) throws IOException
      Get the output stream to write the preferences.
      Throws:
      IOException
    • store

      public void store(PreferencesImpl prefs) throws org.osgi.service.prefs.BackingStoreException
      Description copied from interface: BackingStore
      Store 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:
      store in interface BackingStore
      Parameters:
      prefs - The preferences.
      Throws:
      org.osgi.service.prefs.BackingStoreException
      See Also:
    • hasChanges

      protected boolean hasChanges(PreferencesImpl prefs)
      Has the tree changes?
    • update

      public void update(PreferencesImpl prefs) throws org.osgi.service.prefs.BackingStoreException
      Description copied from interface: BackingStore
      Update the current preferences and its children from the backing store.
      Specified by:
      update in interface BackingStore
      Throws:
      org.osgi.service.prefs.BackingStoreException
      See Also:
    • write

      protected void write(PreferencesImpl prefs, OutputStream os) throws IOException
      Write the preferences recursively to the output stream.
      Parameters:
      prefs -
      os -
      Throws:
      IOException
    • read

      protected void read(PreferencesImpl prefs, InputStream is) throws IOException
      Read the preferences recursively from the input stream.
      Parameters:
      prefs -
      is -
      Throws:
      IOException
    • readPreferences

      protected void readPreferences(PreferencesImpl prefs, InputStream in) throws IOException
      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

      protected void writePreferences(PreferencesImpl prefs, OutputStream out) throws IOException
      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