Interface Preferences


  • public interface Preferences
    Deprecated.
    cq 5.5
    Preferences are a collection of properties similar to a Dictionary. Preferences are configuration properties for a particular user of the application. Like Properties Preferences have a name and a value, which can be any Object.
    In addtion to Properties, Preferences may contain further Preferences, which are maintained in hierarchical structure. But Properties do NOT add any further semantic to the values nor to the hierarchy.

    The current specification differs from other Preferences like the Java Preferences or the OSGI's by the following:
    This Preferences do not impose implicit categorization like the Java package in case of Java Preferences resp. the Bundle's name for the OSGI Preferences. As benefit of this behavior, Preferences can be organized according their inherent structure rather than than the structure of source code.

    See Also:
    PreferencesService
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void flush()
      Deprecated.
      This method persists all changes made to this instance.
      java.lang.String get​(java.lang.String relativePath)
      Deprecated.
      Shortcut access to a String Preference.
      <Type> Type get​(java.lang.String relativePath, Type defaultValue)
      Deprecated.
      Access a Preference value at a given Path and type given by means of the default value.
      <Type> Type get​(java.lang.String relativePath, Type defaultValue, java.lang.Class<Type> type)
      Deprecated.
       
      java.lang.String getAuthorizableId()
      Deprecated.
       
      java.util.Collection<Preferences> getChildren()
      Deprecated.
      All direct children Preferences.
      java.lang.String getPath()
      Deprecated.
       
      java.lang.String getPreferenceName()
      Deprecated.
      Access the relative Path of the current Preferences within the hierarchy.
      Preferences getPreferences​(java.lang.String relativePath)
      Deprecated.
      Return Preferences contained with in this Preferences at the given relative Path.
      A null Preference is not allowed as return value.
      java.util.Collection<java.lang.String> getPreferencesNames()
      Deprecated.
      The names of all Preferences which contain a value.
      void put​(java.lang.String relativePath, java.lang.Object value)
      Deprecated.
      Store the given value at the given path.
      void refresh()
      Deprecated.
      A call to this method synchronizes the values of this Preferences with its persistent state.
      void remove​(java.lang.String relativePath)
      Deprecated.
      Remove the value at the given path.
    • Method Detail

      • getPath

        java.lang.String getPath()
        Deprecated.
        Returns:
        Path of the resource this preference is persisted at
      • getAuthorizableId

        java.lang.String getAuthorizableId()
        Deprecated.
        Returns:
        the AuthorizableId this Preferences are created for
        See Also:
        PreferencesService.get(String)
      • getPreferenceName

        java.lang.String getPreferenceName()
        Deprecated.
        Access the relative Path of the current Preferences within the hierarchy. The value has to be in format, that
          String path = "a/b";
          Preferences rootPref = preferencesService.get(session)
          rootPref.getPreferences(path).getPath().equals(path)
         
        Returns:
        path to the current preferences within the Preferences Hierarchy
      • getPreferencesNames

        java.util.Collection<java.lang.String> getPreferencesNames()
        Deprecated.
        The names of all Preferences which contain a value. The value may be set directly on this Authorizable or inherited. NOTE: this does not mean, that this is the possible exhaustive set of Preferences names
        Returns:
        all Preference names that have a value
      • getChildren

        java.util.Collection<Preferences> getChildren()
        Deprecated.
        All direct children Preferences. The may be set directly on this instance or on an inherited one. NOTE: this does not mean, that this is the possible exhaustive set of children
        Returns:
        all children Preferences that are set
      • getPreferences

        Preferences getPreferences​(java.lang.String relativePath)
                            throws PathNotFoundException
        Deprecated.
        Return Preferences contained with in this Preferences at the given relative Path.
        A null Preference is not allowed as return value. If there are no Preferences at the given Path, implementations have to create new empty Preferences or throw a PathNotFoundException, if this is not possible.
        Thus this method servers as a Factory for new Preferences to be contained in this ones
        Parameters:
        relativePath - relative relativePath within the current Preferences.
        Returns:
        Preferences
        Throws:
        PathNotFoundException - if the Path is absolute or not contained within this Preferences. If path points to a Preferences value other than of type Preferences. A denied access to Preferences has to result in a PathNotFoundException
      • get

        java.lang.String get​(java.lang.String relativePath)
                      throws PathNotFoundException
        Deprecated.
        Shortcut access to a String Preference.
        Parameters:
        relativePath - of the Preference
        Returns:
        the String representation of the value
        Throws:
        PathNotFoundException - if the path does not exist, does not point to Preferences-value that may be converted to a String, or access restrictions prevent from accessing the value.
        See Also:
        get(String, Object)
      • get

        <Type> Type get​(java.lang.String relativePath,
                        Type defaultValue)
                 throws PathNotFoundException
        Deprecated.
        Access a Preference value at a given Path and type given by means of the default value. If the current Preferences don't have a value for the given path, the default value is returned.
        Parameters:
        relativePath - path to Preference
        defaultValue - value to take return type or value if none exists at the given path
        Returns:
        none-null value of given Type
        Throws:
        PathNotFoundException - if path is not accessible for any reason
      • get

        <Type> Type get​(java.lang.String relativePath,
                        Type defaultValue,
                        java.lang.Class<Type> type)
                 throws PathNotFoundException
        Deprecated.
        Parameters:
        relativePath - path to preference
        defaultValue - to take if none is contained in the current preferences
        type - the value has to be returned
        Returns:
        the preference if one set or the default value
        Throws:
        PathNotFoundException - in any case the path can not be accessed
      • put

        void put​(java.lang.String relativePath,
                 java.lang.Object value)
          throws AccessDeniedException
        Deprecated.
        Store the given value at the given path. Implementations are not required to persist changes immediately.
        Parameters:
        relativePath - path to store the given value at
        value - to store
        Throws:
        AccessDeniedException - if access restrictions prevent from saving the value
        See Also:
        flush()
      • remove

        void remove​(java.lang.String relativePath)
             throws AccessDeniedException
        Deprecated.
        Remove the value at the given path. Method need not signal an exceptional state if the given path does not exist or is invalid.
        Implementations are not required to persist changes immediately.
        Parameters:
        relativePath - to the preference to remove
        Throws:
        AccessDeniedException - if access restrictions prevent from removing a Preference
        See Also:
        flush()
      • refresh

        void refresh()
        Deprecated.
        A call to this method synchronizes the values of this Preferences with its persistent state.
        See Also:
        flush()
      • flush

        void flush()
            throws AccessDeniedException
        Deprecated.
        This method persists all changes made to this instance.
        Throws:
        AccessDeniedException - in case access restrictions prevent from writing to persistence layer.