Hey,

Here are some details on the work I have been doing involving the code
generation extension point. I'm looking for comments/questions/concerns
about how this is currently implemented so I can make what ever changes are
necessary before this begins to be used by other developers.

Currently, the org.argouml.argoeclipse.core.codegen extension point is
defined in the argoeclipse-core project. Plug-ins that wish to contribute an
extension point will need to depend on the org.argouml.argoeclipse.core
plug-in as well as the org.argouml.app plug-in.

*Extension Point information:*

*Identifier: *
org.argouml.argoeclipse.core.codegen

*Description: *
Contributes a code generator to ArgoEclipse.

*Configuration Markup:*
<!ELEMENT extension (language+ , generator+)>
<!ATTLIST extension
point CDATA #REQUIRED
id    CDATA #IMPLIED
name  CDATA #IMPLIED>

point - a fully qualified identifier of the target extension point
id - an optional identifier of the extension instance
name - an optional name of the extension instance

<!ELEMENT language EMPTY>
<!ATTLIST language
id    CDATA #REQUIRED
name  CDATA #REQUIRED
image CDATA #IMPLIED>

id - a unique name that will be used to identify this language
name - a translatable name that will be used in the UI for this language
image - a relative name of the icon that will be associated with the
language

<!ELEMENT generator EMPTY>
<!ATTLIST generator
id       CDATA #REQUIRED
language CDATA #REQUIRED
name     CDATA #REQUIRED
class    CDATA #REQUIRED>

id - a unique name that will be used to identify this generator
language - a language ID, the referenced language must be declared in a
corresponding language element
name - a translatable name that will be used in the UI for this generator
class - a fully qualified name of the class that implements
org.argouml.uml.generator.CodeGenerator


*General Usage:*
To use this extension point you make your plug-in dependent on the *
org.argouml.argoeclipse.core* and *org.argouml.app* plug-ins then create an
extension to the *org.argouml.argoeclipse.core.codegen* extension point. You
may then define a *language *element. This registers a language type (id and
name to show in the UI for a given language). Then you create a
*generator*element providing a
*id, name, language, *and a *class* which implements *
org.argouml.uml.generator.CodeGenerator**. *With this done the generator
will show in the new Code Generator wizard under the appropriate language.
*
Backwards Compatibility:*
**The extension point mechanism places some new requirements on implementors
of *org.argouml.uml.generator.CodeGenerator  *namely the requirement that
they provide a public default (no-arg) constructor. This is because the
instantiation of the *CodeGenertor* implementors is delayed as long as
possible. A *CodeGenerator *is actually not instantiated until the code is
about to be generated. All UI presented to the user is simply provided by
meta-data in the plugin.xml file.

There is no requirement for code generators to register themselves with the
the *org.argouml.generator.GeneratorManager* singelton with
a*org.argouml.generator.Language
*object although the developer may still choose to do so to remain
compatible with ArgoUML.



I have modified the Java code generator to work with this new system. The
only change required was making the generators no arg constructor. I have
succesfully generated (very simple) Java code using this. More testing is
needed.


Brian

Reply via email to