Coder Social home page Coder Social logo

dukeboard / kevoree-modeling-framework Goto Github PK

View Code? Open in Web Editor NEW
36.0 36.0 7.0 45.73 MB

Kevoree Modeling Framework

Home Page: http://kevoree.org/kmf

License: GNU Lesser General Public License v3.0

JavaScript 83.41% Java 8.96% Shell 0.02% CSS 0.01% HTML 0.39% TypeScript 7.09% Objective-C++ 0.10%

kevoree-modeling-framework's People

Contributors

ahervieu avatar assaad avatar brice-morin avatar dukeboard avatar gnain avatar jean-emile avatar maxleiko avatar oliryc avatar thomashartmann avatar zishanbilal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kevoree-modeling-framework's Issues

Cast Exception when applying traces on a model

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)

Common interface for all (de)serializers

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.

References in JSON syntax

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...

Exception: Undo in JavaScript

-> 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

Bad opposite handling

Opposite relations are not well generated in the following cases:

1            1
<>---------
1            1
------------
*            1
------------

jet.runtime.Intrinsics$JetNullPointerException on TraceSequence$$TImpl.populateFromStream(TraceSequence.kt:58)

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)

delete() doesn't fully work

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

Refactor for evolution

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.

.equals in KMF

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 !=...)

protection of attribute names in the generator

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 :


  
    
  

  
    
    
    
    
    
  

  
    
    
    
    
  

Character escaping in string attributes

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...

Error display when MM does not parse

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 ':'

Benefits of Scala?

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?

Serialization of special character in JSON format

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.

Deletion semantics in KMF

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?

Generated Kotlin code produces lots of warning

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?

Generation of headers

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?

EMF-like management of collection

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

XMI (im)compatibility

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...

RENEW_INDEX error

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]

JSON serialization

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.

Syntax error on javascript generated code

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

Error reporting

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...

JSON loader

It is pretty nice to be able to serialize models into JSON.

It would be nice to be able to load them :-)

Deserializer KMF Kotlin

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.