You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dan Adams <da...@ifactory.com> on 2006/05/25 04:44:16 UTC

Help in writing a custom annotation

I want to write an annotation that will intercept a method and add a
property to the class. I've started digging around in some of the
annotation sources but it's going pretty slow. Can someone point me at
the right place to look for where to start?

-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


Re: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
Thanks for the help Jesse. Actually, soon after I sent the last email I
realized that (I've been working way too much). Thanks for the help
though. I really appreciate it. My tests just passed so I'm going to go
commit now. :)

On Fri, 2006-05-26 at 16:41 -0400, Jesse Kuhnert wrote:
> Sure, the EnhancementOperation stuff isn't always immediately easy to grok.
> 
> This particular class generically extends any existing renderComponent
> method (if it exists), adding in logic to do other things....You could use
> the same approach to do what you want.
> 
> There's a lot going on in there that's not relevant to your use case, but it
> does show extending an existing non-abstract method .
> 
> http://svn.sourceforge.net/viewcvs.cgi/tacos/trunk/src/java/net/sf/tacos/ajax/impl/InjectAjaxComponentRenderWorker.java?view=markup&rev=22
> 
> On 5/26/06, Dan Adams <da...@ifactory.com> wrote:
> >
> > Okay, so I'm working on this again and just by looking at the other
> > annotation workers it looks like there aren't any that do anything to
> > non-abstract methods. My annotation works on methods which have an
> > implementation. Is there any way to work with a method that is
> > non-abstract using the tapestry annotation classes?
> >
> > On Thu, 2006-05-25 at 14:12 -0400, Jesse Kuhnert wrote:
> > > It's like that at all. The annotation workers run before the normal
> > > enhancement workers (like property setters and such), whoever claims the
> > > property first wins. (you can control when your worker is called via
> > > hivemind's awesome pipeline ability ).
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


SHTML and Tapestry??

Posted by Mi...@expeditors.com.
Anybody know how to make SHTML work with Tapestry?  If it does, then what 
do I need to do to make it work?

Thanks,
  - Mike

Re: Help in writing a custom annotation

Posted by Jesse Kuhnert <jk...@gmail.com>.
Sure, the EnhancementOperation stuff isn't always immediately easy to grok.

This particular class generically extends any existing renderComponent
method (if it exists), adding in logic to do other things....You could use
the same approach to do what you want.

There's a lot going on in there that's not relevant to your use case, but it
does show extending an existing non-abstract method .

http://svn.sourceforge.net/viewcvs.cgi/tacos/trunk/src/java/net/sf/tacos/ajax/impl/InjectAjaxComponentRenderWorker.java?view=markup&rev=22

On 5/26/06, Dan Adams <da...@ifactory.com> wrote:
>
> Okay, so I'm working on this again and just by looking at the other
> annotation workers it looks like there aren't any that do anything to
> non-abstract methods. My annotation works on methods which have an
> implementation. Is there any way to work with a method that is
> non-abstract using the tapestry annotation classes?
>
> On Thu, 2006-05-25 at 14:12 -0400, Jesse Kuhnert wrote:
> > It's like that at all. The annotation workers run before the normal
> > enhancement workers (like property setters and such), whoever claims the
> > property first wins. (you can control when your worker is called via
> > hivemind's awesome pipeline ability ).
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
Okay, so I'm working on this again and just by looking at the other
annotation workers it looks like there aren't any that do anything to
non-abstract methods. My annotation works on methods which have an
implementation. Is there any way to work with a method that is
non-abstract using the tapestry annotation classes?

On Thu, 2006-05-25 at 14:12 -0400, Jesse Kuhnert wrote:
> It's like that at all. The annotation workers run before the normal
> enhancement workers (like property setters and such), whoever claims the
> property first wins. (you can control when your worker is called via
> hivemind's awesome pipeline ability ).



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


Re: Help in writing a custom annotation

Posted by Jesse Kuhnert <jk...@gmail.com>.
It's like that at all. The annotation workers run before the normal
enhancement workers (like property setters and such), whoever claims the
property first wins. (you can control when your worker is called via
hivemind's awesome pipeline ability ).

On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
>
> Hmmm. That gives me an idea. I was thinking that the reason I couldn't
> claim the method is that it would be possible for another annotation
> like @InjectObject for instance to be used and then I would have to
> preserve whatever changes were put in there by InjectObject. But since I
> suppose this annotation will only be used for non-abstract accessors
> that do some sort of calculation that it would be okay to claim the
> property. I'll give that a go and I think I should be all set. Thanks
> Jesse! Keep up the good work on Tapestry. :)
>
> On Thu, 2006-05-25 at 12:35 -0400, Jesse Kuhnert wrote:
> > You should be able to do this fine using the existing annotation page
> logic.
> >
> >
> > In your annotation stuff for handling your specific type "claim" the
> > property specified using EnhancementOperation and then define a method
> body
> > that does the caching logic you describe and you'll be all set. (there
> are
> > other annotations in there that provide method body stuff to javassist
> for
> > you to reference)
> >
> > On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
> > >
> > > Thank you for the time you guys have already spent on this, but if you
> > > have any other comments I would really appreciate them. Is there just
> no
> > > way to do this given the current tapestry annotation class structure?
> > >
> > > On Thu, 2006-05-25 at 10:51 -0400, Dan Adams wrote:
> > > > Well, I've been digging around in all the annotation source for
> 4.0.1
> > > > and I seem to be stuck. It seems like there isn't any way to get to
> the
> > > > javassist methods or to do what I'm trying to do. I've looked at the
> > > > hivemind config and how to add the annotation. My only problem is
> how to
> > > > actually get the annotation to do what it needs to do. Any
> suggestions
> > > > on how to approach the problems I mentioned earlier? I also attached
> the
> > > > source which is pretty short.
> > > >
> > > > On Thu, 2006-05-25 at 10:42 -0400, Jesse Kuhnert wrote:
> > > > > Ah well...The annotations stuff in tapestry is pretty easy to
> follow
> > > (just
> > > > > added a lot of logic in this area myself). It would be best for
> you to
> > > refer
> > > > > to the tapestry annotations source, but the biggest thing is to
> also
> > > > > remember that annotations are done almost the same way that the
> > > > > "enhancement" stuff is done - with a hivemind chained pipeline
> > > > > configuration. There is an annotations hivemind configuration
> section
> > > that
> > > > > configures and sets up all of them as well.
> > > > >
> > > > > On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
> > > > > >
> > > > > > You are right about this. I hadn't realized you could do that
> with
> > > > > > parameters. But that doesn't really apply to my problem since
> @Once
> > > > > > won't normally be used on parameters. It came up because in some
> > > > > > situations you have a method that does a hibernate query and
> returns
> > > a
> > > > > > list of objects and you'd like to be able to easily refer to
> that
> > > > > > property more than once in the template. A common situation is
> > > checking
> > > > > > the list size in an @If before doing something with it.
> > > > > >
> > > > > > On Thu, 2006-05-25 at 10:28 -0400, Jesse Kuhnert wrote:
> > > > > > > Doesn't tapestry support marking a parameter as cache-able
> > > already?
> > > > > > >
> > > > > > > On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
> > > > > > > >
> > > > > > > > Have you looked into AspectJ?
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > > > > Sent: Thursday, May 25, 2006 10:00 AM
> > > > > > > > To: Tapestry users
> > > > > > > > Subject: RE: Help in writing a custom annotation
> > > > > > > >
> > > > > > > > Okay, my annotation is called @Once and if put on accessor
> will
> > > make
> > > > > > > > sure that the method is only executed once and then the
> return
> > > value
> > > > > > is
> > > > > > > > cached. Any further calls to the method will just return the
> > > saved
> > > > > > > > value. I've got pretty far but I think I'm stuck as I want
> to do
> > > > > > > > something that I could do with javassist but I'm not sure
> how to
> > > do
> > > > > > > > within the tapestry enhancement classes. I've attached what
> I
> > > have so
> > > > > > > > far and I would greatly appreciated it if someone could give
> me
> > > some
> > > > > > > > suggestions on what to do. My big problem is:
> > > > > > > >
> > > > > > > > - I could add code at the beginning and end of the method
> with
> > > > > > javassit
> > > > > > > > but can't see a way to do that
> > > > > > > > - Perhaps I could somehow rename the old method to something
> > > else and
> > > > > > > > put in a new method that calls it?
> > > > > > > >
> > > > > > > > Thanks a lot.
> > > > > > > >
> > > > > > > > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > > > > > > > I'd look at the one that injects messages, or beans, or
> even
> > > the one
> > > > > > > > that
> > > > > > > > I
> > > > > > > > > wrote for "autowiring" (available in SVN on the 4.1branch).
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > > > > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > > > > > > > To: Tapestry users
> > > > > > > > > Subject: Help in writing a custom annotation
> > > > > > > > >
> > > > > > > > > I want to write an annotation that will intercept a method
> and
> > > add a
> > > > > > > > > property to the class. I've started digging around in some
> of
> > > the
> > > > > > > > > annotation sources but it's going pretty slow. Can someone
> > > point me
> > > > > > at
> > > > > > > > > the right place to look for where to start?
> > > > > > > > >
> > > > > > > > --
> > > > > > > > Dan Adams
> > > > > > > > Software Engineer
> > > > > > > > Interactive Factory
> > > > > > > > 617.235.5857
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> > > > > > > > For additional commands, e-mail:
> users-help@tapestry.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > --
> > > > > > Dan Adams
> > > > > > Software Engineer
> > > > > > Interactive Factory
> > > > > > 617.235.5857
> > > > > >
> > > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > --
> > > Dan Adams
> > > Software Engineer
> > > Interactive Factory
> > > 617.235.5857
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 617.235.5857
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
Hmmm. That gives me an idea. I was thinking that the reason I couldn't
claim the method is that it would be possible for another annotation
like @InjectObject for instance to be used and then I would have to
preserve whatever changes were put in there by InjectObject. But since I
suppose this annotation will only be used for non-abstract accessors
that do some sort of calculation that it would be okay to claim the
property. I'll give that a go and I think I should be all set. Thanks
Jesse! Keep up the good work on Tapestry. :)

On Thu, 2006-05-25 at 12:35 -0400, Jesse Kuhnert wrote:
> You should be able to do this fine using the existing annotation page logic.
> 
> 
> In your annotation stuff for handling your specific type "claim" the
> property specified using EnhancementOperation and then define a method body
> that does the caching logic you describe and you'll be all set. (there are
> other annotations in there that provide method body stuff to javassist for
> you to reference)
> 
> On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
> >
> > Thank you for the time you guys have already spent on this, but if you
> > have any other comments I would really appreciate them. Is there just no
> > way to do this given the current tapestry annotation class structure?
> >
> > On Thu, 2006-05-25 at 10:51 -0400, Dan Adams wrote:
> > > Well, I've been digging around in all the annotation source for 4.0.1
> > > and I seem to be stuck. It seems like there isn't any way to get to the
> > > javassist methods or to do what I'm trying to do. I've looked at the
> > > hivemind config and how to add the annotation. My only problem is how to
> > > actually get the annotation to do what it needs to do. Any suggestions
> > > on how to approach the problems I mentioned earlier? I also attached the
> > > source which is pretty short.
> > >
> > > On Thu, 2006-05-25 at 10:42 -0400, Jesse Kuhnert wrote:
> > > > Ah well...The annotations stuff in tapestry is pretty easy to follow
> > (just
> > > > added a lot of logic in this area myself). It would be best for you to
> > refer
> > > > to the tapestry annotations source, but the biggest thing is to also
> > > > remember that annotations are done almost the same way that the
> > > > "enhancement" stuff is done - with a hivemind chained pipeline
> > > > configuration. There is an annotations hivemind configuration section
> > that
> > > > configures and sets up all of them as well.
> > > >
> > > > On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
> > > > >
> > > > > You are right about this. I hadn't realized you could do that with
> > > > > parameters. But that doesn't really apply to my problem since @Once
> > > > > won't normally be used on parameters. It came up because in some
> > > > > situations you have a method that does a hibernate query and returns
> > a
> > > > > list of objects and you'd like to be able to easily refer to that
> > > > > property more than once in the template. A common situation is
> > checking
> > > > > the list size in an @If before doing something with it.
> > > > >
> > > > > On Thu, 2006-05-25 at 10:28 -0400, Jesse Kuhnert wrote:
> > > > > > Doesn't tapestry support marking a parameter as cache-able
> > already?
> > > > > >
> > > > > > On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
> > > > > > >
> > > > > > > Have you looked into AspectJ?
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > > > Sent: Thursday, May 25, 2006 10:00 AM
> > > > > > > To: Tapestry users
> > > > > > > Subject: RE: Help in writing a custom annotation
> > > > > > >
> > > > > > > Okay, my annotation is called @Once and if put on accessor will
> > make
> > > > > > > sure that the method is only executed once and then the return
> > value
> > > > > is
> > > > > > > cached. Any further calls to the method will just return the
> > saved
> > > > > > > value. I've got pretty far but I think I'm stuck as I want to do
> > > > > > > something that I could do with javassist but I'm not sure how to
> > do
> > > > > > > within the tapestry enhancement classes. I've attached what I
> > have so
> > > > > > > far and I would greatly appreciated it if someone could give me
> > some
> > > > > > > suggestions on what to do. My big problem is:
> > > > > > >
> > > > > > > - I could add code at the beginning and end of the method with
> > > > > javassit
> > > > > > > but can't see a way to do that
> > > > > > > - Perhaps I could somehow rename the old method to something
> > else and
> > > > > > > put in a new method that calls it?
> > > > > > >
> > > > > > > Thanks a lot.
> > > > > > >
> > > > > > > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > > > > > > I'd look at the one that injects messages, or beans, or even
> > the one
> > > > > > > that
> > > > > > > I
> > > > > > > > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > > > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > > > > > > To: Tapestry users
> > > > > > > > Subject: Help in writing a custom annotation
> > > > > > > >
> > > > > > > > I want to write an annotation that will intercept a method and
> > add a
> > > > > > > > property to the class. I've started digging around in some of
> > the
> > > > > > > > annotation sources but it's going pretty slow. Can someone
> > point me
> > > > > at
> > > > > > > > the right place to look for where to start?
> > > > > > > >
> > > > > > > --
> > > > > > > Dan Adams
> > > > > > > Software Engineer
> > > > > > > Interactive Factory
> > > > > > > 617.235.5857
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > --
> > > > > Dan Adams
> > > > > Software Engineer
> > > > > Interactive Factory
> > > > > 617.235.5857
> > > > >
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > --
> > Dan Adams
> > Software Engineer
> > Interactive Factory
> > 617.235.5857
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


Re: Help in writing a custom annotation

Posted by Jesse Kuhnert <jk...@gmail.com>.
You should be able to do this fine using the existing annotation page logic.


In your annotation stuff for handling your specific type "claim" the
property specified using EnhancementOperation and then define a method body
that does the caching logic you describe and you'll be all set. (there are
other annotations in there that provide method body stuff to javassist for
you to reference)

On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
>
> Thank you for the time you guys have already spent on this, but if you
> have any other comments I would really appreciate them. Is there just no
> way to do this given the current tapestry annotation class structure?
>
> On Thu, 2006-05-25 at 10:51 -0400, Dan Adams wrote:
> > Well, I've been digging around in all the annotation source for 4.0.1
> > and I seem to be stuck. It seems like there isn't any way to get to the
> > javassist methods or to do what I'm trying to do. I've looked at the
> > hivemind config and how to add the annotation. My only problem is how to
> > actually get the annotation to do what it needs to do. Any suggestions
> > on how to approach the problems I mentioned earlier? I also attached the
> > source which is pretty short.
> >
> > On Thu, 2006-05-25 at 10:42 -0400, Jesse Kuhnert wrote:
> > > Ah well...The annotations stuff in tapestry is pretty easy to follow
> (just
> > > added a lot of logic in this area myself). It would be best for you to
> refer
> > > to the tapestry annotations source, but the biggest thing is to also
> > > remember that annotations are done almost the same way that the
> > > "enhancement" stuff is done - with a hivemind chained pipeline
> > > configuration. There is an annotations hivemind configuration section
> that
> > > configures and sets up all of them as well.
> > >
> > > On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
> > > >
> > > > You are right about this. I hadn't realized you could do that with
> > > > parameters. But that doesn't really apply to my problem since @Once
> > > > won't normally be used on parameters. It came up because in some
> > > > situations you have a method that does a hibernate query and returns
> a
> > > > list of objects and you'd like to be able to easily refer to that
> > > > property more than once in the template. A common situation is
> checking
> > > > the list size in an @If before doing something with it.
> > > >
> > > > On Thu, 2006-05-25 at 10:28 -0400, Jesse Kuhnert wrote:
> > > > > Doesn't tapestry support marking a parameter as cache-able
> already?
> > > > >
> > > > > On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
> > > > > >
> > > > > > Have you looked into AspectJ?
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > > Sent: Thursday, May 25, 2006 10:00 AM
> > > > > > To: Tapestry users
> > > > > > Subject: RE: Help in writing a custom annotation
> > > > > >
> > > > > > Okay, my annotation is called @Once and if put on accessor will
> make
> > > > > > sure that the method is only executed once and then the return
> value
> > > > is
> > > > > > cached. Any further calls to the method will just return the
> saved
> > > > > > value. I've got pretty far but I think I'm stuck as I want to do
> > > > > > something that I could do with javassist but I'm not sure how to
> do
> > > > > > within the tapestry enhancement classes. I've attached what I
> have so
> > > > > > far and I would greatly appreciated it if someone could give me
> some
> > > > > > suggestions on what to do. My big problem is:
> > > > > >
> > > > > > - I could add code at the beginning and end of the method with
> > > > javassit
> > > > > > but can't see a way to do that
> > > > > > - Perhaps I could somehow rename the old method to something
> else and
> > > > > > put in a new method that calls it?
> > > > > >
> > > > > > Thanks a lot.
> > > > > >
> > > > > > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > > > > > I'd look at the one that injects messages, or beans, or even
> the one
> > > > > > that
> > > > > > I
> > > > > > > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > > > > > To: Tapestry users
> > > > > > > Subject: Help in writing a custom annotation
> > > > > > >
> > > > > > > I want to write an annotation that will intercept a method and
> add a
> > > > > > > property to the class. I've started digging around in some of
> the
> > > > > > > annotation sources but it's going pretty slow. Can someone
> point me
> > > > at
> > > > > > > the right place to look for where to start?
> > > > > > >
> > > > > > --
> > > > > > Dan Adams
> > > > > > Software Engineer
> > > > > > Interactive Factory
> > > > > > 617.235.5857
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > --
> > > > Dan Adams
> > > > Software Engineer
> > > > Interactive Factory
> > > > 617.235.5857
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 617.235.5857
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
Thank you for the time you guys have already spent on this, but if you
have any other comments I would really appreciate them. Is there just no
way to do this given the current tapestry annotation class structure?

On Thu, 2006-05-25 at 10:51 -0400, Dan Adams wrote:
> Well, I've been digging around in all the annotation source for 4.0.1
> and I seem to be stuck. It seems like there isn't any way to get to the
> javassist methods or to do what I'm trying to do. I've looked at the
> hivemind config and how to add the annotation. My only problem is how to
> actually get the annotation to do what it needs to do. Any suggestions
> on how to approach the problems I mentioned earlier? I also attached the
> source which is pretty short.
> 
> On Thu, 2006-05-25 at 10:42 -0400, Jesse Kuhnert wrote:
> > Ah well...The annotations stuff in tapestry is pretty easy to follow (just
> > added a lot of logic in this area myself). It would be best for you to refer
> > to the tapestry annotations source, but the biggest thing is to also
> > remember that annotations are done almost the same way that the
> > "enhancement" stuff is done - with a hivemind chained pipeline
> > configuration. There is an annotations hivemind configuration section that
> > configures and sets up all of them as well.
> > 
> > On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
> > >
> > > You are right about this. I hadn't realized you could do that with
> > > parameters. But that doesn't really apply to my problem since @Once
> > > won't normally be used on parameters. It came up because in some
> > > situations you have a method that does a hibernate query and returns a
> > > list of objects and you'd like to be able to easily refer to that
> > > property more than once in the template. A common situation is checking
> > > the list size in an @If before doing something with it.
> > >
> > > On Thu, 2006-05-25 at 10:28 -0400, Jesse Kuhnert wrote:
> > > > Doesn't tapestry support marking a parameter as cache-able already?
> > > >
> > > > On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
> > > > >
> > > > > Have you looked into AspectJ?
> > > > >
> > > > > -----Original Message-----
> > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > Sent: Thursday, May 25, 2006 10:00 AM
> > > > > To: Tapestry users
> > > > > Subject: RE: Help in writing a custom annotation
> > > > >
> > > > > Okay, my annotation is called @Once and if put on accessor will make
> > > > > sure that the method is only executed once and then the return value
> > > is
> > > > > cached. Any further calls to the method will just return the saved
> > > > > value. I've got pretty far but I think I'm stuck as I want to do
> > > > > something that I could do with javassist but I'm not sure how to do
> > > > > within the tapestry enhancement classes. I've attached what I have so
> > > > > far and I would greatly appreciated it if someone could give me some
> > > > > suggestions on what to do. My big problem is:
> > > > >
> > > > > - I could add code at the beginning and end of the method with
> > > javassit
> > > > > but can't see a way to do that
> > > > > - Perhaps I could somehow rename the old method to something else and
> > > > > put in a new method that calls it?
> > > > >
> > > > > Thanks a lot.
> > > > >
> > > > > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > > > > I'd look at the one that injects messages, or beans, or even the one
> > > > > that
> > > > > I
> > > > > > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > > > > To: Tapestry users
> > > > > > Subject: Help in writing a custom annotation
> > > > > >
> > > > > > I want to write an annotation that will intercept a method and add a
> > > > > > property to the class. I've started digging around in some of the
> > > > > > annotation sources but it's going pretty slow. Can someone point me
> > > at
> > > > > > the right place to look for where to start?
> > > > > >
> > > > > --
> > > > > Dan Adams
> > > > > Software Engineer
> > > > > Interactive Factory
> > > > > 617.235.5857
> > > > >
> > > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > --
> > > Dan Adams
> > > Software Engineer
> > > Interactive Factory
> > > 617.235.5857
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> > 
> > 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


Re: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
Well, I've been digging around in all the annotation source for 4.0.1
and I seem to be stuck. It seems like there isn't any way to get to the
javassist methods or to do what I'm trying to do. I've looked at the
hivemind config and how to add the annotation. My only problem is how to
actually get the annotation to do what it needs to do. Any suggestions
on how to approach the problems I mentioned earlier? I also attached the
source which is pretty short.

On Thu, 2006-05-25 at 10:42 -0400, Jesse Kuhnert wrote:
> Ah well...The annotations stuff in tapestry is pretty easy to follow (just
> added a lot of logic in this area myself). It would be best for you to refer
> to the tapestry annotations source, but the biggest thing is to also
> remember that annotations are done almost the same way that the
> "enhancement" stuff is done - with a hivemind chained pipeline
> configuration. There is an annotations hivemind configuration section that
> configures and sets up all of them as well.
> 
> On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
> >
> > You are right about this. I hadn't realized you could do that with
> > parameters. But that doesn't really apply to my problem since @Once
> > won't normally be used on parameters. It came up because in some
> > situations you have a method that does a hibernate query and returns a
> > list of objects and you'd like to be able to easily refer to that
> > property more than once in the template. A common situation is checking
> > the list size in an @If before doing something with it.
> >
> > On Thu, 2006-05-25 at 10:28 -0400, Jesse Kuhnert wrote:
> > > Doesn't tapestry support marking a parameter as cache-able already?
> > >
> > > On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
> > > >
> > > > Have you looked into AspectJ?
> > > >
> > > > -----Original Message-----
> > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > Sent: Thursday, May 25, 2006 10:00 AM
> > > > To: Tapestry users
> > > > Subject: RE: Help in writing a custom annotation
> > > >
> > > > Okay, my annotation is called @Once and if put on accessor will make
> > > > sure that the method is only executed once and then the return value
> > is
> > > > cached. Any further calls to the method will just return the saved
> > > > value. I've got pretty far but I think I'm stuck as I want to do
> > > > something that I could do with javassist but I'm not sure how to do
> > > > within the tapestry enhancement classes. I've attached what I have so
> > > > far and I would greatly appreciated it if someone could give me some
> > > > suggestions on what to do. My big problem is:
> > > >
> > > > - I could add code at the beginning and end of the method with
> > javassit
> > > > but can't see a way to do that
> > > > - Perhaps I could somehow rename the old method to something else and
> > > > put in a new method that calls it?
> > > >
> > > > Thanks a lot.
> > > >
> > > > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > > > I'd look at the one that injects messages, or beans, or even the one
> > > > that
> > > > I
> > > > > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > > > >
> > > > > -----Original Message-----
> > > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > > > To: Tapestry users
> > > > > Subject: Help in writing a custom annotation
> > > > >
> > > > > I want to write an annotation that will intercept a method and add a
> > > > > property to the class. I've started digging around in some of the
> > > > > annotation sources but it's going pretty slow. Can someone point me
> > at
> > > > > the right place to look for where to start?
> > > > >
> > > > --
> > > > Dan Adams
> > > > Software Engineer
> > > > Interactive Factory
> > > > 617.235.5857
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > --
> > Dan Adams
> > Software Engineer
> > Interactive Factory
> > 617.235.5857
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


Re: Help in writing a custom annotation

Posted by Jesse Kuhnert <jk...@gmail.com>.
Ah well...The annotations stuff in tapestry is pretty easy to follow (just
added a lot of logic in this area myself). It would be best for you to refer
to the tapestry annotations source, but the biggest thing is to also
remember that annotations are done almost the same way that the
"enhancement" stuff is done - with a hivemind chained pipeline
configuration. There is an annotations hivemind configuration section that
configures and sets up all of them as well.

On 5/25/06, Dan Adams <da...@ifactory.com> wrote:
>
> You are right about this. I hadn't realized you could do that with
> parameters. But that doesn't really apply to my problem since @Once
> won't normally be used on parameters. It came up because in some
> situations you have a method that does a hibernate query and returns a
> list of objects and you'd like to be able to easily refer to that
> property more than once in the template. A common situation is checking
> the list size in an @If before doing something with it.
>
> On Thu, 2006-05-25 at 10:28 -0400, Jesse Kuhnert wrote:
> > Doesn't tapestry support marking a parameter as cache-able already?
> >
> > On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
> > >
> > > Have you looked into AspectJ?
> > >
> > > -----Original Message-----
> > > From: Dan Adams [mailto:dan@ifactory.com]
> > > Sent: Thursday, May 25, 2006 10:00 AM
> > > To: Tapestry users
> > > Subject: RE: Help in writing a custom annotation
> > >
> > > Okay, my annotation is called @Once and if put on accessor will make
> > > sure that the method is only executed once and then the return value
> is
> > > cached. Any further calls to the method will just return the saved
> > > value. I've got pretty far but I think I'm stuck as I want to do
> > > something that I could do with javassist but I'm not sure how to do
> > > within the tapestry enhancement classes. I've attached what I have so
> > > far and I would greatly appreciated it if someone could give me some
> > > suggestions on what to do. My big problem is:
> > >
> > > - I could add code at the beginning and end of the method with
> javassit
> > > but can't see a way to do that
> > > - Perhaps I could somehow rename the old method to something else and
> > > put in a new method that calls it?
> > >
> > > Thanks a lot.
> > >
> > > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > > I'd look at the one that injects messages, or beans, or even the one
> > > that
> > > I
> > > > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > > >
> > > > -----Original Message-----
> > > > From: Dan Adams [mailto:dan@ifactory.com]
> > > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > > To: Tapestry users
> > > > Subject: Help in writing a custom annotation
> > > >
> > > > I want to write an annotation that will intercept a method and add a
> > > > property to the class. I've started digging around in some of the
> > > > annotation sources but it's going pretty slow. Can someone point me
> at
> > > > the right place to look for where to start?
> > > >
> > > --
> > > Dan Adams
> > > Software Engineer
> > > Interactive Factory
> > > 617.235.5857
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 617.235.5857
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
You are right about this. I hadn't realized you could do that with
parameters. But that doesn't really apply to my problem since @Once
won't normally be used on parameters. It came up because in some
situations you have a method that does a hibernate query and returns a
list of objects and you'd like to be able to easily refer to that
property more than once in the template. A common situation is checking
the list size in an @If before doing something with it.

On Thu, 2006-05-25 at 10:28 -0400, Jesse Kuhnert wrote:
> Doesn't tapestry support marking a parameter as cache-able already?
> 
> On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
> >
> > Have you looked into AspectJ?
> >
> > -----Original Message-----
> > From: Dan Adams [mailto:dan@ifactory.com]
> > Sent: Thursday, May 25, 2006 10:00 AM
> > To: Tapestry users
> > Subject: RE: Help in writing a custom annotation
> >
> > Okay, my annotation is called @Once and if put on accessor will make
> > sure that the method is only executed once and then the return value is
> > cached. Any further calls to the method will just return the saved
> > value. I've got pretty far but I think I'm stuck as I want to do
> > something that I could do with javassist but I'm not sure how to do
> > within the tapestry enhancement classes. I've attached what I have so
> > far and I would greatly appreciated it if someone could give me some
> > suggestions on what to do. My big problem is:
> >
> > - I could add code at the beginning and end of the method with javassit
> > but can't see a way to do that
> > - Perhaps I could somehow rename the old method to something else and
> > put in a new method that calls it?
> >
> > Thanks a lot.
> >
> > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > I'd look at the one that injects messages, or beans, or even the one
> > that
> > I
> > > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > >
> > > -----Original Message-----
> > > From: Dan Adams [mailto:dan@ifactory.com]
> > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > To: Tapestry users
> > > Subject: Help in writing a custom annotation
> > >
> > > I want to write an annotation that will intercept a method and add a
> > > property to the class. I've started digging around in some of the
> > > annotation sources but it's going pretty slow. Can someone point me at
> > > the right place to look for where to start?
> > >
> > --
> > Dan Adams
> > Software Engineer
> > Interactive Factory
> > 617.235.5857
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


Re: Help in writing a custom annotation

Posted by Jesse Kuhnert <jk...@gmail.com>.
Doesn't tapestry support marking a parameter as cache-able already?

On 5/25/06, James Carman <ja...@carmanconsulting.com> wrote:
>
> Have you looked into AspectJ?
>
> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com]
> Sent: Thursday, May 25, 2006 10:00 AM
> To: Tapestry users
> Subject: RE: Help in writing a custom annotation
>
> Okay, my annotation is called @Once and if put on accessor will make
> sure that the method is only executed once and then the return value is
> cached. Any further calls to the method will just return the saved
> value. I've got pretty far but I think I'm stuck as I want to do
> something that I could do with javassist but I'm not sure how to do
> within the tapestry enhancement classes. I've attached what I have so
> far and I would greatly appreciated it if someone could give me some
> suggestions on what to do. My big problem is:
>
> - I could add code at the beginning and end of the method with javassit
> but can't see a way to do that
> - Perhaps I could somehow rename the old method to something else and
> put in a new method that calls it?
>
> Thanks a lot.
>
> On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > I'd look at the one that injects messages, or beans, or even the one
> that
> I
> > wrote for "autowiring" (available in SVN on the 4.1 branch).
> >
> > -----Original Message-----
> > From: Dan Adams [mailto:dan@ifactory.com]
> > Sent: Wednesday, May 24, 2006 10:44 PM
> > To: Tapestry users
> > Subject: Help in writing a custom annotation
> >
> > I want to write an annotation that will intercept a method and add a
> > property to the class. I've started digging around in some of the
> > annotation sources but it's going pretty slow. Can someone point me at
> > the right place to look for where to start?
> >
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 617.235.5857
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

RE: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
True. But, on the one hand it would be relatively easy to have an aspect
put the code in wherever the annotation is used. But on the other hand:
- it should also be easy to add new annotations using hivemind
- i would like throw any exceptions about mis-use of the annotation when
the class is constructed, not when the method is executed
- doing it using tapestry gives me access to classes that make it easier
such as EnhancementOperation and such

On Thu, 2006-05-25 at 10:43 -0400, James Carman wrote:
> Don't get me wrong, I understand your reluctance to introduce AspectJ into
> your build environment.  But, this is a perfect case for AspectJ, IMHO.
> 
> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com] 
> Sent: Thursday, May 25, 2006 10:39 AM
> To: Tapestry users
> Subject: RE: Help in writing a custom annotation
> 
> I thought about using it but I thought that putting in an annotation
> seemed like a natural course of action. Plus, using aspecj would put
> some constraints on the project build environment.
> 
> On Thu, 2006-05-25 at 10:02 -0400, James Carman wrote:
> > Have you looked into AspectJ?
> > 
> > -----Original Message-----
> > From: Dan Adams [mailto:dan@ifactory.com] 
> > Sent: Thursday, May 25, 2006 10:00 AM
> > To: Tapestry users
> > Subject: RE: Help in writing a custom annotation
> > 
> > Okay, my annotation is called @Once and if put on accessor will make
> > sure that the method is only executed once and then the return value is
> > cached. Any further calls to the method will just return the saved
> > value. I've got pretty far but I think I'm stuck as I want to do
> > something that I could do with javassist but I'm not sure how to do
> > within the tapestry enhancement classes. I've attached what I have so
> > far and I would greatly appreciated it if someone could give me some
> > suggestions on what to do. My big problem is:
> > 
> > - I could add code at the beginning and end of the method with javassit
> > but can't see a way to do that
> > - Perhaps I could somehow rename the old method to something else and
> > put in a new method that calls it?
> > 
> > Thanks a lot.
> > 
> > On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > > I'd look at the one that injects messages, or beans, or even the one
> that
> > I
> > > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > > 
> > > -----Original Message-----
> > > From: Dan Adams [mailto:dan@ifactory.com] 
> > > Sent: Wednesday, May 24, 2006 10:44 PM
> > > To: Tapestry users
> > > Subject: Help in writing a custom annotation
> > > 
> > > I want to write an annotation that will intercept a method and add a
> > > property to the class. I've started digging around in some of the
> > > annotation sources but it's going pretty slow. Can someone point me at
> > > the right place to look for where to start?
> > > 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


RE: Help in writing a custom annotation

Posted by James Carman <ja...@carmanconsulting.com>.
Don't get me wrong, I understand your reluctance to introduce AspectJ into
your build environment.  But, this is a perfect case for AspectJ, IMHO.

-----Original Message-----
From: Dan Adams [mailto:dan@ifactory.com] 
Sent: Thursday, May 25, 2006 10:39 AM
To: Tapestry users
Subject: RE: Help in writing a custom annotation

I thought about using it but I thought that putting in an annotation
seemed like a natural course of action. Plus, using aspecj would put
some constraints on the project build environment.

On Thu, 2006-05-25 at 10:02 -0400, James Carman wrote:
> Have you looked into AspectJ?
> 
> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com] 
> Sent: Thursday, May 25, 2006 10:00 AM
> To: Tapestry users
> Subject: RE: Help in writing a custom annotation
> 
> Okay, my annotation is called @Once and if put on accessor will make
> sure that the method is only executed once and then the return value is
> cached. Any further calls to the method will just return the saved
> value. I've got pretty far but I think I'm stuck as I want to do
> something that I could do with javassist but I'm not sure how to do
> within the tapestry enhancement classes. I've attached what I have so
> far and I would greatly appreciated it if someone could give me some
> suggestions on what to do. My big problem is:
> 
> - I could add code at the beginning and end of the method with javassit
> but can't see a way to do that
> - Perhaps I could somehow rename the old method to something else and
> put in a new method that calls it?
> 
> Thanks a lot.
> 
> On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > I'd look at the one that injects messages, or beans, or even the one
that
> I
> > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > 
> > -----Original Message-----
> > From: Dan Adams [mailto:dan@ifactory.com] 
> > Sent: Wednesday, May 24, 2006 10:44 PM
> > To: Tapestry users
> > Subject: Help in writing a custom annotation
> > 
> > I want to write an annotation that will intercept a method and add a
> > property to the class. I've started digging around in some of the
> > annotation sources but it's going pretty slow. Can someone point me at
> > the right place to look for where to start?
> > 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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



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


RE: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
I thought about using it but I thought that putting in an annotation
seemed like a natural course of action. Plus, using aspecj would put
some constraints on the project build environment.

On Thu, 2006-05-25 at 10:02 -0400, James Carman wrote:
> Have you looked into AspectJ?
> 
> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com] 
> Sent: Thursday, May 25, 2006 10:00 AM
> To: Tapestry users
> Subject: RE: Help in writing a custom annotation
> 
> Okay, my annotation is called @Once and if put on accessor will make
> sure that the method is only executed once and then the return value is
> cached. Any further calls to the method will just return the saved
> value. I've got pretty far but I think I'm stuck as I want to do
> something that I could do with javassist but I'm not sure how to do
> within the tapestry enhancement classes. I've attached what I have so
> far and I would greatly appreciated it if someone could give me some
> suggestions on what to do. My big problem is:
> 
> - I could add code at the beginning and end of the method with javassit
> but can't see a way to do that
> - Perhaps I could somehow rename the old method to something else and
> put in a new method that calls it?
> 
> Thanks a lot.
> 
> On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> > I'd look at the one that injects messages, or beans, or even the one that
> I
> > wrote for "autowiring" (available in SVN on the 4.1 branch).
> > 
> > -----Original Message-----
> > From: Dan Adams [mailto:dan@ifactory.com] 
> > Sent: Wednesday, May 24, 2006 10:44 PM
> > To: Tapestry users
> > Subject: Help in writing a custom annotation
> > 
> > I want to write an annotation that will intercept a method and add a
> > property to the class. I've started digging around in some of the
> > annotation sources but it's going pretty slow. Can someone point me at
> > the right place to look for where to start?
> > 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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


RE: Help in writing a custom annotation

Posted by James Carman <ja...@carmanconsulting.com>.
Have you looked into AspectJ?

-----Original Message-----
From: Dan Adams [mailto:dan@ifactory.com] 
Sent: Thursday, May 25, 2006 10:00 AM
To: Tapestry users
Subject: RE: Help in writing a custom annotation

Okay, my annotation is called @Once and if put on accessor will make
sure that the method is only executed once and then the return value is
cached. Any further calls to the method will just return the saved
value. I've got pretty far but I think I'm stuck as I want to do
something that I could do with javassist but I'm not sure how to do
within the tapestry enhancement classes. I've attached what I have so
far and I would greatly appreciated it if someone could give me some
suggestions on what to do. My big problem is:

- I could add code at the beginning and end of the method with javassit
but can't see a way to do that
- Perhaps I could somehow rename the old method to something else and
put in a new method that calls it?

Thanks a lot.

On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> I'd look at the one that injects messages, or beans, or even the one that
I
> wrote for "autowiring" (available in SVN on the 4.1 branch).
> 
> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com] 
> Sent: Wednesday, May 24, 2006 10:44 PM
> To: Tapestry users
> Subject: Help in writing a custom annotation
> 
> I want to write an annotation that will intercept a method and add a
> property to the class. I've started digging around in some of the
> annotation sources but it's going pretty slow. Can someone point me at
> the right place to look for where to start?
> 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857



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


RE: Help in writing a custom annotation

Posted by Dan Adams <da...@ifactory.com>.
Okay, my annotation is called @Once and if put on accessor will make
sure that the method is only executed once and then the return value is
cached. Any further calls to the method will just return the saved
value. I've got pretty far but I think I'm stuck as I want to do
something that I could do with javassist but I'm not sure how to do
within the tapestry enhancement classes. I've attached what I have so
far and I would greatly appreciated it if someone could give me some
suggestions on what to do. My big problem is:

- I could add code at the beginning and end of the method with javassit
but can't see a way to do that
- Perhaps I could somehow rename the old method to something else and
put in a new method that calls it?

Thanks a lot.

On Thu, 2006-05-25 at 07:11 -0400, James Carman wrote:
> I'd look at the one that injects messages, or beans, or even the one that I
> wrote for "autowiring" (available in SVN on the 4.1 branch).
> 
> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com] 
> Sent: Wednesday, May 24, 2006 10:44 PM
> To: Tapestry users
> Subject: Help in writing a custom annotation
> 
> I want to write an annotation that will intercept a method and add a
> property to the class. I've started digging around in some of the
> annotation sources but it's going pretty slow. Can someone point me at
> the right place to look for where to start?
> 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857

RE: Help in writing a custom annotation

Posted by James Carman <ja...@carmanconsulting.com>.
I'd look at the one that injects messages, or beans, or even the one that I
wrote for "autowiring" (available in SVN on the 4.1 branch).

-----Original Message-----
From: Dan Adams [mailto:dan@ifactory.com] 
Sent: Wednesday, May 24, 2006 10:44 PM
To: Tapestry users
Subject: Help in writing a custom annotation

I want to write an annotation that will intercept a method and add a
property to the class. I've started digging around in some of the
annotation sources but it's going pretty slow. Can someone point me at
the right place to look for where to start?

-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


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



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