com.microsoft.tfs.core.externaltools.validators
Class AbstractToolValidator

java.lang.Object
  extended by com.microsoft.tfs.core.externaltools.validators.AbstractToolValidator
All Implemented Interfaces:
ExternalToolValidator
Direct Known Subclasses:
CompareToolValidator, MergeToolValidator, ViewToolValidator

public abstract class AbstractToolValidator
extends java.lang.Object
implements ExternalToolValidator

Contains methods for required and forbidden substitution string checking. Derived classes simply implement getForbiddenSubstitutions() and getRequiredSubstitutions().

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Constructor Summary
protected AbstractToolValidator()
           
 
Method Summary
protected abstract  java.lang.String[] getForbiddenSubstitutions()
          Gets the substitution strings which are not allowed in arguments for this external tool.
protected abstract  java.lang.String[] getRequiredSubstitutions()
          Gets the substitution strings which are not required in arguments for this external tool.
 void validate(ExternalTool externalTool)
          Tests whether the command and arguments for the given ExternalToolException satisfy the validator's requirements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractToolValidator

protected AbstractToolValidator()
Method Detail

getForbiddenSubstitutions

protected abstract java.lang.String[] getForbiddenSubstitutions()
Gets the substitution strings which are not allowed in arguments for this external tool.

Returns:
the substitution strings ("%1", etc.) which are not allowed in arguments for this external tool

getRequiredSubstitutions

protected abstract java.lang.String[] getRequiredSubstitutions()
Gets the substitution strings which are not required in arguments for this external tool.

Returns:
the substitution strings ("%1", etc.) which are required in arguments for this external tool

validate

public void validate(ExternalTool externalTool)
              throws ExternalToolException
Tests whether the command and arguments for the given ExternalToolException satisfy the validator's requirements. For example, some substitution strings may be required in arguments, others may be forbidden. The method throws if the tool is invalid, it does not throw if the tool is valid.

Specified by:
validate in interface ExternalToolValidator
Parameters:
externalTool - the tool to validate (must not be null)
Throws:
ExternalToolException - if the tool is invalid


© 2015 Microsoft. All rights reserved.