public class InstanceProperties extends Specification
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SECRETS_PROPERTIES_RESOURCE_NAME
Default base name for properties file in file system for reading secrets.
|
| Modifier | Constructor and Description |
|---|---|
protected |
InstanceProperties(java.util.Properties defaults,
java.lang.String resourcePath,
java.io.File secretsDir,
java.lang.String id)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getApplicationsKey()
Returns the application listing key.
|
java.lang.String |
getEnvironmentsKey()
Returns the environment listing key.
|
static InstanceProperties |
getFor(java.lang.String id,
java.io.File secretsDir)
Primary factory.
|
static InstanceProperties |
getFor(java.lang.String id,
java.util.Properties systemProperties,
java.io.File secretsDir)
Factory.
|
static InstanceProperties |
getFor(java.lang.String id,
java.util.Properties systemProperties,
java.lang.String instancePropertiesResourcePath,
java.io.File secretsDir)
Factory.
|
static InstanceProperties |
getFor(java.lang.String systemPropertiesResourcePath,
java.lang.String instancePropertiesResourcePath,
java.lang.String id,
java.io.File secretsDir)
Factory.
|
java.lang.String |
getHostsKey()
Returns the host listing key.
|
java.lang.String |
getId()
The instance identifier, such as
some.example.system. |
static java.lang.String |
getInstancePropertiesResourcePath(java.lang.String id)
Looks up the resource path for the instance properties.
|
java.lang.String |
getResourcePath()
Returns the resource path to the
instance.properties file. |
java.lang.String |
getRunbooksKey()
Returns the runbook listing key.
|
java.util.Map<java.lang.String,java.lang.Object> |
getSystem()
Accessor for the system properties.
|
static java.lang.String |
getSystemPropertiesResourcePath(java.lang.String id)
Looks up the resource path for the system properties.
|
java.lang.String |
getSystemResourcePath()
The system resource path, derived from the system identifier.
|
static java.lang.String |
getSystemResourcePath(java.lang.String id)
Converts the id to the system resource path.
|
java.util.Map<java.lang.String,java.lang.Object> |
getTargets()
Accessor for the targets.
|
java.lang.String |
getUnitKey(java.lang.String unitType)
Returns the key that lists the units with the parameter unit type.
|
containsKey, convertToMap, convertToMap, get, getBoolean, getBoolean, getInteger, getInteger, getKeys, getString, getString, isEmpty, isFalse, isTrue, loadProperties, loadProperties, loadPropertiesFromFile, loadPropertiesFromFile, loadPropertiesFromList, loadPropertiesFromResource, parseListinggetProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNamesclear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsValue, elements, entrySet, equals, forEach, getOrDefault, hashCode, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, valuespublic static final java.lang.String SECRETS_PROPERTIES_RESOURCE_NAME
protected InstanceProperties(java.util.Properties defaults,
java.lang.String resourcePath,
java.io.File secretsDir,
java.lang.String id)
defaults - Property defaults to apply.resourcePath - The resource path to read the instance properties from.secretsDir - The directory to look for secrets in.id - The system identifier to read instance properties for.public static java.lang.String getSystemResourcePath(java.lang.String id)
If the id is some.example.system the system
resource path will be some/example/system.
id - The system identifier.public static java.lang.String getSystemPropertiesResourcePath(java.lang.String id)
id - The system identifier.public static java.lang.String getInstancePropertiesResourcePath(java.lang.String id)
id - The system identifier.public static InstanceProperties getFor(java.lang.String id, java.io.File secretsDir)
#getFor functions.
The resource paths for the application and instance properties will
be derived from the id parameter.
The instance identifier coincides with the package that holds the instance properties resource.
id - The instance identifiersecretsDir - The directory to start looking for secrets ingetFor(String, String, String, File)public static InstanceProperties getFor(java.lang.String systemPropertiesResourcePath, java.lang.String instancePropertiesResourcePath, java.lang.String id, java.io.File secretsDir)
getFor(String, File) function is preferred.
The instance identifier coincides with the package that holds the instance properties resource.
systemPropertiesResourcePath - The resource path for the system properties resourceinstancePropertiesResourcePath - The resource path for the instance properties resourceid - The instance identifiersecretsDir - The directory to start looking for secrets inpublic static InstanceProperties getFor(java.lang.String id, java.util.Properties systemProperties, java.io.File secretsDir)
getFor(String, File) function is preferred.
The identifier must coincide with the package that holds the instance properties resource.
id - The instance identifier.systemProperties - The system properties.secretsDir - The directory to start looking for secrets in.public static InstanceProperties getFor(java.lang.String id, java.util.Properties systemProperties, java.lang.String instancePropertiesResourcePath, java.io.File secretsDir)
getFor(String, File) function is preferred.id - The instance identifier.systemProperties - The system properties.instancePropertiesResourcePath - The instance properties resource path.secretsDir - The directory to start looking for secrets in.public java.lang.String getResourcePath()
instance.properties file.instance.propertiespublic java.lang.String getId()
some.example.system.
All properties for the instance are prefixed with the identifier.
public java.lang.String getSystemResourcePath()
If the system identifier is some.example.system then the
system resource path is some/example/system.
public java.lang.String getUnitKey(java.lang.String unitType)
The unitType must be in singular form, e.g.
environment, not environments.
The intended key ends with .listing but if the shorter
key without that suffix is available then it will be returned. That
form is deprecated and the shorter key should not be used. The
behavior is only present for backwards compatibility.
For example, if the parameter unit type is host and
the system identifier is some.example.system then the
returned key will be some.example.system.hosts if that
key is available. If it is not available then the newer form will be
returned, some.example.system.hosts.listing. The newer
form should always be used.
unitType - The type to get the listing key forpublic java.lang.String getEnvironmentsKey()
public java.lang.String getHostsKey()
public java.lang.String getApplicationsKey()
public java.lang.String getRunbooksKey()
public java.util.Map<java.lang.String,java.lang.Object> getSystem()
public java.util.Map<java.lang.String,java.lang.Object> getTargets()