Trouble making the HelloWorld running

9 views
Skip to first unread message

gfs.sprl

unread,
Jul 30, 2009, 3:50:30 AM7/30/09
to sarasvati-wf-users
It is really a shame I guess but I can't seem to be able to make the
engine work on the basic helloWorld example;

My test class code:

public WorkflowEngine() {
engine = new MemEngine();
engine.addNodeType( "helloWorld", HelloNode.class );

try {

File xml = new File("/main/webapp/WEB-INF/bootstrap.xml");
engine.getLoader().load(xml);

} catch (LoadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Graph graph = engine.getRepository().getLatestGraph("hello-world");
GraphProcess process = engine.startProcess(graph);

LoggingManager.println(process.getState().toString());

}

my bootstrap helloWorld:

<?xml version="1.0"?>
<process-definition name="hello-world"
xmlns="http://sarasvati.googlecode.com/
ProcessDefinition">

<node name="hello" type="helloWord" isStart="true"/>

</process-definition>


And finally the Node class:

public class HelloNode extends MemNode {

@Override public void execute (Engine engine, NodeToken token)
{
System.out.println( "Hello, world!" );
engine.completeExecution( token, Arc.DEFAULT_ARC );
}
}



I execute this code and get no errors. When showing the state of the
graph it says it has completed but no "Hello, World" message in my
console. What am I missing here? I tried to see whether there was a
guard preventing this node to execute and go directly into Completed
state, but nothing. A plain null meaning Accept (cf javadoc).


Thanks


PS. Where can I get the xml dtd for workflow-descriptions?

Paul Lorenz

unread,
Jul 30, 2009, 9:45:41 AM7/30/09
to sarasvati...@googlegroups.com, gfs....@gmail.com
Your process definition has type "helloWord". It's missing the 'l' for world :)

So, should Sarasvati throw an exception when it encounters an unknown type? Right now it will return the default type (node) when a specific type hasn't been registered.

To answer your last question, Sarasvati uses XML Schema, rather than a DTD. It can be found in  common/ProcessDefinition.xsd in the download.

cheers,
Paul
Reply all
Reply to author
Forward
0 new messages