You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Grotzke <ma...@javakaffee.de> on 2007/05/25 15:35:59 UTC

T5 How to have multiple modules with separate packages for pages

Hi,

I have a question concerning the configuration of tapestry5
with the context-param "tapestry.app-package" and the support
of multiple modules per application (several root-packages).

We have an application that first has modules and then layers
for each module, like the following:

org.comp.app.mod1.presentation
org.comp.app.mod1.business
org.comp.app.mod1.dao

org.comp.app.mod2.presentation
org.comp.app.mod2.business
org.comp.app.mod2.dao

the presentation packages shall contain subpackages
for services, pages and components, e.g. 

org.comp.app.mod1.presentation.pages
org.comp.app.mod1.presentation.components
org.comp.app.mod1.presentation.services


The quickstart archetype generated an AppModule class in
org.comp.app.mod1.presentation.services, but AFAICS
this is intended to configure the application, and therefore
should be located in a package like
org.comp.app.common.presentation.services.

Then I would like to specify "org.comp.app" as the
"tapestry.app-package", or specify several root packages,
for each module the presentation package.

I already tried the first approach, but it failed with 404 NOT_FOUND
if I requested a specific page at /app/mypage (e.g. with
MyPage.java in org.comp.app.mod1.presentation.pages).

How is such an architecture supported by T5?

Thanx in advance,
cheers,
Martin



Re: T5 How to have multiple modules with separate packages for pages

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Fri, 2007-05-25 at 18:52 +0200, Martin Grotzke wrote:
> On Fri, 2007-05-25 at 21:52 +0800, 蝈蝈龙 wrote:
> > I'm also trying to separate the packae in TP5.
> > But I think the package may look like
> > 
> > // business layer
> > org.comp.app.business.mod1
> > org.comp.app.business.mod2
> > 
> > // dao layer
> > org.comp.app.dao.mod1
> > org.comp.app.dao.mod2
> okay, but first horizontal layers and then vertical slices is not
> what we want to have.
> 
> > But I don't know if we can specify several root packages for each module the
> > presentation package. Is it really neccessary?
> that's not really my requirement, but I want to be able to structure
> my application after my preferences and though have it supported by
> tapestry...
> 
> hopefully this is possible :)
Howard, do you have any advice how we can have the described structure
(first modules, then layers) supported by T5?

What would have to be changed, or what would be the place in T5 that we
would have to customize for this?

Thx && cheers,
Martin


> 
> cheers,
> martin
> 
> 
> > 
> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > 
> > 2007/5/25, Martin Grotzke <ma...@javakaffee.de>:
> > >
> > > Hi,
> > >
> > > I have a question concerning the configuration of tapestry5
> > > with the context-param "tapestry.app-package" and the support
> > > of multiple modules per application (several root-packages).
> > >
> > > We have an application that first has modules and then layers
> > > for each module, like the following:
> > >
> > > org.comp.app.mod1.presentation
> > > org.comp.app.mod1.business
> > > org.comp.app.mod1.dao
> > >
> > > org.comp.app.mod2.presentation
> > > org.comp.app.mod2.business
> > > org.comp.app.mod2.dao
> > >
> > > the presentation packages shall contain subpackages
> > > for services, pages and components, e.g.
> > >
> > > org.comp.app.mod1.presentation.pages
> > > org.comp.app.mod1.presentation.components
> > > org.comp.app.mod1.presentation.services
> > >
> > >
> > > The quickstart archetype generated an AppModule class in
> > > org.comp.app.mod1.presentation.services, but AFAICS
> > > this is intended to configure the application, and therefore
> > > should be located in a package like
> > > org.comp.app.common.presentation.services.
> > >
> > > Then I would like to specify "org.comp.app" as the
> > > "tapestry.app-package", or specify several root packages,
> > > for each module the presentation package.
> > >
> > > I already tried the first approach, but it failed with 404 NOT_FOUND
> > > if I requested a specific page at /app/mypage (e.g. with
> > > MyPage.java in org.comp.app.mod1.presentation.pages).
> > >
> > > How is such an architecture supported by T5?
> > >
> > > Thanx in advance,
> > > cheers,
> > > Martin
> > >
> > >
> > >
> > >
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Re: T5 How to have multiple modules with separate packages for pages

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Fri, 2007-05-25 at 21:52 +0800, 蝈蝈龙 wrote:
> I'm also trying to separate the packae in TP5.
> But I think the package may look like
> 
> // business layer
> org.comp.app.business.mod1
> org.comp.app.business.mod2
> 
> // dao layer
> org.comp.app.dao.mod1
> org.comp.app.dao.mod2
okay, but first horizontal layers and then vertical slices is not
what we want to have.

> But I don't know if we can specify several root packages for each module the
> presentation package. Is it really neccessary?
that's not really my requirement, but I want to be able to structure
my application after my preferences and though have it supported by
tapestry...

hopefully this is possible :)

cheers,
martin


> 
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 
> 2007/5/25, Martin Grotzke <ma...@javakaffee.de>:
> >
> > Hi,
> >
> > I have a question concerning the configuration of tapestry5
> > with the context-param "tapestry.app-package" and the support
> > of multiple modules per application (several root-packages).
> >
> > We have an application that first has modules and then layers
> > for each module, like the following:
> >
> > org.comp.app.mod1.presentation
> > org.comp.app.mod1.business
> > org.comp.app.mod1.dao
> >
> > org.comp.app.mod2.presentation
> > org.comp.app.mod2.business
> > org.comp.app.mod2.dao
> >
> > the presentation packages shall contain subpackages
> > for services, pages and components, e.g.
> >
> > org.comp.app.mod1.presentation.pages
> > org.comp.app.mod1.presentation.components
> > org.comp.app.mod1.presentation.services
> >
> >
> > The quickstart archetype generated an AppModule class in
> > org.comp.app.mod1.presentation.services, but AFAICS
> > this is intended to configure the application, and therefore
> > should be located in a package like
> > org.comp.app.common.presentation.services.
> >
> > Then I would like to specify "org.comp.app" as the
> > "tapestry.app-package", or specify several root packages,
> > for each module the presentation package.
> >
> > I already tried the first approach, but it failed with 404 NOT_FOUND
> > if I requested a specific page at /app/mypage (e.g. with
> > MyPage.java in org.comp.app.mod1.presentation.pages).
> >
> > How is such an architecture supported by T5?
> >
> > Thanx in advance,
> > cheers,
> > Martin
> >
> >
> >
> >
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Re: T5 How to have multiple modules with separate packages for pages

Posted by 蝈蝈龙 <el...@gmail.com>.
I'm also trying to separate the packae in TP5.
But I think the package may look like

// business layer
org.comp.app.business.mod1
org.comp.app.business.mod2

// dao layer
org.comp.app.dao.mod1
org.comp.app.dao.mod2

// presentation layer
then the presentation packages shall contain subpackages
for services, pages and components look like:
    org.comp.app.presentation.pages
    org.comp.app.presentation.pages.mod1
    org.comp.app.presentation.pages.mod2

    org.comp.app.presentation.components
    org.comp.app.presentation.components.mod1
    org.comp.app.presentation.components.mod2
   ....

So that you can specify "org.comp.app.presentation" as the "
tapestry.app-package" in WEB.XML . Now it should work.
The net result is  that you don't use the 'presentation' to idetify
presentation layer. I think so.
But I don't know if we can specify several root packages for each module the
presentation package. Is it really neccessary?

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

2007/5/25, Martin Grotzke <ma...@javakaffee.de>:
>
> Hi,
>
> I have a question concerning the configuration of tapestry5
> with the context-param "tapestry.app-package" and the support
> of multiple modules per application (several root-packages).
>
> We have an application that first has modules and then layers
> for each module, like the following:
>
> org.comp.app.mod1.presentation
> org.comp.app.mod1.business
> org.comp.app.mod1.dao
>
> org.comp.app.mod2.presentation
> org.comp.app.mod2.business
> org.comp.app.mod2.dao
>
> the presentation packages shall contain subpackages
> for services, pages and components, e.g.
>
> org.comp.app.mod1.presentation.pages
> org.comp.app.mod1.presentation.components
> org.comp.app.mod1.presentation.services
>
>
> The quickstart archetype generated an AppModule class in
> org.comp.app.mod1.presentation.services, but AFAICS
> this is intended to configure the application, and therefore
> should be located in a package like
> org.comp.app.common.presentation.services.
>
> Then I would like to specify "org.comp.app" as the
> "tapestry.app-package", or specify several root packages,
> for each module the presentation package.
>
> I already tried the first approach, but it failed with 404 NOT_FOUND
> if I requested a specific page at /app/mypage (e.g. with
> MyPage.java in org.comp.app.mod1.presentation.pages).
>
> How is such an architecture supported by T5?
>
> Thanx in advance,
> cheers,
> Martin
>
>
>
>

Re: T5 How to have multiple modules with separate packages for pages

Posted by Martin Grotzke <ma...@javakaffee.de>.
Great, this does the trick!

Thanx a lot,
cheers,
Martin


On Sun, 2007-05-27 at 23:11 +0700, Ivan Dubrov wrote:
> You can contribute to ComponentClassResolver service mappings from
> prefix (e.g, "mod1") to package, like the following:
> 
> public static void
> contributeComponentClassResolver(Configuration<LibraryMapping>
> configuration) {
>     configuration.add(new LibraryMapping("mod1",
> "org.comp.app.mod1.presentation"));
>     configuration.add(new LibraryMapping("mod2",
> "org.comp.app.mod2.presentation"));
> }
> 
> All your pages will be available at paths like "mod1/pagename" and all
> components in mod1 available as "<t:mod1.componentname>" in templates.
> 
> Martin Grotzke wrote:
> > Hi,
> >
> > I have a question concerning the configuration of tapestry5
> > with the context-param "tapestry.app-package" and the support
> > of multiple modules per application (several root-packages).
> >
> > We have an application that first has modules and then layers
> > for each module, like the following:
> >
> > org.comp.app.mod1.presentation
> > org.comp.app.mod1.business
> > org.comp.app.mod1.dao
> >
> > org.comp.app.mod2.presentation
> > org.comp.app.mod2.business
> > org.comp.app.mod2.dao
> >
> > the presentation packages shall contain subpackages
> > for services, pages and components, e.g. 
> >
> > org.comp.app.mod1.presentation.pages
> > org.comp.app.mod1.presentation.components
> > org.comp.app.mod1.presentation.services
> >
> >
> > The quickstart archetype generated an AppModule class in
> > org.comp.app.mod1.presentation.services, but AFAICS
> > this is intended to configure the application, and therefore
> > should be located in a package like
> > org.comp.app.common.presentation.services.
> >
> > Then I would like to specify "org.comp.app" as the
> > "tapestry.app-package", or specify several root packages,
> > for each module the presentation package.
> >
> > I already tried the first approach, but it failed with 404 NOT_FOUND
> > if I requested a specific page at /app/mypage (e.g. with
> > MyPage.java in org.comp.app.mod1.presentation.pages).
> >
> > How is such an architecture supported by T5?
> >   
> > Thanx in advance,
> > cheers,
> > Martin
> >
> >
> >   
> 
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Re: T5 How to have multiple modules with separate packages for pages

Posted by Ivan Dubrov <wf...@gmail.com>.
You can contribute to ComponentClassResolver service mappings from
prefix (e.g, "mod1") to package, like the following:

public static void
contributeComponentClassResolver(Configuration<LibraryMapping>
configuration) {
    configuration.add(new LibraryMapping("mod1",
"org.comp.app.mod1.presentation"));
    configuration.add(new LibraryMapping("mod2",
"org.comp.app.mod2.presentation"));
}

All your pages will be available at paths like "mod1/pagename" and all
components in mod1 available as "<t:mod1.componentname>" in templates.

Martin Grotzke wrote:
> Hi,
>
> I have a question concerning the configuration of tapestry5
> with the context-param "tapestry.app-package" and the support
> of multiple modules per application (several root-packages).
>
> We have an application that first has modules and then layers
> for each module, like the following:
>
> org.comp.app.mod1.presentation
> org.comp.app.mod1.business
> org.comp.app.mod1.dao
>
> org.comp.app.mod2.presentation
> org.comp.app.mod2.business
> org.comp.app.mod2.dao
>
> the presentation packages shall contain subpackages
> for services, pages and components, e.g. 
>
> org.comp.app.mod1.presentation.pages
> org.comp.app.mod1.presentation.components
> org.comp.app.mod1.presentation.services
>
>
> The quickstart archetype generated an AppModule class in
> org.comp.app.mod1.presentation.services, but AFAICS
> this is intended to configure the application, and therefore
> should be located in a package like
> org.comp.app.common.presentation.services.
>
> Then I would like to specify "org.comp.app" as the
> "tapestry.app-package", or specify several root packages,
> for each module the presentation package.
>
> I already tried the first approach, but it failed with 404 NOT_FOUND
> if I requested a specific page at /app/mypage (e.g. with
> MyPage.java in org.comp.app.mod1.presentation.pages).
>
> How is such an architecture supported by T5?
>   
> Thanx in advance,
> cheers,
> Martin
>
>
>   


-- 
WBR,
Ivan S. Dubrov