|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.microsoft.tfs.core.checkinpolicies.PolicyEvaluationStatus
public class PolicyEvaluationStatus
Contains status about a policy that is ready to be evaluated (or possibly
already has). These objects are used exclusively by PolicyEvaluator
to evaluate policies and report status.
This class is thread-safe, but caller threads must synchronize access to
calls of initialize(PendingCheckin, PolicyContext)
,
evaluate(PolicyContext)
, and getFailures()
if they want
meaningful failure information.
Constructor Summary | |
---|---|
PolicyEvaluationStatus(PolicyInstance policy,
int priority,
java.lang.String[] scopeExpressions)
Creates a PolicyEvaluationStatus for the given policy. |
Method Summary | |
---|---|
void |
addPolicyStateChangedEventListener(PolicyStateChangedListener listener)
Adds a listener of the PolicyStateChangedEvent , which is fired
when the PolicyInstance in this status object changes its state. |
void |
close()
Once a PolicyEvaluationStatus is closed, you cannot invoke
getPolicy() , initialize(PendingCheckin, PolicyContext)
or evaluate(PolicyContext) on it. |
void |
evaluate(PolicyContext policyContext)
Evaluates the policy instance in this status. |
PolicyFailure[] |
getFailures()
|
PolicyInstance |
getPolicy()
|
PolicyType |
getPolicyType()
Gets the type of policy this status is for. |
int |
getPriority()
|
java.lang.String[] |
getScopeExpressions()
|
void |
initialize(PendingCheckin pendingCheckin,
PolicyContext context)
Initializes (or re-initializes) the evaluatable policy instance. |
void |
removePolicyStateChangedEventListener(PolicyStateChangedListener listener)
Removes a listener previously added via addPolicyStateChangedEventListener(PolicyStateChangedListener) . |
void |
update(int priority,
java.lang.String[] scopeExpressions,
Memento configurationMemento)
Updates this status for re-use with a new configuration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PolicyEvaluationStatus(PolicyInstance policy, int priority, java.lang.String[] scopeExpressions)
PolicyEvaluationStatus
for the given policy. The policy
is not initialized or evaluated automatically.
policy
- the policy to wrap (must not be null
)priority
- the evaluation priority of this status (lower numbers evaluate
before higher numbers).scopeExpressions
- an array of strings that are regular expressions that define the
scope of this policy (the server paths it affects). An empty array
means all paths.Method Detail |
---|
public void addPolicyStateChangedEventListener(PolicyStateChangedListener listener)
PolicyStateChangedEvent
, which is fired
when the PolicyInstance
in this status object changes its state.
listener
- the listener to add (must not be null
)public void removePolicyStateChangedEventListener(PolicyStateChangedListener listener)
addPolicyStateChangedEventListener(PolicyStateChangedListener)
.
listener
- the listener to remove (must not be null
)public void initialize(PendingCheckin pendingCheckin, PolicyContext context)
PolicyInstance.initialize(PendingCheckin, PolicyContext)
method
are thrown from here.
java.lang.IllegalStateException
- if close()
has been called.
java.lang.Throwable
- if
PolicyInstance.initialize(PendingCheckin, PolicyContext)
threwpublic void evaluate(PolicyContext policyContext) throws PolicyEvaluationCancelledException
getFailures()
when this method returns to obtain any failures detected.
policyContext
- contextual settings that may include information about the user
interface, etc. (must not be null
)
PolicyEvaluationCancelledException
- if the user canceled the evaluation of the policy.
java.lang.IllegalStateException
- if close()
has been called.public PolicyFailure[] getFailures()
public PolicyType getPolicyType()
close()
has been called.
java.lang.IllegalStateException
- if close()
has been called.public void close()
PolicyEvaluationStatus
is closed, you cannot invoke
getPolicy()
, initialize(PendingCheckin, PolicyContext)
or evaluate(PolicyContext)
on it.
close
in interface com.microsoft.tfs.util.Closable
Closable.close()
public void update(int priority, java.lang.String[] scopeExpressions, Memento configurationMemento)
PolicyEvaluator
reloads policies.
priority
- the new priority.scopeExpressions
- the regular expression strings that define the server items this
policy evaluates (an empty array means all paths) (must not be
null
)configurationMemento
- the policy definition's configuration memento.public PolicyInstance getPolicy()
public int getPriority()
public java.lang.String[] getScopeExpressions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |