Skip to content

Commit

Permalink
WINDUP-223: Support executeBefore()/executeBeforeIDs() and executeAft…
Browse files Browse the repository at this point in the history
…er()/executeAfterIDs() for provider ordering
  • Loading branch information
jsight committed Aug 22, 2014
1 parent 4f37f37 commit b6d73f1
Show file tree
Hide file tree
Showing 15 changed files with 483 additions and 124 deletions.
Expand Up @@ -130,7 +130,7 @@ private void logTimeTakenByPhase(GraphContext graphContext, RulePhase phase, int
{
RulePhaseExecutionStatisticsModel model = graphContext.getService(RulePhaseExecutionStatisticsModel.class)
.create();
model.setRulePhase(phase.toString());
model.setRulePhase(phase == null ? "Implicit" : phase.toString());
model.setTimeTaken(timeTaken);
timeTakenByPhase.put(phase, model);
}
Expand Down
Expand Up @@ -57,26 +57,53 @@ public void enhanceMetadata(Context context)
}

/**
* Returns a list of WindupRuleProvider classes that this instance depends on.
* Returns a list of {@link WindupRuleProvider} classes that should execute before the {@link Rule}s in this
* {@link WindupRuleProvider}.
*
* Dependencies can also be specified based on id ({@link #getIDDependencies}).
* {@link WindupRuleProvider}s can also be specified based on id ({@link #getExecuteAfterID}).
*/
public List<Class<? extends WindupRuleProvider>> getClassDependencies()
public List<Class<? extends WindupRuleProvider>> getExecuteAfter()
{
return Collections.emptyList();
}

/**
* Returns a list of the WindupRuleProvider dependencies for this configuration provider.
* Returns a list of the {@link WindupRuleProvider} classes that should execute before the {@link Rule}s in this
* {@link WindupRuleProvider}.
*
* This is returned as a list of Rule IDs in order to support extensions that cannot depend on each other via class
* names. For example, in the case of the Groovy rules extension, a single class covers many rules with their own
* IDs.
*
* For depending upon Java-based rules, getClassDependencies is preferred. Dependencies of both types can be
* returned by a single WindupRuleProvider.
* For specifying Java-based rules, getExecuteAfter is preferred.
*/
public List<String> getIDDependencies()
public List<String> getExecuteAfterIDs()
{
return Collections.emptyList();
}

/**
* Returns a list of {@link WindupRuleProvider} classes that should execute after the {@link Rule}s in this
* {@link WindupRuleProvider}.
*
* {@link WindupRuleProvider}s can also be specified based on id ({@link #getExecuteBeforeID}).
*/
public List<Class<? extends WindupRuleProvider>> getExecuteBefore()
{
return Collections.emptyList();
}

/**
* Returns a list of the {@link WindupRuleProvider} classes that should execute after the {@link Rule}s in this
* {@link WindupRuleProvider}.
*
* This is returned as a list of Rule IDs in order to support extensions that cannot depend on each other via class
* names. For example, in the case of the Groovy rules extension, a single class covers many rules with their own
* IDs.
*
* For specifying Java-based rules, getExecuteBefore is preferred.
*/
public List<String> getExecuteBeforeIDs()
{
return Collections.emptyList();
}
Expand Down Expand Up @@ -111,7 +138,7 @@ protected final List<String> generateDependencies(
@Override
public int priority()
{
return getPhase().getPriority();
return getPhase() == null ? 0 : getPhase().getPriority();
}

@Override
Expand Down

0 comments on commit b6d73f1

Please sign in to comment.