*/
TokenService tokenService = new TokenServiceImpl();
InstanceService eiSvc = new InstanceServiceImpl();
BusinessProcessServiceImpl graphManager = new BusinessProcessServiceImpl();
TaskService taskService = new TaskServiceImpl();
TimerServiceImpl timerService = new TimerServiceImpl();
MessageProcessor impl = new MessageProcessor();
impl.setTaskService(taskService);
impl.setTimerService(timerService);
impl.setExecutionInstanceService(eiSvc);
impl.setTokenService(tokenService);
impl.setBusinessProcessService(graphManager);
QueueServiceImpl qs = new QueueServiceImpl(impl);
timerService.setQueueService(qs);
impl.setQueueService(qs);
/*
* now start the message pump for processing since we are all ready
*/
qs.start();
Engine engine = new Engine(tokenService, eiSvc, graphManager, qs);
System.out.println("STARTING AN INSTANCE");
HashMap m = new HashMap();
m.put("foo", "foo value");
FileReader reader = null;
try {
reader = new FileReader(new File("workflow_simple.xml"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
// engine.addBusinessProcess(reader);
engine.startNewInstance(1, m);
while(true) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
System.out.print("> ");
String line = br.readLine();
System.out.println("--->" + line);
if (line.startsWith("n ")) {
String s = line.substring("n ".length());
System.out.println("nudging token id = " + s);
engine.nudge(new TokenID(Integer.parseInt(s)));
}
else
if (line.startsWith("t")){
List l = taskService.getTasksForUser(new UserID(1), Task.TASK_INCOMPLETE);
Iterator it = l.iterator();
while(it.hasNext()) {
Task task = (Task) it.next();