rgen 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +20 -1
- data/MIT-LICENSE +1 -1
- data/README +12 -9
- data/lib/instantiators/ea_instantiator.rb +36 -0
- data/lib/metamodels/uml13_metamodel.rb +559 -0
- data/lib/metamodels/uml13_metamodel_ext.rb +26 -0
- data/lib/mmgen/metamodel_generator.rb +5 -5
- data/lib/mmgen/mm_ext/ecore_ext.rb +95 -0
- data/lib/mmgen/mmgen.rb +6 -4
- data/lib/mmgen/templates/annotations.tpl +37 -0
- data/lib/mmgen/templates/metamodel_generator.tpl +171 -0
- data/lib/rgen/ecore/ecore.rb +190 -0
- data/lib/rgen/ecore/ecore_instantiator.rb +25 -0
- data/lib/rgen/ecore/ecore_transformer.rb +85 -0
- data/lib/rgen/environment.rb +9 -24
- data/lib/rgen/find_helper.rb +68 -0
- data/lib/rgen/{instantiator.rb → instantiator/abstract_instantiator.rb} +6 -2
- data/lib/rgen/instantiator/abstract_xml_instantiator.rb +59 -0
- data/lib/rgen/instantiator/default_xml_instantiator.rb +117 -0
- data/lib/rgen/instantiator/ecore_xml_instantiator.rb +144 -0
- data/lib/rgen/instantiator/nodebased_xml_instantiator.rb +157 -0
- data/lib/rgen/instantiator/xmi11_instantiator.rb +164 -0
- data/lib/rgen/metamodel_builder.rb +103 -9
- data/lib/rgen/metamodel_builder/build_helper.rb +26 -4
- data/lib/rgen/metamodel_builder/builder_extensions.rb +285 -88
- data/lib/rgen/metamodel_builder/builder_runtime.rb +7 -1
- data/lib/rgen/metamodel_builder/data_types.rb +67 -0
- data/lib/rgen/metamodel_builder/intermediate/annotation.rb +30 -0
- data/lib/rgen/metamodel_builder/metamodel_description.rb +232 -0
- data/lib/rgen/metamodel_builder/mm_multiple.rb +23 -0
- data/lib/rgen/metamodel_builder/module_extension.rb +33 -0
- data/lib/rgen/model_comparator.rb +56 -0
- data/lib/rgen/model_dumper.rb +5 -5
- data/lib/rgen/name_helper.rb +17 -1
- data/lib/rgen/template_language.rb +148 -28
- data/lib/rgen/template_language/directory_template_container.rb +56 -38
- data/lib/rgen/template_language/output_handler.rb +93 -77
- data/lib/rgen/template_language/template_container.rb +186 -143
- data/lib/rgen/transformer.rb +19 -14
- data/lib/transformers/uml13_to_ecore.rb +75 -0
- data/redist/xmlscan/ChangeLog +1301 -0
- data/redist/xmlscan/README +34 -0
- data/redist/xmlscan/THANKS +11 -0
- data/redist/xmlscan/doc/changes.html +74 -0
- data/redist/xmlscan/doc/changes.rd +80 -0
- data/redist/xmlscan/doc/en/conformance.html +136 -0
- data/redist/xmlscan/doc/en/conformance.rd +152 -0
- data/redist/xmlscan/doc/en/manual.html +356 -0
- data/redist/xmlscan/doc/en/manual.rd +402 -0
- data/redist/xmlscan/doc/ja/conformance.ja.html +118 -0
- data/redist/xmlscan/doc/ja/conformance.ja.rd +134 -0
- data/redist/xmlscan/doc/ja/manual.ja.html +325 -0
- data/redist/xmlscan/doc/ja/manual.ja.rd +370 -0
- data/redist/xmlscan/doc/src/Makefile +41 -0
- data/redist/xmlscan/doc/src/conformance.rd.src +256 -0
- data/redist/xmlscan/doc/src/langsplit.rb +110 -0
- data/redist/xmlscan/doc/src/manual.rd.src +614 -0
- data/redist/xmlscan/install.rb +41 -0
- data/redist/xmlscan/lib/xmlscan/encoding.rb +311 -0
- data/redist/xmlscan/lib/xmlscan/htmlscan.rb +289 -0
- data/redist/xmlscan/lib/xmlscan/namespace.rb +352 -0
- data/redist/xmlscan/lib/xmlscan/parser.rb +299 -0
- data/redist/xmlscan/lib/xmlscan/scanner.rb +1109 -0
- data/redist/xmlscan/lib/xmlscan/version.rb +22 -0
- data/redist/xmlscan/lib/xmlscan/visitor.rb +158 -0
- data/redist/xmlscan/lib/xmlscan/xmlchar.rb +441 -0
- data/redist/xmlscan/memo/CONFORMANCE +1249 -0
- data/redist/xmlscan/memo/PRODUCTIONS +195 -0
- data/redist/xmlscan/memo/contentspec.ry +335 -0
- data/redist/xmlscan/samples/chibixml.rb +105 -0
- data/redist/xmlscan/samples/getxmlchar.rb +122 -0
- data/redist/xmlscan/samples/rexml.rb +159 -0
- data/redist/xmlscan/samples/xmlbench.rb +88 -0
- data/redist/xmlscan/samples/xmlbench/parser/chibixml.rb +22 -0
- data/redist/xmlscan/samples/xmlbench/parser/nqxml.rb +29 -0
- data/redist/xmlscan/samples/xmlbench/parser/rexml.rb +62 -0
- data/redist/xmlscan/samples/xmlbench/parser/xmlparser.rb +22 -0
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-0.0.10.rb +62 -0
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-chibixml.rb +22 -0
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-rexml.rb +22 -0
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan.rb +99 -0
- data/redist/xmlscan/samples/xmlbench/xmlbench-lib.rb +116 -0
- data/redist/xmlscan/samples/xmlconftest.rb +200 -0
- data/redist/xmlscan/test.rb +7 -0
- data/redist/xmlscan/tests/deftestcase.rb +73 -0
- data/redist/xmlscan/tests/runtest.rb +47 -0
- data/redist/xmlscan/tests/testall.rb +14 -0
- data/redist/xmlscan/tests/testencoding.rb +438 -0
- data/redist/xmlscan/tests/testhtmlscan.rb +752 -0
- data/redist/xmlscan/tests/testnamespace.rb +457 -0
- data/redist/xmlscan/tests/testparser.rb +591 -0
- data/redist/xmlscan/tests/testscanner.rb +1749 -0
- data/redist/xmlscan/tests/testxmlchar.rb +143 -0
- data/redist/xmlscan/tests/visitor.rb +34 -0
- data/test/array_extensions_test.rb +2 -2
- data/test/ea_instantiator_test.rb +41 -0
- data/test/ecore_self_test.rb +53 -0
- data/test/environment_test.rb +11 -6
- data/test/metamodel_builder_test.rb +404 -245
- data/test/metamodel_roundtrip_test.rb +52 -0
- data/test/metamodel_roundtrip_test/TestModel.rb +65 -0
- data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +64 -0
- data/test/metamodel_roundtrip_test/houseMetamodel.ecore +32 -0
- data/test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb +39 -0
- data/test/rgen_test.rb +3 -3
- data/test/template_language_test.rb +65 -39
- data/test/template_language_test/expected_result.txt +24 -3
- data/test/template_language_test/templates/code/array.tpl +11 -0
- data/test/template_language_test/templates/content/author.tpl +7 -0
- data/test/template_language_test/templates/content/chapter.tpl +1 -1
- data/test/template_language_test/templates/root.tpl +17 -8
- data/test/template_language_test/testout.txt +24 -3
- data/test/testmodel/class_model_checker.rb +119 -0
- data/test/{xmi_instantiator_test/testmodel.eap → testmodel/ea_testmodel.eap} +0 -0
- data/test/{xmi_instantiator_test/testmodel.xml → testmodel/ea_testmodel.xml} +81 -14
- data/test/testmodel/ea_testmodel_partial.xml +317 -0
- data/test/testmodel/ecore_model_checker.rb +101 -0
- data/test/testmodel/manual_testmodel.xml +22 -0
- data/test/testmodel/object_model_checker.rb +67 -0
- data/test/transformer_test.rb +18 -10
- data/test/xml_instantiator_test.rb +81 -8
- data/test/xml_instantiator_test/simple_ecore_model_checker.rb +94 -0
- data/test/xml_instantiator_test/simple_xmi_ecore_instantiator.rb +53 -0
- data/test/xml_instantiator_test/simple_xmi_metamodel.rb +49 -0
- data/test/xml_instantiator_test/simple_xmi_to_ecore.rb +75 -0
- metadata +126 -28
- data/lib/ea/xmi_class_instantiator.rb +0 -46
- data/lib/ea/xmi_helper.rb +0 -26
- data/lib/ea/xmi_metamodel.rb +0 -34
- data/lib/ea/xmi_object_instantiator.rb +0 -46
- data/lib/ea/xmi_to_classmodel.rb +0 -78
- data/lib/ea/xmi_to_objectmodel.rb +0 -92
- data/lib/mmgen/mm_ext/uml_classmodel_ext.rb +0 -71
- data/lib/mmgen/templates/uml_classmodel.tpl +0 -63
- data/lib/rgen/xml_instantiator.rb +0 -132
- data/lib/uml/objectmodel_instantiator.rb +0 -53
- data/lib/uml/uml_classmodel.rb +0 -92
- data/lib/uml/uml_objectmodel.rb +0 -65
- data/test/metamodel_generator_test.rb +0 -44
- data/test/metamodel_generator_test/TestModel.rb +0 -40
- data/test/metamodel_generator_test/expected_result.txt +0 -40
- data/test/xmi_class_instantiator_test.rb +0 -24
- data/test/xmi_instantiator_test/class_model_checker.rb +0 -97
- data/test/xmi_object_instantiator_test.rb +0 -65
- data/test/xml_instantiator_test/testmodel.xml +0 -7
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rgen/instantiator/default_xml_instantiator'
|
2
|
+
require 'rgen/environment'
|
3
|
+
require 'rgen/ecore/ecore'
|
4
|
+
require 'xml_instantiator_test/simple_xmi_metamodel'
|
5
|
+
|
6
|
+
# SimpleXMIECoreInstantiator demonstrates the usage of the DefaultXMLInstantiator.
|
7
|
+
# It can be used to instantiate an ECore model from an XMI description
|
8
|
+
# produced by Enterprise Architect.
|
9
|
+
#
|
10
|
+
# Note however, that this is *not* the recommended way to read an EA model.
|
11
|
+
# See EAInstantiatorTest for the clean way to do this.
|
12
|
+
#
|
13
|
+
# This example shows how arbitrary XML content can be used to instantiate
|
14
|
+
# an implicit metamodel. The resulting model is transformed into a simple
|
15
|
+
# ECore model.
|
16
|
+
#
|
17
|
+
# See XMLInstantiatorTest for an example of how to use this class.
|
18
|
+
#
|
19
|
+
class SimpleXMIECoreInstantiator < RGen::Instantiator::DefaultXMLInstantiator
|
20
|
+
|
21
|
+
map_tag_ns "omg.org/UML1.3", SimpleXMIMetaModel::UML
|
22
|
+
|
23
|
+
resolve_by_id :typeClass, :src => :type, :id => :xmi_id
|
24
|
+
resolve_by_id :subtypeClass, :src => :subtype, :id => :xmi_id
|
25
|
+
resolve_by_id :supertypeClass, :src => :supertype, :id => :xmi_id
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
@envXMI = RGen::Environment.new
|
29
|
+
super(@envXMI, SimpleXMIMetaModel, true)
|
30
|
+
end
|
31
|
+
|
32
|
+
def new_object(node)
|
33
|
+
if node.tag == "EAStub"
|
34
|
+
class_name = saneClassName(node.attributes["UMLType"])
|
35
|
+
mod = XMIMetaModel::UML
|
36
|
+
build_on_error(NameError, :build_class, class_name, mod) do
|
37
|
+
mod.const_get(class_name).new
|
38
|
+
end
|
39
|
+
else
|
40
|
+
super
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# This method does the actual work.
|
45
|
+
def instantiateECoreModel(envOut, str)
|
46
|
+
instantiate(str)
|
47
|
+
|
48
|
+
require 'xml_instantiator_test/simple_xmi_to_ecore'
|
49
|
+
|
50
|
+
SimpleXmiToECore.new(@envXMI,envOut).transform
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# This is an extension of the implicit metamodel created by the
|
2
|
+
# DefaultXMLInstantiator when it reads an Enterprise Architect
|
3
|
+
# XMI file.
|
4
|
+
#
|
5
|
+
module SimpleXMIMetaModel
|
6
|
+
|
7
|
+
module UML
|
8
|
+
include RGen::MetamodelBuilder
|
9
|
+
|
10
|
+
class Classifier_feature < MMBase
|
11
|
+
end
|
12
|
+
|
13
|
+
class ClassifierRole < MMBase
|
14
|
+
end
|
15
|
+
|
16
|
+
class Clazz < ClassifierRole
|
17
|
+
end
|
18
|
+
|
19
|
+
class Interface < ClassifierRole
|
20
|
+
end
|
21
|
+
|
22
|
+
class Operation < MMBase
|
23
|
+
end
|
24
|
+
|
25
|
+
class Generalization < MMBase
|
26
|
+
end
|
27
|
+
|
28
|
+
class ModelElement_stereotype < MMBase
|
29
|
+
end
|
30
|
+
|
31
|
+
class AssociationEnd < MMBase
|
32
|
+
module ClassModule
|
33
|
+
def otherEnd
|
34
|
+
parent.associationEnd.find{|ae| ae != self}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class AssociationEndRole < MMBase
|
40
|
+
end
|
41
|
+
|
42
|
+
ClassifierRole.one_to_many 'associationEnds', AssociationEnd, 'typeClass'
|
43
|
+
ClassifierRole.one_to_many 'associationEndRoles', AssociationEndRole, 'typeClass'
|
44
|
+
Clazz.one_to_many 'generalizationsAsSubtype', Generalization, 'subtypeClass'
|
45
|
+
Clazz.one_to_many 'generalizationsAsSupertype', Generalization, 'supertypeClass'
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rgen/transformer'
|
2
|
+
require 'rgen/ecore/ecore'
|
3
|
+
require 'rgen/array_extensions'
|
4
|
+
require 'xml_instantiator_test/simple_xmi_metamodel'
|
5
|
+
|
6
|
+
class SimpleXmiToECore < RGen::Transformer
|
7
|
+
include RGen::ECore
|
8
|
+
|
9
|
+
class MapHelper
|
10
|
+
def initialize(keyMethod,valueMethod,elements)
|
11
|
+
@keyMethod, @valueMethod, @elements = keyMethod, valueMethod, elements
|
12
|
+
end
|
13
|
+
def [](key)
|
14
|
+
return @elements.select{|e| e.send(@keyMethod) == key}.first.send(@valueMethod) rescue NoMethodError
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class TaggedValueHelper < MapHelper
|
20
|
+
def initialize(element)
|
21
|
+
super('tag','value',element.modelElement_taggedValue.taggedValue)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Do the actual transformation.
|
26
|
+
# Input and output environment have to be provided to the transformer constructor.
|
27
|
+
def transform
|
28
|
+
trans(:class => SimpleXMIMetaModel::UML::Clazz)
|
29
|
+
end
|
30
|
+
|
31
|
+
transform SimpleXMIMetaModel::UML::Package, :to => EPackage do
|
32
|
+
{ :name => name,
|
33
|
+
:eSuperPackage => trans(parent.parent.is_a?(SimpleXMIMetaModel::UML::Package) ? parent.parent : nil) }
|
34
|
+
end
|
35
|
+
|
36
|
+
transform SimpleXMIMetaModel::UML::Clazz, :to => EClass do
|
37
|
+
{ :name => name,
|
38
|
+
:ePackage => trans(parent.parent.is_a?(SimpleXMIMetaModel::UML::Package) ? parent.parent : nil),
|
39
|
+
:eStructuralFeatures => trans(classifier_feature.attribute + associationEnds),
|
40
|
+
:eOperations => trans(classifier_feature.operation),
|
41
|
+
:eSuperTypes => trans(generalizationsAsSubtype.supertypeClass),
|
42
|
+
:eAnnotations => [ EAnnotation.new(:details => trans(modelElement_taggedValue.taggedValue)) ] }
|
43
|
+
end
|
44
|
+
|
45
|
+
transform SimpleXMIMetaModel::UML::TaggedValue, :to => EStringToStringMapEntry do
|
46
|
+
{ :key => tag, :value => value}
|
47
|
+
end
|
48
|
+
|
49
|
+
transform SimpleXMIMetaModel::UML::Attribute, :to => EAttribute do
|
50
|
+
typemap = { "String" => EString, "boolean" => EBoolean, "int" => EInt, "float" => EFloat }
|
51
|
+
tv = TaggedValueHelper.new(@current_object)
|
52
|
+
{ :name => name, :eType => typemap[tv['type']],
|
53
|
+
:eAnnotations => [ EAnnotation.new(:details => trans(modelElement_taggedValue.taggedValue)) ] }
|
54
|
+
end
|
55
|
+
|
56
|
+
transform SimpleXMIMetaModel::UML::Operation, :to => EOperation do
|
57
|
+
{ :name => name }
|
58
|
+
end
|
59
|
+
|
60
|
+
transform SimpleXMIMetaModel::UML::AssociationEnd, :to => EReference, :if => :isReference do
|
61
|
+
{ :eType => trans(otherEnd.typeClass),
|
62
|
+
:name => otherEnd.name,
|
63
|
+
:eOpposite => trans(otherEnd),
|
64
|
+
:lowerBound => (otherEnd.multiplicity || '0').split('..').first.to_i,
|
65
|
+
:upperBound => (otherEnd.multiplicity || '1').split('..').last.gsub('*','-1').to_i,
|
66
|
+
:containment => (aggregation == 'composite'),
|
67
|
+
:eAnnotations => [ EAnnotation.new(:details => trans(modelElement_taggedValue.taggedValue)) ] }
|
68
|
+
end
|
69
|
+
|
70
|
+
method :isReference do
|
71
|
+
otherEnd.isNavigable == 'true' ||
|
72
|
+
# composite assocations are bidirectional
|
73
|
+
aggregation == 'composite' || otherEnd.aggregation == 'composite'
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rgen
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date:
|
6
|
+
version: 0.4.0
|
7
|
+
date: 2007-08-08 00:00:00 +02:00
|
8
8
|
summary: Ruby Modelling and Generator Framework
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -29,75 +29,167 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Martin Thiede
|
31
31
|
files:
|
32
|
-
- lib/
|
32
|
+
- lib/instantiators
|
33
|
+
- lib/metamodels
|
33
34
|
- lib/mmgen
|
34
35
|
- lib/rgen
|
35
|
-
- lib/
|
36
|
-
- lib/
|
37
|
-
- lib/
|
38
|
-
- lib/
|
39
|
-
- lib/ea/xmi_object_instantiator.rb
|
40
|
-
- lib/ea/xmi_to_classmodel.rb
|
41
|
-
- lib/ea/xmi_to_objectmodel.rb
|
36
|
+
- lib/transformers
|
37
|
+
- lib/instantiators/ea_instantiator.rb
|
38
|
+
- lib/metamodels/uml13_metamodel.rb
|
39
|
+
- lib/metamodels/uml13_metamodel_ext.rb
|
42
40
|
- lib/mmgen/metamodel_generator.rb
|
43
41
|
- lib/mmgen/mmgen.rb
|
44
42
|
- lib/mmgen/mm_ext
|
45
43
|
- lib/mmgen/templates
|
46
|
-
- lib/mmgen/mm_ext/
|
47
|
-
- lib/mmgen/templates/
|
44
|
+
- lib/mmgen/mm_ext/ecore_ext.rb
|
45
|
+
- lib/mmgen/templates/annotations.tpl
|
46
|
+
- lib/mmgen/templates/metamodel_generator.tpl
|
48
47
|
- lib/rgen/array_extensions.rb
|
49
48
|
- lib/rgen/auto_class_creator.rb
|
49
|
+
- lib/rgen/ecore
|
50
50
|
- lib/rgen/environment.rb
|
51
|
-
- lib/rgen/
|
51
|
+
- lib/rgen/find_helper.rb
|
52
|
+
- lib/rgen/instantiator
|
52
53
|
- lib/rgen/metamodel_builder
|
53
54
|
- lib/rgen/metamodel_builder.rb
|
55
|
+
- lib/rgen/model_comparator.rb
|
54
56
|
- lib/rgen/model_dumper.rb
|
55
57
|
- lib/rgen/name_helper.rb
|
56
58
|
- lib/rgen/template_language
|
57
59
|
- lib/rgen/template_language.rb
|
58
60
|
- lib/rgen/transformer.rb
|
59
|
-
- lib/rgen/
|
61
|
+
- lib/rgen/ecore/ecore.rb
|
62
|
+
- lib/rgen/ecore/ecore_instantiator.rb
|
63
|
+
- lib/rgen/ecore/ecore_transformer.rb
|
64
|
+
- lib/rgen/instantiator/abstract_instantiator.rb
|
65
|
+
- lib/rgen/instantiator/abstract_xml_instantiator.rb
|
66
|
+
- lib/rgen/instantiator/default_xml_instantiator.rb
|
67
|
+
- lib/rgen/instantiator/ecore_xml_instantiator.rb
|
68
|
+
- lib/rgen/instantiator/nodebased_xml_instantiator.rb
|
69
|
+
- lib/rgen/instantiator/xmi11_instantiator.rb
|
60
70
|
- lib/rgen/metamodel_builder/builder_extensions.rb
|
61
71
|
- lib/rgen/metamodel_builder/builder_runtime.rb
|
62
72
|
- lib/rgen/metamodel_builder/build_helper.rb
|
73
|
+
- lib/rgen/metamodel_builder/data_types.rb
|
74
|
+
- lib/rgen/metamodel_builder/intermediate
|
75
|
+
- lib/rgen/metamodel_builder/metamodel_description.rb
|
76
|
+
- lib/rgen/metamodel_builder/mm_multiple.rb
|
77
|
+
- lib/rgen/metamodel_builder/module_extension.rb
|
78
|
+
- lib/rgen/metamodel_builder/intermediate/annotation.rb
|
63
79
|
- lib/rgen/template_language/directory_template_container.rb
|
64
80
|
- lib/rgen/template_language/output_handler.rb
|
65
81
|
- lib/rgen/template_language/template_container.rb
|
66
82
|
- lib/rgen/template_language/template_helper.rb
|
67
|
-
- lib/
|
68
|
-
- lib/uml/uml_classmodel.rb
|
69
|
-
- lib/uml/uml_objectmodel.rb
|
83
|
+
- lib/transformers/uml13_to_ecore.rb
|
70
84
|
- test/array_extensions_test.rb
|
85
|
+
- test/ea_instantiator_test.rb
|
86
|
+
- test/ecore_self_test.rb
|
71
87
|
- test/environment_test.rb
|
72
88
|
- test/metamodel_builder_test.rb
|
73
|
-
- test/
|
74
|
-
- test/
|
89
|
+
- test/metamodel_roundtrip_test
|
90
|
+
- test/metamodel_roundtrip_test.rb
|
75
91
|
- test/output_handler_test.rb
|
76
92
|
- test/rgen_test.rb
|
77
93
|
- test/template_language_test
|
78
94
|
- test/template_language_test.rb
|
95
|
+
- test/testmodel
|
79
96
|
- test/transformer_test.rb
|
80
|
-
- test/xmi_class_instantiator_test.rb
|
81
|
-
- test/xmi_instantiator_test
|
82
|
-
- test/xmi_object_instantiator_test.rb
|
83
97
|
- test/xml_instantiator_test
|
84
98
|
- test/xml_instantiator_test.rb
|
85
|
-
- test/
|
86
|
-
- test/
|
99
|
+
- test/metamodel_roundtrip_test/houseMetamodel.ecore
|
100
|
+
- test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
|
101
|
+
- test/metamodel_roundtrip_test/TestModel.rb
|
102
|
+
- test/metamodel_roundtrip_test/TestModel_Regenerated.rb
|
87
103
|
- test/template_language_test/expected_result.txt
|
88
104
|
- test/template_language_test/templates
|
89
105
|
- test/template_language_test/testout.txt
|
106
|
+
- test/template_language_test/templates/code
|
90
107
|
- test/template_language_test/templates/content
|
91
108
|
- test/template_language_test/templates/index
|
92
109
|
- test/template_language_test/templates/root.tpl
|
110
|
+
- test/template_language_test/templates/code/array.tpl
|
111
|
+
- test/template_language_test/templates/content/author.tpl
|
93
112
|
- test/template_language_test/templates/content/chapter.tpl
|
94
113
|
- test/template_language_test/templates/index/c
|
95
114
|
- test/template_language_test/templates/index/chapter.tpl
|
96
115
|
- test/template_language_test/templates/index/c/cmod.tpl
|
97
|
-
- test/
|
98
|
-
- test/
|
99
|
-
- test/
|
100
|
-
- test/
|
116
|
+
- test/testmodel/class_model_checker.rb
|
117
|
+
- test/testmodel/ea_testmodel.eap
|
118
|
+
- test/testmodel/ea_testmodel.xml
|
119
|
+
- test/testmodel/ea_testmodel_partial.xml
|
120
|
+
- test/testmodel/ecore_model_checker.rb
|
121
|
+
- test/testmodel/manual_testmodel.xml
|
122
|
+
- test/testmodel/object_model_checker.rb
|
123
|
+
- test/xml_instantiator_test/simple_ecore_model_checker.rb
|
124
|
+
- test/xml_instantiator_test/simple_xmi_ecore_instantiator.rb
|
125
|
+
- test/xml_instantiator_test/simple_xmi_metamodel.rb
|
126
|
+
- test/xml_instantiator_test/simple_xmi_to_ecore.rb
|
127
|
+
- redist/xmlscan
|
128
|
+
- redist/xmlscan/ChangeLog
|
129
|
+
- redist/xmlscan/doc
|
130
|
+
- redist/xmlscan/install.rb
|
131
|
+
- redist/xmlscan/lib
|
132
|
+
- redist/xmlscan/memo
|
133
|
+
- redist/xmlscan/README
|
134
|
+
- redist/xmlscan/samples
|
135
|
+
- redist/xmlscan/test.rb
|
136
|
+
- redist/xmlscan/tests
|
137
|
+
- redist/xmlscan/THANKS
|
138
|
+
- redist/xmlscan/doc/changes.html
|
139
|
+
- redist/xmlscan/doc/changes.rd
|
140
|
+
- redist/xmlscan/doc/en
|
141
|
+
- redist/xmlscan/doc/ja
|
142
|
+
- redist/xmlscan/doc/src
|
143
|
+
- redist/xmlscan/doc/en/conformance.html
|
144
|
+
- redist/xmlscan/doc/en/conformance.rd
|
145
|
+
- redist/xmlscan/doc/en/manual.html
|
146
|
+
- redist/xmlscan/doc/en/manual.rd
|
147
|
+
- redist/xmlscan/doc/ja/conformance.ja.html
|
148
|
+
- redist/xmlscan/doc/ja/conformance.ja.rd
|
149
|
+
- redist/xmlscan/doc/ja/manual.ja.html
|
150
|
+
- redist/xmlscan/doc/ja/manual.ja.rd
|
151
|
+
- redist/xmlscan/doc/src/conformance.rd.src
|
152
|
+
- redist/xmlscan/doc/src/langsplit.rb
|
153
|
+
- redist/xmlscan/doc/src/Makefile
|
154
|
+
- redist/xmlscan/doc/src/manual.rd.src
|
155
|
+
- redist/xmlscan/lib/xmlscan
|
156
|
+
- redist/xmlscan/lib/xmlscan/encoding.rb
|
157
|
+
- redist/xmlscan/lib/xmlscan/htmlscan.rb
|
158
|
+
- redist/xmlscan/lib/xmlscan/namespace.rb
|
159
|
+
- redist/xmlscan/lib/xmlscan/parser.rb
|
160
|
+
- redist/xmlscan/lib/xmlscan/scanner.rb
|
161
|
+
- redist/xmlscan/lib/xmlscan/version.rb
|
162
|
+
- redist/xmlscan/lib/xmlscan/visitor.rb
|
163
|
+
- redist/xmlscan/lib/xmlscan/xmlchar.rb
|
164
|
+
- redist/xmlscan/memo/CONFORMANCE
|
165
|
+
- redist/xmlscan/memo/contentspec.ry
|
166
|
+
- redist/xmlscan/memo/PRODUCTIONS
|
167
|
+
- redist/xmlscan/samples/chibixml.rb
|
168
|
+
- redist/xmlscan/samples/getxmlchar.rb
|
169
|
+
- redist/xmlscan/samples/rexml.rb
|
170
|
+
- redist/xmlscan/samples/xmlbench
|
171
|
+
- redist/xmlscan/samples/xmlbench.rb
|
172
|
+
- redist/xmlscan/samples/xmlconftest.rb
|
173
|
+
- redist/xmlscan/samples/xmlbench/parser
|
174
|
+
- redist/xmlscan/samples/xmlbench/xmlbench-lib.rb
|
175
|
+
- redist/xmlscan/samples/xmlbench/parser/chibixml.rb
|
176
|
+
- redist/xmlscan/samples/xmlbench/parser/nqxml.rb
|
177
|
+
- redist/xmlscan/samples/xmlbench/parser/rexml.rb
|
178
|
+
- redist/xmlscan/samples/xmlbench/parser/xmlparser.rb
|
179
|
+
- redist/xmlscan/samples/xmlbench/parser/xmlscan-0.0.10.rb
|
180
|
+
- redist/xmlscan/samples/xmlbench/parser/xmlscan-chibixml.rb
|
181
|
+
- redist/xmlscan/samples/xmlbench/parser/xmlscan-rexml.rb
|
182
|
+
- redist/xmlscan/samples/xmlbench/parser/xmlscan.rb
|
183
|
+
- redist/xmlscan/tests/deftestcase.rb
|
184
|
+
- redist/xmlscan/tests/runtest.rb
|
185
|
+
- redist/xmlscan/tests/testall.rb
|
186
|
+
- redist/xmlscan/tests/testencoding.rb
|
187
|
+
- redist/xmlscan/tests/testhtmlscan.rb
|
188
|
+
- redist/xmlscan/tests/testnamespace.rb
|
189
|
+
- redist/xmlscan/tests/testparser.rb
|
190
|
+
- redist/xmlscan/tests/testscanner.rb
|
191
|
+
- redist/xmlscan/tests/testxmlchar.rb
|
192
|
+
- redist/xmlscan/tests/visitor.rb
|
101
193
|
- README
|
102
194
|
- CHANGELOG
|
103
195
|
- MIT-LICENSE
|
@@ -106,6 +198,12 @@ test_files: []
|
|
106
198
|
rdoc_options:
|
107
199
|
- --main
|
108
200
|
- README
|
201
|
+
- -x
|
202
|
+
- redist
|
203
|
+
- -x
|
204
|
+
- test
|
205
|
+
- -x
|
206
|
+
- metamodels
|
109
207
|
extra_rdoc_files:
|
110
208
|
- README
|
111
209
|
- CHANGELOG
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'rgen/xml_instantiator'
|
2
|
-
require 'rgen/environment'
|
3
|
-
require 'uml/uml_classmodel'
|
4
|
-
require 'ea/xmi_metamodel'
|
5
|
-
|
6
|
-
# This module can be used to instantiate an UMLClassModel from an XMI description.
|
7
|
-
#
|
8
|
-
# Here is an example:
|
9
|
-
#
|
10
|
-
# envUML = RGen::Environment.new
|
11
|
-
# File.open(MODEL_DIR+"/testmodel.xml") { |f|
|
12
|
-
# XMIClassInstantiator.new.instantiateUMLClassModel(envUML, f.read)
|
13
|
-
# }
|
14
|
-
#
|
15
|
-
# # now use the newly created UML model
|
16
|
-
# envUML.find(:class => UMLClassModel::UMLClass).each { |c|
|
17
|
-
# puts c.name
|
18
|
-
# }
|
19
|
-
#
|
20
|
-
# This module relies on XmiToClassmodel to do the actual transformation.
|
21
|
-
#
|
22
|
-
class XMIClassInstantiator < RGen::XMLInstantiator
|
23
|
-
|
24
|
-
include UMLClassModel
|
25
|
-
|
26
|
-
map_tag_ns "omg.org/UML1.3", XMIMetaModel::UML
|
27
|
-
|
28
|
-
resolve_by_id :typeClass, :src => :type, :id => :xmi_id
|
29
|
-
resolve_by_id :subtypeClass, :src => :subtype, :id => :xmi_id
|
30
|
-
resolve_by_id :supertypeClass, :src => :supertype, :id => :xmi_id
|
31
|
-
|
32
|
-
def initialize
|
33
|
-
@envXMI = RGen::Environment.new
|
34
|
-
super(@envXMI, XMIMetaModel, true)
|
35
|
-
end
|
36
|
-
|
37
|
-
# This method does the actual work.
|
38
|
-
def instantiateUMLClassModel(envOut, str)
|
39
|
-
instantiate(str)
|
40
|
-
|
41
|
-
require 'ea/xmi_to_classmodel'
|
42
|
-
|
43
|
-
XmiToClassmodel.new(@envXMI,envOut).transform
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
data/lib/ea/xmi_helper.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'rgen/metamodel_builder'
|
2
|
-
|
3
|
-
module RGen
|
4
|
-
|
5
|
-
module XMIHelper
|
6
|
-
|
7
|
-
class MapHelper
|
8
|
-
def initialize(keyMethod,valueMethod,elements)
|
9
|
-
@keyMethod, @valueMethod, @elements = keyMethod, valueMethod, elements
|
10
|
-
end
|
11
|
-
def [](key)
|
12
|
-
return @elements.select{|e| e.send(@keyMethod) == key}.first.send(@valueMethod) rescue NoMethodError
|
13
|
-
nil
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class TaggedValueHelper < MapHelper
|
18
|
-
def initialize(element)
|
19
|
-
super('tag','value',element.modelElement_taggedValue.taggedValue)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|