Interface IProfile
-
- All Known Implementing Classes:
com._1c.g5.v8.dt.internal.platform.services.core.profiles.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 useProfileKeys.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 usesync()
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:
IProfileProvider
,ProfileKeys
,ProfileKeys.IProfileValues
- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This interface is not intended to be implemented by clients.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
delete()
Delete this profile and underlying resource.void
flush()
Flush the profile.Boolean
getBooleanValue(String key)
Returns theboolean
value associated with the specifiedkey
in this profile.BigDecimal
getNumberValue(String key)
Returns theBigDecimal
value associated with the specifiedkey
in this profile.String
getStringValue(String key)
Returns the string value associated with the specifiedkey
in this profile.<T extends Value>
TgetValue(String key)
Returns the genericValue
associated with the specifiedkey
in this profile.void
remove(String key)
Removes the value associated with the specifiedkey
in this profile, if any.void
setBooleanValue(String key, boolean value)
Associate aboolean
value with the specifiedkey
in this profile.void
setNumberValue(String key, BigDecimal value)
Associate aBigDecimal
value with the specifiedkey
in this profile.void
setStringValue(String key, String value)
Associate aString
value with the specifiedkey
in this profile.void
setValue(String key, Value value)
Associate a genericValue
with the specifiedkey
in this profile.void
sync()
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 thesync
invocation.
-
-
-
Method Detail
-
getValue
<T extends Value> T getValue(String key)
Returns the genericValue
associated with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter.- Parameters:
key
- the value key, cannot benull
- Returns:
- the value or
null
if the profile has no value associated withkey
-
setValue
void setValue(String key, Value value)
Associate a genericValue
with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
remove
void remove(String key)
Removes the value associated with the specifiedkey
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 benull
-
getStringValue
String getStringValue(String key)
Returns the string value associated with the specifiedkey
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 benull
- Returns:
- the value or
null
if the profile has no value associated withkey
- Throws:
ClassCastException
- if value associated with the specifiedkey
is not aString
value
-
setStringValue
void setStringValue(String key, String value)
Associate aString
value with the specifiedkey
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 executessetValue(String, Value)
.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
getBooleanValue
Boolean getBooleanValue(String key)
Returns theboolean
value associated with the specifiedkey
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 benull
- Returns:
- the value or
null
if the profile has no value associated withkey
- Throws:
ClassCastException
- if value associated with the specifiedkey
is not aboolean
value
-
setBooleanValue
void setBooleanValue(String key, boolean value)
Associate aboolean
value with the specifiedkey
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 executessetValue(String, Value)
.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
getNumberValue
BigDecimal getNumberValue(String key)
Returns theBigDecimal
value associated with the specifiedkey
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 benull
- Returns:
- the value or
null
if the profile has no value associated withkey
- Throws:
ClassCastException
- if value associated with the specifiedkey
is not aBigDecimal
value
-
setNumberValue
void setNumberValue(String key, BigDecimal value)
Associate aBigDecimal
value with the specifiedkey
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 executessetValue(String, Value)
.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
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 thesync
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 anIllegalStateException
.- Throws:
IOException
- if an I/0 error occurred
-
-