public class BuildProperties
extends java.lang.Object
implements java.util.Map<java.lang.String,java.lang.String>
java.util.Properties
.
The main differences are:
getFileProperty(key, file)
method first checks the file property table to see if a property exists that matches the key. If so it then
does a pattern match search of the file for all of the file path patterns listed for the key. If no pattern matches the file, it will then check the
basic properties table to see if the key exists there. If so, it will return the value as the "default" value for the file property.
load(...)
methods support the following file properties format:
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUILD_REPORT_ONLY |
static java.lang.String |
METADATA_STORE_PASSWORD |
static java.lang.String |
METADATA_STORE_SCHEMA |
static java.lang.String |
METADATA_STORE_TYPE |
static java.lang.String |
METADATA_STORE_TYPE_DB2 |
static java.lang.String |
METADATA_STORE_TYPE_FILE |
static java.lang.String |
METADATA_STORE_URL |
static java.lang.String |
METADATA_STORE_USERID |
Modifier and Type | Method and Description |
---|---|
static void |
addFilePattern(java.lang.String key,
java.lang.String value,
java.lang.String filePattern)
Appends a file pattern to the list of associated file patterns for the property
|
static void |
addFilePatterns(java.lang.String key,
java.lang.String value,
java.util.List<java.lang.String> filePatterns)
Appends a list of file patterns to the list of associated file patterns for the property
|
static java.util.Set<java.lang.String> |
basicPropertyKeySet()
Returns a set of keys used as basic properties
|
void |
clear() |
static void |
clearFileProperties()
Removes all file properties
|
static void |
clearProperties()
Removes all basic properties
|
boolean |
containsKey(java.lang.Object arg0) |
boolean |
containsValue(java.lang.Object arg0) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> |
entrySet() |
static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
filePropertyValueKeySet()
Returns a Map containing the file properties key set.
|
java.lang.String |
get(java.lang.Object arg0) |
static java.lang.String |
getFileProperty(java.lang.String key,
java.lang.String file)
Searches for the file property for the given key that is associated to the file.
|
static java.util.List<java.lang.String> |
getFilePropertyPatterns(java.lang.String key,
java.lang.String value)
Returns the list of file patterns associated with a file property
|
static BuildProperties |
getInstance()
Returns a singleton instance of BuildProperties.
|
static java.lang.String |
getProperty(java.lang.String key)
Returns the basic property value
|
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet() |
static java.lang.String |
list()
Returns a list of all the basic and file properties
|
static void |
load(java.io.File file)
Loads a list of file properties from an external properties file
|
static void |
load(java.io.File file,
java.lang.String encoding)
Loads a list of file properties from an external properties file
|
static void |
load(java.lang.String sourceDir,
java.lang.String file)
Loads a list of file properties from an external properties file
|
static void |
load(java.lang.String sourceDir,
java.lang.String file,
java.lang.String encoding)
Loads a list of file properties from an external properties file
|
java.lang.String |
put(java.lang.String arg0,
java.lang.String arg1) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.String> arg0) |
java.lang.String |
remove(java.lang.Object arg0) |
static void |
removeFileProperty(java.lang.String key)
Removes all file properties for the key given
|
static void |
removeProperty(java.lang.String key)
Removes the basic property for the key given
|
static void |
setFileProperty(java.lang.String key,
java.lang.String value,
java.util.List<java.lang.String> filePatterns)
Sets a name value property with a list of associated file patterns in the file properties table.
|
static void |
setFileProperty(java.lang.String key,
java.lang.String value,
java.lang.String filePattern)
Sets a name value property associated to a file pattern in the file properties table.
|
static void |
setProperty(java.lang.String key,
java.lang.String value)
Sets a basic property
|
int |
size() |
static void |
staticReset() |
java.util.Collection<java.lang.String> |
values() |
public static final java.lang.String METADATA_STORE_TYPE
public static final java.lang.String METADATA_STORE_TYPE_FILE
public static final java.lang.String METADATA_STORE_TYPE_DB2
public static final java.lang.String METADATA_STORE_USERID
public static final java.lang.String METADATA_STORE_URL
public static final java.lang.String METADATA_STORE_PASSWORD
public static final java.lang.String METADATA_STORE_SCHEMA
public static final java.lang.String BUILD_REPORT_ONLY
public static BuildProperties getInstance()
public static void load(java.lang.String sourceDir, java.lang.String file) throws java.io.IOException
sourceDir
- The absolute directory that contains the properties filefile
- The relative path of the properties filejava.io.IOException
- If an error occurred in loading the files.public static void load(java.lang.String sourceDir, java.lang.String file, java.lang.String encoding) throws java.io.IOException
sourceDir
- The absolute directory that contains the properties filefile
- The relative path of the properties fileencoding
- The encoding of the properties filejava.io.IOException
- If an error occurred in loading the files.public static void load(java.io.File file) throws java.io.IOException
file
- The properties file to loadjava.io.IOException
- If an error occurred in loading the files.public static void load(java.io.File file, java.lang.String encoding) throws java.io.IOException
file
- The properties file to loadencoding
- The encoding of the properties filejava.io.IOException
- If an error occurred in loading the files.public static java.lang.String getFileProperty(java.lang.String key, java.lang.String file)
NULL
is returned.key
- The key of the file property to be searched.file
- The relative path of the file to search for.NULL
if no property is found.public static java.lang.String getProperty(java.lang.String key)
key
- The name of the property to be setNULL
if it does not existpublic static void setFileProperty(java.lang.String key, java.lang.String value, java.lang.String filePattern)
key
- The name of the property to be setvalue
- The value of the property to be setfilePattern
- The file pattern to associate the property to
property.public static void setFileProperty(java.lang.String key, java.lang.String value, java.util.List<java.lang.String> filePatterns)
key
- The name of the property to be setvalue
- The value of the property to be setfilePatterns
- The list of file patterns to associate the property to
property.public static void setProperty(java.lang.String key, java.lang.String value)
key
- The name of the property to be setvalue
- The value of the property to be setpublic static void removeProperty(java.lang.String key)
key
- The key of the property to removepublic static void removeFileProperty(java.lang.String key)
key
- - The key of the properties to removepublic static void clearProperties()
public static void clearFileProperties()
public static java.util.Set<java.lang.String> basicPropertyKeySet()
public static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> filePropertyValueKeySet()
public static java.util.List<java.lang.String> getFilePropertyPatterns(java.lang.String key, java.lang.String value)
key
- The name of the file property to retrievevalue
- The value of the property to retrievepublic static void addFilePattern(java.lang.String key, java.lang.String value, java.lang.String filePattern)
key
- The name of the file propertyvalue
- The value of the file propertyfilePattern
- The file pattern to add to the file propertypublic static void addFilePatterns(java.lang.String key, java.lang.String value, java.util.List<java.lang.String> filePatterns)
key
- The name of the file propertyvalue
- The value of the file propertyfilePatterns
- The list of file patterns to add to the file propertypublic static java.lang.String list()
public static void staticReset()
public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.String>
public boolean containsKey(java.lang.Object arg0)
containsKey
in interface java.util.Map<java.lang.String,java.lang.String>
public boolean containsValue(java.lang.Object arg0)
containsValue
in interface java.util.Map<java.lang.String,java.lang.String>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.String>
public java.lang.String get(java.lang.Object arg0)
get
in interface java.util.Map<java.lang.String,java.lang.String>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.lang.String>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.lang.String>
public java.lang.String put(java.lang.String arg0, java.lang.String arg1)
put
in interface java.util.Map<java.lang.String,java.lang.String>
public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.String> arg0)
putAll
in interface java.util.Map<java.lang.String,java.lang.String>
public java.lang.String remove(java.lang.Object arg0)
remove
in interface java.util.Map<java.lang.String,java.lang.String>
public int size()
size
in interface java.util.Map<java.lang.String,java.lang.String>
public java.util.Collection<java.lang.String> values()
values
in interface java.util.Map<java.lang.String,java.lang.String>
<IBM Copyright © 2018 IBM Corp. All Rights Reserved.