org.apache.maven.enforcer.rule
Class EnforcerPortRule

java.lang.Object
  extended by org.apache.maven.enforcer.rule.EnforcerPortRule
All Implemented Interfaces:
org.apache.maven.enforcer.rule.api.EnforcerRule

public class EnforcerPortRule
extends Object
implements org.apache.maven.enforcer.rule.api.EnforcerRule


Constructor Summary
EnforcerPortRule()
           
 
Method Summary
static boolean available(int port)
          Check port availability.
 void execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper helper)
           
 String getCacheId()
          If your rule is cacheable, you must return a unique id when parameters or conditions change that would cause the result to be different.
 boolean isCacheable()
          This tells the system if the results are cacheable at all.
 boolean isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule arg0)
          If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to allow double checking of the results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnforcerPortRule

public EnforcerPortRule()
Method Detail

available

public static boolean available(int port)
Check port availability. Taken from: http://svn.apache.org/viewvc/mina/trunk/core /src/main/java/org/apache/mina/util/AvailablePortFinder.java?view=markup


execute

public void execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper helper)
             throws org.apache.maven.enforcer.rule.api.EnforcerRuleException
Specified by:
execute in interface org.apache.maven.enforcer.rule.api.EnforcerRule
Throws:
org.apache.maven.enforcer.rule.api.EnforcerRuleException

getCacheId

public String getCacheId()
If your rule is cacheable, you must return a unique id when parameters or conditions change that would cause the result to be different. Multiple cached results are stored based on their id. The easiest way to do this is to return a hash computed from the values of your parameters. If your rule is not cacheable, then the result here is not important, you may return anything.

Specified by:
getCacheId in interface org.apache.maven.enforcer.rule.api.EnforcerRule

isCacheable

public boolean isCacheable()
This tells the system if the results are cacheable at all. Keep in mind that during forked builds and other things, a given rule may be executed more than once for the same project. This means that even things that change from project to project may still be cacheable in certain instances.

Specified by:
isCacheable in interface org.apache.maven.enforcer.rule.api.EnforcerRule

isResultValid

public boolean isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule arg0)
If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to allow double checking of the results. Most of the time this can be done by generating unique ids, but sometimes the results of objects returned by the helper need to be queried. You may for example, store certain objects in your rule and then query them later.

Specified by:
isResultValid in interface org.apache.maven.enforcer.rule.api.EnforcerRule


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.