[kepler-users] changing MoML parameters

Ufuk Utku Turuncoglu turuncu at ucar.edu
Sat Jun 27 18:58:24 PDT 2009


Hi,

I try to change parameters of a MoML file but i get following error,

java.lang.RuntimeException: MoMLSimplApplication.changeFailed(): 
<property name="gridftp_srv" value="gridftp.frost.ncar.teragrid.org"/> 
failed:
    at 
ptolemy.moml.MoMLSimpleApplication.changeFailed(MoMLSimpleApplication.java:167)
    at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:204)
    at ptolemy.kernel.util.NamedObj.executeChangeRequests(NamedObj.java:699)
    at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1686)
    at ptolemy.actor.CompositeActor.requestChange(CompositeActor.java:1347)
    at org.earth.loader.JobMail.fire(JobMail.java:146)
    at org.earth.loader.JobMail.print(JobMail.java:274)
    at org.earth.loader.CheckMailBox.run(KeplerEarth.java:216)
    at java.lang.Thread.run(Thread.java:637)
Caused by: com.microstar.xml.XmlException: Cannot find a suitable 
constructor (2 args) (class ptolemy.kernel.util.Workspace = 
"ptolemy.kernel.util.Workspace {}", class java.lang.String = 
"gridftp_srv") for 'ptolemy.kernel.util.Attribute' in [external stream] 
at line 1 and column 72
    at ptolemy.moml.MoMLParser._createInstance(MoMLParser.java:4179)
    at ptolemy.moml.MoMLParser._handlePropertyElement(MoMLParser.java:5348)
    at ptolemy.moml.MoMLParser.startElement(MoMLParser.java:2866)
    at com.microstar.xml.XmlParser.parseElement(XmlParser.java:931)
    at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481)
    at com.microstar.xml.XmlParser.doParse(XmlParser.java:159)
    at com.microstar.xml.XmlParser.parse(XmlParser.java:132)
    at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1394)
    at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1367)
    at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1522)
    at ptolemy.moml.MoMLChangeRequest._execute(MoMLChangeRequest.java:270)
    at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:170)
    ... 7 more

The part of my code as follow,

            MoMLParser parser = new MoMLParser();
            MoMLParser.setMoMLFilters(BackwardCompatibility.allFilters());
            MoMLParser.addMoMLFilter(new RemoveGraphicalClasses());
            CompositeActor toplevel = (CompositeActor) 
parser.parse(null, new File(wkdir+"/"+wkname).toURI().toURL());
           
            NamedObj context = toplevel.getContainer();
           
            // create a manager for composite actor and execute it
            Manager manager = new Manager(toplevel.workspace(), 
"Follow-up workflow");
            toplevel.setManager(manager);
            toplevel.addChangeListener(this);
            manager.addExecutionListener(this);
           
            // get parameters and values
            NodeList nodes = (NodeList) 
reader.read("//parameters/node()", XPathConstants.NODESET);
            for (int i=0; i<nodes.getLength(); i++) {
                Node node = nodes.item(i);
               
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    String moml = "<property 
name=\""+node.getNodeName()+"\" value=\""+node.getTextContent()+"\"/>";
                    ChangeRequest request = new 
MoMLChangeRequest(context, moml);
                    toplevel.requestChange(request);
                }
               
               
            }

I think that problem is related with definition of MoMLChangeRequest but 
i am not sure.  Any suggestion will be helpful.

Thanks,

--ufuk



More information about the Kepler-users mailing list