jetbrains.buildServer.vcs.impl
Class VcsRootImpl

java.lang.Object
  extended by jetbrains.buildServer.vcs.impl.VcsRootImpl
All Implemented Interfaces:
jetbrains.buildServer.log.Loggable, VcsRoot

public class VcsRootImpl
extends java.lang.Object
implements VcsRoot

Version control connection settings.


Field Summary
static java.lang.String BRANCH_SPEC_PROP
           
protected static java.lang.String CHECKOUT_ROOT
           
protected  java.util.Map<java.lang.String,java.lang.String> myProperties
           
static java.lang.String VCS_NAME_PROP
           
static java.lang.String VCS_ROOT_NAME_PROP
           
 
Fields inherited from interface jetbrains.buildServer.vcs.VcsRoot
SECURE_PROPERTY_PREFIX
 
Constructor Summary
VcsRootImpl(long id, java.util.Map<java.lang.String,java.lang.String> properties)
          Creates new settings on id and properties set.
VcsRootImpl(long id, java.lang.String vcsName)
          Creates new settings object on id and associated version control name.
VcsRootImpl(long id, java.lang.String vcsName, java.util.Map<java.lang.String,java.lang.String> properties)
          Create VcsRootImpl object, the most generic constructor
 
Method Summary
 void addProperty(java.lang.String propertyName, java.lang.String propertyValue)
          Adds new property.
 java.lang.String convertToPresentableString()
          Returns VCS root serialized to string with secure properties values replaced with *****.
 java.lang.String convertToString()
          Returns the root serialized to string value
 java.util.Map<java.lang.String,java.lang.String> createMap()
          Creates map containing all connection properties.
 java.lang.String describe(boolean verbose)
           
 boolean equals(java.lang.Object o)
           
 long getId()
          returns root unique identifier
 java.lang.String getName()
          returns descriptive name of the vcs root
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Returns mapping from a property name to its value
 long getPropertiesHash()
          Returns hash code computed on the base of this VCS root properties.
 java.lang.String getProperty(java.lang.String propertyName)
          Provides specified property value
 java.lang.String getProperty(java.lang.String propertyName, java.lang.String defaultValue)
          Provides specified property value or default value if property is not defined
 java.util.Map<java.lang.String,java.lang.String> getPublicProperties()
           
 java.lang.String getVcsName()
          Returns name of the corresponding version control.
 int hashCode()
           
static boolean isEquivalentRoots(VcsRoot root1, VcsRoot root2)
          Checks whether the specified VCS roots are equivalent.
static boolean isSecureProperty(java.lang.String propertyName)
          Deprecated. since 8.0, use VcsUtil.isSecureProperty
static java.lang.String propertiesToString(java.util.Map<java.lang.String,java.lang.String> properties)
          Deprecated. use VcsUtil.propertiesToStringSecure(java.util.Map)
static java.lang.String propertiesToString(java.util.Map<java.lang.String,java.lang.String> properties, boolean scrambleSecureProps)
          Deprecated. use VcsUtil.propertiesToString(java.util.Map, boolean)
 void setName(java.lang.String name)
          Changes VCS root name.
 void setProperties(java.util.Map<java.lang.String,java.lang.String> map)
          Adds number of properties.
 void setVcsName(java.lang.String vcsName)
          Sets new version control name (name of version control plugin)
static java.util.Map<java.lang.String,java.lang.String> stringToProperties(java.lang.String string)
          Deprecated. since 8.0, use VcsUtil#stringToProperties
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

myProperties

protected final java.util.Map<java.lang.String,java.lang.String> myProperties

VCS_NAME_PROP

@NonNls
public static final java.lang.String VCS_NAME_PROP
See Also:
Constant Field Values

VCS_ROOT_NAME_PROP

@NonNls
public static final java.lang.String VCS_ROOT_NAME_PROP
See Also:
Constant Field Values

BRANCH_SPEC_PROP

@NonNls
public static final java.lang.String BRANCH_SPEC_PROP
See Also:
Constant Field Values

CHECKOUT_ROOT

@NonNls
protected static final java.lang.String CHECKOUT_ROOT
See Also:
Constant Field Values
Constructor Detail

VcsRootImpl

public VcsRootImpl(long id,
                   @NotNull
                   java.lang.String vcsName,
                   @NotNull
                   java.util.Map<java.lang.String,java.lang.String> properties)
Create VcsRootImpl object, the most generic constructor


VcsRootImpl

public VcsRootImpl(long id,
                   java.lang.String vcsName)
Creates new settings object on id and associated version control name. The resulting VCSRoot will have unset name.

Parameters:
id - vcs root id.
vcsName - version control name.

VcsRootImpl

public VcsRootImpl(long id,
                   java.util.Map<java.lang.String,java.lang.String> properties)
Creates new settings on id and properties set.

Parameters:
id - vcs root id.
properties - settings parameters.
Method Detail

getName

public java.lang.String getName()
Description copied from interface: VcsRoot
returns descriptive name of the vcs root

Specified by:
getName in interface VcsRoot
Returns:
see above

getId

public long getId()
Description copied from interface: VcsRoot
returns root unique identifier

Specified by:
getId in interface VcsRoot
Returns:
see above

getPublicProperties

public java.util.Map<java.lang.String,java.lang.String> getPublicProperties()
Specified by:
getPublicProperties in interface VcsRoot
Returns:
all non secure properties of this VCS root.

addProperty

public void addProperty(java.lang.String propertyName,
                        java.lang.String propertyValue)
Adds new property.

Parameters:
propertyName - property name.
propertyValue - property value.

setProperties

public void setProperties(@NotNull
                          java.util.Map<java.lang.String,java.lang.String> map)
Adds number of properties.

Parameters:
map - properties map.

getVcsName

@NotNull
public java.lang.String getVcsName()
Description copied from interface: VcsRoot
Returns name of the corresponding version control.

Specified by:
getVcsName in interface VcsRoot
Returns:
name of the corresponding version control

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
Description copied from interface: VcsRoot
Provides specified property value

Specified by:
getProperty in interface VcsRoot
Parameters:
propertyName - name of the property whose value is requested
Returns:
value of a specified property

getProperty

public java.lang.String getProperty(java.lang.String propertyName,
                                    java.lang.String defaultValue)
Description copied from interface: VcsRoot
Provides specified property value or default value if property is not defined

Specified by:
getProperty in interface VcsRoot
Parameters:
propertyName - name of the property whose value is requested
defaultValue - default value which is returned if property value was not specified explicitly
Returns:
- value of a specified property or 'defaultValue' if it is not defined

getProperties

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Description copied from interface: VcsRoot
Returns mapping from a property name to its value

Specified by:
getProperties in interface VcsRoot
Returns:
map of all defined properties

convertToString

public java.lang.String convertToString()
Description copied from interface: VcsRoot
Returns the root serialized to string value

Specified by:
convertToString in interface VcsRoot
Returns:
serialized settings

convertToPresentableString

public java.lang.String convertToPresentableString()
Description copied from interface: VcsRoot
Returns VCS root serialized to string with secure properties values replaced with *****.

Specified by:
convertToPresentableString in interface VcsRoot
Returns:
see above

describe

@NotNull
public java.lang.String describe(boolean verbose)
Specified by:
describe in interface jetbrains.buildServer.log.Loggable

getPropertiesHash

public long getPropertiesHash()
Description copied from interface: VcsRoot
Returns hash code computed on the base of this VCS root properties.

Specified by:
getPropertiesHash in interface VcsRoot
Returns:
VCS root properties hash code

createMap

@NotNull
public java.util.Map<java.lang.String,java.lang.String> createMap()
Creates map containing all connection properties.

Returns:
map with all connection properties.

setName

public void setName(@NotNull
                    java.lang.String name)
Changes VCS root name.

Parameters:
name - new VCS root name.

setVcsName

public void setVcsName(@NotNull
                       java.lang.String vcsName)
Sets new version control name (name of version control plugin)

Parameters:
vcsName - new version control name

isEquivalentRoots

public static boolean isEquivalentRoots(VcsRoot root1,
                                        VcsRoot root2)
Checks whether the specified VCS roots are equivalent. VCS roots are considered equivalent if they both represent same VcsSupport and contain same properties.

Parameters:
root1 - VCS root
root2 - VCS root
Returns:
true if roots are equivalent

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

propertiesToString

public static java.lang.String propertiesToString(java.util.Map<java.lang.String,java.lang.String> properties)
Deprecated. use VcsUtil.propertiesToStringSecure(java.util.Map)

Converts properties set to string.

Parameters:
properties - map of properties values.
Returns:
string properties presentation.
See Also:
VcsUtil.stringToProperties(String)

propertiesToString

public static java.lang.String propertiesToString(java.util.Map<java.lang.String,java.lang.String> properties,
                                                  boolean scrambleSecureProps)
Deprecated. use VcsUtil.propertiesToString(java.util.Map, boolean)

Converts properties set to string, with optional scrambling of the properties

Parameters:
properties - map of properties values.
Returns:
string properties presentation.
See Also:
VcsUtil.stringToProperties(String)

stringToProperties

public static java.util.Map<java.lang.String,java.lang.String> stringToProperties(java.lang.String string)
Deprecated. since 8.0, use VcsUtil#stringToProperties

Converts string to map of properties.

Parameters:
string - original string.
Returns:
map of properties.
See Also:
VcsUtil.propertiesToString(java.util.Map, boolean)

isSecureProperty

public static boolean isSecureProperty(java.lang.String propertyName)
Deprecated. since 8.0, use VcsUtil.isSecureProperty

Returns true if the property is secure, i.e. its value should be scrambled when property persisted.

Parameters:
propertyName - property name.
Returns:
true if property value should be scrambled.