Simplifying reports - WindupVertexFrame#gremlin(...), Freemarker ...?framed(SomeModel)
by Ondrej Zizka
Hi team,
it would be great if we could frame vertices in Freemarker templates.
It would allow various tricks in @GremlinGroovy which could return
things like .table() and .tree() and .groupBy(), i.e. Table, Map<Map<>>
and Map<...>
And then we could iterate through these structures right in the
template, without need for
a) extra type just to have somewhere to put the query to, or
b) an extra Freemarker function.
In combination with capability to do a gremlin query from WindupVertexFrame,
it could work like this:
<#list
reportModel.rootProject.gremlin("it.as('root').subProjects.as('project').files.as('file').table.cap")
as row>
<tr>
<td>${row['project']?frame('ProjectModel').name}</td>
<td>${row['file']?frame('FileModel').prettyPath}</td>
</tr>
<#/list>
The main advantage is that we could do quite complex data gathering
right in the template without need to introduce yet another model.
That could make reports significantly easier to code, IMO.
WDYT? Is it useful? Is it possible?
Ondra
9 years, 2 months
FILE_TO_PROJECT_MODEL vs PROJECT_MODEL_TO_FILE
by Ondrej Zizka
Hi team,
we have
FileModel.FILE_TO_PROJECT_MODEL out
and
ProjectModel.PROJECT_MODEL_TO_FILE out
Is there any reason to have both? They seem to be duplicating the
semantics, and may cause inconsistency or difficult handling of both.
Regards,
Ondra
9 years, 2 months
Opening two streams for .class
by Ondrej Zizka
ClassFilePreDecompilationScan:
try (InputStream is = fileModel.asInputStream())
{
addClassFileMetadata(event, context, fileModel);
This is opening the stream twice; shouldn't it be rather this?
addClassFileMetadata(event, context, fileModel);
try (InputStream is = fileModel.asInputStream())
{
Ondra
9 years, 2 months
Query.fromType(...).has() ignores has()?
by Ondrej Zizka
Hi,
In BeforeDecompileClassesRuleProvider, I have
.addRule()
.when(Query.fromType(JavaClassFileModel.class)
.withoutProperty(FileModel.PARSE_ERROR)
)
.perform(new ClassFilePreDecompilationScan());
which translates to (verified) :
case NOT_DEFINED:
pipeline.hasNot(this.propertyName);
break;
And yet, when this query is executed, it iterates over a vertex:
Failed when iterating [v[76032]={skipDecompilation: true, isDirectory:
false, filePath:
/tmp/Windup/resJee2d/archives/jee-example-services.jar/com/NonParsable.class,
fileName: NonParsable.class, w:vertextype: [FileResource,
JavaClassFileModel], parseError: BCEL was unable to parse class file
'/tmp/Windup/resJee2d/archives/jee-example-services.jar/com/NonParsable.class':
/tmp/Windup/resJee2d/archives/jee-example-services.jar/com/NonParsable.class
is not a Java .class file}]:
As you may notice, the "parseError" is set.
Any idea why the hasNot() is ignored?
Thanks,
Ondra
9 years, 2 months
Windup docker images for 2.4.0.Final
by Marek Novotny
Hi,
I asked Marek Goldman for updating Windup docker images and he gave me
the committer permissions to https://github.com/jboss-dockerfiles/windup.
So right now it is updated to the latest 2.4.0.Final release.
There is master branch based on jboss/base-jdk:7 and jdk8 branch with
base of jboss/base-jdk:8. All jvm are OpenkJDK builds.
We have setup also binary builds on docker hub so you can pull directly
docker images, see what is available at
https://hub.docker.com/r/jboss/windup/tags/
Enjoy it!
--
Marek Novotny
--
Windup team member and Seam Project Lead
Red Hat Czech s.r.o.
Purkynova 99
612 45 Brno
9 years, 3 months
TopLayerSingletonFramesSelector logic?
by Ondrej Zizka
Just a minor thing, for potential refactoring:
TopLayerSingletonFramesSelector:
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite
event, EvaluationContext context)
{
Variables variables = Variables.instance(event);
this.varName = Iteration.getPayloadVariableName(event, context);
return variables.findVariable(varName);
}
public static String getPayloadVariableName(GraphRewrite event,
EvaluationContext ctx) throws IllegalStateException
{
Variables variables = Variables.instance(event);
Map<String, Iterable<? extends WindupVertexFrame>> topLayer =
variables.peek();
if (topLayer.keySet().size() != 1)
throw new IllegalStateException("Cannot determine Iteration
payload variable name because the top "
+ "layer of " + Variables.class.getSimpleName() + "
stack contains no or multiple variables: " + topLayer.keySet());
String name = topLayer.keySet().iterator().next();
return name;
}
So it verifies that the Variables stack has only one name, then returns
it to let the calling code return the content of that single variable.
I think the logic should be reversed - the check for a single variable
should be in the calling code.
Ondra
9 years, 3 months