Package jetbrains.buildServer.vcs.impl
Class InaccessibleVcsRoot
- java.lang.Object
-
- jetbrains.buildServer.vcs.impl.VcsRootImpl
-
- jetbrains.buildServer.vcs.impl.InaccessibleVcsRoot
-
- All Implemented Interfaces:
Comparable<SVcsRoot>,Loggable,SPersistentEntity,LVcsRoot,SVcsRoot,SVcsRootAccess,SVcsRootEx,SVcsRootUpdate,SVcsRootUsages,VcsRoot
public class InaccessibleVcsRoot extends VcsRootImpl implements SVcsRootEx
Created 23.08.13 15:24- Author:
- Eugene Petrenko (eugene.petrenko@jetbrains.com)
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.vcs.impl.VcsRootImpl
BRANCH_SPEC_PROP, CHECKOUT_ROOT, UNKNOWN_ROOT_NAME, VCS_NAME_PROP, VCS_ROOT_NAME_PROP
-
Fields inherited from interface jetbrains.buildServer.vcs.VcsRoot
SECURE_PROPERTY_PREFIX
-
-
Constructor Summary
Constructors Constructor Description InaccessibleVcsRoot(SVcsRoot found)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckAccessibleFrom(SBuildType buildType)Checks that VCS root can be attached to specified configuration.voidcheckAccessibleFrom(SProject project)Checks that VCS root can be attached to configurations of specified project.intcompareTo(SVcsRoot o)ConfigActioncreateConfigAction(SUser user, String description)Creates a config action instance associated with this entity and having the specified description.Set<SProject>getAccessibleProjects()Returns projects where this VCS root can be attached to a configurationBranchSpecgetBranchSpec(ValueResolver valueResolver)Returns branch specification if it is defined in VCS root and can be fully resolved.StringgetConfigId()Returns the entity's config identifier.FilegetConfigurationFile()Returns the configuration file where this entity instance is persisted (or will be persisted to).FilegetConfigurationFile(File projectsDir)Returns the configuration file where this entity is persisted in custom projects directoryStringgetDescription()EntityId<Long>getEntityId()StringgetExternalId()Returns the external identifier.AuditLogActiongetLastConfigModificationAction()intgetModificationCheckInterval()returns modification check interval in secondsStringgetName()returns descriptive name of the vcs rootintgetNumberOfUsagesInProjects()SPersistentEntitygetParent()The parent entity.ProjectExgetProject()ReadOnlyReasongetReadOnlyReason()VcsRootScopegetScope()Returns scope of this VCS rootMap<SBuildType,CheckoutRules>getUsages()List<SBuildType>getUsagesInConfigurations()Collection<SProject>getUsagesInProjects()StringgetVcsDisplayName()Returns VCS plugin display namePersistentEntityVersiongetVersion()Returns version of this entity which can be used to check if the entity was edited or persisted.booleanisAccessibleFrom(SBuildType buildType)Returns true if VCS root can be attached to specified configuration.booleanisAccessibleFrom(SProject project)Returns true if VCS root can be attached to configurations of specified project.booleanisAliasExternalId(String extId)booleanisBranchSpecDefined(ValueResolver valueResolver)Returns true if after the properties resolution this VCS root has not empty branch specificationbooleanisEmptyUuid()booleanisReadOnly()booleanisUseDefaultModificationCheckInterval()Returns if 'use default modification check interval' mode is enabled for the root.booleanisUsedInProjects()voidmarkPersisted(long expectedEditId)Marks entity as persistedvoidmoveToProject(ConfigAction cause, SProject target)Moves this VCS root to specified target project.voidmoveToProject(SProject target)Moves this VCS root to specified target project.voidpersist()Persists this VCS root on diskvoidpersist(ConfigAction cause)Persists this entity on disk.voidremove()Removes this VCS root from it's project.voidrestoreDefaultModificationCheckInterval()Switched to 'use default modification check interval' mode.PersistTaskschedulePersisting(String reason)Schedules background persisting of this entity settings.PersistTaskschedulePersisting(ConfigAction cause)Schedules background persisting of this project settings.PersistTaskscheduleRemove(ConfigAction cause)Schedules remove of this persistent entity.voidsendExtIdChangedEvents(ConfigAction cause, String oldExtId, String newExtId)Sends external id changed event.voidsetExternalId(String externalId)Changes external id of this VCS root and persists this VCS root configuration to diskvoidsetExternalId(ConfigAction cause, String externalId)Changes external id of this VCS root and persists this VCS root configuration to diskvoidsetExternalId(ConfigAction cause, String externalId, boolean sendEvents)Same as {SVcsRootUpdate.setExternalId(ConfigAction, String)} but provides control over events processing.voidsetModificationCheckInterval(int value)Changes modification check interval for the root.voidunregister()Removes VCS root from project model but does not removes any configuration files from disk-
Methods inherited from class jetbrains.buildServer.vcs.impl.VcsRootImpl
addProperty, describe, equals, getId, getProperties, getProperty, getProperty, getVcsName, hashCode, isEquivalentRoots, setName, setProperties, setVcsName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.SPersistentEntity
isVirtual
-
Methods inherited from interface jetbrains.buildServer.vcs.SVcsRootUpdate
setName, setProperties, setVcsName
-
Methods inherited from interface jetbrains.buildServer.vcs.VcsRoot
getId, getProperties, getProperty, getProperty, getVcsName
-
-
-
-
Constructor Detail
-
InaccessibleVcsRoot
public InaccessibleVcsRoot(@NotNull SVcsRoot found)
-
-
Method Detail
-
getModificationCheckInterval
public int getModificationCheckInterval()
Description copied from interface:SVcsRootreturns modification check interval in seconds- Specified by:
getModificationCheckIntervalin interfaceSVcsRoot- Returns:
- modification check interval configured for the root.
-
setModificationCheckInterval
public void setModificationCheckInterval(int value)
Description copied from interface:SVcsRootUpdateChanges modification check interval for the root.- Specified by:
setModificationCheckIntervalin interfaceSVcsRootUpdate- Parameters:
value- seconds.
-
isUseDefaultModificationCheckInterval
public boolean isUseDefaultModificationCheckInterval()
Description copied from interface:SVcsRootReturns if 'use default modification check interval' mode is enabled for the root.- Specified by:
isUseDefaultModificationCheckIntervalin interfaceSVcsRoot- Returns:
- if 'use default modification check interval' mode is enabled for the root.
-
restoreDefaultModificationCheckInterval
public void restoreDefaultModificationCheckInterval()
Description copied from interface:SVcsRootUpdateSwitched to 'use default modification check interval' mode.- Specified by:
restoreDefaultModificationCheckIntervalin interfaceSVcsRootUpdate
-
isAccessibleFrom
public boolean isAccessibleFrom(@NotNull SBuildType buildType)Description copied from interface:SVcsRootAccessReturns true if VCS root can be attached to specified configuration.- Specified by:
isAccessibleFromin interfaceSVcsRootAccess- Parameters:
buildType- build configuration- Returns:
- true if VCS roots with this scope are accessible from the specified build configuration.
-
isAccessibleFrom
public boolean isAccessibleFrom(@NotNull SProject project)Description copied from interface:SVcsRootAccessReturns true if VCS root can be attached to configurations of specified project.- Specified by:
isAccessibleFromin interfaceSVcsRootAccess- Parameters:
project- project- Returns:
- true if VCS roots with this scope are accessible from the specified project
-
getAccessibleProjects
@NotNull public Set<SProject> getAccessibleProjects()
Description copied from interface:SVcsRootAccessReturns projects where this VCS root can be attached to a configuration- Specified by:
getAccessibleProjectsin interfaceSVcsRootAccess- Returns:
- see above
-
checkAccessibleFrom
public void checkAccessibleFrom(@NotNull SBuildType buildType) throws InvalidVcsRootScopeExceptionDescription copied from interface:SVcsRootAccessChecks that VCS root can be attached to specified configuration.- Specified by:
checkAccessibleFromin interfaceSVcsRootAccess- Parameters:
buildType- build configuration- Throws:
InvalidVcsRootScopeException- if VCS root is inaccessible
-
checkAccessibleFrom
public void checkAccessibleFrom(@NotNull SProject project) throws InvalidVcsRootScopeExceptionDescription copied from interface:SVcsRootAccessChecks that VCS root can be attached to configurations of specified project.- Specified by:
checkAccessibleFromin interfaceSVcsRootAccess- Parameters:
project- project- Throws:
InvalidVcsRootScopeException- if VCS root is not accessible
-
getDescription
@NotNull public String getDescription()
- Specified by:
getDescriptionin interfaceLVcsRoot- Returns:
- short human readable description of the root. Composed by underlying VCS support.
-
getVcsDisplayName
@NotNull public String getVcsDisplayName()
Description copied from interface:LVcsRootReturns VCS plugin display name- Specified by:
getVcsDisplayNamein interfaceLVcsRoot- Returns:
- see above, returns null if VCS plugin corresponding to VCS root does not exist
-
getUsages
@NotNull public Map<SBuildType,CheckoutRules> getUsages()
- Specified by:
getUsagesin interfaceSVcsRootUsages- Returns:
- This method returns all usages of this VCS root in various build configurations + its checkout rules
-
getUsagesInConfigurations
@NotNull public List<SBuildType> getUsagesInConfigurations()
- Specified by:
getUsagesInConfigurationsin interfaceSVcsRootUsages- Returns:
- All configurations where this VCS Root is used (excluding VCS settings usages). Works faster than
SVcsRootUsages.getUsages()
-
getName
@NotNull public String getName()
Description copied from interface:VcsRootreturns descriptive name of the vcs root- Specified by:
getNamein interfaceSPersistentEntity- Specified by:
getNamein interfaceVcsRoot- Overrides:
getNamein classVcsRootImpl- Returns:
- see above
-
getConfigId
@NotNull public String getConfigId()
Description copied from interface:SPersistentEntityReturns the entity's config identifier. Config identifier uniquely identifies the entity across different TeamCity servers and can't be modified in contrast to external identifier.- Specified by:
getConfigIdin interfaceSPersistentEntity
-
getExternalId
@NotNull public String getExternalId()
Description copied from interface:SPersistentEntityReturns the external identifier.- Specified by:
getExternalIdin interfaceSPersistentEntity- Specified by:
getExternalIdin interfaceVcsRoot- Overrides:
getExternalIdin classVcsRootImpl- Returns:
- externalID for this VCS Root, if it was set.
-
getScope
@NotNull public VcsRootScope getScope()
Description copied from interface:SVcsRootUsagesReturns scope of this VCS root- Specified by:
getScopein interfaceSVcsRootUsages- Returns:
- scope of this VCS root
-
getEntityId
@NotNull public EntityId<Long> getEntityId()
- Specified by:
getEntityIdin interfaceSVcsRootEx
-
getProject
@NotNull public ProjectEx getProject() throws ProjectNotFoundException
- Specified by:
getProjectin interfaceSVcsRootEx- Specified by:
getProjectin interfaceSVcsRootUsages- Returns:
- project this VCS root belongs to
- Throws:
ProjectNotFoundException
-
unregister
public void unregister()
Description copied from interface:SVcsRootExRemoves VCS root from project model but does not removes any configuration files from disk- Specified by:
unregisterin interfaceSVcsRootEx
-
getLastConfigModificationAction
@Nullable public AuditLogAction getLastConfigModificationAction()
- Specified by:
getLastConfigModificationActionin interfaceSVcsRootEx
-
getBranchSpec
@Nullable public BranchSpec getBranchSpec(@NotNull ValueResolver valueResolver)
Description copied from interface:SVcsRootExReturns branch specification if it is defined in VCS root and can be fully resolved. If branch spec is not defined or cannot be fully resolved returns null.- Specified by:
getBranchSpecin interfaceSVcsRootEx- Parameters:
valueResolver- value resolver to use- Returns:
- see above
-
isBranchSpecDefined
public boolean isBranchSpecDefined(@NotNull ValueResolver valueResolver)Description copied from interface:SVcsRootExReturns true if after the properties resolution this VCS root has not empty branch specification- Specified by:
isBranchSpecDefinedin interfaceSVcsRootEx- Returns:
-
getParent
@Nullable public SPersistentEntity getParent()
Description copied from interface:SPersistentEntityThe parent entity.- Specified by:
getParentin interfaceSPersistentEntity- Returns:
- see above.
-
getNumberOfUsagesInProjects
public int getNumberOfUsagesInProjects()
- Specified by:
getNumberOfUsagesInProjectsin interfaceSVcsRootUsages- Returns:
- number of projects using this VCS root in their templates or configurations.
-
isUsedInProjects
public boolean isUsedInProjects()
- Specified by:
isUsedInProjectsin interfaceSVcsRootUsages- Returns:
- true if
SVcsRootUsages.getNumberOfUsagesInProjects()is positive, but works faster because it does not count all of the usages
-
getUsagesInProjects
@NotNull public Collection<SProject> getUsagesInProjects()
- Specified by:
getUsagesInProjectsin interfaceSVcsRootUsages- Returns:
- projects using this VCS root in their templates or configurations.
-
setExternalId
public void setExternalId(@NotNull String externalId) throws DuplicateExternalIdExceptionDescription copied from interface:SVcsRootUpdateChanges external id of this VCS root and persists this VCS root configuration to disk- Specified by:
setExternalIdin interfaceSVcsRootUpdate- Overrides:
setExternalIdin classVcsRootImpl- Parameters:
externalId- External ID for this VCS Root- Throws:
DuplicateExternalIdException- if newly specified external id already exists
-
setExternalId
public void setExternalId(@NotNull ConfigAction cause, @NotNull String externalId) throws DuplicateExternalIdException, InvalidIdentifierExceptionDescription copied from interface:SVcsRootUpdateChanges external id of this VCS root and persists this VCS root configuration to disk- Specified by:
setExternalIdin interfaceSVcsRootUpdate- Parameters:
cause- config action caused the changeexternalId- new external id- Throws:
DuplicateExternalIdException- if newly specified external id already existsInvalidIdentifierException
-
persist
public void persist() throws ProjectNotFoundExceptionDescription copied from interface:SVcsRootUpdatePersists this VCS root on disk- Specified by:
persistin interfaceSPersistentEntity- Specified by:
persistin interfaceSVcsRootUpdate- Throws:
ProjectNotFoundException- if project where this VCS root belongs does not exist
-
persist
public void persist(@NotNull ConfigAction cause) throws PersistFailedExceptionDescription copied from interface:SPersistentEntityPersists this entity on disk.- Specified by:
persistin interfaceSPersistentEntity- Parameters:
cause- an action which caused persisting- Throws:
PersistFailedException- if persisting failed
-
schedulePersisting
@NotNull public PersistTask schedulePersisting(@NotNull ConfigAction cause) throws PersistFailedException
Description copied from interface:SPersistentEntitySchedules background persisting of this project settings.- Specified by:
schedulePersistingin interfaceSPersistentEntity- Parameters:
cause- an action which caused persisting- Returns:
- a task which can be used to track the operation progress or wait for the operation to complete
- Throws:
PersistFailedException- if failed to schedule the operation- See Also:
SPersistentEntity.schedulePersisting(String)
-
schedulePersisting
@NotNull public PersistTask schedulePersisting(@NotNull String reason) throws PersistFailedException
Description copied from interface:SPersistentEntitySchedules background persisting of this entity settings.- Specified by:
schedulePersistingin interfaceSPersistentEntity- Parameters:
reason- provides a reason why persist operation was called- Returns:
- a task which can be used to track the operation progress or wait for the operation to complete
- Throws:
PersistFailedException- if failed to schedule the operation- See Also:
SPersistentEntity.schedulePersisting(ConfigAction)
-
scheduleRemove
@NotNull public PersistTask scheduleRemove(@NotNull ConfigAction cause) throws PersistFailedException
Description copied from interface:SPersistentEntitySchedules remove of this persistent entity. Returns task which can be used to wait for the operation to complete.- Specified by:
scheduleRemovein interfaceSPersistentEntity- Parameters:
cause- reason of the remove- Returns:
- a task which can be used to track the operation progress or wait for the operation to complete
- Throws:
PersistFailedException- if failed to schedule the operation
-
remove
public void remove()
Description copied from interface:SVcsRootUpdateRemoves this VCS root from it's project.- Specified by:
removein interfaceSPersistentEntity- Specified by:
removein interfaceSVcsRootUpdate
-
moveToProject
public void moveToProject(@NotNull SProject target) throws ScopeCannotBeChangedExceptionDescription copied from interface:SVcsRootUpdateMoves this VCS root to specified target project. Upon successful completion affected configuration settings will be persisted.- Specified by:
moveToProjectin interfaceSVcsRootUpdate- Parameters:
target- target project- Throws:
ScopeCannotBeChangedException- if move is impossible because of VCS root usages
-
moveToProject
public void moveToProject(@NotNull ConfigAction cause, @NotNull SProject target) throws ScopeCannotBeChangedException, DuplicateVcsRootNameExceptionDescription copied from interface:SVcsRootUpdateMoves this VCS root to specified target project. Upon successful completion affected configuration settings will be persisted.- Specified by:
moveToProjectin interfaceSVcsRootUpdate- Parameters:
cause- config action caused the changetarget- target project- Throws:
ScopeCannotBeChangedException- if move is impossible because of VCS root usagesDuplicateVcsRootNameException
-
getConfigurationFile
@NotNull public File getConfigurationFile()
Description copied from interface:SPersistentEntityReturns the configuration file where this entity instance is persisted (or will be persisted to).- Specified by:
getConfigurationFilein interfaceSPersistentEntity- Returns:
- see above.
-
getConfigurationFile
@NotNull public File getConfigurationFile(@NotNull File projectsDir)
Description copied from interface:SPersistentEntityReturns the configuration file where this entity is persisted in custom projects directory- Specified by:
getConfigurationFilein interfaceSPersistentEntity- Parameters:
projectsDir- path to teamcity projects directory- Returns:
- see above
-
compareTo
public int compareTo(@NotNull SVcsRoot o)- Specified by:
compareToin interfaceComparable<SVcsRoot>
-
getVersion
@NotNull public PersistentEntityVersion getVersion()
Description copied from interface:SPersistentEntityReturns version of this entity which can be used to check if the entity was edited or persisted.- Specified by:
getVersionin interfaceSPersistentEntity- Returns:
- see above
-
markPersisted
public void markPersisted(long expectedEditId)
Description copied from interface:SPersistentEntityMarks entity as persisted- Specified by:
markPersistedin interfaceSPersistentEntity- Parameters:
expectedEditId- expected editId in the end of persist. The entity will be marked as unedited if expected editId is the same as actual, ie. the entity wasn't edited while persist was running
-
createConfigAction
@NotNull public ConfigAction createConfigAction(@Nullable SUser user, @NotNull String description)
Description copied from interface:SPersistentEntityCreates a config action instance associated with this entity and having the specified description. The config action object can be used inSPersistentEntity.schedulePersisting(ConfigAction)orSPersistentEntity.scheduleRemove(ConfigAction)methods to describe the performed action.- Specified by:
createConfigActionin interfaceSPersistentEntity- Parameters:
user- user who performs operation, or null if operation is performed by the systemdescription- description to set to the config action object- Returns:
- new config action
-
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnlyin interfaceSPersistentEntity- Returns:
- true if this entity settings are in read only mode
-
getReadOnlyReason
@Nullable public ReadOnlyReason getReadOnlyReason()
- Specified by:
getReadOnlyReasonin interfaceSPersistentEntity- Returns:
- reason why this entity settings are in read only state or null if they are not read only
-
isEmptyUuid
public boolean isEmptyUuid()
- Specified by:
isEmptyUuidin interfaceSVcsRootEx- Returns:
- true if this root has an empty uuid in its config on disk
-
isAliasExternalId
public boolean isAliasExternalId(@NotNull String extId)- Specified by:
isAliasExternalIdin interfaceSVcsRootEx- Returns:
- true if the provided external id is an alias for the current external id of this VCS root
-
setExternalId
public void setExternalId(@NotNull ConfigAction cause, @NotNull String externalId, boolean sendEvents) throws DuplicateExternalIdException, InvalidIdentifierException, ObsoleteEntityException, ReadOnlyEntityExceptionDescription copied from interface:SVcsRootExSame as {SVcsRootUpdate.setExternalId(ConfigAction, String)} but provides control over events processing. If parameter sendEvents is false, then no events about changing of the external id will be sent. This mode can be useful if the events will be sent later, for instance, in case of bulk edit ids operation.- Specified by:
setExternalIdin interfaceSVcsRootEx- Throws:
DuplicateExternalIdExceptionInvalidIdentifierExceptionObsoleteEntityExceptionReadOnlyEntityException
-
sendExtIdChangedEvents
public void sendExtIdChangedEvents(@NotNull ConfigAction cause, @NotNull String oldExtId, @NotNull String newExtId)Description copied from interface:SVcsRootExSends external id changed event.- Specified by:
sendExtIdChangedEventsin interfaceSVcsRootEx
-
-