eclipselabs/passerelle

Nested composite workflows broken

Closed this issue · 3 comments

What steps will reproduce the problem?
1. Create two new composites comp1 and comp2
2. In comp2, connect the input port to e.g. sleep and then to output port
3. In comp1, connect the input port to comp2 and then to the output port

What is the expected output? What do you see instead?

This works in DAWB version 0.9.0 (now 18 months old...). What happens now is 
that not only the two composites can be opened if their editors are closed, no 
workflows can be opened. The error message is:

13:08:13.554 ERROR Cannot create the palette loader factory! 
com.microstar.xml.XmlException: No port named "comp2.Input Port" in .comp1 in 
http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd at line 43 and column 4
    at com.isencia.passerelle.model.util.MoMLParser._checkForNull(MoMLParser.java:3624) [com.isencia.passerelle.engine/:na]
    at com.isencia.passerelle.model.util.MoMLParser._getPort(MoMLParser.java:4539) [com.isencia.passerelle.engine/:na]
    at com.isencia.passerelle.model.util.MoMLParser._processLink(MoMLParser.java:5610) [com.isencia.passerelle.engine/:na]
    at com.isencia.passerelle.model.util.MoMLParser.access$7(MoMLParser.java:5571) [com.isencia.passerelle.engine/:na]
    at com.isencia.passerelle.model.util.MoMLParser$LinkRequest.execute(MoMLParser.java:6656) [com.isencia.passerelle.engine/:na]
    at com.isencia.passerelle.model.util.MoMLParser._processPendingRequests(MoMLParser.java:5789) [com.isencia.passerelle.engine/:na]
    at com.isencia.passerelle.model.util.MoMLParser.endElement(MoMLParser.java:889) [com.isencia.passerelle.engine/:na]
    at com.microstar.xml.XmlParser.parseETag(XmlParser.java:1026) [com.microstar_1.2.0.jar:na]
    at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1098) [com.microstar_1.2.0.jar:na]
    at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) [com.microstar_1.2.0.jar:na]
    at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481) [com.microstar_1.2.0.jar:na]
    at com.microstar.xml.XmlParser.doParse(XmlParser.java:159) [com.microstar_1.2.0.jar:na]
etc.


What version of the product are you using? On what operating system?

DAWN master using Passerelle local repository. I haven't tested in the 
Passerelle workbench.

Please provide any additional information below.

The problem is in the method 'readSubModels' in the class SubmodelUtils. If I 
exchange the following code:

        for (String modelName : modelNames) {

            final IFile file = pass.getFile(modelName + ".moml");
            Flow flow = FlowManager.readMoml(new InputStreamReader(file
                    .getContents()));
            flow.setSource(file.getLocation().toOSString());
            if (flow.isClassDefinition()) {
                MoMLParser.putActorClass(modelName, flow);
                flow.setName(modelName);
                modelList.put(modelName, flow);
            }
        }

with the following code (taken from SubmodelUtils.readSubModels used in DAWB 
0.9.0):

        for (Object modelOb : sorted) {

            final String modelName = (String)modelOb;
            if (modelName==null||"".equals(modelName)) continue;

            final IFile file = pass.getFile(modelName+".moml");
            try {
                if (file.exists()) {

                    Flow flow = FlowManager.readMoml(new InputStreamReader(file.getContents()));
//                  flow.setSource(file.getLocation().toOSString());
                    if (flow.isClassDefinition()) {
                        MoMLParser.putActorClass(modelName, flow);
                        flow.setName(modelName);
                        modelList.put(modelName, flow);
                    }

                }

            } catch (Exception e1) {
                logger.error("Cannot read moml file!", e1);
            }
        }

the problem is solved.


Original issue reported on code.google.com by s.olof.svensson@gmail.com on 7 Feb 2013 at 12:15

I found out that the patch above only partially solves the problem: if DAWN is 
not restarted everything works fine, if DAWN is restarted and one tries to load 
one of the nested workflows the problem appear again.

I approached the DAWB-0.9.0 version even more of SubmodelUtils by removing the 
methods initializeSubmodels and createEmptySubModel. See patch here:

https://github.com/DawnScience/dawn-isenciaui/commit/882aa6b87a7f2d6bb4c69214b95
55a5db054429f

After this patch I can restart DAWN and nested submodels work

Original comment by s.olof.svensson@gmail.com on 7 Feb 2013 at 3:32

SubModelUtils is not used in the basic Passerelle RCP workbench.
Proposed change from DAWN has been committed.
Pls can you test it out?

tx
erwin

Original comment by erwin...@gmail.com on 7 Feb 2013 at 3:50

  • Changed state: Accepted

Original comment by erwin...@gmail.com on 26 Feb 2013 at 6:14

  • Changed state: Fixed