[kepler-users] changing MoML parameters
Ufuk Utku Turuncoglu
turuncu at ucar.edu
Sun Jun 28 08:29:33 PDT 2009
Hi,
I have already try that and it gives different error. I change only line as
MoMLChangeRequest request = new MoMLChangeRequest(toplevel, moml);
and error,
java.lang.RuntimeException: MoMLSimplApplication.changeFailed():
<property name="gridftp_srv"
value="gridftpppp.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:119)
at org.earth.loader.JobMail.print(JobMail.java:229)
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
Thanks for help,
--ufuk
Edward A. Lee wrote:
>
> The problem is that context is null, so the MoML parser is trying to
> create an attribute with no container. It tries to put in the Workspace,
> but a naked Attribute can't go in the workspace. Only subclasses of
> Entity
> can go in the workspace. I think you want:
>
> context = toplevel;
>
> rather than
>
> context = toplevel.getContainer();
>
> Edward
>
>
> Ufuk Utku Turuncoglu wrote:
>> 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
>> _______________________________________________
>> Kepler-users mailing list
>> Kepler-users at kepler-project.org
>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
More information about the Kepler-users
mailing list