Class AgentGeneralRequirementsManagerImpl
- java.lang.Object
-
- jetbrains.buildServer.requirements.impl.AgentGeneralRequirementsManagerImpl
-
- All Implemented Interfaces:
AgentGeneralRequirementsManager
public class AgentGeneralRequirementsManagerImpl extends Object implements AgentGeneralRequirementsManager
-
-
Field Summary
Fields Modifier and Type Field Description static String
SUPPORTED_OS_PROPERTY
-
Fields inherited from interface jetbrains.buildServer.requirements.AgentGeneralRequirementsManager
LINUX, MAC, WINDOWS
-
-
Constructor Summary
Constructors Constructor Description AgentGeneralRequirementsManagerImpl(RequirementFactory requirementFactory, BuildAgentManager agentManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCpuCountRequirement(BuildTypeSettings buildTypeSettings, long minVal, long maxVal)
Adds requirement for matching agents by CPU count.void
addCpuCountRequirement(BuildTypeSettings buildTypeSettings, String minVal, String maxVal)
Adds requirement for matching agents by CPU count.void
addMemorySizeRequirement(BuildTypeSettings buildTypeSettings, long minVal, long maxVal)
Adds requirement for matching agents by memory size.void
addMemorySizeRequirement(BuildTypeSettings settings, String minVal, String maxVal)
Adds requirement for matching agents by memory size.void
addOperatingSystemRequirement(BuildTypeSettings settings, String osName)
Adds requirement for matching agents by operating systemvoid
addOperatingSystemRequirement(BuildTypeSettings settings, Collection<String> osNames)
Adds requirement for matching agents by operating system.long
detectMaximumCpuCount(List<Requirement> requirements)
Detects maximum CPU count, which satisfies the requirementslong
detectMaximumMemorySize(List<Requirement> requirements)
Detects maximum memory size, which satisfies the requirementslong
detectMinimumMemorySize(List<Requirement> requirements)
Detects minimum memory size, which satisfies the requirementslong
detectMinumumCpuCount(List<Requirement> requirements)
Detects minimum CPU count, which satisfies the requirementsCollection<String>
getCompatibleOperatingSystems(BuildTypeSettings settings)
long
getMinimumMatchingNumericValue(List<Requirement> requirements, long defaultVal)
List<String>
getRequiredOperatingSystems(List<Requirement> requirements)
Detects operating systems, required byrequirements
List<String>
getRequiredOperatingSystems(BuildTypeSettings settings)
Detects operating systems, required for the build typeList<Requirement>
getRequirementsByName(String parameterName, BuildTypeSettings settings)
Searches for requirement by parameter nameSet<String>
getSupportedOperatingSystems()
Returns set of operating systems, which is used for general requirements.
-
-
-
Field Detail
-
SUPPORTED_OS_PROPERTY
public static final String SUPPORTED_OS_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AgentGeneralRequirementsManagerImpl
public AgentGeneralRequirementsManagerImpl(@NotNull RequirementFactory requirementFactory, @NotNull BuildAgentManager agentManager)
-
-
Method Detail
-
getCompatibleOperatingSystems
@NotNull public Collection<String> getCompatibleOperatingSystems(@NotNull BuildTypeSettings settings)
- Specified by:
getCompatibleOperatingSystems
in interfaceAgentGeneralRequirementsManager
- Parameters:
settings
- settings, which agents are checked- Returns:
- collection of compatible agents OS names
-
getRequiredOperatingSystems
@NotNull public List<String> getRequiredOperatingSystems(@NotNull List<Requirement> requirements)
Description copied from interface:AgentGeneralRequirementsManager
Detects operating systems, required byrequirements
- Specified by:
getRequiredOperatingSystems
in interfaceAgentGeneralRequirementsManager
- Parameters:
requirements
- requirements, from which operating systems are detected- Returns:
- list of detected OS
-
addOperatingSystemRequirement
public void addOperatingSystemRequirement(@NotNull BuildTypeSettings settings, @NotNull String osName)
Description copied from interface:AgentGeneralRequirementsManager
Adds requirement for matching agents by operating system- Specified by:
addOperatingSystemRequirement
in interfaceAgentGeneralRequirementsManager
- Parameters:
settings
- settings, where requirement should be addedosName
- required operating system
-
addOperatingSystemRequirement
public void addOperatingSystemRequirement(@NotNull BuildTypeSettings settings, @NotNull Collection<String> osNames)
Description copied from interface:AgentGeneralRequirementsManager
Adds requirement for matching agents by operating system. All agents, which name is in the collection, will match the resulting requirement- Specified by:
addOperatingSystemRequirement
in interfaceAgentGeneralRequirementsManager
- Parameters:
settings
- settings, where requirement should be addedosNames
- collections of required operating systems
-
getSupportedOperatingSystems
@NotNull public Set<String> getSupportedOperatingSystems()
Description copied from interface:AgentGeneralRequirementsManager
Returns set of operating systems, which is used for general requirements. This may contain some predefined list and also operating systems of all registered at the moment agent- Specified by:
getSupportedOperatingSystems
in interfaceAgentGeneralRequirementsManager
- Returns:
- supported operating systems set
-
getRequiredOperatingSystems
@NotNull public List<String> getRequiredOperatingSystems(@NotNull BuildTypeSettings settings)
Description copied from interface:AgentGeneralRequirementsManager
Detects operating systems, required for the build type- Specified by:
getRequiredOperatingSystems
in interfaceAgentGeneralRequirementsManager
- Parameters:
settings
- settings, from which operating systems are detected- Returns:
- list of detected OS
-
getRequirementsByName
@NotNull public List<Requirement> getRequirementsByName(@NotNull String parameterName, @NotNull BuildTypeSettings settings)
Description copied from interface:AgentGeneralRequirementsManager
Searches for requirement by parameter name- Specified by:
getRequirementsByName
in interfaceAgentGeneralRequirementsManager
- Parameters:
parameterName
- name, by which requirements are searchedsettings
- settings, where requirements are searched- Returns:
- list of found requirements
-
addCpuCountRequirement
public void addCpuCountRequirement(@NotNull BuildTypeSettings buildTypeSettings, @NotNull String minVal, @NotNull String maxVal)
Description copied from interface:AgentGeneralRequirementsManager
Adds requirement for matching agents by CPU count. All agents, which have CPU count in the range of[minVal, maxVal]
, will match the resulting requirement. Given bounds are not validated- Specified by:
addCpuCountRequirement
in interfaceAgentGeneralRequirementsManager
- Parameters:
buildTypeSettings
- settings, where requirement should be addedminVal
- lower bound for CPU countmaxVal
- upper bound for CPU count
-
getMinimumMatchingNumericValue
public long getMinimumMatchingNumericValue(@NotNull List<Requirement> requirements, long defaultVal)
-
detectMinumumCpuCount
public long detectMinumumCpuCount(@NotNull List<Requirement> requirements)
Description copied from interface:AgentGeneralRequirementsManager
Detects minimum CPU count, which satisfies the requirements- Specified by:
detectMinumumCpuCount
in interfaceAgentGeneralRequirementsManager
- Parameters:
requirements
- list of requirements to satisfy- Returns:
- detected CPU count
-
detectMaximumCpuCount
public long detectMaximumCpuCount(@NotNull List<Requirement> requirements)
Description copied from interface:AgentGeneralRequirementsManager
Detects maximum CPU count, which satisfies the requirements- Specified by:
detectMaximumCpuCount
in interfaceAgentGeneralRequirementsManager
- Parameters:
requirements
- list of requirements to satisfy- Returns:
- detected CPU count
-
detectMinimumMemorySize
public long detectMinimumMemorySize(@NotNull List<Requirement> requirements)
Description copied from interface:AgentGeneralRequirementsManager
Detects minimum memory size, which satisfies the requirements- Specified by:
detectMinimumMemorySize
in interfaceAgentGeneralRequirementsManager
- Parameters:
requirements
- list of requirements to satisfy- Returns:
- detected memory size
-
detectMaximumMemorySize
public long detectMaximumMemorySize(@NotNull List<Requirement> requirements)
Description copied from interface:AgentGeneralRequirementsManager
Detects maximum memory size, which satisfies the requirements- Specified by:
detectMaximumMemorySize
in interfaceAgentGeneralRequirementsManager
- Parameters:
requirements
- list of requirements to satisfy- Returns:
- detected memory size
-
addMemorySizeRequirement
public void addMemorySizeRequirement(@NotNull BuildTypeSettings settings, @NotNull String minVal, @NotNull String maxVal)
Description copied from interface:AgentGeneralRequirementsManager
Adds requirement for matching agents by memory size. All agents, which have memory size in the range of[minVal, maxVal]
, will match the resulting requirement. Given bounds are not validated- Specified by:
addMemorySizeRequirement
in interfaceAgentGeneralRequirementsManager
minVal
- lower bound for memory sizemaxVal
- upper bound for memory size
-
addCpuCountRequirement
public void addCpuCountRequirement(@NotNull BuildTypeSettings buildTypeSettings, long minVal, long maxVal) throws GeneralRequirementsValidationException
Description copied from interface:AgentGeneralRequirementsManager
Adds requirement for matching agents by CPU count. All agents, which have CPU count in the range of[minVal, maxVal]
, will match the resulting requirement. Given bounds are validated- Specified by:
addCpuCountRequirement
in interfaceAgentGeneralRequirementsManager
- Parameters:
buildTypeSettings
- settings, where requirement should be addedminVal
- lower bound for CPU countmaxVal
- upper bound for CPU count- Throws:
GeneralRequirementsValidationException
- if range is not valid
-
addMemorySizeRequirement
public void addMemorySizeRequirement(@NotNull BuildTypeSettings buildTypeSettings, long minVal, long maxVal) throws GeneralRequirementsValidationException
Description copied from interface:AgentGeneralRequirementsManager
Adds requirement for matching agents by memory size. All agents, which have memory size in the range of[minVal, maxVal]
, will match the resulting requirement. Given bounds are not validated- Specified by:
addMemorySizeRequirement
in interfaceAgentGeneralRequirementsManager
- Parameters:
buildTypeSettings
- settings, where requirement should be addedminVal
- lower bound for memory sizemaxVal
- upper bound for memory size- Throws:
GeneralRequirementsValidationException
- if bounds are not valid
-
-