Re: [T5.2.6] Component class transformation on initialized private instance fields

2012-01-09 Thread Kalle Korhonen
On Mon, Jan 9, 2012 at 11:27 PM, robert baker  wrote:
> I wanted to write a doc snippet to go in the Component Classes page in
> the guide under "Transient Instance Variables" in a warning
> box/pullout after the first paragraph, rewording and summing up what
> you both have said:
> """
> Never initialize an instance field to a mutable object at the point of
> declaration.  If this is done, the instance created from that
> initializer becomes the default value for that field and is reused
> inside the component on every request.  This could cause state to
> inadvertently be shared between different sessions in an application.
> """

Added, thanks.

> I don't know who to send it to or if there is a documentation manager,
> but the above is public domain if (s)he wants it.

The de facto documentation manager is Bob Harner, but in this rare
case I managed to get there first. Anybody with an ICLA on file can
edit the documentation.

Kalle

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: [T5.2.6] Component class transformation on initialized private instance fields

2012-01-09 Thread robert baker
Hey I just wanted to thank you both (Josh and Thiago) before I forget;
this helped solve a tough production bug that was affecting a lot of
people.

I wanted to write a doc snippet to go in the Component Classes page in
the guide under "Transient Instance Variables" in a warning
box/pullout after the first paragraph, rewording and summing up what
you both have said:

"""
Never initialize an instance field to a mutable object at the point of
declaration.  If this is done, the instance created from that
initializer becomes the default value for that field and is reused
inside the component on every request.  This could cause state to
inadvertently be shared between different sessions in an application.
"""

I don't know who to send it to or if there is a documentation manager,
but the above is public domain if (s)he wants it.

Thanks,
Les Baker

On Thu, Jan 5, 2012 at 5:53 AM, Thiago H. de Paula Figueiredo
 wrote:
> On Thu, 05 Jan 2012 03:35:53 -0200, robert baker 
> wrote:
>
>> Hi all,
>
>
> Hi!
>
>
>> When a page/component is transformed (in version 5.2.6) and there is a
>> field like the following:
>>
>> private List aList = new ArrayList();
>
>
> You should never, never, never, ever initialize a component, page or mixin
> field in its declaration unless it's an atomic value (primitive types,
> String, wrappers, immutable data).
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: [T5.2.6] Component class transformation on initialized private instance fields

2012-01-05 Thread Thiago H. de Paula Figueiredo
On Thu, 05 Jan 2012 03:35:53 -0200, robert baker   
wrote:



Hi all,


Hi!


When a page/component is transformed (in version 5.2.6) and there is a
field like the following:

private List aList = new ArrayList();


You should never, never, never, ever initialize a component, page or mixin  
field in its declaration unless it's an atomic value (primitive types,  
String, wrappers, immutable data).


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: [T5.2.6] Component class transformation on initialized private instance fields

2012-01-04 Thread Josh Canfield
> Does the inline initialization claim the field at transformation-time
> so that it is not cleared during request detachment?

The inline initialization is used to reset the value at the end of a
request. So, if you put stuff in the default list then you are going
to see it in all of your pages. It's pretty easy to test.

void onActivate() {
  System.out.println("aList.length: " + aList.length());
  aList.add("something");
  // over write it
  aList = new ArrayList();
}
Every time you load the page you should see the length getting bigger.

This may also cause concurrency problems depending on what operations
you are performing on the list since all the requests are using the
same object.

Josh


On Wed, Jan 4, 2012 at 9:35 PM, robert baker  wrote:
> Hi all,
>
> When a page/component is transformed (in version 5.2.6) and there is a
> field like the following:
>
> private List aList = new ArrayList();
>
> Does the inline initialization claim the field at transformation-time
> so that it is not cleared during request detachment?
>
> ("Claim" as in what the @Retain annotation would do in vers. 5.1.0.5 and 
> prior.)
>
> I looked in the online manual for information about this but didn't
> find anything in the places I looked, and quickly got over my head
> (for the short time I had) in the source.  I'm trying to debug a
> problem (data bleeding over into other sessions) with a coworker's
> page class and a "yes" answer to the above would complete the circle,
> so to speak.
>
> Thanks very much,
> Les Baker
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



[T5.2.6] Component class transformation on initialized private instance fields

2012-01-04 Thread robert baker
Hi all,

When a page/component is transformed (in version 5.2.6) and there is a
field like the following:

private List aList = new ArrayList();

Does the inline initialization claim the field at transformation-time
so that it is not cleared during request detachment?

("Claim" as in what the @Retain annotation would do in vers. 5.1.0.5 and prior.)

I looked in the online manual for information about this but didn't
find anything in the places I looked, and quickly got over my head
(for the short time I had) in the source.  I'm trying to debug a
problem (data bleeding over into other sessions) with a coworker's
page class and a "yes" answer to the above would complete the circle,
so to speak.

Thanks very much,
Les Baker

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Class Transformation problem

2011-08-14 Thread Rendy Tapestry
Yes it works, thank you.

Rendy.

On Fri, Aug 5, 2011 at 11:27 PM, Josh Canfield wrote:

> Right, this is what I was talking about. I use tynamo resteasy in this way.
>
> On Fri, Aug 5, 2011 at 12:27 AM, Taha Hafeez 
> wrote:
> > I don't think you need ComponentClassTransformationWorker. What you
> > need is, as Josh said, a service advice
> >
> > http://tapestry.apache.org/service-advisors.html
> >
> > Now the tricky part is where to apply it. As Josh said, if you expose
> > your resources as services you will be able to apply advises and even
> > use injection.
> >
> > By "exposing as service" I mean create an interface and its
> > implementation and bind using ServiceBinder. Then you can add that
> > resource to resteasy as
> >
> > public static void contributeApplication(Configuration
> > singletons, ObjectLocator locator)
> > {
> >singletons.add(locator.autobuild(MyDomainObjectResource.class));
> > }
> >
> > Disclaimer: I have never used tynamo-resteasy and this information is
> > based on http://tynamo.org/tapestry-resteasy+guide.
> >
> > On Fri, Aug 5, 2011 at 8:16 AM, Rendy Tapestry 
> wrote:
> >> Hi Josh,
> >>
> >> Might you please elaborate your answer ? I don't get it :)
> >>
> >> Thanks,
> >> Rendy.
> >>
> >> On Thu, Aug 4, 2011 at 10:29 PM, Josh Canfield  >wrote:
> >>
> >>> Also, rest resources can be bound as services to use injection and
> advice.
> >>> On Aug 4, 2011 8:05 AM, "Taha Hafeez" 
> wrote:
> >>> > Hi Rendy
> >>> >
> >>> > No ComponentClassTransformWorker will not work outside
> >>> > pages/components package. But class transformation is not the only
> >>> > reason to keep a special packages. You sometime need to scan classes
> >>> > for annotations etc and it is easy if you have specific packages
> >>> > which can be contributed to the scanning service.
> >>> >
> >>> > As far as class transformation is concerned, you can transform an
> >>> > existing class or create a new one by using ClassFab etc classes
> which
> >>> > are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).
> >>> >
> >>> > Can you elaborate on your problem ?
> >>> >
> >>> > On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry <
> rendy.tapes...@gmail.com
> >>> >
> >>> wrote:
> >>> >> Hi all,
> >>> >>
> >>> >> I have problem with class transformation, my question, will this
> class
> >>> >> transformation work outside from special package (pages for
> example). I
> >>> am
> >>> >> using restful integration from tynamo which direct me to put my web
> >>> service
> >>> >> in rest package. Is the package name matter with class
> transformation ?
> >>> If
> >>> >> yes, how could I solve my problem ?
> >>> >>
> >>> >> Thanks,
> >>> >>
> >>> >> Rendy.
> >>> >>
> >>> >> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
> >>> >>
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > Regards
> >>> >
> >>> > Taha Hafeez Siddiqi (tawus)
> >>> > http://tawus.wordpress.com
> >>> >
> >>> > -
> >>> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >>> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >>> >
> >>>
> >>
> >
> >
> >
> > --
> > Regards
> >
> > Taha Hafeez Siddiqi (tawus)
> > http://tawus.wordpress.com
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Class Transformation problem

2011-08-05 Thread Josh Canfield
Right, this is what I was talking about. I use tynamo resteasy in this way.

On Fri, Aug 5, 2011 at 12:27 AM, Taha Hafeez  wrote:
> I don't think you need ComponentClassTransformationWorker. What you
> need is, as Josh said, a service advice
>
> http://tapestry.apache.org/service-advisors.html
>
> Now the tricky part is where to apply it. As Josh said, if you expose
> your resources as services you will be able to apply advises and even
> use injection.
>
> By "exposing as service" I mean create an interface and its
> implementation and bind using ServiceBinder. Then you can add that
> resource to resteasy as
>
> public static void contributeApplication(Configuration
> singletons, ObjectLocator locator)
> {
>        singletons.add(locator.autobuild(MyDomainObjectResource.class));
> }
>
> Disclaimer: I have never used tynamo-resteasy and this information is
> based on http://tynamo.org/tapestry-resteasy+guide.
>
> On Fri, Aug 5, 2011 at 8:16 AM, Rendy Tapestry  
> wrote:
>> Hi Josh,
>>
>> Might you please elaborate your answer ? I don't get it :)
>>
>> Thanks,
>> Rendy.
>>
>> On Thu, Aug 4, 2011 at 10:29 PM, Josh Canfield wrote:
>>
>>> Also, rest resources can be bound as services to use injection and advice.
>>> On Aug 4, 2011 8:05 AM, "Taha Hafeez"  wrote:
>>> > Hi Rendy
>>> >
>>> > No ComponentClassTransformWorker will not work outside
>>> > pages/components package. But class transformation is not the only
>>> > reason to keep a special packages. You sometime need to scan classes
>>> > for annotations etc and it is easy if you have specific packages
>>> > which can be contributed to the scanning service.
>>> >
>>> > As far as class transformation is concerned, you can transform an
>>> > existing class or create a new one by using ClassFab etc classes which
>>> > are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).
>>> >
>>> > Can you elaborate on your problem ?
>>> >
>>> > On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry >> >
>>> wrote:
>>> >> Hi all,
>>> >>
>>> >> I have problem with class transformation, my question, will this class
>>> >> transformation work outside from special package (pages for example). I
>>> am
>>> >> using restful integration from tynamo which direct me to put my web
>>> service
>>> >> in rest package. Is the package name matter with class transformation ?
>>> If
>>> >> yes, how could I solve my problem ?
>>> >>
>>> >> Thanks,
>>> >>
>>> >> Rendy.
>>> >>
>>> >> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Regards
>>> >
>>> > Taha Hafeez Siddiqi (tawus)
>>> > http://tawus.wordpress.com
>>> >
>>> > -
>>> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> > For additional commands, e-mail: users-h...@tapestry.apache.org
>>> >
>>>
>>
>
>
>
> --
> Regards
>
> Taha Hafeez Siddiqi (tawus)
> http://tawus.wordpress.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Class Transformation problem

2011-08-05 Thread Rendy Tapestry
Thanks Taha & Josh, I will give it a try and later post back the result
here.

Thanks,
Rendy.

On Fri, Aug 5, 2011 at 2:27 PM, Taha Hafeez wrote:

> I don't think you need ComponentClassTransformationWorker. What you
> need is, as Josh said, a service advice
>
> http://tapestry.apache.org/service-advisors.html
>
> Now the tricky part is where to apply it. As Josh said, if you expose
> your resources as services you will be able to apply advises and even
> use injection.
>
> By "exposing as service" I mean create an interface and its
> implementation and bind using ServiceBinder. Then you can add that
> resource to resteasy as
>
> public static void contributeApplication(Configuration
> singletons, ObjectLocator locator)
> {
>singletons.add(locator.autobuild(MyDomainObjectResource.class));
> }
>
> Disclaimer: I have never used tynamo-resteasy and this information is
> based on http://tynamo.org/tapestry-resteasy+guide.
>
> On Fri, Aug 5, 2011 at 8:16 AM, Rendy Tapestry 
> wrote:
> > Hi Josh,
> >
> > Might you please elaborate your answer ? I don't get it :)
> >
> > Thanks,
> > Rendy.
> >
> > On Thu, Aug 4, 2011 at 10:29 PM, Josh Canfield  >wrote:
> >
> >> Also, rest resources can be bound as services to use injection and
> advice.
> >> On Aug 4, 2011 8:05 AM, "Taha Hafeez"  wrote:
> >> > Hi Rendy
> >> >
> >> > No ComponentClassTransformWorker will not work outside
> >> > pages/components package. But class transformation is not the only
> >> > reason to keep a special packages. You sometime need to scan classes
> >> > for annotations etc and it is easy if you have specific packages
> >> > which can be contributed to the scanning service.
> >> >
> >> > As far as class transformation is concerned, you can transform an
> >> > existing class or create a new one by using ClassFab etc classes which
> >> > are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).
> >> >
> >> > Can you elaborate on your problem ?
> >> >
> >> > On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry <
> rendy.tapes...@gmail.com
> >> >
> >> wrote:
> >> >> Hi all,
> >> >>
> >> >> I have problem with class transformation, my question, will this
> class
> >> >> transformation work outside from special package (pages for example).
> I
> >> am
> >> >> using restful integration from tynamo which direct me to put my web
> >> service
> >> >> in rest package. Is the package name matter with class transformation
> ?
> >> If
> >> >> yes, how could I solve my problem ?
> >> >>
> >> >> Thanks,
> >> >>
> >> >> Rendy.
> >> >>
> >> >> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Regards
> >> >
> >> > Taha Hafeez Siddiqi (tawus)
> >> > http://tawus.wordpress.com
> >> >
> >> > -
> >> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >> >
> >>
> >
>
>
>
> --
> Regards
>
> Taha Hafeez Siddiqi (tawus)
> http://tawus.wordpress.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Class Transformation problem

2011-08-05 Thread Taha Hafeez
I don't think you need ComponentClassTransformationWorker. What you
need is, as Josh said, a service advice

http://tapestry.apache.org/service-advisors.html

Now the tricky part is where to apply it. As Josh said, if you expose
your resources as services you will be able to apply advises and even
use injection.

By "exposing as service" I mean create an interface and its
implementation and bind using ServiceBinder. Then you can add that
resource to resteasy as

public static void contributeApplication(Configuration
singletons, ObjectLocator locator)
{
singletons.add(locator.autobuild(MyDomainObjectResource.class));
}

Disclaimer: I have never used tynamo-resteasy and this information is
based on http://tynamo.org/tapestry-resteasy+guide.

On Fri, Aug 5, 2011 at 8:16 AM, Rendy Tapestry  wrote:
> Hi Josh,
>
> Might you please elaborate your answer ? I don't get it :)
>
> Thanks,
> Rendy.
>
> On Thu, Aug 4, 2011 at 10:29 PM, Josh Canfield wrote:
>
>> Also, rest resources can be bound as services to use injection and advice.
>> On Aug 4, 2011 8:05 AM, "Taha Hafeez"  wrote:
>> > Hi Rendy
>> >
>> > No ComponentClassTransformWorker will not work outside
>> > pages/components package. But class transformation is not the only
>> > reason to keep a special packages. You sometime need to scan classes
>> > for annotations etc and it is easy if you have specific packages
>> > which can be contributed to the scanning service.
>> >
>> > As far as class transformation is concerned, you can transform an
>> > existing class or create a new one by using ClassFab etc classes which
>> > are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).
>> >
>> > Can you elaborate on your problem ?
>> >
>> > On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry > >
>> wrote:
>> >> Hi all,
>> >>
>> >> I have problem with class transformation, my question, will this class
>> >> transformation work outside from special package (pages for example). I
>> am
>> >> using restful integration from tynamo which direct me to put my web
>> service
>> >> in rest package. Is the package name matter with class transformation ?
>> If
>> >> yes, how could I solve my problem ?
>> >>
>> >> Thanks,
>> >>
>> >> Rendy.
>> >>
>> >> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
>> >>
>> >
>> >
>> >
>> > --
>> > Regards
>> >
>> > Taha Hafeez Siddiqi (tawus)
>> > http://tawus.wordpress.com
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> > For additional commands, e-mail: users-h...@tapestry.apache.org
>> >
>>
>



-- 
Regards

Taha Hafeez Siddiqi (tawus)
http://tawus.wordpress.com

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Class Transformation problem

2011-08-04 Thread Rendy Tapestry
Hi Josh,

Might you please elaborate your answer ? I don't get it :)

Thanks,
Rendy.

On Thu, Aug 4, 2011 at 10:29 PM, Josh Canfield wrote:

> Also, rest resources can be bound as services to use injection and advice.
> On Aug 4, 2011 8:05 AM, "Taha Hafeez"  wrote:
> > Hi Rendy
> >
> > No ComponentClassTransformWorker will not work outside
> > pages/components package. But class transformation is not the only
> > reason to keep a special packages. You sometime need to scan classes
> > for annotations etc and it is easy if you have specific packages
> > which can be contributed to the scanning service.
> >
> > As far as class transformation is concerned, you can transform an
> > existing class or create a new one by using ClassFab etc classes which
> > are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).
> >
> > Can you elaborate on your problem ?
> >
> > On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry  >
> wrote:
> >> Hi all,
> >>
> >> I have problem with class transformation, my question, will this class
> >> transformation work outside from special package (pages for example). I
> am
> >> using restful integration from tynamo which direct me to put my web
> service
> >> in rest package. Is the package name matter with class transformation ?
> If
> >> yes, how could I solve my problem ?
> >>
> >> Thanks,
> >>
> >> Rendy.
> >>
> >> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
> >>
> >
> >
> >
> > --
> > Regards
> >
> > Taha Hafeez Siddiqi (tawus)
> > http://tawus.wordpress.com
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
>


Re: Class Transformation problem

2011-08-04 Thread Rendy Tapestry
Hi Taha,

Thanks for your response. This my problem in detail,

I am creating a web service using tynamo, in tynamo, they direct us to place
Resource class in rest package. In every service inside the resource, I want
to put an annotation (like your @xhr - ajax graceful degradation) to every
method I want to transform. The transformation itself is simple one, I want
to catch every exeception thrown from invocation.proceed and convert it to a
string. This string will be used to override the result sent to the caller.

Because this package is not the one in controlled package, how do I
accomplish this idea ?

Thanks,
Rendy.

On Thu, Aug 4, 2011 at 10:29 PM, Josh Canfield wrote:

> Also, rest resources can be bound as services to use injection and advice.
> On Aug 4, 2011 8:05 AM, "Taha Hafeez"  wrote:
> > Hi Rendy
> >
> > No ComponentClassTransformWorker will not work outside
> > pages/components package. But class transformation is not the only
> > reason to keep a special packages. You sometime need to scan classes
> > for annotations etc and it is easy if you have specific packages
> > which can be contributed to the scanning service.
> >
> > As far as class transformation is concerned, you can transform an
> > existing class or create a new one by using ClassFab etc classes which
> > are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).
> >
> > Can you elaborate on your problem ?
> >
> > On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry  >
> wrote:
> >> Hi all,
> >>
> >> I have problem with class transformation, my question, will this class
> >> transformation work outside from special package (pages for example). I
> am
> >> using restful integration from tynamo which direct me to put my web
> service
> >> in rest package. Is the package name matter with class transformation ?
> If
> >> yes, how could I solve my problem ?
> >>
> >> Thanks,
> >>
> >> Rendy.
> >>
> >> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
> >>
> >
> >
> >
> > --
> > Regards
> >
> > Taha Hafeez Siddiqi (tawus)
> > http://tawus.wordpress.com
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
>


Re: Class Transformation problem

2011-08-04 Thread Josh Canfield
Also, rest resources can be bound as services to use injection and advice.
On Aug 4, 2011 8:05 AM, "Taha Hafeez"  wrote:
> Hi Rendy
>
> No ComponentClassTransformWorker will not work outside
> pages/components package. But class transformation is not the only
> reason to keep a special packages. You sometime need to scan classes
> for annotations etc and it is easy if you have specific packages
> which can be contributed to the scanning service.
>
> As far as class transformation is concerned, you can transform an
> existing class or create a new one by using ClassFab etc classes which
> are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).
>
> Can you elaborate on your problem ?
>
> On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry 
wrote:
>> Hi all,
>>
>> I have problem with class transformation, my question, will this class
>> transformation work outside from special package (pages for example). I
am
>> using restful integration from tynamo which direct me to put my web
service
>> in rest package. Is the package name matter with class transformation ?
If
>> yes, how could I solve my problem ?
>>
>> Thanks,
>>
>> Rendy.
>>
>> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
>>
>
>
>
> --
> Regards
>
> Taha Hafeez Siddiqi (tawus)
> http://tawus.wordpress.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>


Re: Class Transformation problem

2011-08-04 Thread Taha Hafeez
Hi Rendy

No ComponentClassTransformWorker will not work outside
pages/components package. But class transformation is not the only
reason to keep a special packages. You sometime need to scan classes
for annotations etc and it is easy if you have  specific packages
which can be contributed to the scanning service.

As far as class transformation is concerned, you can transform an
existing class or create a new one by using ClassFab etc classes which
are based on javassist in 5.2+ (on PlasticClass etc in 5.3+).

Can you elaborate on your problem ?

On Thu, Aug 4, 2011 at 7:25 PM, Rendy Tapestry  wrote:
> Hi all,
>
> I have problem with class transformation, my question, will this class
> transformation work outside from special package (pages for example). I am
> using restful integration from tynamo which direct me to put my web service
> in rest package. Is the package name matter with class transformation ? If
> yes, how could I solve my problem ?
>
> Thanks,
>
> Rendy.
>
> ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)
>



-- 
Regards

Taha Hafeez Siddiqi (tawus)
http://tawus.wordpress.com

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Class Transformation problem

2011-08-04 Thread Rendy Tapestry
Hi all,

I have problem with class transformation, my question, will this class
transformation work outside from special package (pages for example). I am
using restful integration from tynamo which direct me to put my web service
in rest package. Is the package name matter with class transformation ? If
yes, how could I solve my problem ?

Thanks,

Rendy.

ps. I am using tapestry 5.2.5 (ComponentClassTransformWorker)


Re: Class Transformation

2011-02-17 Thread Thiago H. de Paula Figueiredo
On Thu, 17 Feb 2011 14:11:39 -0200, Taha Hafeez   
wrote:



Can I do it in Javassist.


You'd need to ensure your Javassist-changed class version is the only one  
used in your application. This is probably quite hard to do. If I needed  
to something like you want, I'd study how Projet Lombok works.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Class Transformation

2011-02-17 Thread Taha Hafeez
We did use envers in one of our projects but it makes creating auditing
reports a project in itself. Besides the auditing is not of our liking. We,
being a financial organization, have to audit every thing and having so many
audit tables around is just too much. Also there is less control over the
amount of auditing. Also we have a maker-checker concept and implementing it
needs some audit data in the domain classes..

Can I do it in Javassist. I know tapestry5 will be migrating to plastic but
then I can also make upgrades to my application later.

I have a slight idea

Something like

for(String className: classNameLocator.locateClassNames(packageName)){
   CtClass ctClass = classFactoryClassPool.get(className);
   //Do whatever using javasssist
}

Am I on the right path ?

I will checkout lombok

regards
Taha



On Thu, Feb 17, 2011 at 9:23 PM, Kalle Korhonen
wrote:

> On Thu, Feb 17, 2011 at 7:15 AM, Taha Hafeez 
> wrote:
> > Back to the question. What I really want to do is provide an @Auditable
> > annotation on my domain classes and then add some fields/methods at the
> time
> > of loading the classes.
>
> Are you sure that adding the auditing data directly to your domain
> classes is a good idea? Just asking whether you've considered the
> trade-offs.
>
> If you are using Hibernate, see
> http://docs.jboss.org/envers/docs/index.html.
>
> Kalle
>
>
> > On Thu, Feb 17, 2011 at 8:12 PM, Thiago H. de Paula Figueiredo <
> > thiag...@gmail.com> wrote:
> >
> >> On Thu, 17 Feb 2011 11:33:35 -0200, Taha Hafeez <
> tawus.tapes...@gmail.com>
> >> wrote:
> >>
> >>  Hi
> >>>
> >>
> >> Hi!
> >>
> >>  There is internal support for creating new classes in tapestry ioc
> using
> >>> ClassFactory/ClassFab.
> >>>
> >>
> >> They're going to be deprecated soon and remved in the future. The
> >> replacement will be Howard's Plastic package:
> >> https://github.com/hlship/plastic.
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> >> and instructor
> >> Owner, Ars Machina Tecnologia da Informação Ltda.
> >> http://www.arsmachina.com.br
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Class Transformation

2011-02-17 Thread Kalle Korhonen
On Thu, Feb 17, 2011 at 7:15 AM, Taha Hafeez  wrote:
> Back to the question. What I really want to do is provide an @Auditable
> annotation on my domain classes and then add some fields/methods at the time
> of loading the classes.

Are you sure that adding the auditing data directly to your domain
classes is a good idea? Just asking whether you've considered the
trade-offs.

If you are using Hibernate, see http://docs.jboss.org/envers/docs/index.html.

Kalle


> On Thu, Feb 17, 2011 at 8:12 PM, Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
>> On Thu, 17 Feb 2011 11:33:35 -0200, Taha Hafeez 
>> wrote:
>>
>>  Hi
>>>
>>
>> Hi!
>>
>>  There is internal support for creating new classes in tapestry ioc using
>>> ClassFactory/ClassFab.
>>>
>>
>> They're going to be deprecated soon and remved in the future. The
>> replacement will be Howard's Plastic package:
>> https://github.com/hlship/plastic.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.com.br
>>
>

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Class Transformation

2011-02-17 Thread Lenny Primak
+1 Lombok. It is awesome and I've used it for some time. 



On Feb 17, 2011, at 10:38 AM, "Thiago H. de Paula Figueiredo" 
 wrote:

> On Thu, 17 Feb 2011 13:15:01 -0200, Taha Hafeez  
> wrote:
> 
>> Back to the question. What I really want to do is provide an @Auditable
>> annotation on my domain classes and then add some fields/methods at the time 
>> of loading the classes.
> 
> Tapestry-IoC doesn't change classes at all. It just creates proxies around 
> existing objects. I guess you need to look at at the Project Lombok (very, 
> very insteresting package, by the way) for some insipiration: 
> http://projectlombok.org/.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and 
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Class Transformation

2011-02-17 Thread Thiago H. de Paula Figueiredo
On Thu, 17 Feb 2011 13:15:01 -0200, Taha Hafeez   
wrote:



Back to the question. What I really want to do is provide an @Auditable
annotation on my domain classes and then add some fields/methods at the  
time of loading the classes.


Tapestry-IoC doesn't change classes at all. It just creates proxies around  
existing objects. I guess you need to look at at the Project Lombok (very,  
very insteresting package, by the way) for some insipiration:  
http://projectlombok.org/.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Class Transformation

2011-02-17 Thread Taha Hafeez
I know a bit of asm and I am really looking forward to browse its code but I
am too busy with migrating
our internal wicket applications to Tapestry5. We are also planning to
replace front-end of Finacle from jsp to tapestry5.

Back to the question. What I really want to do is provide an @Auditable
annotation on my domain classes and then add some fields/methods at the time
of loading the classes.

regards
Taha


On Thu, Feb 17, 2011 at 8:12 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 17 Feb 2011 11:33:35 -0200, Taha Hafeez 
> wrote:
>
>  Hi
>>
>
> Hi!
>
>  There is internal support for creating new classes in tapestry ioc using
>> ClassFactory/ClassFab.
>>
>
> They're going to be deprecated soon and remved in the future. The
> replacement will be Howard's Plastic package:
> https://github.com/hlship/plastic.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>


Re: Class Transformation

2011-02-17 Thread Thiago H. de Paula Figueiredo
On Thu, 17 Feb 2011 11:33:35 -0200, Taha Hafeez   
wrote:



Hi


Hi!


There is internal support for creating new classes in tapestry ioc using
ClassFactory/ClassFab.


They're going to be deprecated soon and remved in the future. The  
replacement will be Howard's Plastic package:  
https://github.com/hlship/plastic.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Class Transformation

2011-02-17 Thread Taha Hafeez
Hi

There is internal support for creating new classes in tapestry ioc using
ClassFactory/ClassFab. What if I have to modify an existing class say add
methods/fields or do I have to go for javassist directly

regards
Taha


Re: Class transformation

2008-02-20 Thread Robin Helgelin
On Wed, Feb 20, 2008 at 5:37 PM, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:
> Sorry, my bad. That is indeed not possible at the moment.

I did post and example in my first message in this thread where I was
playing with it, but I couldn't get Tapestry to process my renamed
method, so I gave it a rest.

-- 
 regards,
 Robin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Class transformation

2008-02-20 Thread Filip S. Adamsen

Sorry, my bad. That is indeed not possible at the moment.

-Filip

Robin Helgelin skrev:

On Wed, Feb 20, 2008 at 3:35 PM, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:

Can't you just override the method instead and call the super method at
 the right time?


Sure, but currently Tapestry class transformation doesn't support
this. Or maybe I'm just blind :)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Class transformation

2008-02-20 Thread Robin Helgelin
On Wed, Feb 20, 2008 at 3:35 PM, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:
> Can't you just override the method instead and call the super method at
>  the right time?

Sure, but currently Tapestry class transformation doesn't support
this. Or maybe I'm just blind :)

-- 
 regards,
 Robin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Class transformation

2008-02-20 Thread Filip S. Adamsen
Can't you just override the method instead and call the super method at 
the right time?


-Filip

Robin Helgelin skrev:

On Feb 19, 2008 8:47 PM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:

I think it's because the code you add is effectively inside a block,
i.e. in Java it would be:
{
  int i = 5;
}

So the scope of the new variable is limited.  That means you need to
generate all the code that uses the variable as a single body passed
to ClassTransformation.


Ah, ok. That seems problematic, as I want to both prefix and expand. I
guess it could be solved by adding a field to the class instead.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Class transformation

2008-02-19 Thread Robin Helgelin
On Feb 19, 2008 8:47 PM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> I think it's because the code you add is effectively inside a block,
> i.e. in Java it would be:
> {
>   int i = 5;
> }
>
> So the scope of the new variable is limited.  That means you need to
> generate all the code that uses the variable as a single body passed
> to ClassTransformation.

Ah, ok. That seems problematic, as I want to both prefix and expand. I
guess it could be solved by adding a field to the class instead.

-- 
regards,
Robin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Class transformation

2008-02-19 Thread Howard Lewis Ship
I think it's because the code you add is effectively inside a block,
i.e. in Java it would be:
{
  int i = 5;
}

So the scope of the new variable is limited.  That means you need to
generate all the code that uses the variable as a single body passed
to ClassTransformation.

On Feb 19, 2008 10:55 AM, Robin Helgelin <[EMAIL PROTECTED]> wrote:
> On Feb 19, 2008 7:44 PM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> > Could the extend method be failing because it does not return a value?
>
> I tried returning a value, no change. It barfs on my variable i,
> backtrace as this:
>
> Caused by: org.apache.tapestry.internal.services.MethodCompileException:
> Error compiling method public java.lang.String onActionFromCounter()
> (i += 1;): [source error] no such field: i
> at 
> org.apache.tapestry.internal.services.InternalClassTransformationImpl.extendMethod(InternalClassTransformationImpl.java:625)
> at 
> nu.localhost.tapestry.acegi.services.internal.AcegiWorker.transformMethod(AcegiWorker.java:112)
> at 
> nu.localhost.tapestry.acegi.services.internal.AcegiWorker.transform(AcegiWorker.java:46)
> at 
> $ComponentClassTransformWorker_118330aced0.transform($ComponentClassTransformWorker_118330aced0.java)
> at 
> $ComponentClassTransformWorker_118330aceca.transform($ComponentClassTransformWorker_118330aceca.java)
> at 
> org.apache.tapestry.internal.services.ComponentClassTransformerImpl.transformComponentClass(ComponentClassTransformerImpl.java:147)
> ... 94 more
> Caused by: javassist.CannotCompileException: [source error] no such field: i
> at javassist.CtBehavior.insertAfter(CtBehavior.java:703)
> at javassist.CtBehavior.insertAfter(CtBehavior.java:627)
> at 
> org.apache.tapestry.internal.services.InternalClassTransformationImpl.extendMethod(InternalClassTransformationImpl.java:621)
> ... 99 more
> Caused by: compile error: no such field: i
> at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:812)
> at javassist.compiler.TypeChecker.atFieldAssign(TypeChecker.java:270)
> at 
> javassist.compiler.JvstTypeChecker.atFieldAssign(JvstTypeChecker.java:83)
> at javassist.compiler.TypeChecker.atAssignExpr(TypeChecker.java:229)
> at javassist.compiler.ast.AssignExpr.accept(AssignExpr.java:38)
> at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:241)
> at javassist.compiler.CodeGen.atStmnt(CodeGen.java:329)
> at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
> at javassist.compiler.Javac.compileStmnt(Javac.java:568)
> at javassist.CtBehavior.insertAfterAdvice(CtBehavior.java:724)
> at javassist.CtBehavior.insertAfter(CtBehavior.java:669)
> ... 101 more
>
> --
>
> regards,
> Robin
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Class transformation

2008-02-19 Thread Robin Helgelin
On Feb 19, 2008 7:44 PM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> Could the extend method be failing because it does not return a value?

I tried returning a value, no change. It barfs on my variable i,
backtrace as this:

Caused by: org.apache.tapestry.internal.services.MethodCompileException:
Error compiling method public java.lang.String onActionFromCounter()
(i += 1;): [source error] no such field: i
at 
org.apache.tapestry.internal.services.InternalClassTransformationImpl.extendMethod(InternalClassTransformationImpl.java:625)
at 
nu.localhost.tapestry.acegi.services.internal.AcegiWorker.transformMethod(AcegiWorker.java:112)
at 
nu.localhost.tapestry.acegi.services.internal.AcegiWorker.transform(AcegiWorker.java:46)
at 
$ComponentClassTransformWorker_118330aced0.transform($ComponentClassTransformWorker_118330aced0.java)
at 
$ComponentClassTransformWorker_118330aceca.transform($ComponentClassTransformWorker_118330aceca.java)
at 
org.apache.tapestry.internal.services.ComponentClassTransformerImpl.transformComponentClass(ComponentClassTransformerImpl.java:147)
... 94 more
Caused by: javassist.CannotCompileException: [source error] no such field: i
at javassist.CtBehavior.insertAfter(CtBehavior.java:703)
at javassist.CtBehavior.insertAfter(CtBehavior.java:627)
at 
org.apache.tapestry.internal.services.InternalClassTransformationImpl.extendMethod(InternalClassTransformationImpl.java:621)
... 99 more
Caused by: compile error: no such field: i
at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:812)
at javassist.compiler.TypeChecker.atFieldAssign(TypeChecker.java:270)
at 
javassist.compiler.JvstTypeChecker.atFieldAssign(JvstTypeChecker.java:83)
at javassist.compiler.TypeChecker.atAssignExpr(TypeChecker.java:229)
at javassist.compiler.ast.AssignExpr.accept(AssignExpr.java:38)
at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:241)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:329)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
at javassist.compiler.Javac.compileStmnt(Javac.java:568)
at javassist.CtBehavior.insertAfterAdvice(CtBehavior.java:724)
at javassist.CtBehavior.insertAfter(CtBehavior.java:669)
... 101 more

-- 
regards,
Robin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Class transformation

2008-02-19 Thread Howard Lewis Ship
Could the extend method be failing because it does not return a value?

On Feb 19, 2008 9:31 AM, Robin Helgelin <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to do a simple prefix and extend to a single method,
> however, it seems that ClassTransformation.extendMethod(), doesn't
> find variables declared with prefixMethod().
>
> Simple example which throws a javassist.CannotCompileException:
>
> transformation.prefixMethod(method, "int i = 1;");
> transformation.extendMethod(method, "i += 1;");
>
> I also tried expanding the method by wrapping it, but that seems to
> break @Persist:et members. I attach my attempt. It seems the problem
> is that Tapestry only scans the new method, not the old one copied, am
> I correct?
>
> public void renameAndExtendMethod(TransformMethodSignature
> methodSignature, String newMethodName, String methodBody)
> {
> failIfFrozen();
>
> CtMethod methodOld = findMethod(methodSignature);
> methodOld.setName(newMethodName);
>
> CtMethod methodNew;
> try
> {
>  methodNew = CtNewMethod.copy(methodOld,
>  methodSignature.getMethodName(),
>  _ctClass,
>  null);
>  methodNew.setBody(methodBody);
>  _ctClass.addMethod(methodNew);
> }
> catch (CannotCompileException ex)
> {
> throw new
> MethodCompileException(ServicesMessages.methodCompileError(
> methodSignature,
> methodBody,
> ex), methodBody, ex);
> }
>
> addMethodToDescription("renameAndExtend", methodSignature, 
> methodBody);
> _addedMethods.add(methodOld);
> }
>
> --
> regards,
> Robin
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Class transformation

2008-02-19 Thread Robin Helgelin
Hi,

I'm trying to do a simple prefix and extend to a single method,
however, it seems that ClassTransformation.extendMethod(), doesn't
find variables declared with prefixMethod().

Simple example which throws a javassist.CannotCompileException:

transformation.prefixMethod(method, "int i = 1;");
transformation.extendMethod(method, "i += 1;");

I also tried expanding the method by wrapping it, but that seems to
break @Persist:et members. I attach my attempt. It seems the problem
is that Tapestry only scans the new method, not the old one copied, am
I correct?

public void renameAndExtendMethod(TransformMethodSignature
methodSignature, String newMethodName, String methodBody)
{
failIfFrozen();

CtMethod methodOld = findMethod(methodSignature);
methodOld.setName(newMethodName);

CtMethod methodNew;
try
{
 methodNew = CtNewMethod.copy(methodOld,
 methodSignature.getMethodName(),
 _ctClass,
 null);
 methodNew.setBody(methodBody);
 _ctClass.addMethod(methodNew);
}
catch (CannotCompileException ex)
{
throw new
MethodCompileException(ServicesMessages.methodCompileError(
methodSignature,
methodBody,
ex), methodBody, ex);
}

addMethodToDescription("renameAndExtend", methodSignature, methodBody);
_addedMethods.add(methodOld);
}

-- 
regards,
Robin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] class transformation to override an annotated method

2007-06-29 Thread #Cyrille37#

Dan Adams a écrit :

@Once
public List getFoos() {
  // do some expensive operation like reading foos from the db
}
  

Could you please give us the your @Once annotation source code ?
My 2 reasons are :
   - I'm learning Java so I'll like to see how to write such annotation
   - It is a really great idea !!
But do not feel obliged of course ;-)
Cheers,
Cyrille.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] class transformation to override an annotated method

2007-06-29 Thread Dan Adams
yeah, the docs say that it adds you code to the end of it. I added a
ticket:

https://issues.apache.org/jira/browse/TAPESTRY-1615

On Fri, 2007-06-29 at 09:30 -0700, Howard Lewis Ship wrote:
> You can extend an existing method, but off the top of my head, I can't
> remember if that automatically invokes the existing method before
> executing the new code. I think it does, which would defeat what you
> are trying to do.
> 
> On 6/29/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> > You are correct, ClassTransformation needs the ability to rename a method.
> >
> > On 6/29/07, Dan Adams <[EMAIL PROTECTED]> wrote:
> > > Okay, so I'm creating a @Once annotation that when applied to a method
> > > like so:
> > >
> > > @Once
> > > public List getFoos() {
> > >   // do some expensive operation like reading foos from the db
> > > }
> > >
> > > you can call getFoos() as much as you want and it will only actually
> > > execute once, allowing you to reference foos many times in your template
> > > (or elsewhere) without having to worry about doing expensive operations
> > > multiple times or having to cache a value manually.
> > >
> > > I had this working just fine in T4 because you could call the superclass
> > > method but since this is transforming the class I can't call
> > > super.getFoos(). ClassTransformation doesn't seem to have any methods
> > > for renaming a method or replacing any calls to it. Any suggestions?
> > >
> > > --
> > > Dan Adams
> > > Senior Software Engineer
> > > Interactive Factory
> > > 617.235.5857
> > >
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
> 
> 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] class transformation to override an annotated method

2007-06-29 Thread Howard Lewis Ship

You can extend an existing method, but off the top of my head, I can't
remember if that automatically invokes the existing method before
executing the new code. I think it does, which would defeat what you
are trying to do.

On 6/29/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:

You are correct, ClassTransformation needs the ability to rename a method.

On 6/29/07, Dan Adams <[EMAIL PROTECTED]> wrote:
> Okay, so I'm creating a @Once annotation that when applied to a method
> like so:
>
> @Once
> public List getFoos() {
>   // do some expensive operation like reading foos from the db
> }
>
> you can call getFoos() as much as you want and it will only actually
> execute once, allowing you to reference foos many times in your template
> (or elsewhere) without having to worry about doing expensive operations
> multiple times or having to cache a value manually.
>
> I had this working just fine in T4 because you could call the superclass
> method but since this is transforming the class I can't call
> super.getFoos(). ClassTransformation doesn't seem to have any methods
> for renaming a method or replacing any calls to it. Any suggestions?
>
> --
> Dan Adams
> Senior Software Engineer
> Interactive Factory
> 617.235.5857
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] class transformation to override an annotated method

2007-06-29 Thread Howard Lewis Ship

You are correct, ClassTransformation needs the ability to rename a method.

On 6/29/07, Dan Adams <[EMAIL PROTECTED]> wrote:

Okay, so I'm creating a @Once annotation that when applied to a method
like so:

@Once
public List getFoos() {
  // do some expensive operation like reading foos from the db
}

you can call getFoos() as much as you want and it will only actually
execute once, allowing you to reference foos many times in your template
(or elsewhere) without having to worry about doing expensive operations
multiple times or having to cache a value manually.

I had this working just fine in T4 because you could call the superclass
method but since this is transforming the class I can't call
super.getFoos(). ClassTransformation doesn't seem to have any methods
for renaming a method or replacing any calls to it. Any suggestions?

--
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[T5] class transformation to override an annotated method

2007-06-29 Thread Dan Adams
Okay, so I'm creating a @Once annotation that when applied to a method
like so:

@Once
public List getFoos() {
  // do some expensive operation like reading foos from the db
}

you can call getFoos() as much as you want and it will only actually
execute once, allowing you to reference foos many times in your template
(or elsewhere) without having to worry about doing expensive operations
multiple times or having to cache a value manually.

I had this working just fine in T4 because you could call the superclass
method but since this is transforming the class I can't call
super.getFoos(). ClassTransformation doesn't seem to have any methods
for renaming a method or replacing any calls to it. Any suggestions?

-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]