com.microsoft.tfs.core.checkinpolicies.loaders
Class ClasspathPolicyLoader

java.lang.Object
  extended by com.microsoft.tfs.core.checkinpolicies.loaders.ClasspathPolicyLoader
All Implemented Interfaces:
PolicyLoader

public class ClasspathPolicyLoader
extends java.lang.Object
implements PolicyLoader

Loads check-in policies from the classpath of the ClassLoader that loaded this class. See POLICY_INSTANCE_PROPERTIES_FILENAME for the name of the classpath resource that declares available policy implementations.

Since:
TEE-SDK-10.1
Thread-safety:
thread-safe

Field Summary
static java.lang.String POLICY_INSTANCE_PROPERTIES_FILENAME
          ClasspathPolicyLoader searches the ClassLoader that loaded this class for all resources with this name.
 
Constructor Summary
ClasspathPolicyLoader()
          Creates a ClasspathPolicyLoader, which loads implementations by searching the classpath for implementation properties files.
 
Method Summary
 java.lang.String[] getAvailablePolicyTypeIDs()
          Returns all the policy type ID strings that could be loaded by this loader.
 PolicyInstance load(java.lang.String policyTypeID)
          Loads a policy instance that is appropriate for the given policy type ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLICY_INSTANCE_PROPERTIES_FILENAME

public static final java.lang.String POLICY_INSTANCE_PROPERTIES_FILENAME
ClasspathPolicyLoader searches the ClassLoader that loaded this class for all resources with this name. These resources are properties files which are parsed in order to determine the name of a PolicyInstance class to load and the policy ID the class implements. Other properties may also be read from this resource.

Constant Field Value:
"checkin-policy-instance.properties"
See Also:
Constant Field Values
Constructor Detail

ClasspathPolicyLoader

public ClasspathPolicyLoader()
Creates a ClasspathPolicyLoader, which loads implementations by searching the classpath for implementation properties files.

Method Detail

load

public PolicyInstance load(java.lang.String policyTypeID)
                    throws PolicyLoaderException
Loads a policy instance that is appropriate for the given policy type ID.

Specified by:
load in interface PolicyLoader
Parameters:
policyTypeID - the string that identifies the type of policy to load (must not be null or empty)
Returns:
a new policy instance whose type ID matches the given ID, or null if no matching PolicyInstances could be found.
Throws:
PolicyLoaderException - if an I/O error occurred loading the policy.

getAvailablePolicyTypeIDs

public java.lang.String[] getAvailablePolicyTypeIDs()
                                             throws PolicyLoaderException
Returns all the policy type ID strings that could be loaded by this loader. It's possible that an ID returned by this method will fail to load for other reasons when PolicyLoader.load(String) is invoked.

Specified by:
getAvailablePolicyTypeIDs in interface PolicyLoader
Returns:
an array of policy type ID strings that could be loaded by this loader.
Throws:
PolicyLoaderException - if an I/O error occurred searching for policies.


© 2015 Microsoft. All rights reserved.