dukeboard / kevoree-modeling-framework Goto Github PK
View Code? Open in Web Editor NEWKevoree Modeling Framework
Home Page: http://kevoree.org/kmf
License: GNU Lesser General Public License v3.0
Kevoree Modeling Framework
Home Page: http://kevoree.org/kmf
License: GNU Lesser General Public License v3.0
traces and model: https://gist.github.com/edaubert/9464318
Stack:
05:15 ERROR: error while apply trace sequence
java.lang.ClassCastException: org.kevoree.impl.ContainerRootImpl cannot be cast to org.kevoree.ContainerNode
at org.kevoree.impl.GroupImpl.reflexiveMutator(GroupImpl.kt:435)
at org.kevoree.modeling.api.trace.ModelTraceApplicator.createOrAdd(ModelTraceApplicator.kt:38)
at org.kevoree.modeling.api.trace.ModelTraceApplicator.applyTraceOnModel(ModelTraceApplicator.kt:56)
at org.kevoree.modeling.api.trace.TraceSequence$$TImpl.applyOn(TraceSequence.kt:108)
at org.kevoree.trace.DefaultTraceSequence.applyOn(DefaultTraceSequence.kt)
at org.kevoree.core.impl.KevoreeCoreBean$UpdateSequenceRunnable.run(KevoreeCoreBean.kt:158)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
It would be good if all serializer (XMI, JSON) could implement the very same interface to make it easy for clients to switch serializer. The same goes for deserializer.
The users of my generated JSON syntax for my language are not quite satisfied with the way references are managed... Instead of writing:
"required": [{"ref" : "artefactTypes[derby]/provided[derbyProvided]"} ,
{"ref" : "artefactTypes[jboss]/provided[wcProvided]"}
]
they would like to write:
"required": ["artefactTypes[derby]/provided[derbyProvided]", "artefactTypes[jboss]/provided[wcProvided]"]
In a perfect world, they would even like to write
"required": ["derby/derbyProvided", "jboss/wcProvided"]
but this might get more tricky/inefficient to parse...
-> reverse on list seems not to work in JS
01:25 DEBUG: Rolling back transition of smartgrid.core.SmartMeter, event smartgrid.core.Startup, caller smartgrid.core.SmartMeter lu.snt.smartgrid.model.js.min.js:285
Uncaught TypeError: Object [object Object] has no method 'reverse' lu.snt.smartgrid.model.js.min.js:247
Kotlin.defineRootPackage.kotlin.Kotlin.definePackage.reverse_7 lu.snt.smartgrid.model.js.min.js:247
d.TraceSequence.Kotlin.createTrait.reverse lu.snt.smartgrid.model.js.min.js:63
Kotlin.defineRootPackage.org.Kotlin.definePackage.kevoree.Kotlin.definePackage.modeling.Kotlin.definePackage.api.Kotlin.definePackage.util.Kotlin.definePackage.ModelTracker.Kotlin.createClass.undo lu.snt.smartgrid.model.js.min.js:325
d.FsmAspect.Kotlin.createTrait.trigger lu.snt.smartgrid.model.js.min.js:127
execute (index):297
Opposite relations are not well generated in the following cases:
1 1
<>---------
1 1
------------
* 1
------------
I try tu use hazelCast group in Kevoree and I get this exception coming from kmf:
jet.runtime.Intrinsics$JetNullPointerException
at org.kevoree.modeling.api.trace.TraceSequence$$TImpl.populateFromStream(TraceSequence.kt:58)
at org.kevoree.trace.DefaultTraceSequence.populateFromStream(DefaultTraceSequence.kt)
at org.kevoree.modeling.api.trace.TraceSequence$$TImpl.populateFromString(TraceSequence.kt:32)
at org.kevoree.trace.DefaultTraceSequence.populateFromString(DefaultTraceSequence.kt)
at org.kevoree.library.java.hazelcast.BroadcastGroup.onMessage(BroadcastGroup.java:60)
at com.hazelcast.topic.TopicService.dispatchEvent(TopicService.java:93)
at com.hazelcast.spi.impl.EventServiceImpl$EventPacketProcessor.process(EventServiceImpl.java:473)
at com.hazelcast.spi.impl.EventServiceImpl$RemoteEventPacketProcessor.run(EventServiceImpl.java:499)
at com.hazelcast.util.executor.StripedExecutor$Worker.run(StripedExecutor.java:142)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at com.hazelcast.util.executor.PoolExecutorThreadFactory$ManagedThread.run(PoolExecutorThreadFactory.java:59)
In my example, the ModelJSONSerializer is generated in package:
net.cloudml.serializer
However, the package declared at the very first line of ModelJSONSerializer .kt is:
net.cloudml.core.serializer
import org.kevoree.impl.DefaultKevoreeFactory
import org.kevoree.*;
import org.kevoree.modeling.api.ModelSerializer;
import org.kevoree.serializer.JSONModelSerializer;
import org.kevoree.modeling.api.events.ModelElementListener;
import org.kevoree.modeling.api.events.ModelEvent;
import java.io.PrintWriter
fun main(args: Array<String>) {
var factory : KevoreeFactory = DefaultKevoreeFactory();
var model : ContainerRoot = factory.createContainerRoot();
var node : ContainerNode = factory.createContainerNode();
node.name = "node0";
model.addNodes(node);
var grp : Group = factory.createGroup();
grp.name = "grp";
model.addGroups(grp);
grp.addSubNodes(node);
var comp : ComponentInstance = factory.createComponentInstance();
comp.name = "comp";
node.addComponents(comp);
var chan : Channel = factory.createChannel();
chan.name = "chan";
model.addHubs(chan);
var port : Port = factory.createPort();
port.name = "output";
comp.addRequired(port);
var binding : MBinding = factory.createMBinding();
binding.hub = chan;
binding.port = port;
model.addMBindings(binding);
node.addModelElementListener(object: ModelElementListener {
override fun elementChanged(e: ModelEvent) {
println(e.toString());
}
});
node.delete();
// chan.delete();
var save : ModelSerializer = JSONModelSerializer();
var modelStr : String = save.serialize(model)!!;
var writer : PrintWriter = PrintWriter("model.json", "UTF-8");
writer.write(modelStr);
writer.close();
}
Saved model will still contain bindings to removed component
Sample project
I cannot find documentation on how to use KMF in a Maven project. In particular, examples of pom.xml would be nice.
The goal is to refactor the plugin and code, to allow for simple expendability of loader and serializer.
One should be able to ask for generation of different loaders / serializers from the same Model, and in the same compilation process.
Is there a particular (I mean, useful) semantic on the .equals
in KMF? Or is it stupidly mapped to java.lang.Object.equals
(i.e. not overidden), which itself is basically mapped to Java's ==
, which is not so useful in practice, e.g. if I am comparing two models (having of course all their elements !=
...)
I created a EClass position and I added the attribute "long" in my ecore file.
During the KMF generation, it create a method setLong which produces the error below during the compilation :
Too many arguments for public abstract fun setLong (): jet.Unit of
Workaround : rename long --> longitude
Ecore file :
If I create a metamodel with only abstract classes to modularize some concepts between several metamodels. Kotline generator does not generate the ModelSerializor class.
It seems the generated Kotlin code to serialize models in JSON does not compile. Too many argument are passed to the _ToJson of the root element. The parameter _refNameInParent* should be removed when calling it.
It looks like attributes of root elements are not loaded
Implementation of a Gradle Plugin for KMF
It seems the Wiki is outdated. It still talks about scala... which has recently been kicked out from the generated code when KMF has been put on a strict diet ;-)
https://github.com/dukeboard/kevoree-modeling-framework/wiki/Getting-started
Error: Can reflexively RENEW_INDEX for subNodes on [object Object]
Can, can, can, but can't really :)
Implement the persistency layer with MapDB and/or OrientDB
I have an attribute deployingCommand (of type String) holding the value: "cd ~; echo "source domeRun.sh" | sudo nohup bash"
Note the " into the string...
It is serialized as
<MyElement deployingCommand="cd ~; echo "source domeRun.sh" | sudo nohup bash"></myElement>
The " have disappeared, screwing up the whole thing...
When writing
source : fsm.State[0,1] oppositeOf outgoing : fsm.State
The grammar is obviously not respected bu the error message is not helping:
<relation declaration> or MetaModelTokenType.} expected, got ':'
In a generative approach like KMF, what are the benefits of targeting Scala? Why not generating plain old Java with much less overhead at runtime compared to Scala?
This feature would enable to specify that a model element is uniquely identified by a not ordered tuple of attributes.
var model : ContainerRoot = factory.createContainerRoot()
// ... assume you have several elements in your model
model.visit(myVisitor, true, true, true)
// no visit done except for level 0
model.visit(myVisitor, true, true, false)
// works fine for all levels
It seems the XMI serializer does not print empty refs. It would be nice if the JSON serializer also implemented this optimization...
According to the definition of kevscript in Kevoree, we are able to define attributes with muliple lines, with quote inside the value and potentially every existing special characters
However, the produce JSON doesn't handle well this characters and so we add some specific trick to avoid some issue.
For example, in Java, we replace all the \ by \ to ensure the string which is store in the JSON is well enough with ", ' and \n.
Is it possible to automatically manage this and the special characters from KMF ?
Indeed, KMF is responsible to generate the JSON with the JsonModelSerializer.
I wonder how the deletion of an element is managed by KMF. For me, a deleted element, and all its contained elements (i.e. its containment tree) should be available for garbage collecting i.e., no more reference (composite, as well as "normal" references) should point to these elements.
How is that managed in KMF?
Implementation of the pool of reusable objects.
Cleaning and update of the generated code to use this pool.
I guess most of them are not problematic... but they seem to indicate redundant/illformed comparison to null, casts, etc. Maybe it would be good to check these warnings and try to solve so of them?
It would be good if we could generate headers (for license, etc) in the generated Kotlin files, according to a specified template. I guess there should be complete freedom on the license of the generated Kotlin files, right?
It would be great (to facilitate the porting of existing code) if we could do:
myElement.getMyCollection().add(myOtherElement);//This exactly looks like existing client code using the EMF API.
instead of
myElement.addMyCollection(myOtherElement); //This does not look like EMF client code...
Of course, we should keep all the good properties on KMF/Kotlin collections
Assert generated code is embeddable in JavaScript when option is activated in the plugin
Here is an XMI generated by KMF:
<?xml version="1.0" encoding="UTF-8"?>
<DeploymentModel
xmlns:org.cloudml.core="http://cloudml.org/core"
xmlns:xsi="http://wwww.w3.org/2001/XMLSchema-instance"
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xsi:type="core:DeploymentModel"
name="EmptyDeployment">
</DeploymentModel>
Here is an XMI generated by the Eclipse plugins (model, edit, editor) generated from my metamodel (ecore file):
<?xml version="1.0" encoding="UTF-8"?>
<org.cloudml.core:DeploymentModel
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:org.cloudml.core="http://cloudml.org/core"
name="EmtpyDeployment"/>
Not quite the same...
Finally, here is an XMI generated when creating a dynamica instance directly from my metamodel (without using the model, edit, editor plugins):
<?xml version="1.0" encoding="ASCII"?>
<org.cloudml.core:DeploymentModel
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:org.cloudml.core="http://cloudml.org/core"
xsi:schemaLocation="http://cloudml.org/core CloudML.ecore#//core"
name="EmptyModel"/>
Still not equivalent to KMF-XMI...
Basically, I cannot open KMF-XMI models in Eclipse...
Decorate the generated code with events on modifications
The StructureView should be refreshed when the MM is changed and/or saved
Renaming referenced instances will result in a RENEW_INDEX event (logic) but it will fail.
//...
var model = factory.createContainerRoot();
var node = factory.createContainerNode();
var group = factory.createGroup();
node.name = 'initialName';
group.name = 'myGrp';
group.addSubNodes(node);
model.addNodes(node);
model.addGroups(group);
node.name = 'changeName';
// BOUM
// Error: Can reflexively RENEW_INDEX for subNodes on [object Object]
According to json.org:
"JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate."
KMF/JSON serialization definitely considers the machine side... Here are a few suggestions which could also consider the human-side of JSON:
1 - Omitting "eClass":"qualified:name:of:metaclass" when the class to instantiate is unambiguous (i.e. with a composite reference pointing to a class with no sub-classes). I think EMF does that in XMI serialization. The goal would be to make the JSON more natural to write. The limitation (the reason why it should be an optional "optimization") is that it would make the serialization less robust (typically if a sub-class is introduced in the metamodel, the existing serialized models are screwed).
2 - Use more natural paths instead of these ugly XMI-like paths. Again, the goal is to make the JSON more natural to write. We could e.g. let the designer specify for each EClass an attribute that can serve as ID, then use qualified name (constructed according to the composite references from the top) to refer to object. Something like mtTypeDefinition.myProvidedPort (assuming "name" is defined as ID), instead of //@typeDefitions.10/@required.2. Again, this optimization should be optional and to be decided by the designer, who should ensure he could ensure namespace-like IDs.
When I use both the release 1.3.2 and the current snapshot (coming from the trunk of the repository) to generate the javascript version of the Kevoree model (https://github.com/dukeboard/kevoree-modeling-framework/tree/master/samples/org.kevoree.modeling.sample.kevoree.js), I got a syntax error when I access the web page.
The error is:
"Uncaught SyntaxError: Use of future reserved word in strict mode"
the line which throw this error is the following line:
"setInterface: function (interface) {"
and the error come from the attribute interface (according to intellij which defines interface as a keyword).
I suppose the used names must be protected
It seems an invalid path raise this exception:
java.lang.ClassCastException: jet.Unit cannot be cast to
Not very helpful...
Something like
Cannot resolve "invalid-path"
Would be more helpful...
It is pretty nice to be able to serialize models into JSON.
It would be nice to be able to load them :-)
Hi,
I managed to serialize an instance of my model without problem. However, once serialized I can no longer deserialize.
I have this exception:
Exception in thread "main" javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,199]
Message: http://www.w3.org/TR/1999/REC-xml-names-19990114#ElementPrefixUnbound?AccessControl&AccessControl:AccessControlRoot
You can see below de the instance :
<AccessControl:AccessControlRoot xmlns:="null" xmlns:xsi="http://wwww.w3.org/2001/XMLSchema-instance" xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xsi:type="AccessControl:AccessControlRoot">
<users xsi:type="AccessControl:User" modulus="128191875432883463701881696876912782260741058997209542282473076003966132732866025346618670016767688489924429957900755627317749059739590821846584788061439123502272140124594184655817837436096731372581872960165322843110262287721782887546945427966975622401926941505168430656855779010696189487477180719911867778477" publicExponent="65537">
<roles>
<elements xsi:type="AccessControl:Element" elementQuery="typeDefinitions[NioChannel]">
<permissions xsi:type="AccessControl:Permission" PrimitiveQuery="AddFragmentBinding">
</permissions>
...
</elements>
<elements xsi:type="AccessControl:Element" elementQuery="typeDefinitions[BasicGroup]">
<permissions xsi:type="AccessControl:Permission" PrimitiveQuery="AddFragmentBinding">
</permissions>
...
</elements>
<elements xsi:type="AccessControl:Element" elementQuery="typeDefinitions[FakeConsole]">
<permissions xsi:type="AccessControl:Permission" PrimitiveQuery="AddFragmentBinding">
</permissions>
...
</elements>
<elements xsi:type="AccessControl:Element" elementQuery="typeDefinitions[Grapher]">
<permissions xsi:type="AccessControl:Permission" PrimitiveQuery="AddFragmentBinding">
</permissions>
...
</elements>
</roles>
</users>
</AccessControl:AccessControlRoot>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.