org.apache.maven.plugins.enforcer
Class AbstractNonCacheableEnforcerRule

java.lang.Object
  extended by org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
      extended by org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
All Implemented Interfaces:
EnforcerRule
Direct Known Subclasses:
AbstractBanDependencies, AlwaysFail, AlwaysPass, EvaluateBeanshell, RequireActiveProfile, RequireNoRepositories, RequirePluginVersions, RequireProperty, RequireReleaseVersion

public abstract class AbstractNonCacheableEnforcerRule
extends AbstractStandardEnforcerRule

The Class AbstractNonCacheableEnforcerRule. This is to be used by rules that don't need caching... it saves implementing a bunch of methods.

Version:
$Id: AbstractNonCacheableEnforcerRule.java 805190 2009-08-17 22:30:49Z hboutemy $
Author:
Brian Fox

Field Summary
 
Fields inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
message
 
Constructor Summary
AbstractNonCacheableEnforcerRule()
           
 
Method Summary
 String getCacheId()
          If the rule is to be cached, this id is used as part of the key.
 boolean isCacheable()
          This method tells the enforcer if the rule results may be cached.
 boolean isResultValid(EnforcerRule cachedRule)
          Checks if cached result is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.enforcer.rule.api.EnforcerRule
execute
 

Constructor Detail

AbstractNonCacheableEnforcerRule

public AbstractNonCacheableEnforcerRule()
Method Detail

getCacheId

public String getCacheId()
Description copied from interface: EnforcerRule
If the rule is to be cached, this id is used as part of the key. This can allow rules to take parameters that allow multiple results of the same rule to be cached.

Returns:
id to be used by the enforcer to determine uniqueness of cache results. The ids only need to be unique within a given rule implementation as the full key will be [classname]-[id]

isCacheable

public boolean isCacheable()
Description copied from interface: EnforcerRule
This method tells the enforcer if the rule results may be cached. If the result is true, the results will be remembered for future executions in the same build (ie children). Subsequent iterations of the rule will be queried to see if they are also cacheable. This will allow the rule to be uncached further down the tree if needed.

Returns:
true if rule is cacheable

isResultValid

public boolean isResultValid(EnforcerRule cachedRule)
Description copied from interface: EnforcerRule
Checks if cached result is valid.

Parameters:
cachedRule - the last cached instance of the rule. This is to be used by the rule to potentially determine if the results are still valid (ie if the configuration has been overridden)
Returns:
true if the stored results are valid for the same id.


Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.