You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by br...@tariffenet.it on 2005/10/07 11:00:20 UTC

[Tiles] Resolving inheritances improvements

Hi list!
As I promised here is my suggestion...
In Dimensions I had to use a workaround for a missing feature. In order to
resolve inheritances and overriding definitions between multiple
definition files, i need to follow these steps:
1) Find the "leaf" definition file;
2) build the path from this leaf to the root;
3) current file = root file, complete definitions = empty;
4) load current file into definitions;
5) override current file definitions into the complete definitions (via
the "extend" method
6) current file = next file in the path;
7) return to point 4 until end.
8) Resolve inheritances.

As you can see I need to follow the path twice (from the leaf to the root
and then from the root to the leaf). If you could put a method that add
all the missing definitions (i.e. add all definitions that are not already
present in a definitions set). This way I can follow the path only once
(from leaf to root), eventually reusing already loaded definitions files.

1) Find the "leaf" definition file;
2) If it is already loaded, finish.
3) Create an empty definitions set;
4) put all missing definitions loaded into the definitions set;
5) find the parent definition file;
6) if it is already loaded, put all missing definitions (by cloning them)
in the definitions set and go to 9;
7) if it is the root file, go to 9;
8) go to step 5;
9) resolve inheritances.

As you can see, there will be a big caching of already loaded definitions
files, only by adding two methods (addMissingDefinitions in
XmlDefinitionsSet and "clone" in XmlDefinition).
What do you think about it?
Ciao
Antonio Petrelli


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


Re: [Tiles] Resolving inheritances improvements

Posted by Greg Reddin <li...@reddin.org>.
On Oct 7, 2005, at 4:00 AM, <br...@tariffenet.it>  
<br...@tariffenet.it> wrote:

> 1) Find the "leaf" definition file;
> 2) If it is already loaded, finish.
> 3) Create an empty definitions set;
> 4) put all missing definitions loaded into the definitions set;
> 5) find the parent definition file;
> 6) if it is already loaded, put all missing definitions (by cloning  
> them)
> in the definitions set and go to 9;
> 7) if it is the root file, go to 9;
> 8) go to step 5;
> 9) resolve inheritances.
>
> As you can see, there will be a big caching of already loaded  
> definitions
> files, only by adding two methods (addMissingDefinitions in
> XmlDefinitionsSet and "clone" in XmlDefinition).
> What do you think about it?

If I understand you correctly Standalone Tiles may be doing that now  
by default.  I'll have to take another look at it (maybe add another  
test case).

Greg


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