cxbrooks / test

Second test for bugzilla to git
0 stars 0 forks source link

Instantiating custom actors #218

Closed cxbrooks closed 12 years ago

cxbrooks commented 14 years ago

Note: the issue was created automatically with bugzilla2github tool

Original bug ID: BZ#336 From: @cxbrooks Reported version: 8.1.devel CC: pt-dev@chess.eecs.berkeley.edu

cxbrooks commented 14 years ago

From the April, 2010 visit, Warren writes: "Add the ability to contribute custom actors to Ptolemy dynamically - Add the ability to contribute custom actors to Ptolemy dynamically."

We'll need further clarification on this because Ptolemy can instantiate custom actors at run time. Actors can be saved in the User Library.

See "Sharing Across Models" in http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/design/usingVergil/usingVergil.pdf Also, search for "User Library" or "UserLibrary"

The faq has a link to "Adding an Actor" in http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/doc/coding/index.htm

Perhaps we could make adding an actor simpler or more well documented?

cxbrooks commented 14 years ago

What is needed here is the ability to create a set of custom actors and then make it easy to deploy those actors to other developers.

An actor writer can create actors using Graph | Instantiate Entity or Instantiate Attribute and then right click on the actor and select "Save Actor In Library".

The question is: how would an actor writer transmit these saved actors to a model developer?

One idea would be to have some easy way to import a sub palette into the UserLibrary.

cxbrooks commented 12 years ago

The Graph -> Import Library menu choice will load a library of actors into the left hand actor palette. There are a few caveats though. 1) The library file to be loaded should be a MoML class that extends

<?xml version="1.0" standalone="no"?> <!DOCTYPE class PUBLIC "-//UC Berkeley//DTD MoML 1//EN" "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">

2) To see the new actors, one must do New -> Graph. Currently, ActorGraphFrame does this for us. Ideally, the imported actors would appear in the left hand actor palette of the current graph editor.

3) To permanently store the library elements: 1) Graph -> Import Library 2) In the new graph viewer, right click on the new library and select "Open For Editing" 3) Select all the actors, right lcick and select "Save Actor In Library" This will update the UserLibrary, which is stored in $HOME/.ptolemyII/UserLibrary.xml

Open Issues: 1) What about custom actors that use custom java files? 2) If I import a library twice that has an actor with the same name, what happens? 3) How ActorGraphFrame does New -> Graph is a little bit suspect.

cxbrooks commented 12 years ago

I've updated how we create vergil.exe, $PTII/bin/vergil and $PTII/bin/vergil.bat so that $HOME/.ptolemyII and $HOME/ptolemyII/*.jar are included in the classpath which which Vergil is invoked.

This makes it much easier to deploy custom actors by placing the .class files in $HOME/.ptolemyII or placing jar files in that directory.

Interestingly Java 1.6 and later understands * in the CLASSPATH or the value of the -classpath argument to match any .jar or .JAR files in that directory. See http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

Unfortunately, Eclipse does not understand * style classpathentry values. So, configure looks in $HOME/.ptolemyII and adds any .jar files. This is hack, since if the Eclipse user adds any .jar files, they will need to either update the Eclipse classpath by hand or rerun configure. Ant, vergil.exe, $PTII/bin/vergil and $PTII/bin/vergil.bat should all recognize any new .jar files at run time.

cxbrooks commented 12 years ago

Managing custom actors works much better now that the various ways to invoke vergil attempt to get jar files from ~/.ptolemyII/. I've updated $PTII/doc/coding/addinganactor.htm.