Class BuildPropertiesHelper
Properties have prefixes which are automatically added by this class.
Do not use any other means of access.
Property prefix is polarion.build..
- Version:
- $Revision$ $Date$
- Author:
- Stepan Roh, Polarion Software
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Properties
gatherProperties
(IContextualBuildArtifact ctxArtifact, String buildDescriptorName, String calculationDescriptorName, Properties additionalProperties) Gather all relevant build/calculation properties for given build artifact.static String
getFullPropertyName
(String name) Get full name of given build property (including prefix).static Properties
getProperties
(IBuildArtifact buildArtifact, String buildDescriptorName, String calculationDescriptorName, Properties additionalProperties) Gather all relevant build/calculation properties for given build artifact.static Properties
getProperties
(IContextualBuildArtifact ctxArtifact) Get build/calculation properties attached to given artifact.static String
getPropertyValue
(Properties props, String name) Return property value.static String
getPropertyValue
(Properties props, String name, String def) Return property value.static boolean
isBuildProperty
(String name) Whether the given full property name is build configuration property.
-
Method Details
-
getFullPropertyName
Get full name of given build property (including prefix).- Parameters:
name
- property name- Returns:
- full property name (not
null
) - Throws:
IllegalArgumentException
- ifname
isnull
-
getPropertyValue
Return property value.- Parameters:
props
- propertiesname
- property name (without prefix)- Returns:
- property value or
null
if not found - Throws:
IllegalArgumentException
- ifprops
isnull
IllegalArgumentException
- ifname
isnull
-
getPropertyValue
Return property value.- Parameters:
props
- propertiesname
- property name (without prefix)def
- default value- Returns:
- property value or given default if not found
- Throws:
IllegalArgumentException
- ifprops
isnull
IllegalArgumentException
- ifname
isnull
-
getProperties
public static Properties getProperties(IBuildArtifact buildArtifact, String buildDescriptorName, String calculationDescriptorName, Properties additionalProperties) Gather all relevant build/calculation properties for given build artifact.Properties precedence order: system properties, build properties, calculation properties, additional properties (latter ones take precedence over former ones).
Only build-related and public system properties are gathered.
- Parameters:
buildArtifact
- build artifactbuildDescriptorName
- build descriptor name ornull
calculationDescriptorName
- calculation descriptor name ornull
additionalProperties
- additional properties ornull
- Returns:
- new instance of
Properties
(can be freely modified) - Throws:
IllegalArgumentException
- ifbuildArtifact
isnull
IllegalArgumentException
- if one of descriptors is not known
-
gatherProperties
public static Properties gatherProperties(IContextualBuildArtifact ctxArtifact, String buildDescriptorName, String calculationDescriptorName, Properties additionalProperties) Gather all relevant build/calculation properties for given build artifact.Properties precedence order: system properties, build properties, calculation properties, additional properties (latter ones take precedence over former ones).
Only build-related system properties are gathered.
Because of used caching use this method rather than uncached
getProperties(IBuildArtifact, String, String, Properties)
} whenever possible.- Parameters:
ctxArtifact
- contextual build artifactbuildDescriptorName
- build descriptor name ornull
(ignored when found in context)calculationDescriptorName
- calculation descriptor name ornull
(ignored when found in context)additionalProperties
- additional properties ornull
(ignored when found in context)- Returns:
- shared instance of
Properties
(do not modify) - Throws:
IllegalArgumentException
- ifctxArtifact
isnull
IllegalArgumentException
- if one of descriptors is not known- See Also:
-
getProperties
Get build/calculation properties attached to given artifact.gatherProperties(IContextualBuildArtifact, String, String, Properties)
must be called at least once prior to calling this.- Parameters:
ctxArtifact
- contextual build artifact- Returns:
- shared instance of
Properties
(do not modify) - Throws:
IllegalArgumentException
- ifctxArtifact
isnull
- See Also:
-
isBuildProperty
Whether the given full property name is build configuration property.- Parameters:
name
- full property name (notnull
)- Returns:
true
if given property name is build configuration property
-