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 PropertiesgatherProperties(IContextualBuildArtifact ctxArtifact, String buildDescriptorName, String calculationDescriptorName, Properties additionalProperties) Gather all relevant build/calculation properties for given build artifact.static StringgetFullPropertyName(String name) Get full name of given build property (including prefix).static PropertiesgetProperties(IBuildArtifact buildArtifact, String buildDescriptorName, String calculationDescriptorName, Properties additionalProperties) Gather all relevant build/calculation properties for given build artifact.static PropertiesgetProperties(IContextualBuildArtifact ctxArtifact) Get build/calculation properties attached to given artifact.static StringgetPropertyValue(Properties props, String name) Return property value.static StringgetPropertyValue(Properties props, String name, String def) Return property value.static booleanisBuildProperty(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- ifnameisnull
-
getPropertyValue
Return property value.- Parameters:
props- propertiesname- property name (without prefix)- Returns:
- property value or
nullif not found - Throws:
IllegalArgumentException- ifpropsisnullIllegalArgumentException- ifnameisnull
-
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- ifpropsisnullIllegalArgumentException- ifnameisnull
-
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 ornullcalculationDescriptorName- calculation descriptor name ornulladditionalProperties- additional properties ornull- Returns:
- new instance of
Properties(can be freely modified) - Throws:
IllegalArgumentException- ifbuildArtifactisnullIllegalArgumentException- 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- ifctxArtifactisnullIllegalArgumentException- 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- ifctxArtifactisnull- See Also:
-
isBuildProperty
Whether the given full property name is build configuration property.- Parameters:
name- full property name (notnull)- Returns:
trueif given property name is build configuration property
-