public Map startAndWait (long timeout)
throws InvalidKeyException, NotEnabledException,
InvalidRequesterException, RequesterRequiredException,
CannotStartException, AlreadyRunningException,
CannotRemoveException {
WorkflowService workflowService = null;
Channel chan = null;
try {
WorkflowServiceFactory wsf = WorkflowServiceFactory.newInstance();
workflowService = wsf.newWorkflowService();
ProcessDefinitionDirectory procDefDir
= workflowService.processDefinitionDirectory();
ProcessDirectory procDir = workflowService.processDirectory();
ProcessMgr pmgr = procDefDir.processMgr
("chabacc", "chabacc_test_sender");
WfProcess process
= pmgr.createProcess(new DefaultRequester (workflowService));
chan = workflowService.getChannel(process, "test_channel");
process.start();
Map pd = chan.receiveMessage(timeout);
return pd;
} catch (RemoteException e) {
throw new EJBException (e);
} finally {
workflowService.release (chan);
workflowService.release(workflowService);
}
}