Hi enrico
>
> BTW, if I create a new class, say JobResultData extending ResultData and
> explicitly declaring the method, then it works.

So a bit more code is required but I think this is the best approach.
Can you commit your change?
>
> FYI the key method should be
> freemarker.ext.beans.BeansWrapper.discoverAccessibleMethods (if I followed
> correctly the method calls...).

I got there too ;) It seems it would be easy to fix
(discoverAccessibleMethods could get a bit shorter). The question is
if's worth the effort of trying to get this into freemarker. On the
other hand just having our own ObjectWrapper isn't so easy because as
all the relevant methods are private so we cannot just provide a
subclass.

>
> So the model should be a Java Bean, and I don't think that anonymous
> classes are it.
>
> So we could change the object wrapper to support our inline methods, or ask
> the freemarker ml howto.
>
> But at this point I am not sure that it is a recommended way of providing
> the pojo to fm.

Well the recommended way in Stanbol is to use RdfViewable. This also
ensures that the resource can be dereferenced as RDF as well. And for
porting the existing code we have to use public value objects (as with
JobResultData).

Cheers,
Reto

>
> Cheers,
> Enrico
>
>
> On 16 July 2013 11:04, Reto Bachmann-Gmür <r...@wymiwyg.com> wrote:
>
>> Hi Enrico
>>
>> Thanks for analyzing this further. It' really weird that freemarker
>> doesn't get all the methods of the anonymous inner class. I guess an
>> optimization attempt going wrong. Debugging freemarker code is not a
>> nice thing to do ...
>>
>> Cheers,
>> Reto
>>
>> On Tue, Jul 16, 2013 at 11:44 AM, Enrico Daga <enricod...@gmail.com>
>> wrote:
>> > (some) more insight.
>> >
>> > Another thing I tried is the following in the fm template:
>> >
>> >  ${it.class.getMethod("getJobInfo").getName()}
>> > ${it.jobInfo!"NULL"}
>> > ${it.getJobInfo()}
>> >
>> > While the first line works, displaying the method name, the second
>> displays
>> > NULL and the third throws the exception. Another note is that the method
>> > getJobInfo() is never called by the template, while if I override a
>> method
>> > defined in a supertype (for example getUriInfo) it is executed regularly.
>> > So I guess there is some problem in the way the template engine evaluate
>> > the expression looking for the actual method of an inline instance.
>> >
>> > I have setup a sling logger for freemarker and found that the method
>> > getJobInfo is not included in the introspection info for the actual
>> object
>> > (big log [1]).
>> >
>> > So this pattern won't work at least with the actual configuration of the
>> > template engine.
>> >
>> > Enrico
>> >
>> >
>> >
>> > [1] Follows the log:
>> > -------------
>> >
>> > 16.07.2013 10:32:40.573 *DEBUG* [1106793701@qtp-2017787826-51]
>> > freemarker.beans Key "jobInfo" was not found on instance of
>> > org.apache.stanbol.commons.jobs.web.resources.JobsResource$2.
>> Introspection
>> > information for the class is: {getRootUrl=public java.lang.String
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRootUrl(),
>> > getRequestUri=public java.net.URI
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRequestUri(),
>> > mainMenuItems=java.beans.PropertyDescriptor@6398d702, hashCode=public
>> > native int java.lang.Object.hashCode(),
>> > registeredLinkResources=java.beans.PropertyDescriptor@bf736045,
>> > java.lang.Object@11496fc2={public java.net.URI
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getPublicBaseUri()=[Ljava.lang.Class;@2c69c4e9
>> ,
>> > public boolean
>> > java.lang.Object.equals(java.lang.Object)=[Ljava.lang.Class;@53feb3c6,
>> > public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getNavigationLinks()=[Ljava.lang.Class;@76ccb73e
>> ,
>> > public java.lang.String
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getStaticResourcesRootUrl()=[Ljava.lang.Class;@7a128460
>> ,
>> > public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRegisteredLinkResources()=[Ljava.lang.Class;@55b0f93c
>> ,
>> > public final native java.lang.Class
>> > java.lang.Object.getClass()=[Ljava.lang.Class;@55bafe17, public
>> > java.lang.String
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getStaticRootUrl()=[Ljava.lang.Class;@677fc3f9
>> ,
>> > public java.net.URI
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getConsoleBaseUri()=[Ljava.lang.Class;@751b4584
>> ,
>> > public native int java.lang.Object.hashCode()=[Ljava.lang.Class;@5171192c
>> ,
>> > public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRegisteredScriptResources()=[Ljava.lang.Class;@582bc179
>> ,
>> > public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getMainMenuItems()=[Ljava.lang.Class;@20ab1c28
>> ,
>> > public java.net.URI
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRequestUri()=[Ljava.lang.Class;@41c596d9
>> ,
>> > public java.lang.String
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRootUrl()=[Ljava.lang.Class;@1332a24b
>> ,
>> > public java.lang.String
>> > java.lang.Object.toString()=[Ljava.lang.Class;@613cf3c5},
>> > requestUri=java.beans.PropertyDescriptor@a9193b22,
>> > staticRootUrl=java.beans.PropertyDescriptor@ac5c5fb,
>> > getNavigationLinks=public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getNavigationLinks(),
>> > getPublicBaseUri=public java.net.URI
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getPublicBaseUri(),
>> > getRegisteredScriptResources=public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRegisteredScriptResources(),
>> > registeredScriptResources=java.beans.PropertyDescriptor@1b975b12,
>> > getClass=public final native java.lang.Class java.lang.Object.getClass(),
>> > getMainMenuItems=public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getMainMenuItems(),
>> > equals=public boolean java.lang.Object.equals(java.lang.Object),
>> > class=java.beans.PropertyDescriptor@88f57024,
>> > staticResourcesRootUrl=java.beans.PropertyDescriptor@dd57bb70,
>> > consoleBaseUri=java.beans.PropertyDescriptor@5cd93387,
>> > getConsoleBaseUri=public java.net.URI
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getConsoleBaseUri(),
>> > getStaticRootUrl=public java.lang.String
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getStaticRootUrl(),
>> > getStaticResourcesRootUrl=public java.lang.String
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getStaticResourcesRootUrl(),
>> > rootUrl=java.beans.PropertyDescriptor@575a742d,
>> > getRegisteredLinkResources=public java.util.List
>> >
>> org.apache.stanbol.commons.web.base.resource.TemplateLayoutConfiguration.getRegisteredLinkResources(),
>> > publicBaseUri=java.beans.PropertyDescriptor@14a41d71,
>> > navigationLinks=java.beans.PropertyDescriptor@9297e601, toString=public
>> > java.lang.String java.lang.Object.toString()}
>> >
>> >
>> >
>> > On 14 July 2013 23:20, Enrico Daga <enricod...@gmail.com> wrote:
>> >
>> >> Hi Reto,
>> >> Yes 1.2 is around and works well.
>> >>
>> >> I had a look at JobsResource and I found that freemarker variables do
>> not
>> >> work at all. I can't say why at the moment, but replacing "this" with an
>> >> inline subclass of ResultData deals to an InvalidReferenceException for
>> >> anything I try to reference from it even if the "it" var is not null
>> and is
>> >> the actual pojo.
>> >> Invoking /jobs/test starts a fake background job, you can easily see the
>> >> problem by following the url to ping the status (/jobs/{jobId}).
>> >> Needs more insight.
>> >>
>> >>
>> >> On 14 July 2013 13:05, Reto Bachmann-Gmür <r...@wymiwyg.com> wrote:
>> >>
>> >>> Hi Enrico
>> >>>
>> >>>
>> >>> Had quite some problems with this things. On hand OSGi stuff:
>> >>>
>> >>>
>> >>>
>> http://mail-archives.apache.org/mod_mbox/felix-users/201306.mbox/%3CCALvhUEWRe+XKW=2M0e7DwNC8bm=mrakpqng5uq+ax5mocws...@mail.gmail.com%3E
>> >>>
>> >>> On the other hands jersey dependency on stuff that wasn't yet in
>> central.
>> >>>
>> >>> If the final version's out and things are working, great!
>> >>>
>> >>> Reto
>> >>>
>> >>>
>> >>> On Sun, Jul 14, 2013 at 1:13 PM, Enrico Daga <enricod...@gmail.com>
>> >>> wrote:
>> >>> > Hi Reto,
>> >>> > I am trying to run the mini launcher as test but jersey did not start
>> >>> > because javax.annotation was 1.1.9-b02 (saw on felix console). The
>> weird
>> >>> > thing is that the deployed bundle was 1.2-b04 (as configured in
>> >>> bundlelist
>> >>> > stanbolcommons and present in .../startup/1/). I changed the bundle
>> >>> version
>> >>> > to 1.2 and now it starts. Don't know why 1.2-b04 was seen as
>> 1.1.9-b02,
>> >>> but
>> >>> > is there a special reason why we would need 1.2-b04?
>> >>> >
>> >>> > Enrico
>> >>> >
>> >>> >
>> >>> > On 12 July 2013 19:15, Enrico Daga <enricod...@gmail.com> wrote:
>> >>> >
>> >>> >> Hi Reto, yes, now works. Thank you.
>> >>> >>
>> >>> >>
>> >>> >> On 12 July 2013 13:27, Reto Bachmann-Gmür <r...@wymiwyg.com> wrote:
>> >>> >>
>> >>> >>> Hi Enrico
>> >>> >>>
>> >>> >>> Thanks a lot for looking into this.
>> >>> >>>
>> >>> >>> The aim of the ng branch is to be more portable. Most notably this
>> is
>> >>> >>> independence of jersey and of the ServletContext hacks.
>> >>> >>>
>> >>> >>> I'm sorry I removed the jersey specific test only locally. I
>> committed
>> >>> >>> the removal and hope that it now compiles for you too.
>> >>> >>>
>> >>> >>> Cheers,
>> >>> >>> Reto
>> >>> >>>
>> >>> >>> On Fri, Jul 12, 2013 at 2:13 PM, Enrico Daga <enricod...@gmail.com
>> >
>> >>> >>> wrote:
>> >>> >>> > Hi Reto,
>> >>> >>> > sorry for this late reply, for some reasons I skipped this thread
>> >>> >>> > entirely...
>> >>> >>> > For what concerns the Commons Jobs API it is only used by
>> >>> reasoners. It
>> >>> >>> is
>> >>> >>> > a bit explained in a README file even if probably a documentation
>> >>> >>> targeted
>> >>> >>> > to developers would help. I could add it to the web site
>> >>> documentation.
>> >>> >>> > About the branch commons-ng, if I understood the aim is to clear
>> the
>> >>> >>> JAX-RS
>> >>> >>> > implementation in order to be jersey independent, right?
>> >>> >>> > I downloded the branch to have a look to your examples but had
>> the
>> >>> >>> > following:
>> >>> >>> >
>> >>> >>> > [ERROR] Failed to execute goal
>> >>> >>> > org.apache.maven.plugins:maven-compiler-plugin:2.3.1:testCompile
>> >>> >>> > (default-testCompile) on project
>> >>> org.apache.stanbol.entityhub.jersey:
>> >>> >>> > Compilation failure: Compilation failure:
>> >>> >>> > [ERROR]
>> >>> >>> >
>> >>> >>>
>> >>>
>> /Users/enricox/Development/Stanbol-commons-ng/entityhub/jersey/src/test/java/org/apache/stanbol/entityhub/jersey/parsers/RepresetnationReaderTest.java:[27,40]
>> >>> >>> > package com.sun.jersey.api.representation does not exist
>> >>> >>> >
>> >>> >>> > My idea was to have a look, learn howto and migrate the
>> reasoners.
>> >>> I'll
>> >>> >>> add
>> >>> >>> > the documentation of Jobs, if you think it is useful (I like that
>> >>> small
>> >>> >>> > thing btw, I would like to see it reused)
>> >>> >>> >
>> >>> >>> > Cheers,
>> >>> >>> > Enrico
>> >>> >>> >
>> >>> >>> >
>> >>> >>> >
>> >>> >>> > On 10 July 2013 15:11, Rupert Westenthaler <
>> >>> >>> rupert.westentha...@gmail.com>wrote:
>> >>> >>> >
>> >>> >>> >> Hi Reto
>> >>> >>> >>
>> >>> >>> >> Generally I find this API very interesting and I was considering
>> >>> this
>> >>> >>> >> as useful for the implementation of the Stanbol Enhancer "/task"
>> >>> >>> >> endpoint as suggested by David in [1]. For the current services
>> >>> >>> >> provided by the Enhancer and Entityhub this is not applicable as
>> >>> there
>> >>> >>> >> are no async services where users would like to interact with
>> >>> running
>> >>> >>> >> jobs.
>> >>> >>> >>
>> >>> >>> >> best
>> >>> >>> >> Rupert
>> >>> >>> >>
>> >>> >>> >> [1] http://stanbol.markmail.org/thread/npwf7olw2jemvu37
>> >>> >>> >>
>> >>> >>> >> On Wed, Jul 10, 2013 at 3:56 PM, Reto Bachmann-Gmür <
>> >>> r...@apache.org>
>> >>> >>> >> wrote:
>> >>> >>> >> > After not getting any answer I used grep myself ;)
>> >>> >>> >> >
>> >>> >>> >> > It seems commons.job is currently only used in the
>> reasoner.web.
>> >>> >>> >> >
>> >>> >>> >> > Are there plans to use this elsewhere? Or to add some
>> >>> documentation
>> >>> >>> >> > for it to be more likely to be adopted?
>> >>> >>> >> >
>> >>> >>> >> > Cheers,
>> >>> >>> >> > Reto
>> >>> >>> >> >
>> >>> >>> >> > On Wed, Jun 26, 2013 at 10:14 PM, Reto Bachmann-Gmür <
>> >>> >>> r...@apache.org>
>> >>> >>> >> wrote:
>> >>> >>> >> >> Did anybody have a chance to try this out? Where is Commons
>> Job
>> >>> >>> >> documented?
>> >>> >>> >> >>
>> >>> >>> >> >> Cheers,
>> >>> >>> >> >> Reto
>> >>> >>> >> >>
>> >>> >>> >> >>
>> >>> >>> >> >> On Fri, Jun 7, 2013 at 11:56 PM, Reto Bachmann-Gmür <
>> >>> >>> r...@apache.org>
>> >>> >>> >> wrote:
>> >>> >>> >> >>>
>> >>> >>> >> >>> At least I think it runs again.I'm not sure how to test it.
>> >>> Would
>> >>> >>> be
>> >>> >>> >> great
>> >>> >>> >> >>> if somebody else could check it out.
>> >>> >>> >> >>>
>> >>> >>> >> >>> Cheers,
>> >>> >>> >> >>> Reto
>> >>> >>> >> >>
>> >>> >>> >> >>
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >> --
>> >>> >>> >> | Rupert Westenthaler             rupert.westentha...@gmail.com
>> >>> >>> >> | Bodenlehenstraße 11
>> ++43-699-11108907
>> >>> >>> >> | A-5500 Bischofshofen
>> >>> >>> >>
>> >>> >>> >
>> >>> >>> >
>> >>> >>> >
>> >>> >>> > --
>> >>> >>> > Enrico Daga
>> >>> >>> >
>> >>> >>> > --
>> >>> >>> > http://www.enridaga.net
>> >>> >>> > skype: enri-pan
>> >>> >>>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> --
>> >>> >> Enrico Daga
>> >>> >>
>> >>> >> --
>> >>> >> http://www.enridaga.net
>> >>> >> skype: enri-pan
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >
>> >>> >
>> >>> > --
>> >>> > Enrico Daga
>> >>> >
>> >>> > --
>> >>> > http://www.enridaga.net
>> >>> > skype: enri-pan
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Enrico Daga
>> >>
>> >> --
>> >> http://www.enridaga.net
>> >> skype: enri-pan
>> >>
>> >>
>> >>
>> >
>> >
>> > --
>> > Enrico Daga
>> >
>> > --
>> > http://www.enridaga.net
>> > skype: enri-pan
>>
>
>
>
> --
> Enrico Daga
>
> --
> http://www.enridaga.net
> skype: enri-pan

Reply via email to