You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Julian Sinai <js...@yahoo.com> on 2006/08/28 19:54:58 UTC

The right way to look up a service?

Hi

I'm writing my own engine service and I'm basing it on the Chart example in the Workbench app that ships with the Tapestry distribution. The example uses a line in ChartAsset.java that's deprecated in Tap 4:

        _chartService = engine.getService(ChartService.SERVICE_NAME);

The service is used to build the ILink in the buildURL method as follows:

        ILink l = _chartService.getLink(false, _chartProvider);

What's the right way to do this in Tap 4? You can't use @InjectObject in an asset class.

Thanks.



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


RE: Is there a way to pregenerate Component/Page classes?

Posted by Patrick Moore <pm...@yahoo.com>.
Hi Greg --

Thanks for your answer. As far as using testing as a solution, that is not very
satisfactory as:
- I am starting a company by myself and, while I am doing test code, I really
want to focus on the business logic not the general of validation components
and pages.
- It relies on developers always adding tests for all components simply to
verify what tapestry should be able to verify automatically.

The load-on-startup only starts up Tapestry, but does not actually test any
pages. Also this occurs during the restart phase of build deployment. I would
like to have this check occur as part of the image creation.

In short, I want errors discovered as soon as they occur and automatically,
preferably with a maven2 plugin. Having a dynamic environment is great for
development, but when going to production, where you don't want things to be
changed, having a static verification step is nice as well.

-Pat

--- Greg.L.Cormier@servicecanada.gc.ca wrote:

> 1. Testing.
> 
> 2. Hmm, have you looked into a <load-on-startup> tag for web.xml? I'm not
> 100% sure it would work with Tapestry but, since Tapestry does have a
> Servlet, i would guess that it would.
> 
> 4. I find that the servlet loading takes the longest, about 8 seconds the
> first time. After that, it's hard to determine if the server was restarted,
> all the pages load rather quickly.
> 
> -Greg
> 
> -----Original Message-----
> From: Patrick Moore [mailto:pm24601@yahoo.com]
> Sent: Wednesday, August 30, 2006 10:06 PM
> To: Tapestry users
> Subject: Re: Is there a way to pregenerate Component/Page classes?
> 
> 
> 1. So that I know that there are no problems with any component or page.
> Otherwise how do I know a customer isn't going to find a problem on the
> production site?
> 
> 2. So that no user experiences any delay after a server restart.
> 
> 3. So that in a cluster the bytecode generation is only done once.
> 
> 4. So if the server restarts it is not obvious to any user.
> 
> Considering how slow it can be to generate new components and pages why would
> I
> want it done while a customer is trying to use the site?
> 
> --- "hv @ Fashion Content" <in...@fashioncontent.com> wrote:
> 
> > Uh, what??
> > 
> > You sure you are are referring to Tapestry? Why would you want generate a 
> > class file?
> > 
> > "Patrick Moore" <pm...@yahoo.com> skrev i en meddelelse 
> > news:20060830213336.32415.qmail@web81409.mail.mud.yahoo.com...
> > > Is there a way to have Tapestry walk the component/page packages and 
> > > generate
> > > the .class files?
> > >
> > > I would like to do this to make sure that in production there are no 
> > > errors at
> > > the basic component/page definition level.
> > >
> > > Otherwise it seems like I am force to have a script that walks every
> > > page/component just to get the byte code generated.
> > >
> > > I don't know if there is a mvn plugin that will do this for me but if 
> > > there is
> > > please let me know.
> > >
> > > -Pat
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 


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


RE: Is there a way to pregenerate Component/Page classes?

Posted by Gr...@servicecanada.gc.ca.
1. Testing.

2. Hmm, have you looked into a <load-on-startup> tag for web.xml? I'm not 100% sure it would work with Tapestry but, since Tapestry does have a Servlet, i would guess that it would.

4. I find that the servlet loading takes the longest, about 8 seconds the first time. After that, it's hard to determine if the server was restarted, all the pages load rather quickly.

-Greg

-----Original Message-----
From: Patrick Moore [mailto:pm24601@yahoo.com]
Sent: Wednesday, August 30, 2006 10:06 PM
To: Tapestry users
Subject: Re: Is there a way to pregenerate Component/Page classes?


1. So that I know that there are no problems with any component or page.
Otherwise how do I know a customer isn't going to find a problem on the
production site?

2. So that no user experiences any delay after a server restart.

3. So that in a cluster the bytecode generation is only done once.

4. So if the server restarts it is not obvious to any user.

Considering how slow it can be to generate new components and pages why would I
want it done while a customer is trying to use the site?

--- "hv @ Fashion Content" <in...@fashioncontent.com> wrote:

> Uh, what??
> 
> You sure you are are referring to Tapestry? Why would you want generate a 
> class file?
> 
> "Patrick Moore" <pm...@yahoo.com> skrev i en meddelelse 
> news:20060830213336.32415.qmail@web81409.mail.mud.yahoo.com...
> > Is there a way to have Tapestry walk the component/page packages and 
> > generate
> > the .class files?
> >
> > I would like to do this to make sure that in production there are no 
> > errors at
> > the basic component/page definition level.
> >
> > Otherwise it seems like I am force to have a script that walks every
> > page/component just to get the byte code generated.
> >
> > I don't know if there is a mvn plugin that will do this for me but if 
> > there is
> > please let me know.
> >
> > -Pat
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


---------------------------------------------------------------------
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: Is there a way to pregenerate Component/Page classes?

Posted by Patrick Moore <pm...@yahoo.com>.
1. So that I know that there are no problems with any component or page.
Otherwise how do I know a customer isn't going to find a problem on the
production site?

2. So that no user experiences any delay after a server restart.

3. So that in a cluster the bytecode generation is only done once.

4. So if the server restarts it is not obvious to any user.

Considering how slow it can be to generate new components and pages why would I
want it done while a customer is trying to use the site?

--- "hv @ Fashion Content" <in...@fashioncontent.com> wrote:

> Uh, what??
> 
> You sure you are are referring to Tapestry? Why would you want generate a 
> class file?
> 
> "Patrick Moore" <pm...@yahoo.com> skrev i en meddelelse 
> news:20060830213336.32415.qmail@web81409.mail.mud.yahoo.com...
> > Is there a way to have Tapestry walk the component/page packages and 
> > generate
> > the .class files?
> >
> > I would like to do this to make sure that in production there are no 
> > errors at
> > the basic component/page definition level.
> >
> > Otherwise it seems like I am force to have a script that walks every
> > page/component just to get the byte code generated.
> >
> > I don't know if there is a mvn plugin that will do this for me but if 
> > there is
> > please let me know.
> >
> > -Pat
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


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


Re: Is there a way to pregenerate Component/Page classes?

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
Uh, what??

You sure you are are referring to Tapestry? Why would you want generate a 
class file?

"Patrick Moore" <pm...@yahoo.com> skrev i en meddelelse 
news:20060830213336.32415.qmail@web81409.mail.mud.yahoo.com...
> Is there a way to have Tapestry walk the component/page packages and 
> generate
> the .class files?
>
> I would like to do this to make sure that in production there are no 
> errors at
> the basic component/page definition level.
>
> Otherwise it seems like I am force to have a script that walks every
> page/component just to get the byte code generated.
>
> I don't know if there is a mvn plugin that will do this for me but if 
> there is
> please let me know.
>
> -Pat
>
> ---------------------------------------------------------------------
> 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: Is there a way to pregenerate Component/Page classes?

Posted by Bryan Lewis <br...@maine.rr.com>.
You're asking to preload all the pages in the app, to check for syntax 
errors in the html and page specs.  Things the compiler doesn't catch, 
that normally you wouldn't discover until you visit the page.  I used to 
do that.  It's not supported directly by Tapestry, but in Tapestry3 it 
wasn't too bad.  The gist of it was:

    Set pageNameSet = requestCycle.getRequestContext().getServlet()
              .getServletConfig().getServletContext()
              .getResourcePaths("/WEB-INF/");

Then each page could be loaded with cycle.getPage(pageName).  It felt 
like sort of a hack, though... I had to do it at a point after startup 
where I could get a requestCycle; I did it in the first login.

In Tap4 it was a little harder to get to the servletContext.  I believe 
it can be obtained from an injected instance of ApplicationGlobals but I 
didn't pursue that technique.  I removed the feature because it slowed 
down development (all the pages had to be loaded after every restart, 
when normally you're editing only one or two), and it didn't catch any 
surprising errors after we got past the flurry of the initial release.  
It felt like more trouble than it was worth.



Patrick Moore wrote:
> Is there a way to have Tapestry walk the component/page packages and generate
> the .class files?
>
> I would like to do this to make sure that in production there are no errors at
> the basic component/page definition level.
>
> Otherwise it seems like I am force to have a script that walks every
> page/component just to get the byte code generated.
>
> I don't know if there is a mvn plugin that will do this for me but if there is
> please let me know.
>
> -Pat
>
> ---------------------------------------------------------------------
> 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


Is there a way to pregenerate Component/Page classes?

Posted by Patrick Moore <pm...@yahoo.com>.
Is there a way to have Tapestry walk the component/page packages and generate
the .class files?

I would like to do this to make sure that in production there are no errors at
the basic component/page definition level.

Otherwise it seems like I am force to have a script that walks every
page/component just to get the byte code generated.

I don't know if there is a mvn plugin that will do this for me but if there is
please let me know.

-Pat

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


Re: The right way to look up a service?

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
You seem to ask conflicting questions. I don't see why you would need to 
look up a service from an asset. Asset is a value holding object, so you
would want to keep it as independent as possible.

In terms of how to look up a service, you would use HiveMind configuration 
when the object isn't a page/component.

Assets are best created using the "tapestry.asset" HiveMind package of 
factories.

Henrik

"Julian Sinai" <js...@yahoo.com> skrev i en meddelelse 
news:20060828175458.7686.qmail@web82005.mail.mud.yahoo.com...
> Hi
>
> I'm writing my own engine service and I'm basing it on the Chart example 
> in the Workbench app that ships with the Tapestry distribution. The 
> example uses a line in ChartAsset.java that's deprecated in Tap 4:
>
>        _chartService = engine.getService(ChartService.SERVICE_NAME);
>
> The service is used to build the ILink in the buildURL method as follows:
>
>        ILink l = _chartService.getLink(false, _chartProvider);
>
> What's the right way to do this in Tap 4? You can't use @InjectObject in 
> an asset class.
>
> Thanks.
>
>
>
> ---------------------------------------------------------------------
> 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