[forge-dev] Scaffolding and class loading

Lincoln Baxter, III lincolnbaxter at gmail.com
Thu Dec 6 15:10:02 EST 2012


Right now if it works, do it. That's probably the only best practice I can
give you for the Scaffold in Forge 1. It's really not a great design (my
fault.) But it was also never designed to go this far without being
re-written :) Most likely, we will need to wait to address this in Forge 2.


On Thu, Dec 6, 2012 at 3:06 PM, Luca Masini <
luca.masini.mailing.list at gmail.com> wrote:

> I used another approach, I overrided the
>
> lookupClass( String className, ClassLoader classLoader )
>
> in BaseConfigReader to lookup also in the current class ClassLoader, and
> this solved the problem (the Scaffolding class is always into the module
> ClassLoader).
>
> But I would like to have a suggestion about the best approach, any
> suggestion ?
>
>
> 2012/12/6 Lincoln Baxter, III <lincolnbaxter at gmail.com>
>
> Well... we know this is a problem in Forge 1, which is one of the big
>> reasons we are working on Forge 2. But you might want to take a look at the
>> Spring MVC scaffold, which had to overcome this same issue:
>>
>>
>> https://github.com/forge/plugin-spring-mvc/blob/master/src/main/java/org/jboss/forge/scaffold/spring/SpringScaffold.java#L208
>>
>> Note the special template resolver.
>>
>> ~Lincoln
>>
>> PS. Sorry for the late reply.
>>
>>
>> On Tue, Dec 4, 2012 at 9:04 AM, Luca Masini <luca.masini at gmail.com>wrote:
>>
>>> Ok, I've found the problem, is with the "SimpleResourceResolver" that
>>> tries to locate resources in a context where those are not available.
>>>
>>> This works fine with the faces scaffold because it is part of the forge
>>> standard modules (I think.....).
>>>
>>> Any comments or better explanation ??
>>>
>>>
>>>
>>> 2012/12/4 Luca Masini <luca.masini at gmail.com>
>>>
>>>> Hi guys, I'm facing a strange problem. Inside a facet which is a
>>>> scaffold provider I need to load a resource for MetaWidget. I can see
>>>> printing this from the method that needs the resource
>>>>
>>>>
>>>> this.getClass().getClassLoader().getResource("scaffold/errai/metawidget-formbean.xml")
>>>>
>>>> that the file is available:
>>>>
>>>>
>>>> file:/Users/lucamasini/.forge/plugins/org/jboss/forge/forge-scaffold-errai/1.0.6-SNAPSHOT-e0a249f3-6fe7-4ea1-8fd9-680f8e422af4/forge-scaffold-errai.jar!/scaffold/errai/metawidget-formbean.xml
>>>>
>>>> but inside the SimpleResourceResolver neither:
>>>>
>>>> ClassLoader loaderContext =
>>>> Thread.currentThread().getContextClassLoader();
>>>>
>>>> or:
>>>>
>>>> InputStream stream = getClass().getResourceAsStream( resource );
>>>>
>>>> can find the resource because the "forge-scaffold-errai.jar" is not one
>>>> of the JAR used by the current classloader (which is a JBoss's
>>>> ModuleClassloader).
>>>>
>>>> The current implementation of scaffolding for faces works because is
>>>> inside the forge itself, but I think we have some problems using it in an
>>>> external plugin.
>>>>
>>>> Do you think I need to declare it in some kind of manifest ??
>>>>
>>>> Thank you
>>>> L.
>>>>
>>>> --
>>>> ****************************************
>>>> http://www.lucamasini.net
>>>> http://twitter.com/lmasini
>>>> http://www.linkedin.com/pub/luca-masini/7/10/2b9
>>>> ****************************************
>>>>
>>>
>>>
>>>
>>> --
>>> ****************************************
>>> http://www.lucamasini.net
>>> http://twitter.com/lmasini
>>> http://www.linkedin.com/pub/luca-masini/7/10/2b9
>>> ****************************************
>>>
>>> _______________________________________________
>>> forge-dev mailing list
>>> forge-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>
>>>
>>
>>
>> --
>> Lincoln Baxter, III
>> http://ocpsoft.org
>> "Simpler is better."
>>
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>
>>
>
>
> --
> ****************************************
> http://www.lucamasini.net
> http://twitter.com/lmasini
> http://www.linkedin.com/pub/luca-masini/7/10/2b9
> ****************************************
>
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
>
>


-- 
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20121206/520534ed/attachment-0001.html 


More information about the forge-dev mailing list