01: /*
02: * This file is part of the WfMOpen project.
03: * Copyright (C) 2001-2006 Danet GmbH (www.danet.de), BU BTS.
04: * All rights reserved.
05: *
06: * This program is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU General Public License as published by
08: * the Free Software Foundation; either version 2 of the License, or
09: * (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: * $Id: TestEjbInvoker.java,v 1.1 2006/11/03 23:04:33 mlipp Exp $
21: *
22: * $Log: TestEjbInvoker.java,v $
23: * Revision 1.1 2006/11/03 23:04:33 mlipp
24: * New demo tools.
25: *
26: */
27: package de.danet.an.wfdemo.testtools;
28:
29: import java.rmi.RemoteException;
30: import java.util.Map;
31:
32: import de.danet.an.util.EJBUtil;
33: import de.danet.an.workflow.api.Activity;
34: import de.danet.an.workflow.api.FormalParameter;
35: import de.danet.an.workflow.spis.aii.ApplicationNotStoppedException;
36: import de.danet.an.workflow.spis.aii.CannotExecuteException;
37: import de.danet.an.workflow.spis.aii.ResultProvider;
38: import de.danet.an.workflow.spis.aii.ToolAgent;
39:
40: /**
41: * This class provides a test tool that invokes the test EJB
42: *
43: * @author Michael Lipp
44: *
45: */
46: public class TestEjbInvoker implements ToolAgent, ResultProvider {
47:
48: private ThreadLocal result = new ThreadLocal();
49:
50: /* (non-Javadoc)
51: * @see de.danet.an.workflow.spis.aii.ToolAgent#invoke
52: */
53: public void invoke(Activity activity,
54: FormalParameter[] formalParameters, Map actualParameters)
55: throws RemoteException, CannotExecuteException {
56: de.danet.an.wfdemo.testejb.Test test = (de.danet.an.wfdemo.testejb.Test) EJBUtil
57: .createSession(
58: de.danet.an.wfdemo.testejb.TestHome.class,
59: "ejb/WfMOpenTestEJB");
60: try {
61: Map pd = test.startAndWait();
62: result.set(pd);
63: } catch (Exception e) {
64: throw (CannotExecuteException) (new CannotExecuteException(
65: e.getMessage())).initCause(e);
66: }
67: }
68:
69: /* (non-Javadoc)
70: * @see de.danet.an.workflow.spis.aii.ResultProvider#result()
71: */
72: public Object result() {
73: return result.get();
74: }
75:
76: /* (non-Javadoc)
77: * @see de.danet.an.workflow.spis.aii.ToolAgent#terminate(de.danet.an.workflow.api.Activity)
78: */
79: public void terminate(Activity activity)
80: throws ApplicationNotStoppedException, RemoteException {
81: throw new ApplicationNotStoppedException("Not supported.");
82: }
83:
84: }
|