com.ibm.di.util
Class JavaPropertiesFile

java.lang.Object
  extended by com.ibm.di.util.BasePropertiesFile
      extended by com.ibm.di.util.JavaPropertiesFile

public class JavaPropertiesFile
extends BasePropertiesFile

In-memory representation of a Java properties file that can contain protected properties with encrypted values. This class reads and writes valid Java properties. When writing the order of the properties and the user comments are kept. Only the changed properties are stored in the output file.

Since:
7.1
See Also:
PropertiesFile

Nested Class Summary
 
Nested classes/interfaces inherited from class com.ibm.di.util.BasePropertiesFile
BasePropertiesFile.Property
 
Field Summary
 
Fields inherited from class com.ibm.di.util.BasePropertiesFile
lines, modified, properties, propertyCrypto, PROTECT_PREFIX, PROTECT_VAL_PREFIX, resHash
 
Constructor Summary
JavaPropertiesFile(String path)
          Constructs Java properties file without any encryption/decryption of properties.
JavaPropertiesFile(String path, String keyStoreProp, String keyStoreTypeProp, String keyStoreAliasProp, String transformationProp, String stashFileProp)
          Constructs Java properties file, obtain keystore and key passwords from the stash file and encrypt/decrypt protected properties.
 
Method Summary
 Properties asProperties()
           
 void store(String path)
          Write the contents of this properties file to disk.
 
Methods inherited from class com.ibm.di.util.BasePropertiesFile
getProperty, isModified, isPropertyEncrypted, isPropertyProtected, keys, removeProperty, setProperty, setPropertyEncrypted, setPropertyProtected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaPropertiesFile

public JavaPropertiesFile(String path)
                   throws Exception
Constructs Java properties file without any encryption/decryption of properties.

Parameters:
path - path to properties files
Throws:
Exception

JavaPropertiesFile

public JavaPropertiesFile(String path,
                          String keyStoreProp,
                          String keyStoreTypeProp,
                          String keyStoreAliasProp,
                          String transformationProp,
                          String stashFileProp)
                   throws Exception
Constructs Java properties file, obtain keystore and key passwords from the stash file and encrypt/decrypt protected properties.

Parameters:
path - path to properties files
keyStoreProp - keystore password property name
keyStoreTypeProp - keystore type property name
keyStoreAliasProp - alias property name
transformationProp - transformation property name
stashFileProp - stash file property name
Throws:
Exception
Method Detail

store

public void store(String path)
           throws Exception
Write the contents of this properties file to disk. The order of the properties order and all user comments are kept. Only the modified properties are overwritten in the file.

Specified by:
store in class BasePropertiesFile
Parameters:
path - a file, whether the contents will be saved
Throws:
Exception - error while writing the file or error while encrypting the file

asProperties

public Properties asProperties()
                        throws Exception
Returns:
Properties object representing the contents of this properties file
Throws:
Exception - if not able to decrypt some property value