You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Simone Tripodi <si...@apache.org> on 2011/11/14 09:02:07 UTC

[digester] help on fixing DIGESTER-153

Hi all guys,
I'm writing to ask you all a big help on fixing that issues that is
spoling my sweet dreams and completely blocking for the rest :)

The well known issue is that the Digester has been able to create
objects using only the default empty constructor, that is because
instances are created when the XML elements begin.

Thanks to Matt Benson's effort, using CGLIB it is possible to create
instances using arbitrary constructors, extracting arguments from the
same matching XML element attributes.

I am sure we can do even more, extracting constructor arguments from
nested elements, I mean, given the following POJO:

class MyBean
{

  // (g|s)etter omitted
  private float floatProperty;

  public MyBean( double doubleProperty, boolean booleanProperty )
    ...
}

and the following XML snippet

<toplevel>
  <bean double="9.99">
    <boolean>true</boolean>
    <float>5.5</float>
  </bean>
</toplevel>

I would like - but don't know how, that's here that I need help - via
CGLIB (or something similar) implementing a Lazy Initialization policy
that allows us creating a proxy that tracks the Object methods
invocations, but the constructor and methods will be invoked only when
the matchin XML element terminates.

Just to be more clear:

<toplevel>
  <bean double="9.99">            <!-- create the MyBean Proxy,
register the 1st ctor argument -->
    <boolean>true</boolean>     <!-- register the 2nd ctor argument -->
    <float>5.5</float>                <!-- track invokation of the
setBeanProperty -->
  </bean>                                <!-- matche ends, invoke the
constructor and tracked methods -->
</toplevel>

Do you think that would be possible?
Many thanks in advance, all the best!
Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [digester] help on fixing DIGESTER-153

Posted by Simone Tripodi <si...@apache.org>.
Hi Matt! :)
thanks a lot in advance for your help, you cannot imagine how many
tries I already gave - and how many different bytecode FW I tested -
without success! You would be my hero of 2011! :)
ALL THE BEST!
Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Mon, Nov 28, 2011 at 3:48 AM, Matt Benson <gu...@gmail.com> wrote:
> Sorry, I missed this.  I've done something like this before.  Ping me
> in a few days.  :)
>
> Matt
>
> On Mon, Nov 14, 2011 at 5:58 AM, Simone Tripodi
> <si...@apache.org> wrote:
>> Hi James!
>> many thanks in advance!!! All the best,
>> Simo
>>
>> http://people.apache.org/~simonetripodi/
>> http://simonetripodi.livejournal.com/
>> http://twitter.com/simonetripodi
>> http://www.99soft.org/
>>
>>
>>
>> On Mon, Nov 14, 2011 at 12:51 PM, James Carman
>> <jc...@carmanconsulting.com> wrote:
>>> Sounds easy enough, but it might involve rethinking the guts of digester a
>>> bit.  Let me "digest" on that a bit, but I think we can do it somewhat
>>> easily.
>>>
>>> Sent from tablet device.  Please excuse typos and brevity.
>>> On Nov 14, 2011 3:02 AM, "Simone Tripodi" <si...@apache.org> wrote:
>>>
>>>> Hi all guys,
>>>> I'm writing to ask you all a big help on fixing that issues that is
>>>> spoling my sweet dreams and completely blocking for the rest :)
>>>>
>>>> The well known issue is that the Digester has been able to create
>>>> objects using only the default empty constructor, that is because
>>>> instances are created when the XML elements begin.
>>>>
>>>> Thanks to Matt Benson's effort, using CGLIB it is possible to create
>>>> instances using arbitrary constructors, extracting arguments from the
>>>> same matching XML element attributes.
>>>>
>>>> I am sure we can do even more, extracting constructor arguments from
>>>> nested elements, I mean, given the following POJO:
>>>>
>>>> class MyBean
>>>> {
>>>>
>>>>  // (g|s)etter omitted
>>>>  private float floatProperty;
>>>>
>>>>  public MyBean( double doubleProperty, boolean booleanProperty )
>>>>    ...
>>>> }
>>>>
>>>> and the following XML snippet
>>>>
>>>> <toplevel>
>>>>  <bean double="9.99">
>>>>    <boolean>true</boolean>
>>>>    <float>5.5</float>
>>>>  </bean>
>>>> </toplevel>
>>>>
>>>> I would like - but don't know how, that's here that I need help - via
>>>> CGLIB (or something similar) implementing a Lazy Initialization policy
>>>> that allows us creating a proxy that tracks the Object methods
>>>> invocations, but the constructor and methods will be invoked only when
>>>> the matchin XML element terminates.
>>>>
>>>> Just to be more clear:
>>>>
>>>> <toplevel>
>>>>  <bean double="9.99">            <!-- create the MyBean Proxy,
>>>> register the 1st ctor argument -->
>>>>    <boolean>true</boolean>     <!-- register the 2nd ctor argument -->
>>>>    <float>5.5</float>                <!-- track invokation of the
>>>> setBeanProperty -->
>>>>  </bean>                                <!-- matche ends, invoke the
>>>> constructor and tracked methods -->
>>>> </toplevel>
>>>>
>>>> Do you think that would be possible?
>>>> Many thanks in advance, all the best!
>>>> Simo
>>>>
>>>> http://people.apache.org/~simonetripodi/
>>>> http://simonetripodi.livejournal.com/
>>>> http://twitter.com/simonetripodi
>>>> http://www.99soft.org/
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [digester] help on fixing DIGESTER-153

Posted by Matt Benson <gu...@gmail.com>.
Sorry, I missed this.  I've done something like this before.  Ping me
in a few days.  :)

Matt

On Mon, Nov 14, 2011 at 5:58 AM, Simone Tripodi
<si...@apache.org> wrote:
> Hi James!
> many thanks in advance!!! All the best,
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
>
> On Mon, Nov 14, 2011 at 12:51 PM, James Carman
> <jc...@carmanconsulting.com> wrote:
>> Sounds easy enough, but it might involve rethinking the guts of digester a
>> bit.  Let me "digest" on that a bit, but I think we can do it somewhat
>> easily.
>>
>> Sent from tablet device.  Please excuse typos and brevity.
>> On Nov 14, 2011 3:02 AM, "Simone Tripodi" <si...@apache.org> wrote:
>>
>>> Hi all guys,
>>> I'm writing to ask you all a big help on fixing that issues that is
>>> spoling my sweet dreams and completely blocking for the rest :)
>>>
>>> The well known issue is that the Digester has been able to create
>>> objects using only the default empty constructor, that is because
>>> instances are created when the XML elements begin.
>>>
>>> Thanks to Matt Benson's effort, using CGLIB it is possible to create
>>> instances using arbitrary constructors, extracting arguments from the
>>> same matching XML element attributes.
>>>
>>> I am sure we can do even more, extracting constructor arguments from
>>> nested elements, I mean, given the following POJO:
>>>
>>> class MyBean
>>> {
>>>
>>>  // (g|s)etter omitted
>>>  private float floatProperty;
>>>
>>>  public MyBean( double doubleProperty, boolean booleanProperty )
>>>    ...
>>> }
>>>
>>> and the following XML snippet
>>>
>>> <toplevel>
>>>  <bean double="9.99">
>>>    <boolean>true</boolean>
>>>    <float>5.5</float>
>>>  </bean>
>>> </toplevel>
>>>
>>> I would like - but don't know how, that's here that I need help - via
>>> CGLIB (or something similar) implementing a Lazy Initialization policy
>>> that allows us creating a proxy that tracks the Object methods
>>> invocations, but the constructor and methods will be invoked only when
>>> the matchin XML element terminates.
>>>
>>> Just to be more clear:
>>>
>>> <toplevel>
>>>  <bean double="9.99">            <!-- create the MyBean Proxy,
>>> register the 1st ctor argument -->
>>>    <boolean>true</boolean>     <!-- register the 2nd ctor argument -->
>>>    <float>5.5</float>                <!-- track invokation of the
>>> setBeanProperty -->
>>>  </bean>                                <!-- matche ends, invoke the
>>> constructor and tracked methods -->
>>> </toplevel>
>>>
>>> Do you think that would be possible?
>>> Many thanks in advance, all the best!
>>> Simo
>>>
>>> http://people.apache.org/~simonetripodi/
>>> http://simonetripodi.livejournal.com/
>>> http://twitter.com/simonetripodi
>>> http://www.99soft.org/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [digester] help on fixing DIGESTER-153

Posted by Simone Tripodi <si...@apache.org>.
Hi James!
many thanks in advance!!! All the best,
Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Mon, Nov 14, 2011 at 12:51 PM, James Carman
<jc...@carmanconsulting.com> wrote:
> Sounds easy enough, but it might involve rethinking the guts of digester a
> bit.  Let me "digest" on that a bit, but I think we can do it somewhat
> easily.
>
> Sent from tablet device.  Please excuse typos and brevity.
> On Nov 14, 2011 3:02 AM, "Simone Tripodi" <si...@apache.org> wrote:
>
>> Hi all guys,
>> I'm writing to ask you all a big help on fixing that issues that is
>> spoling my sweet dreams and completely blocking for the rest :)
>>
>> The well known issue is that the Digester has been able to create
>> objects using only the default empty constructor, that is because
>> instances are created when the XML elements begin.
>>
>> Thanks to Matt Benson's effort, using CGLIB it is possible to create
>> instances using arbitrary constructors, extracting arguments from the
>> same matching XML element attributes.
>>
>> I am sure we can do even more, extracting constructor arguments from
>> nested elements, I mean, given the following POJO:
>>
>> class MyBean
>> {
>>
>>  // (g|s)etter omitted
>>  private float floatProperty;
>>
>>  public MyBean( double doubleProperty, boolean booleanProperty )
>>    ...
>> }
>>
>> and the following XML snippet
>>
>> <toplevel>
>>  <bean double="9.99">
>>    <boolean>true</boolean>
>>    <float>5.5</float>
>>  </bean>
>> </toplevel>
>>
>> I would like - but don't know how, that's here that I need help - via
>> CGLIB (or something similar) implementing a Lazy Initialization policy
>> that allows us creating a proxy that tracks the Object methods
>> invocations, but the constructor and methods will be invoked only when
>> the matchin XML element terminates.
>>
>> Just to be more clear:
>>
>> <toplevel>
>>  <bean double="9.99">            <!-- create the MyBean Proxy,
>> register the 1st ctor argument -->
>>    <boolean>true</boolean>     <!-- register the 2nd ctor argument -->
>>    <float>5.5</float>                <!-- track invokation of the
>> setBeanProperty -->
>>  </bean>                                <!-- matche ends, invoke the
>> constructor and tracked methods -->
>> </toplevel>
>>
>> Do you think that would be possible?
>> Many thanks in advance, all the best!
>> Simo
>>
>> http://people.apache.org/~simonetripodi/
>> http://simonetripodi.livejournal.com/
>> http://twitter.com/simonetripodi
>> http://www.99soft.org/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [digester] help on fixing DIGESTER-153

Posted by James Carman <jc...@carmanconsulting.com>.
Sounds easy enough, but it might involve rethinking the guts of digester a
bit.  Let me "digest" on that a bit, but I think we can do it somewhat
easily.

Sent from tablet device.  Please excuse typos and brevity.
On Nov 14, 2011 3:02 AM, "Simone Tripodi" <si...@apache.org> wrote:

> Hi all guys,
> I'm writing to ask you all a big help on fixing that issues that is
> spoling my sweet dreams and completely blocking for the rest :)
>
> The well known issue is that the Digester has been able to create
> objects using only the default empty constructor, that is because
> instances are created when the XML elements begin.
>
> Thanks to Matt Benson's effort, using CGLIB it is possible to create
> instances using arbitrary constructors, extracting arguments from the
> same matching XML element attributes.
>
> I am sure we can do even more, extracting constructor arguments from
> nested elements, I mean, given the following POJO:
>
> class MyBean
> {
>
>  // (g|s)etter omitted
>  private float floatProperty;
>
>  public MyBean( double doubleProperty, boolean booleanProperty )
>    ...
> }
>
> and the following XML snippet
>
> <toplevel>
>  <bean double="9.99">
>    <boolean>true</boolean>
>    <float>5.5</float>
>  </bean>
> </toplevel>
>
> I would like - but don't know how, that's here that I need help - via
> CGLIB (or something similar) implementing a Lazy Initialization policy
> that allows us creating a proxy that tracks the Object methods
> invocations, but the constructor and methods will be invoked only when
> the matchin XML element terminates.
>
> Just to be more clear:
>
> <toplevel>
>  <bean double="9.99">            <!-- create the MyBean Proxy,
> register the 1st ctor argument -->
>    <boolean>true</boolean>     <!-- register the 2nd ctor argument -->
>    <float>5.5</float>                <!-- track invokation of the
> setBeanProperty -->
>  </bean>                                <!-- matche ends, invoke the
> constructor and tracked methods -->
> </toplevel>
>
> Do you think that would be possible?
> Many thanks in advance, all the best!
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>