jetbrains.buildServer.vcs
Class CheckoutRules

java.lang.Object
  extended by jetbrains.buildServer.vcs.FileRuleSet<IncludeRule,FileRule>
      extended by jetbrains.buildServer.vcs.CheckoutRules
All Implemented Interfaces:
jetbrains.buildServer.log.Loggable

public class CheckoutRules
extends FileRuleSet<IncludeRule,FileRule>
implements jetbrains.buildServer.log.Loggable

Contains a number of rules how to layout project sources on agent side.


Field Summary
static CheckoutRules DEFAULT
           
static java.lang.String INCLUDE_SEP
           
 
Constructor Summary
CheckoutRules(java.util.List<IncludeRule> includeRules, java.util.List<FileRule> excludeRules)
          Creates rules object on include and exclude rules lists.
CheckoutRules(java.util.List<java.lang.String> body)
          Creates new checkout rules instance on a list of string rules.
CheckoutRules(java.lang.String body)
          Creates new checkout rules instance on string rules presentation.
 
Method Summary
 boolean containsWildcards()
          Checks if some rule from the set contains wildcards.
static CheckoutRules createCommonRule(java.util.List<CheckoutRules> ruleses)
          Creates 'union' rule
protected  FileRule createNewExcludeRule(FileRule includeRule)
           
protected  FileRule createNewExcludeRule(java.lang.String line)
           
protected  IncludeRule createNewIncludeRule(IncludeRule includeRule)
           
protected  IncludeRule createNewIncludeRule(java.lang.String rule)
           
 CheckoutRules createNewRulesForPrefix(java.lang.String prefixPath)
          Creates new checkout rule set with prefix appended to every rule right part.
static CheckoutRules createOn(java.lang.String ruleStr)
          Creates new rule set on the specified rules string presentation.
 java.lang.String describe(boolean verbose)
           
protected  void doPostInitProcess(java.util.List<IncludeRule> includeRules, java.util.List<FileRule> excludeRules)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getAsString()
           
 java.util.List<IncludeRule> getRootIncludeRules()
          Returns include rules sorted by from part.
 int hashCode()
           
static boolean isCorrect(java.lang.String line)
          Returns true if line represents syntactically correct include or exclude rule.
 java.lang.String map(java.lang.String path)
          Maps vcs relative file path to path described by checkout rules.
protected  void postProcessCreatedRules(java.util.List<IncludeRule> includeRules, java.util.List<FileRule> excludeRules)
           
 boolean shouldInclude(java.lang.String path)
           
protected  boolean shouldInclude(java.lang.String path, Filter<FileRule> includeExcludeRulesFilter)
           
 boolean shouldInclude(java.lang.String path, IncludeRule rule)
           
 boolean shouldInclude(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> props)
           
 java.lang.String toString()
           
 
Methods inherited from class jetbrains.buildServer.vcs.FileRuleSet
createPropertiesFilter, findMostSpecific, getBody, getExcludeRules, getExcludeRules, getIncludeRuleFor, getIncludeRuleMerged, getIncludeRules, getIncludeRules, isSubDir, preparePath, shouldInclude, sortByFrom
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final CheckoutRules DEFAULT

INCLUDE_SEP

public static final java.lang.String INCLUDE_SEP
See Also:
Constant Field Values
Constructor Detail

CheckoutRules

public CheckoutRules(@NotNull
                     java.util.List<java.lang.String> body)
Creates new checkout rules instance on a list of string rules.

Parameters:
body - list of string rules.

CheckoutRules

public CheckoutRules(@NotNull
                     java.lang.String body)
Creates new checkout rules instance on string rules presentation.

Parameters:
body - string rule presentation.

CheckoutRules

public CheckoutRules(java.util.List<IncludeRule> includeRules,
                     java.util.List<FileRule> excludeRules)
Creates rules object on include and exclude rules lists.

Parameters:
includeRules - include rules list.
excludeRules - exclude rules list.
Method Detail

map

@Nullable
public java.lang.String map(java.lang.String path)
Maps vcs relative file path to path described by checkout rules.

Parameters:
path - to map
Returns:
mapped path or null if path should be skipped.

shouldInclude

public boolean shouldInclude(java.lang.String path)
Overrides:
shouldInclude in class FileRuleSet<IncludeRule,FileRule>

shouldInclude

public boolean shouldInclude(java.lang.String path,
                             java.util.Map<java.lang.String,java.lang.String> props)
Overrides:
shouldInclude in class FileRuleSet<IncludeRule,FileRule>

shouldInclude

protected boolean shouldInclude(java.lang.String path,
                                @NotNull
                                Filter<FileRule> includeExcludeRulesFilter)
Overrides:
shouldInclude in class FileRuleSet<IncludeRule,FileRule>

shouldInclude

public boolean shouldInclude(java.lang.String path,
                             IncludeRule rule)
Overrides:
shouldInclude in class FileRuleSet<IncludeRule,FileRule>

createCommonRule

@NotNull
public static CheckoutRules createCommonRule(@NotNull
                                                     java.util.List<CheckoutRules> ruleses)
Creates 'union' rule

Parameters:
ruleses - given rule set.
Returns:
union rule.

toString

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

getAsString

@NotNull
public java.lang.String getAsString()
Returns:
checkout rule set string presentation.

isCorrect

public static boolean isCorrect(@NotNull
                                java.lang.String line)
Returns true if line represents syntactically correct include or exclude rule. Note that empty line is considered correct.

Parameters:
line - include or exclude rule
Returns:
true if line is correct

getRootIncludeRules

public java.util.List<IncludeRule> getRootIncludeRules()
Returns include rules sorted by from part. Some include rules may be omitted if they are completely included by other rules.

Returns:
all include rules.

createNewRulesForPrefix

@NotNull
public CheckoutRules createNewRulesForPrefix(@NotNull
                                                     java.lang.String prefixPath)
Creates new checkout rule set with prefix appended to every rule right part.

Parameters:
prefixPath - specified prefix.
Returns:
new rule set.

postProcessCreatedRules

protected void postProcessCreatedRules(java.util.List<IncludeRule> includeRules,
                                       java.util.List<FileRule> excludeRules)
Overrides:
postProcessCreatedRules in class FileRuleSet<IncludeRule,FileRule>

doPostInitProcess

protected void doPostInitProcess(java.util.List<IncludeRule> includeRules,
                                 java.util.List<FileRule> excludeRules)
Specified by:
doPostInitProcess in class FileRuleSet<IncludeRule,FileRule>

createNewIncludeRule

protected IncludeRule createNewIncludeRule(java.lang.String rule)
Specified by:
createNewIncludeRule in class FileRuleSet<IncludeRule,FileRule>

createNewExcludeRule

protected FileRule createNewExcludeRule(java.lang.String line)
Specified by:
createNewExcludeRule in class FileRuleSet<IncludeRule,FileRule>

createNewIncludeRule

protected IncludeRule createNewIncludeRule(IncludeRule includeRule)
Specified by:
createNewIncludeRule in class FileRuleSet<IncludeRule,FileRule>

createNewExcludeRule

protected FileRule createNewExcludeRule(FileRule includeRule)
Specified by:
createNewExcludeRule in class FileRuleSet<IncludeRule,FileRule>

createOn

public static CheckoutRules createOn(java.lang.String ruleStr)
Creates new rule set on the specified rules string presentation.

Parameters:
ruleStr - specified rule set string presentation.
Returns:
new rule set object.

containsWildcards

public boolean containsWildcards()
Checks if some rule from the set contains wildcards.

Returns:
true if some rule from the set contains wildcard, false otherwise.

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

describe

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