jetbrains.buildServer.vcs.impl
Class VcsRootImpl

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

public class VcsRootImpl
extends java.lang.Object
implements VcsRoot

Version control connection settings.


Field Summary
protected static java.lang.String CHECKOUT_ROOT
           
protected  java.util.Map<java.lang.String,java.lang.String> myProperties
           
protected  java.lang.String myVcsName
           
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.
 
Method Summary
 void addAllProperties(java.util.Map<java.lang.String,java.lang.String> map)
          Adds number of properties.
 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.
 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.
static boolean isEquivalentRoots(VcsRoot root1, VcsRoot root2)
          Checks whether the specified VCS roots are equivalent.
static boolean isSecureProperty(java.lang.String propertyName)
          Returns true if the property is secure, i.e.
static java.lang.String propertiesToString(java.util.Map<java.lang.String,java.lang.String> properties)
          Converts properties set to string.
static java.lang.String propertiesToString(java.util.Map<java.lang.String,java.lang.String> properties, boolean scrambleSecureProps)
           
 void setName(java.lang.String name)
          Changes connecton name.
static java.util.Map<java.lang.String,java.lang.String> stringToProperties(java.lang.String string)
          Converts string to map of properties.
 java.lang.String toString()
           
static java.lang.String unescapeStr(java.lang.String name)
          Replaces '\-' with '\n' and '\\' with '\' and '\_' with =
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myVcsName

protected java.lang.String myVcsName

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

CHECKOUT_ROOT

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

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.

VcsRootImpl

public VcsRootImpl(long id,
                   java.lang.String vcsName)
Creates new settings object on id and associated version control name.

Parameters:
id - vcs root id.
vcsName - version control name.
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.

addAllProperties

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

Parameters:
map - properties map.

getVcsName

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

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

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

propertiesToString

public static java.lang.String propertiesToString(java.util.Map<java.lang.String,java.lang.String> properties)
Converts properties set to string.

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

propertiesToString

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

unescapeStr

public static java.lang.String unescapeStr(java.lang.String name)
Replaces '\-' with '\n' and '\\' with '\' and '\_' with =

Parameters:
name - string where replacements have to be made
Returns:
unescaped string.

isSecureProperty

public static boolean isSecureProperty(java.lang.String propertyName)
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.

stringToProperties

public static java.util.Map<java.lang.String,java.lang.String> stringToProperties(java.lang.String string)
Converts string to map of properties.

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

createMap

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 connecton name.

Parameters:
name - new connection 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