Package com.ibm.di.util
Class BasePropertiesFile.Property
- java.lang.Object
-
- com.ibm.di.util.BasePropertiesFile.Property
-
- Enclosing class:
- BasePropertiesFile
protected static class BasePropertiesFile.Property extends java.lang.Object
A property from a properties file. If provided the actual read line from the file is also saved and updated in case of change to property key or value.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getKey()
java.lang.StringBuilder
getLine()
java.lang.String
getValue()
boolean
isEncrypted()
boolean
isModified()
boolean
isOwnProperty()
boolean
isProtected()
void
setEncrypted(boolean encrypt)
Encrypt/decrypt the property's value.void
setLine(java.lang.StringBuilder line)
Associate a new line object to this property.void
setProtected(boolean protect)
Mark the property as protected/non-protected.
-
-
-
Constructor Detail
-
Property
public Property(java.lang.String rawKey, java.lang.String rawValue, java.lang.StringBuilder line, Crypto crypto)
Construct a property.- Parameters:
rawKey
- the raw key of the propertyrawValue
- the raw value of the property.line
- the corresponding line of the propertycrypto
- cryptographic object for encryption/decryption of the property's value
-
-
Method Detail
-
getKey
public java.lang.String getKey()
- Returns:
- the key of the property with no marker protect prefix
-
getValue
public java.lang.String getValue() throws java.lang.Exception
- Returns:
- the value of the property as plain text (decrypted if necessary)
- Throws:
java.lang.Exception
- error during decryption
-
isEncrypted
public boolean isEncrypted()
- Returns:
- whether the property's value is encrypted; implies that the property is protected
-
isProtected
public boolean isProtected()
- Returns:
- whether the property is protected
-
isModified
public boolean isModified()
- Returns:
- whether the property was modified
-
setEncrypted
public void setEncrypted(boolean encrypt) throws java.lang.Exception
Encrypt/decrypt the property's value.- Parameters:
encrypt
- whether the property's value will be encrypted- Throws:
java.lang.Exception
- encryption/decryption error
-
setProtected
public void setProtected(boolean protect) throws java.lang.Exception
Mark the property as protected/non-protected. The operation will involve decryption if an encrypted property is transformed to non-protected.- Parameters:
protect
- whether the property will be marked as protected- Throws:
java.lang.Exception
- decryption error
-
isOwnProperty
public boolean isOwnProperty()
- Returns:
- whether the property originates from this properties file or from some of the properties file that it references
-
getLine
public java.lang.StringBuilder getLine()
- Returns:
- the corresponding line for this property in the main properties file
-
setLine
public void setLine(java.lang.StringBuilder line)
Associate a new line object to this property.- Parameters:
line
- a line from the main properties file
-
-