- Project tools
-
-
- How do I...
-
| Category |
Featured projects |
| scm |
Subversion,
Subclipse,
TortoiseSVN,
RapidSVN
|
| issuetrack |
Scarab |
| requirements |
xmlbasedsrs |
| design |
ArgoUML |
| techcomm |
SubEtha,
eyebrowse,
midgard,
cowiki |
| construction |
antelope,
scons,
frameworx,
build-interceptor,
propel,
phing
|
| testing |
maxq,
aut
|
| deployment |
current |
| process |
ReadySET |
| libraries |
GEF,
Axion,
Style,
SSTree
|
| Over 500 more tools... |
|
On Friday, May 18, the normal maintenance window (17:00 Pacific time) will be extended for data center maintenance until 23:00 Pacific. No extended down-time is planned, but brief delays and interruptions are possible throughout the period.
If you were registered and logged in, you could join this project.
Mission
|
Bosco is a code generator tool: it generates the underlying
model (also called repository) for any modeling language
expressed in MOF. In other words, it reads XMI files and generates the
corresponding source code, in different object-oriented languages
(Java, Eiffel, Python, C++). In the case of Java, the generated code
implements the JMI
interfaces.
Bosco is written in Python and uses Cheetah, a template engine.
More precisely, the code generation is driven by template files, which
merges source code with Cheetah statements (#for, #if, etc.). Thanks to
this, the generation is highly configurable: one can add new features
to generated code without writting a single line of Python.
|
|
Small example
XMI Element
|
The element below commes from
the UML 1.5 specification. It describles the metaclass Class,
and its only attribute, isActive: |
|
|
<Model:Class annotation="" isAbstract="false" isLeaf="false" isRoot="false" isSingleton="false" name="Class" supertypes="a32989FB2023D" visibility="public_vis" xmi.id="a3298A02900FE"> <Model:Namespace.contents> <Model:Attribute annotation="" isChangeable="true" isDerived="false" name="isActive" scope="instance_level" type="a33DD6F650276" visibility="public_vis" xmi.id="a33F24B5A0190"> <Model:StructuralFeature.multiplicity> <Model:MultiplicityType is_ordered="false" is_unique="false" lower="1" upper="1"/> </Model:StructuralFeature.multiplicity> </Model:Attribute> </Model:Namespace.contents> </Model:Class>
|
|
Template
|
A Cheetah template files merges
text with simple statements (#set, #if #else, #for) and some Python
code. The following template is a simplified version of the one that
generates Java interfaces for MOF classes. |
|
|
package $(class.container.idl_prefix).$(class.container.name);
#set $hasparents = $len($class.supertypes) > 0 #set $parents_str = ', '.join(map(lambda x: x.container.idl_prefix+'.'+x.container.name+'.'+x.name,$class.supertypes))
#if $hasparents public interface $(class.name) extends $parents_str { #else public interface $(class.name) extends javax.jmi.reflect.RefObject { #end if // Attributes: #for attrs in $class.attributes() #set $aux = $attrs.name.capitalize() public $(attrs.type.name) get${aux}() throws javax.jmi.reflect.JmiException; }; // end of interface $(class.name)Class
|
|
Generated Java code
package org.omg.uml.Foundation.Core; public interface Class extends org.omg.uml.Foundation.Core.Classifier { // Attributes:
public void setActive(boolean aisActive) throws javax.jmi.reflect.JmiException;
public boolean isActive() throws javax.jmi.reflect.JmiException;
}; // end of interface Class
Documentation
Related projects
|