Previously I demonstrated how to create an Ecore metamodel describing Java .properties files, with the ultimate goal of using openArchitectureWare to build strongly-typed accessor classes for my properties. Before I start writing oAW templates, though, I want to have a sample model that I can work with which is relatively simple but still exercises most of the breadth of my metamodel.
The oAW sample project contains a model already called "Model.xmi". The "xmi" is "XML Metadata Interchange", an OMG specification concerned with interoperable models, and the default format for models in Ecore/EMF. I will delete the existing Model.xmi file and create a new model called "SamplePropertySet.xmi". One way to do this is to open the Properties.ecore metamodel, right-click on the class that I want at the "root" of my model (namely, PropertySet), and select "Create Dynamic Instance". Choosing a location in my workspace, away I go.
The .xmi file can be edited with the "Sample Reflective Ecore Model Editor", which is essentially the same as the tree-node-properties editor I used on the .ecore file, except now the entities that I edit on my model are instances of the classes and attributes defined in my metamodel. In other words, the "root" of my model is a PropertySet, and to that I can add children which are Property instances. When I select one of these and open the Eclipse Properties grid, the properties are the class attributes defined in the metamodel. If you have been following along and are still a little fuzzy on the relationship between metamodel and model, the following illustration might be helpful:
I'm going to test my openArchitectureWare code generation templates with a couple of properties -- one of type "Integer" and another of type "String". My "completed" model looks like this:
There are a number of other things that I could do with EMF at this point, such as generating a Java object model and "starter" Eclipse plugins for working with my models. But I don't need to do any of that for this project: Starting next time, everything going forward will be in the Land of openArchitectureWare.