Interface ConfigurationStore

  • All Known Implementing Classes:
    DatabaseConfigurationStore, HashtableConfigurationStore, PropertyConfigurationStore, XMLConfigurationStore

    public interface ConfigurationStore
    Abstracts the runtime storage, the serialization and deserialization of the configuration properties and their associated values of ConfigurationServiceImpl and the format of the configuration file. Thus ConfigurationServiceImpl can operate regardless of these specifics and takes care of asking the VetoableChangeListeners, converting the property values to the requested types and notifying the PropertyChangeListeners.
    Author:
    Lyubomir Marinov
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object getProperty​(String name)
      Gets the value in this ConfigurationStore of a property with a specific name.
      String[] getPropertyNames()
      Gets the names of the properties which have values associated in this ConfigurationStore.
      boolean isSystemProperty​(String name)
      Determines whether a specific name stands for a system property.
      void reloadConfiguration​(File file)
      Removes all property name-value associations currently present in this ConfigurationStore and deserializes new property name-value associations from a specific File which presumably is in the format represented by this instance.
      void removeProperty​(String name)
      Removes the value association in this ConfigurationStore of the property with a specific name.
      void setNonSystemProperty​(String name, Object value)
      Sets the value of a non-system property with a specific name to a specific value in this ConfigurationStore.
      void setSystemProperty​(String name)
      Sets a property with a specific name to be considered a system property by the ConfigurationStore.
      void storeConfiguration​(OutputStream out)
      Stores/serializes the property name-value associations currently present in this ConfigurationStore into a specific OutputStream in the format represented by this instance.
    • Method Detail

      • getProperty

        Object getProperty​(String name)
        Gets the value in this ConfigurationStore of a property with a specific name.
        Parameters:
        name - the name of the property to get the value of
        Returns:
        the value in this ConfigurationStore of the property with the specified name; null if the property with the specified name does not have an association with a value in this ConfigurationStore
      • getPropertyNames

        String[] getPropertyNames()
        Gets the names of the properties which have values associated in this ConfigurationStore.
        Returns:
        an array of Strings which specify the names of the properties that have values associated in this ConfigurationStore; an empty array if this instance contains no property values
      • isSystemProperty

        boolean isSystemProperty​(String name)
        Determines whether a specific name stands for a system property.
        Parameters:
        name - the name of a property which is to be determined whether it is a system property
        Returns:
        true if the specified name stands for a system property; false, otherwise
      • reloadConfiguration

        void reloadConfiguration​(File file)
                          throws IOException,
                                 XMLException
        Removes all property name-value associations currently present in this ConfigurationStore and deserializes new property name-value associations from a specific File which presumably is in the format represented by this instance.
        Parameters:
        file - the File to be read and to deserialize new property name-value associations from into this instance
        Throws:
        IOException - if there is an input error while reading from the specified file
        XMLException - if parsing the contents of the specified file fails
      • removeProperty

        void removeProperty​(String name)
        Removes the value association in this ConfigurationStore of the property with a specific name. If the property with the specified name is not associated with a value in this ConfigurationStore, does nothing.
        Parameters:
        name - the name of the property which is to have its value association in this ConfigurationStore removed
      • setNonSystemProperty

        void setNonSystemProperty​(String name,
                                  Object value)
        Sets the value of a non-system property with a specific name to a specific value in this ConfigurationStore.
        Parameters:
        name - the name of the non-system property to be set to the specified value in this ConfigurationStore
        value - the value to be assigned to the non-system property with the specified name in this ConfigurationStore
      • setSystemProperty

        void setSystemProperty​(String name)
        Sets a property with a specific name to be considered a system property by the ConfigurationStore.
        Parameters:
        name - the name of the property to be set as a system property in this ConfigurationStore
      • storeConfiguration

        void storeConfiguration​(OutputStream out)
                         throws IOException
        Stores/serializes the property name-value associations currently present in this ConfigurationStore into a specific OutputStream in the format represented by this instance.
        Parameters:
        out - the OutputStream to receive the serialized form of the property name-value associations currently present in this ConfigurationStore
        Throws:
        IOException - if there is an output error while storing the properties managed by this ConfigurationStore into the specified file