Class SecuredVersionedSettingsManager
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.auth.SecuredVersionedSettingsManager
-
- All Implemented Interfaces:
VersionedSettingsManager
public class SecuredVersionedSettingsManager extends Object implements VersionedSettingsManager
-
-
Constructor Summary
Constructors Constructor Description SecuredVersionedSettingsManager(VersionedSettingsManager delegate, SecurityContextEx securityContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigAction
createEnableConfigActionAfterUpgrade(int prevVersion, int curVersion)
boolean
enableVersionedSettings()
Globally enable versioned settings on the server, if the enabling process is not running yet.TriggerRules
excludeSettingRoots(String rules, Collection<SBuildType> buildTypes)
Returns trigger rules which exclude unattached settings VCS roots used in given buildTypes.ProjectSettingsGenerator
findGenerator(String format)
Returns the project settings generator for the specified format or null if no such generator existList<String>
generateSettingsZip(SProject project, File dst, String format, ProjectSettingsGeneratorConfig config)
Generates zip with project settings in the specified format and writes it to the given dst file.String
getCredentialsStorageType(SProject project)
Returns type of theCredentialsStorage
which should be used for versioned settings of the specified project.VersionedSettingsConfig
getEffectiveBuildSettingsConfig(SBuildType buildType)
Returns build settings config of a project where versioned settings VCS root is configured for given buildType's project.VersionedSettingsConfig
getEffectiveBuildSettingsConfig(SProject project)
Returns settings config of a project where versioned settings VCS root is configured for the given project.VersionedSettingsConfig.BuildSettingsMode
getEffectiveBuildSettingsMode(SBuildType buildType)
Returns build settings mode of a project where versioned settings VCS root is configured for given buildType's project.VersionedSettingsConfig.BuildSettingsMode
getEffectiveBuildSettingsMode(SProject project)
Returns build settings mode for given project or null if versioned settings are not configured for given projectString
getEffectiveFormat(SProject project)
Returns effective settings format for the given project or null if versioned settings are not configured in the projectProjectSettingsGenerator
getEffectiveGenerator(SProject project)
Returns effective settings generator for given project or default generator if versioned settings are not configured for given projectProjectSettingsGenerator
getEffectiveGeneratorOrNull(SProject project)
Returns effective settings generator for given project or default generator if versioned settings are not configured for given project, returns null if the generator specified in project settings is not found.Pair<SProject,VersionedSettingsConfig>
getEffectiveProjectConfig(SProject project)
Returns project and settings config of a project where versioned settings VCS root is configured for the given project.ProjectSettingsPaths
getEffectiveProjectSettingsPaths(SProject project)
Returns effective Versioned Settings Files Paths for the given project.Collection<ProjectSettingsGenerator>
getGenerators()
Returns all registered project settings generatorsVersionedSettingsOptions
getOptions()
SVcsRoot
getOwnVersionedSettingsVcsRoot(SProject project)
Returns versioned settings root configured for given project ignoring settings inherited from parent project.Set<SProject>
getProjectsByOwnSettingsRoot(VcsRoot root)
Returns all projects which explicitly use the given VCS root for storing settings ignoring the settings inherited from parent projectSet<SProject>
getProjectsByOwnSettingsRootInstance(VcsRootInstance root)
Returns all projects which explicitly use the given VCS root instance for storing settings, ignoring the settings inherited from the parent projectSet<SProject>
getProjectsBySettingsRoot(VcsRoot root)
Returns all projects which use the given VCS root for storing settingsSet<SProject>
getProjectsBySettingsRootInstance(VcsRootInstance root)
Returns all projects which use the given VCS root instance for storing settingsSet<SProject>
getProjectsWithOwnVersionedSettings()
Returns set of projects where versioned settings are explicitly enabled (does not include projects with 'same as parent' settings).Map<SBuildType,CheckoutRules>
getSettingsRootCheckoutRules(Collection<SBuildType> buildTypes, VcsRootInstance settingsRoot)
Returns settings VCS root checkout rules for a collection of build types if versioned settings are not configured for the build type's project or if different root is used to store settings then returned map will not contain entry for this build typeCheckoutRules
getSettingsRootCheckoutRules(SBuildType buildType, VcsRootInstance root)
Returns settings VCS root checkout rules for given build type or null if versioned settings are not configured for the build type's project or if different root is used to store settingsBuildRevision
getSettingsRootRevision(BuildPromotionEx buildPromotion)
Returns a revision of a settings VCS root for the given build promotion or null if build promotion does not have version settings enabled or checking for changes is not done yet.Set<SProject>
getSubProjectsWithSameSettings(SProject project)
Returns transitive sub-projects of the given project which use 'same as parent' versioned settingsSProject
getVersionedSettingsProject(SProject project)
Returns a project where versioned settings VCS root is configured for given project.SVcsRoot
getVersionedSettingsVcsRoot(SProject project)
For given project returns VCS root where project settings are stored.VcsRootInstance
getVersionedSettingsVcsRootInstance(SProject project)
For given project finds VCS root where project settings are stored, then resolves it's parameters using given project as a context.VcsRootInstanceEntry
getVersionedSettingsVcsRootInstanceEntry(SBuildType buildType)
Returns settings VCS root entry for the given build type or null if versioned settings are not configured for the build type's projectboolean
hasVersionedSettings(SProject project)
Returns true if the specified project stores settings in VCS, false otherwiseboolean
isEnableSettingsActionAfterUpgrade(ConfigAction configAction)
boolean
isProjectWithCustomSettingsFormat(SProject project)
Returns true if the specified project uses custom settings format, returns false otherwiseboolean
isProjectWithReadOnlySettingsFormat(SProject project)
Returns true if the specified project uses read-only settings format, returns false otherwise or when configured format is not foundboolean
isShowBranchesFromVersionedSettingsVcsRoot(SBuildType buildType)
Returns true if branches from the versioned settings VCS root should be shown in the context of the build configuration.boolean
isShowSettingsChanges(SProject project)
Returns true if settings changes should be shown in builds in the given projectVersionedSettingsConfig
readConfig(SProject project)
void
setContextParameters(SProject project, Map<String,String> parameters)
boolean
shouldTakeSettingsFromVcs(SBuildType buildType, BuildPromotionEx promotion)
Returns true if the given promotion should take settings from VCS, takes buildType's and promotion's options into account.void
visitProjectsInSettingsRootInstance(VcsRootInstance root, BiConsumer<SProject,VersionedSettingsConfig> consumer)
Visits projects storing settings in the given VCS root instancevoid
writeConfig(ConfigAction cause, SProject project, VersionedSettingsConfig config)
-
-
-
Constructor Detail
-
SecuredVersionedSettingsManager
public SecuredVersionedSettingsManager(@NotNull VersionedSettingsManager delegate, @NotNull SecurityContextEx securityContext)
-
-
Method Detail
-
getVersionedSettingsVcsRoot
@Nullable public SVcsRoot getVersionedSettingsVcsRoot(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
For given project returns VCS root where project settings are stored. Returns null if versioned settings are not configured for given project.- Specified by:
getVersionedSettingsVcsRoot
in interfaceVersionedSettingsManager
- Returns:
-
getOwnVersionedSettingsVcsRoot
@Nullable public SVcsRoot getOwnVersionedSettingsVcsRoot(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns versioned settings root configured for given project ignoring settings inherited from parent project.- Specified by:
getOwnVersionedSettingsVcsRoot
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
getProjectsWithOwnVersionedSettings
@NotNull public Set<SProject> getProjectsWithOwnVersionedSettings()
Description copied from interface:VersionedSettingsManager
Returns set of projects where versioned settings are explicitly enabled (does not include projects with 'same as parent' settings).- Specified by:
getProjectsWithOwnVersionedSettings
in interfaceVersionedSettingsManager
- Returns:
- see above
-
getVersionedSettingsVcsRootInstance
@Nullable public VcsRootInstance getVersionedSettingsVcsRootInstance(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
For given project finds VCS root where project settings are stored, then resolves it's parameters using given project as a context. Returns null if versioned settings are not configured for given project.- Specified by:
getVersionedSettingsVcsRootInstance
in interfaceVersionedSettingsManager
- Returns:
-
getProjectsBySettingsRoot
@NotNull public Set<SProject> getProjectsBySettingsRoot(@NotNull VcsRoot root)
Description copied from interface:VersionedSettingsManager
Returns all projects which use the given VCS root for storing settings- Specified by:
getProjectsBySettingsRoot
in interfaceVersionedSettingsManager
- Parameters:
root
- VCS root of interest- Returns:
- see above
-
getProjectsByOwnSettingsRoot
@NotNull public Set<SProject> getProjectsByOwnSettingsRoot(@NotNull VcsRoot root)
Description copied from interface:VersionedSettingsManager
Returns all projects which explicitly use the given VCS root for storing settings ignoring the settings inherited from parent project- Specified by:
getProjectsByOwnSettingsRoot
in interfaceVersionedSettingsManager
- Parameters:
root
- VCS root of interest- Returns:
- see above
-
getProjectsByOwnSettingsRootInstance
@NotNull public Set<SProject> getProjectsByOwnSettingsRootInstance(@NotNull VcsRootInstance root)
Description copied from interface:VersionedSettingsManager
Returns all projects which explicitly use the given VCS root instance for storing settings, ignoring the settings inherited from the parent project- Specified by:
getProjectsByOwnSettingsRootInstance
in interfaceVersionedSettingsManager
- Parameters:
root
- VCS root instance of interest- Returns:
- see above
-
getProjectsBySettingsRootInstance
@NotNull public Set<SProject> getProjectsBySettingsRootInstance(@NotNull VcsRootInstance root)
Description copied from interface:VersionedSettingsManager
Returns all projects which use the given VCS root instance for storing settings- Specified by:
getProjectsBySettingsRootInstance
in interfaceVersionedSettingsManager
- Parameters:
root
- VCS root instance of interest- Returns:
- see above
-
visitProjectsInSettingsRootInstance
public void visitProjectsInSettingsRootInstance(@NotNull VcsRootInstance root, @NotNull BiConsumer<SProject,VersionedSettingsConfig> consumer)
Description copied from interface:VersionedSettingsManager
Visits projects storing settings in the given VCS root instance- Specified by:
visitProjectsInSettingsRootInstance
in interfaceVersionedSettingsManager
- Parameters:
root
- VCS root instance of interestconsumer
- is called for every visited project and its config
-
getVersionedSettingsVcsRootInstanceEntry
@Nullable public VcsRootInstanceEntry getVersionedSettingsVcsRootInstanceEntry(@NotNull SBuildType buildType)
Description copied from interface:VersionedSettingsManager
Returns settings VCS root entry for the given build type or null if versioned settings are not configured for the build type's project- Specified by:
getVersionedSettingsVcsRootInstanceEntry
in interfaceVersionedSettingsManager
- Parameters:
buildType
- build type of interest- Returns:
- see above
-
getSettingsRootCheckoutRules
@Nullable public CheckoutRules getSettingsRootCheckoutRules(@NotNull SBuildType buildType, @NotNull VcsRootInstance root)
Description copied from interface:VersionedSettingsManager
Returns settings VCS root checkout rules for given build type or null if versioned settings are not configured for the build type's project or if different root is used to store settings- Specified by:
getSettingsRootCheckoutRules
in interfaceVersionedSettingsManager
- Parameters:
buildType
- build type of interestroot
- settings root- Returns:
- see above
-
getSettingsRootCheckoutRules
@NotNull public Map<SBuildType,CheckoutRules> getSettingsRootCheckoutRules(@NotNull Collection<SBuildType> buildTypes, @NotNull VcsRootInstance settingsRoot)
Description copied from interface:VersionedSettingsManager
Returns settings VCS root checkout rules for a collection of build types if versioned settings are not configured for the build type's project or if different root is used to store settings then returned map will not contain entry for this build type- Specified by:
getSettingsRootCheckoutRules
in interfaceVersionedSettingsManager
- Parameters:
buildTypes
- build types of interestsettingsRoot
- settings root- Returns:
- see above
-
getEffectiveGenerator
@NotNull public ProjectSettingsGenerator getEffectiveGenerator(@NotNull SProject project) throws IllegalArgumentException
Description copied from interface:VersionedSettingsManager
Returns effective settings generator for given project or default generator if versioned settings are not configured for given project- Specified by:
getEffectiveGenerator
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
- Throws:
IllegalArgumentException
- if generator is not found for settings format used in project
-
getEffectiveGeneratorOrNull
@Nullable public ProjectSettingsGenerator getEffectiveGeneratorOrNull(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns effective settings generator for given project or default generator if versioned settings are not configured for given project, returns null if the generator specified in project settings is not found.- Specified by:
getEffectiveGeneratorOrNull
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
getEffectiveFormat
@Nullable public String getEffectiveFormat(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns effective settings format for the given project or null if versioned settings are not configured in the project- Specified by:
getEffectiveFormat
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
isProjectWithCustomSettingsFormat
public boolean isProjectWithCustomSettingsFormat(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns true if the specified project uses custom settings format, returns false otherwise- Specified by:
isProjectWithCustomSettingsFormat
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
isProjectWithReadOnlySettingsFormat
public boolean isProjectWithReadOnlySettingsFormat(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns true if the specified project uses read-only settings format, returns false otherwise or when configured format is not found- Specified by:
isProjectWithReadOnlySettingsFormat
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
getGenerators
@NotNull public Collection<ProjectSettingsGenerator> getGenerators()
Description copied from interface:VersionedSettingsManager
Returns all registered project settings generators- Specified by:
getGenerators
in interfaceVersionedSettingsManager
- Returns:
- see above
-
findGenerator
@Nullable public ProjectSettingsGenerator findGenerator(@NotNull String format)
Description copied from interface:VersionedSettingsManager
Returns the project settings generator for the specified format or null if no such generator exist- Specified by:
findGenerator
in interfaceVersionedSettingsManager
- Parameters:
format
- format of interest- Returns:
- see above
-
getVersionedSettingsProject
@Nullable public SProject getVersionedSettingsProject(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns a project where versioned settings VCS root is configured for given project. Returns null if versioned settings are not configured for given project.- Specified by:
getVersionedSettingsProject
in interfaceVersionedSettingsManager
- Returns:
-
hasVersionedSettings
public boolean hasVersionedSettings(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns true if the specified project stores settings in VCS, false otherwise- Specified by:
hasVersionedSettings
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
readConfig
@NotNull public VersionedSettingsConfig readConfig(@NotNull SProject project)
- Specified by:
readConfig
in interfaceVersionedSettingsManager
-
getEffectiveBuildSettingsMode
@Nullable public VersionedSettingsConfig.BuildSettingsMode getEffectiveBuildSettingsMode(@NotNull SBuildType buildType)
Description copied from interface:VersionedSettingsManager
Returns build settings mode of a project where versioned settings VCS root is configured for given buildType's project. Returns null if versioned settings are not configured for given buildType's project.- Specified by:
getEffectiveBuildSettingsMode
in interfaceVersionedSettingsManager
- Parameters:
buildType
- buildType of interest- Returns:
- see above
-
getEffectiveBuildSettingsConfig
@Nullable public VersionedSettingsConfig getEffectiveBuildSettingsConfig(@NotNull SBuildType buildType)
Description copied from interface:VersionedSettingsManager
Returns build settings config of a project where versioned settings VCS root is configured for given buildType's project. Returns null if versioned settings are not configured for given buildType's project.- Specified by:
getEffectiveBuildSettingsConfig
in interfaceVersionedSettingsManager
- Parameters:
buildType
- buildType of interest- Returns:
- see above
-
getEffectiveBuildSettingsConfig
@Nullable public VersionedSettingsConfig getEffectiveBuildSettingsConfig(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns settings config of a project where versioned settings VCS root is configured for the given project. Returns null if versioned settings are not configured for the given project.- Specified by:
getEffectiveBuildSettingsConfig
in interfaceVersionedSettingsManager
- Returns:
- see above
-
getEffectiveProjectConfig
@Nullable public Pair<SProject,VersionedSettingsConfig> getEffectiveProjectConfig(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns project and settings config of a project where versioned settings VCS root is configured for the given project. Returns null if versioned settings are not configured for the given project- Specified by:
getEffectiveProjectConfig
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
getEffectiveBuildSettingsMode
@Nullable public VersionedSettingsConfig.BuildSettingsMode getEffectiveBuildSettingsMode(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns build settings mode for given project or null if versioned settings are not configured for given project- Specified by:
getEffectiveBuildSettingsMode
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
writeConfig
public void writeConfig(@NotNull ConfigAction cause, @NotNull SProject project, @NotNull VersionedSettingsConfig config)
- Specified by:
writeConfig
in interfaceVersionedSettingsManager
-
setContextParameters
public void setContextParameters(@NotNull SProject project, @NotNull Map<String,String> parameters)
- Specified by:
setContextParameters
in interfaceVersionedSettingsManager
-
excludeSettingRoots
@NotNull public TriggerRules excludeSettingRoots(@Nullable String rules, @NotNull Collection<SBuildType> buildTypes)
Description copied from interface:VersionedSettingsManager
Returns trigger rules which exclude unattached settings VCS roots used in given buildTypes. If the rules contain a rule for a settings VCS root, then this rule is not modified and no new rules for this root are added- Specified by:
excludeSettingRoots
in interfaceVersionedSettingsManager
- Parameters:
rules
- trigger rules string representationbuildTypes
- buildTypes to process- Returns:
- see above
-
isShowSettingsChanges
public boolean isShowSettingsChanges(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns true if settings changes should be shown in builds in the given project- Specified by:
isShowSettingsChanges
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
isShowBranchesFromVersionedSettingsVcsRoot
public boolean isShowBranchesFromVersionedSettingsVcsRoot(@NotNull SBuildType buildType)
Description copied from interface:VersionedSettingsManager
Returns true if branches from the versioned settings VCS root should be shown in the context of the build configuration. Currently, these branches are shown if versioned settings are enabled in the build configuration project and the "Build settings mode" is either "use VCS" or "prefer VCS".- Specified by:
isShowBranchesFromVersionedSettingsVcsRoot
in interfaceVersionedSettingsManager
- Returns:
- see above
-
getCredentialsStorageType
@Nullable public String getCredentialsStorageType(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns type of theCredentialsStorage
which should be used for versioned settings of the specified project. Returns null, if credentials should be stored in scrambled form in project configuration files.- Specified by:
getCredentialsStorageType
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
getSubProjectsWithSameSettings
@NotNull public Set<SProject> getSubProjectsWithSameSettings(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns transitive sub-projects of the given project which use 'same as parent' versioned settings- Specified by:
getSubProjectsWithSameSettings
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interest- Returns:
- see above
-
getOptions
@NotNull public VersionedSettingsOptions getOptions()
- Specified by:
getOptions
in interfaceVersionedSettingsManager
-
shouldTakeSettingsFromVcs
public boolean shouldTakeSettingsFromVcs(@NotNull SBuildType buildType, @NotNull BuildPromotionEx promotion)
Description copied from interface:VersionedSettingsManager
Returns true if the given promotion should take settings from VCS, takes buildType's and promotion's options into account.- Specified by:
shouldTakeSettingsFromVcs
in interfaceVersionedSettingsManager
- Parameters:
buildType
- build's buildTypepromotion
- build promotion of interest- Returns:
- see above
-
generateSettingsZip
@NotNull public List<String> generateSettingsZip(@NotNull SProject project, @NotNull File dst, @NotNull String format, @NotNull ProjectSettingsGeneratorConfig config) throws IOException
Description copied from interface:VersionedSettingsManager
Generates zip with project settings in the specified format and writes it to the given dst file. Includes settings of the project and all its subprojects with same versioned settings as in parent recursively.- Specified by:
generateSettingsZip
in interfaceVersionedSettingsManager
- Parameters:
project
- project of interestdst
- destination zip archive fileformat
- formatconfig
- config for generation- Returns:
- list of errors detected during generation
- Throws:
IOException
-
createEnableConfigActionAfterUpgrade
@NotNull public ConfigAction createEnableConfigActionAfterUpgrade(int prevVersion, int curVersion)
- Specified by:
createEnableConfigActionAfterUpgrade
in interfaceVersionedSettingsManager
-
isEnableSettingsActionAfterUpgrade
public boolean isEnableSettingsActionAfterUpgrade(@NotNull ConfigAction configAction)
- Specified by:
isEnableSettingsActionAfterUpgrade
in interfaceVersionedSettingsManager
-
enableVersionedSettings
public boolean enableVersionedSettings()
Description copied from interface:VersionedSettingsManager
Globally enable versioned settings on the server, if the enabling process is not running yet.- Specified by:
enableVersionedSettings
in interfaceVersionedSettingsManager
- Returns:
- true if versioned settings were enabled as a result of this call
-
getEffectiveProjectSettingsPaths
@NotNull public ProjectSettingsPaths getEffectiveProjectSettingsPaths(@NotNull SProject project)
Description copied from interface:VersionedSettingsManager
Returns effective Versioned Settings Files Paths for the given project.- Specified by:
getEffectiveProjectSettingsPaths
in interfaceVersionedSettingsManager
- Returns:
- see above
-
getSettingsRootRevision
@Nullable public BuildRevision getSettingsRootRevision(@NotNull BuildPromotionEx buildPromotion)
Description copied from interface:VersionedSettingsManager
Returns a revision of a settings VCS root for the given build promotion or null if build promotion does not have version settings enabled or checking for changes is not done yet.- Specified by:
getSettingsRootRevision
in interfaceVersionedSettingsManager
- Returns:
- see above
-
-