[forge-dev] automatic dependency detection too restrictive?

Lincoln Baxter, III lincolnbaxter at gmail.com
Mon Feb 27 11:01:54 EST 2012

Hi Thomas,

Sorry for the late response. I have been on Vacation.

Actually I think that perhaps the best solution is actuallly just to expose
MVEL as a dependency to plugins that request it. This would be the simplest
solution IMO, and would only request code-changes in the Forge plugin


Just like this.

What do you think?

On Fri, Feb 17, 2012 at 2:08 PM, Thomas Frühbeck <fruehbeck at aon.at> wrote:

> Am 15.02.2012 16:03, schrieb Lincoln Baxter, III:
> > I just had a thought. Are you sure that you really need the MVEL
> > library? Is it possible that you are directly referencing MVEL classes
> > when you should instead be referencing Seam Render classes?
> >
> > "TemplateCompiler" comes to mind.
> Lincoln you were right, the issue is in fact related to TemplateCompiler
> but not directly.
> I think I understand the problem now in detail and want to propose a
> solution. As my code was just taken from the FacesScaffold I did not
> further think about using it.
> As it turns out my plugin is not "as privileged?" as the FacesScaffold,
> so the problem became visible with my implementation.
> Situation: the FacesScaffold wants to calculate the textual indentation
> for the metawidgets that will be rendered inside of a template.
> To access the _compiled_ template, which seams to show the real
> indentation level, the following code was executed:
>     private org.jboss.seam.render.template.CompiledTemplateResource
> createTemplate;
>     ...
>          String template =
> String.valueOf(this.createTemplate.getCompiledTemplate().getTemplate());
> Now there is the hidden access to the MVEL libraries, because
> CompiledTemplateResource.getTemplate() will return a native
> org.mvel2.templates.CompiledTemplate.
> This is _very_ unfortunate, because there seems to be no easy way to
> e.g. override getTemplate() because it is already in the seam.render libs.
> On the other side it is quite important to provide consistent
> indentation for the generated sources - it simply looks ugly and unprof
> if code goes zigzag.
> My proposed solution is to provide a TemplateConverter in the
> scaffold.faces plugin. There the visibility of MVEL is provided and so
> does not conflict with forge's libs.
> On the other hand the FacesScaffold classes are visible to the other
> plugins.
> package org.jboss.forge.scaffold.faces;
> @Dependent
> public class TemplateConverter {
>     public String convert(CompiledTemplateResource resource) {
>         return new String(resource.getCompiledTemplate().getTemplate());
>     }
> }
> So now I can convert the compiled templates by :
>    @Inject
>    private TemplateConverter templateConverter;
> ...
>    String template = templateConverter.convert(this.backingBeanTemplate);
> I would be very glad to provide the pull.request for this class.
> Any recommendations for the solution or the destination package for the
> converter?
> Thomas
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev

Lincoln Baxter, III
"Keep it Simple"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20120227/1abf1885/attachment.html 

More information about the forge-dev mailing list