Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.0-alpha-11
-
Fix Version/s: None
-
Component/s: modello-core, modello-plugin-java, modello-plugin-xpp3
-
Labels:None
-
Complexity:Intermediate
-
Patch Submitted:Yes
Description
Following discussion (well, qui short discussion, but well, modello isn't much about disucssions right now):
http://www.nabble.com/-Modello--Providing-a-modello's-meta-model-t2084698.html
I'm aiming at making modello self-generating (ie be able to generate Java class / xpp-reader for modello using a modello - model).
Bootstrap problems should/could be taken care of by committing the generated code te SVN, so as to be able to build modello from scratch at any time. What's more, that would provide interesting, up-to-date documentation about modello.
So to do this, there are several steps to take:
- create the meta-model file (using current version)
- clean-up existing modello code
- implements missing features
- rewrite modello meta-model to fully support current modello syntax
I have already taken step 1 (this can already provide some nice documentation, available on http://dcabasson.developpez.com/maven/metamodel.html ).
That leads me to the following things on my TODO list:
- For step 2
- Following attributes seems unused : deprecatedVersion, typeValidator
- For step 3
- allow for imports/import in code segments (some code segments needs external import, such as exceptions)
- refactor code to extract helper methods to other class? (as including codeSegments is, IMHO, much less understandable)
- add support for metadata on some tag. For example, add an allowMetadata field on class and field level. (maybe an optionnal metadataName too)
There is probably some other things to be done, but that's my first list there....
Attach is first patch, providing a crude metamodel.
Issue Links
- relates to
-
MODELLO-145
Create an XSD for Modello
-
I created a complete Modello model in
MODELLO-145to generate xdoc and an xsd: you can see the result in the Modello site.From this work, I can see now 2 main problems to solve if we want to generate Modello model with Modello:
Then I'm convinced that:
The benefit would be to have a good documentation in the models, that would be rendered simultaneously in xdoc, xsd and javadoc.
MODELLO-145to generate xdoc and an xsd: you can see the result in the Modello site. From this work, I can see now 2 main problems to solve if we want to generate Modello model with Modello:- association: in the java code, ModelAssociation extends ModelField, but in the XML, association is only 2 elements (there is a trick in ModelReader.parseFields(...) )
- XML attributes: Modello treats them as an extensible way to have plugins add their metadata
Then I'm convinced that:- we won't be able to generate a reader with Modello, because of these 2 problems.
- generating java model should be feasible, with some tricks to deal with these things:
- association: differentiate a class in the model for java generation from the class for xdoc/xsd generation
- XML attributes: I think that having each plugin define its own metadata model (containing XML attributes only), and a way to merge them with the core model is feasible (tricky though)
The benefit would be to have a good documentation in the models, that would be rendered simultaneously in xdoc, xsd and javadoc.