On Wed, Apr 2, 2008 at 2:49 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:
> > I'm not quite clear what your description above means. I think we are > talking about the same thing, but just to be clear this is how I would > see it working: > > == for goal build-metadata: > > start with an empty model > for each jarfile containing a META-INF/myfaces-metadata.xml file > read that myfaces-metadata.xml file > add the resulting objects into the model[1] > run the ModelBuilder for the current project, which adds more objects to > the model > save the model into META-INF/myfaces-metadata.xml in the current project > > An alternative would be to do the merging just at the xml level, then > build a model from the resulting merged xml file. That also seems > reasonable. > > == for other goals (eg generate faces.xml, generate tag classes): > start with an empty model > read META-INF/myfaces-metadata.xml for the current project only > add the resulting objects to the model > pass the model object to the appropriate generator class[3] > > [1] Hmm..might need to somehow detect and handle duplicate data. > Yes, duplicated data is the problem. > > In particular, tomahawk will depend on both myfaces-api and > myfaces-impl. But the META-INF/myfaces-metadata.xml file will have a > copy of all the data from the myfaces-metadata.xml contained in > myfaces-api jarfile. So if *all* jars in the classpath are processed, > the data from myfaces-api.jar will be processed twice. > Tomahawk sandbox depends on tomahawk core and myfaces api. Tomahawk core depends of myfaces api only (because it should be compatible with jsf ri, no impl dependences should be present). So the problem ilustrated here raises on sandbox. > > Options I see are > (a) don't worry; the data will just be identical Right. > > (b) check that if a model object is being overwritten, the new data is > identical > (c) have the plugin configured with an explicit list of jars to process > metadata from. Then in the pom it must be configured so that > myfaces-impl is processed and myfaces-api is ignored. Then make it an > error for the same model object to be defined twice. > (d) have a myfaces-metadata.xml file *not* include data inherited from > parent projects. That's cleaner in a way, but means that when processing > other goals we cannot just load the metadata file from the local project > but need to merge in all the ancestor projects too. Ecch. > (e) in the myfaces-metadata.xml, somehow mark entries with the jarfile > they came from. > Really, the option that likes me more is (e). One option to do this is create a modelId parameter (for components and other stuff inside Model), assigned on the pom as a param. This param can be used in several situations: (a) In tomahawk core, we need to generate a hierarchy of tag classes for myfaces api components. >From this classes, tomahawk tag classes inherit. Note we need to change package for myfaces api component tag classes group (only html components). One option is give the possibility to apply a XSTL filter to myfaces-metadata.xml that do this. (b) Specify that some goal should be applied to a specific group of components, identified with a modelId. I will test this ideas and see what happen. regards Leonardo Uribe
