All Known Implementing Classes:
Profile, ProfileDependenciesModule.TestableProfile

public interface IProfile
Represents 1C:Enterprise runtime settings profile. Profiles are tree-based hierarchy of setting folders. Any profile folder contains key-value map.

Clients can access any part of folder hierarchy setting by properly constructed key. Keys consist of path to target folder and key name, all splitted with / delimiter. Clients may use ProfileKeys.of(...) for convenience.

Clients can modify and remove existing folder values or add new. To apply changes clients need to execute flush() method. Example of usage:

 // get string value of path to infobase publication location
 // it is stored in folder with name "Config" with key "WebDirectory"
 String publicationLocation = profile.getStringValue(ProfileKeys.of("Config", "WebDirectory"));

 ...

 // set new value of path to infobase publication location with other web server
 // these changes will affect 1C:Enteprise Designer work
 profile.setStringValue(ProfileKeys.of("Config", "WebDirectory"), "D:/example_publication_folder/");
 profile.setStringValue(ProfileKeys.of("Config", "WebServer"), "Apache 2.2");

 // apply changes
 profile.flush();
 

IProfile is a handle of underlying profile resource. Once it was read, it is no longer in sync state with underlying resource. Clients can use sync() method to sync the profile with underlying resource.

Instances are not thread-safe and have no protection against concurrent profile underlying resources access.

See Also:
Restriction:
This interface is not intended to be extended by clients.
Restriction:
This interface is not intended to be implemented by clients.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Delete this profile and underlying resource.
    void
    Flush the profile.
    Returns the boolean value associated with the specified key in this profile.
    Returns the BigDecimal value associated with the specified key in this profile.
    Returns the string value associated with the specified key in this profile.
    <T extends Value>
    T
    Returns the generic Value associated with the specified key in this profile.
    void
    Removes the value associated with the specified key in this profile, if any.
    void
    setBooleanValue(String key, boolean value)
    Associate a boolean value with the specified key in this profile.
    void
    Associate a BigDecimal value with the specified key in this profile.
    void
    Associate a String value with the specified key in this profile.
    void
    setValue(String key, Value value)
    Associate a generic Value with the specified key in this profile.
    void
    Ensures that future reads from this profile reflect any changes that were saved to the profile resource (from any sourcees - DT IDE or 1C:Enterprise processes) prior to the sync invocation.
  • Method Details

    • getValue

      <T extends Value> T getValue(String key)
      Returns the generic Value associated with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter.
      Parameters:
      key - the value key, cannot be null
      Returns:
      the value or null if the profile has no value associated with key
    • setValue

      void setValue(String key, Value value)
      Associate a generic Value with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter.
      Parameters:
      key - the value key, cannot be null
      value - the value to associate, cannot be null
    • remove

      void remove(String key)
      Removes the value associated with the specified key in this profile, if any. Key consist of path to target folder and key name, all splitted with / delimiter.
      Parameters:
      key - the value key, cannot be null
    • getStringValue

      String getStringValue(String key)
      Returns the string value associated with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter.

      This is convenience method that executes getValue(String) method and extracts actual value.

      Parameters:
      key - the value key, cannot be null
      Returns:
      the value or null if the profile has no value associated with key
      Throws:
      ClassCastException - if value associated with the specified key is not a String value
    • setStringValue

      void setStringValue(String key, String value)
      Associate a String value with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter. This is convenience method that wraps actual value and executes setValue(String, Value).
      Parameters:
      key - the value key, cannot be null
      value - the value to associate, cannot be null
    • getBooleanValue

      Boolean getBooleanValue(String key)
      Returns the boolean value associated with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter.

      This is convenience method that executes getValue(String) method and extracts actual value.

      Parameters:
      key - the value key, cannot be null
      Returns:
      the value or null if the profile has no value associated with key
      Throws:
      ClassCastException - if value associated with the specified key is not a boolean value
    • setBooleanValue

      void setBooleanValue(String key, boolean value)
      Associate a boolean value with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter. This is convenience method that wraps actual value and executes setValue(String, Value).
      Parameters:
      key - the value key, cannot be null
      value - the value to associate, cannot be null
    • getNumberValue

      BigDecimal getNumberValue(String key)
      Returns the BigDecimal value associated with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter.

      This is convenience method that executes getValue(String) method and extracts actual value.

      Parameters:
      key - the value key, cannot be null
      Returns:
      the value or null if the profile has no value associated with key
      Throws:
      ClassCastException - if value associated with the specified key is not a BigDecimal value
    • setNumberValue

      void setNumberValue(String key, BigDecimal value)
      Associate a BigDecimal value with the specified key in this profile. Key consist of path to target folder and key name, all splitted with / delimiter. This is convenience method that wraps actual value and executes setValue(String, Value).
      Parameters:
      key - the value key, cannot be null
      value - the value to associate, cannot be null
    • flush

      void flush() throws IOException
      Flush the profile. All profile changes will be applied to the underlying resources.
      Throws:
      IOException - if an I/0 error occurred
    • sync

      void sync() throws IOException
      Ensures that future reads from this profile reflect any changes that were saved to the profile resource (from any sourcees - DT IDE or 1C:Enterprise processes) prior to the sync invocation.

      All changes will be cleared.

      Throws:
      IOException - if an I/0 error occurred
    • delete

      void delete() throws IOException
      Delete this profile and underlying resource. Once a profile has been deleted, attempting any method on the corresponding instance will fail with an IllegalStateException.
      Throws:
      IOException - if an I/0 error occurred