Skip to content

Commit

Permalink
Added toString() methods and made sure that WindupRuleProvider subcla…
Browse files Browse the repository at this point in the history
…sses call super.enhanceMetadata(...)
  • Loading branch information
jsight committed Oct 6, 2014
1 parent e90b1ab commit 12aa999
Show file tree
Hide file tree
Showing 69 changed files with 268 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,19 @@ public void perform(GraphRewrite event, EvaluationContext context, PAYLOADTYPE p
{
IteratingRuleProvider.this.perform(event, context, payload);
}

@Override
public String toString()
{
return IteratingRuleProvider.this.toStringPerform();
}
}

/**
* This should return a string describing the operation to be performed by the subclass.
*/
public abstract String toStringPerform();

@Override
public final Configuration getConfiguration(GraphContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ private void logTimeTakenByPhase(GraphContext graphContext, RulePhase phase, int
}
}

/*
* Executors
*/
@Override
public void perform(Rewrite rewrite, EvaluationContext context)
{
Expand All @@ -161,8 +158,6 @@ public void perform(Rewrite rewrite, EvaluationContext context)
*/
GraphRewrite event = (GraphRewrite) rewrite;

List<Rule> rules = config.getRules();

for (RuleLifecycleListener listener : listeners)
{
listener.beforeExecution();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public Configuration getConfiguration(GraphContext context)
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
if (this.metadataEnhancer != null)
metadataEnhancer.accept(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import org.ocpsoft.logging.Logger;
import org.ocpsoft.logging.Logger.Level;
import org.ocpsoft.rewrite.config.ConfigurationRuleParameterBuilder;
import org.ocpsoft.rewrite.config.DefaultOperationBuilder;
import org.ocpsoft.rewrite.context.EvaluationContext;
import org.ocpsoft.rewrite.event.Rewrite;
Expand Down Expand Up @@ -102,4 +103,9 @@ public void setParameterStore(ParameterStore store)
messageBuilder.setParameterStore(store);
}

@Override
public String toString()
{
return "LOG[" + level + ", " + messageBuilder.toString() + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,16 @@ public String toString()
builder.append("Query");
if (searchType != null)
{
builder.append(".find(").append(searchType.getClass().getName()).append(")");
builder.append(".find(").append(searchType.getName()).append(")");
}

for (QueryGremlinCriterion criterion : pipelineCriteria)
if (!pipelineCriteria.isEmpty())
{
builder.append(".gremlin(" + criterion + ")");
builder.append(".gremlin()");
for (QueryGremlinCriterion criterion : pipelineCriteria)
{
builder.append(criterion);
}
}
builder.append(".as(" + outputVar + ")");
return builder.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public RulePhase getPhase()
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public RulePhase getPhase()
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,10 @@ public void perform(GraphRewrite event, EvaluationContext context, ReportModel p
throw new WindupException("FreeMarkerOperation TemplateException: " + e.getMessage(), e);
}
}

@Override
public String toString()
{
return "RenderFreeMarkerTemplate";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,10 @@ public void perform(GraphRewrite event, EvaluationContext context)
throw new WindupException("FreeMarkerOperation TemplateException: " + e.getMessage(), e);
}
}

@Override
public String toString()
{
return "FreeMarkerOperation[template=" + templatePath + ", output=" + outputFilename + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,11 @@ public void perform(GraphRewrite event, EvaluationContext context, ApplicationRe
index.addApplicationReportModel(payload);
}
}

@Override
public String toString()
{
return "AddToApplicationIndex";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public void perform(GraphRewrite event, EvaluationContext context, WindupConfigu
}
createApplicationReportIndex(event.getGraphContext(), projectModel);
}

@Override
public String toString()
{
return "AddApplicationReportIndex";
}
};

return ConfigurationBuilder.begin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public void perform(GraphRewrite event, EvaluationContext context, FileModel pay
ReportService reportService = new ReportService(event.getGraphContext());
reportService.setUniqueFilename(sm, payload.getFileName(), "html");
}

@Override
public String toString()
{
return "AddSourceReport";
}
};

return ConfigurationBuilder.begin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public void perform(GraphRewrite event, EvaluationContext context)
String outputPath = cfg.getOutputPath().getFilePath();
copyCssResourcesToOutput(event.getGraphContext(), outputPath);
}

@Override
public String toString()
{
return "CopyCSSToOutput";
}
};

Configuration configuration = ConfigurationBuilder.begin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public void perform(GraphRewrite event, EvaluationContext context)
renderer.renderGraph(graphContext);
}
}

@Override
public String toString()
{
return "RenderGraphForDebugging";
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ public int compare(RulePhaseExecutionStatisticsModel o1,
}

}

@Override
public String toString()
{
return "RenderRuleExecutionTimeReport";
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public List<Class<? extends WindupRuleProvider>> getExecuteAfter()
return asClassList(DiscoverXmlFilesRuleProvider.class);
}

@Override
public String toStringPerform()
{
return "Discover EJB-JAR XML Files";
}

@Override
public ConditionBuilder when()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public List<Class<? extends WindupRuleProvider>> getExecuteAfter()
return asClassList(DiscoverXmlFilesRuleProvider.class);
}

@Override
public String toStringPerform()
{
return "Discover hibernate.cfg.xml files";
}

@Override
public ConditionBuilder when()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public List<Class<? extends WindupRuleProvider>> getExecuteAfter()
return asClassList(DiscoverXmlFilesRuleProvider.class);
}

@Override
public String toStringPerform()
{
return "Discover hibernate.hbm.xml files";
}

@Override
public ConditionBuilder when()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public List<Class<? extends WindupRuleProvider>> getExecuteAfter()
return asClassList(DiscoverXmlFilesRuleProvider.class);
}

@Override
public String toStringPerform()
{
return "Discover Spring Config Files";
}

@Override
public ConditionBuilder when()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public List<Class<? extends WindupRuleProvider>> getExecuteAfter()
return asClassList(DiscoverXmlFilesRuleProvider.class);
}

@Override
public String toStringPerform()
{
return "Discover web.xml files";
}

@Override
public ConditionBuilder when()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class BaseConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Config extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class EjbConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class JBossConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class JBossEsbConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class JBossJBPMConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class JDKConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class JPPConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class PersistenceConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class SeamToCDI extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class SonicESBConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class WebLogicConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class WebServiceConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class WebsphereConfig extends WindupRuleProvider
@Override
public void enhanceMetadata(Context context)
{
super.enhanceMetadata(context);
context.put(RuleMetadata.CATEGORY, "Java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,10 @@ public void perform(final GraphRewrite event, final EvaluationContext context, f
}
}
}

@Override
public String toString()
{
return "DecompileWithProcyon";
}
}
Loading

0 comments on commit 12aa999

Please sign in to comment.