Package com.ibm.di.util
Class JavaPropertiesFile
- java.lang.Object
-
- com.ibm.di.util.BasePropertiesFile
-
- 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
Constructors Constructor Description JavaPropertiesFile(java.lang.String path)
Constructs Java properties file without any encryption/decryption of properties.JavaPropertiesFile(java.lang.String path, java.lang.String keyStoreProp, java.lang.String keyStoreTypeProp, java.lang.String keyStoreAliasProp, java.lang.String transformationProp, java.lang.String stashFileProp)
Constructs Java properties file, obtain keystore and key passwords from the stash file and encrypt/decrypt protected properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Properties
asProperties()
void
store(java.lang.String path)
Write the contents of this properties file to disk.-
Methods inherited from class com.ibm.di.util.BasePropertiesFile
getProperty, getProperty, isModified, isPropertyEncrypted, isPropertyProtected, keys, removeProperty, setProperty, setPropertyEncrypted, setPropertyProtected
-
-
-
-
Constructor Detail
-
JavaPropertiesFile
public JavaPropertiesFile(java.lang.String path) throws java.lang.Exception
Constructs Java properties file without any encryption/decryption of properties.- Parameters:
path
- path to properties files- Throws:
java.lang.Exception
-
JavaPropertiesFile
public JavaPropertiesFile(java.lang.String path, java.lang.String keyStoreProp, java.lang.String keyStoreTypeProp, java.lang.String keyStoreAliasProp, java.lang.String transformationProp, java.lang.String stashFileProp) throws java.lang.Exception
Constructs Java properties file, obtain keystore and key passwords from the stash file and encrypt/decrypt protected properties.- Parameters:
path
- path to properties fileskeyStoreProp
- keystore password property namekeyStoreTypeProp
- keystore type property namekeyStoreAliasProp
- alias property nametransformationProp
- transformation property namestashFileProp
- stash file property name- Throws:
java.lang.Exception
-
-
Method Detail
-
store
public void store(java.lang.String path) throws java.lang.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 classBasePropertiesFile
- Parameters:
path
- a file, whether the contents will be saved- Throws:
java.lang.Exception
- error while writing the file or error while encrypting the file
-
asProperties
public java.util.Properties asProperties() throws java.lang.Exception
- Returns:
- Properties object representing the contents of this properties file
- Throws:
java.lang.Exception
- if not able to decrypt some property value
-
-