Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Triquetrum/Actor Oriented Classes

< Triquetrum
Revision as of 12:14, 5 May 2017 by Erwindl0.gmail.com (Talk | contribs) (Created page with "== Implementing and using Actor Oriented Classes in Triquetrum == Ptolemy II [1] models define actor assemblies that can be executed in different Models of Computation. Acto...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Implementing and using Actor Oriented Classes in Triquetrum

Ptolemy II [1] models define actor assemblies that can be executed in different Models of Computation.

Actors can be implemented in different ways. Most Ptolemy II actors are implemented in Java, but other languages like JavaScript, Python, C have also been used. A different approach is to implement actors as composites of contained actor assemblies, or as "submodels". These are called "Actor Oriented Classes" [2].

In Ptolemy II's Vergil model editor, existing AOC implementations can be handled in a similar way as "programmed" actors. Ptolemy II is able to load both Java-based actor classes and MoML-based AOCs from the classpath, show them in the actor palette/library, let users drag-n-drop them on a graphical model canvas, connect ports, configure parameters etc.

AOCs can also be created using Vergil and can then be shared between "consumer models", either via the concept of a "User library" or by adding them to the classpath (e.g. by adding them in the Ptolemy II build or by copying them on the root installation folder). There is no explicit tool support to share models between multiple users.

With issue #78, the goal is to implement support for AOCs in Triquetrum.

This requires some reflection on different levels :

  1. How can we create AOC models? E.g. first designing a plain model and then mark it somehow as a "reusable AOC"? Or should this be a specific wizard/workflow in the editor upfront?
  2. Where do we store AOCs so they can be used for designing and running "consumer models"?

Linked to this, how can we share them easily between models and with other users?

  1. How to represent AOCs within parent/consumer models? Vergil shows a customizable actor icon and via an "Open actor" action the user can see the internal details of the AOC model in a separate editor window.In Graphiti it's not straightforward to navigate between diagrams/windows from a parent model. This is related to the tight integration between diagram editors and underlying EMF resources. Kieler/ELK use another paradigm where they expand/collapse the contents of a submodel within the same diagram (minimizing the remainder of the surrounding model).
  2. Do we want to support the difference between AOC classes and instances, similarly to Ptolemy II? And if so, also subclassing and other advanced features related to using AOCs in Ptolemy II?

The work will be done in several steps :

  1. Add support for using existing AOCs in the Triquetrum editor. At this stage we depend on using Vergil to implement AOCs.
    1. include AOCs in the editor palette configuration
    2. define a common approach for storing/loading AOC classes for the editor and for a headless workflow runtime
    3. always use instances when adding AOCs to a model (similar to Java-based actors picked from the palette)
    4. simple representation of an AOC in a model with similar configuration options as for a Java-based actor
    5. figure out a way to dynamically add AOCs to an existing Triquetrum installation
    6. extend this to allow opening the AOC model details in a readonly view
  2. Add support for creating AOC models in Triquetrum
    1. graphical models and DSLs?
    2. AOCs defined within a parent model or only as separate models, meant to be used as "reusable submodels"?
    3. classes, subclasses, instances?

Using existing AOCs in Triquetrum

Preparations were made in Ptolemy II for using it in an OSGi context such as Triquetrum. This already provides an API and implementation to load AOCs in a similar way as Java actor classes, by plugging in the org.ptolemy.classloading.osgi.OSGiClassLoadingStrategy as the implementation of org.ptolemy.classloading.ClassLoadingStrategy.

Both Ptolemy's ptolemy.moml.MoMLParser and Triquetrum editor utilities use the ClassLoadingStrategy approach to find actor classes.

The OSGiClassLoadingStrategy implementation tracks all registered OSGi services that implement one of two interfaces :

  • org.ptolemy.classloading.ModelElementClassProvider : provides Java actor classes from OSGi bundles. Implementations are already available and used for providing the default actor library and to allow easy addition of new actors to a Triquetrum editor/runtime (see also https://wiki.eclipse.org/Triquetrum/Extending_Triquetrum)
  • org.ptolemy.classloading.ActorOrientedClassProvider : no implementation yet. This needs to be done to get a first level of AOC support working in Triquetrum.



[1] Ptolemy II ref

[2] http://ptolemy.eecs.berkeley.edu/publications/papers/04/Classes/Lee_Classes.pdf

Back to the top