com.ibm.di.util
Class BasePropertiesFile.Property

java.lang.Object
  extended by com.ibm.di.util.BasePropertiesFile.Property
Enclosing class:
BasePropertiesFile

protected static class BasePropertiesFile.Property
extends 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.


Constructor Summary
BasePropertiesFile.Property(String rawKey, String rawValue, StringBuilder line, Crypto crypto)
          Construct a property.
 
Method Summary
 String getKey()
           
 StringBuilder getLine()
           
 String getValue()
           
 boolean isEncrypted()
           
 boolean isModified()
           
 boolean isOwnProperty()
           
 boolean isProtected()
           
 void setEncrypted(boolean encrypt)
          Encrypt/decrypt the property's value.
 void setLine(StringBuilder line)
          Associate a new line object to this property.
 void setProtected(boolean protect)
          Mark the property as protected/non-protected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasePropertiesFile.Property

public BasePropertiesFile.Property(String rawKey,
                                   String rawValue,
                                   StringBuilder line,
                                   Crypto crypto)
Construct a property.

Parameters:
rawKey - the raw key of the property
rawValue - the raw value of the property.
line - the corresponding line of the property
crypto - cryptographic object for encryption/decryption of the property's value
Method Detail

getKey

public String getKey()
Returns:
the key of the property with no marker protect prefix

getValue

public String getValue()
                throws Exception
Returns:
the value of the property as plain text (decrypted if necessary)
Throws:
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 Exception
Encrypt/decrypt the property's value.

Parameters:
encrypt - whether the property's value will be encrypted
Throws:
Exception - encryption/decryption error

setProtected

public void setProtected(boolean protect)
                  throws 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:
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 StringBuilder getLine()
Returns:
the corresponding line for this property in the main properties file

setLine

public void setLine(StringBuilder line)
Associate a new line object to this property.

Parameters:
line - a line from the main properties file