01: /*
02: * This file is part of the WfMOpen project.
03: * Copyright (C) 2001-2005 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: SimpleApplicationDirectoryLookup.java,v 1.3 2006/10/25 20:55:03 mlipp Exp $
21: *
22: * $Log: SimpleApplicationDirectoryLookup.java,v $
23: * Revision 1.3 2006/10/25 20:55:03 mlipp
24: * Added missing serializability.
25: *
26: * Revision 1.2 2006/09/29 12:32:09 drmlipp
27: * Consistently using WfMOpen as projct name now.
28: *
29: * Revision 1.1 2006/09/21 13:19:51 drmlipp
30: * Made SimpleApplicationDirectory easily accessible for clients.
31: *
32: */
33: package de.danet.an.workflow.tools.util;
34:
35: import java.io.Serializable;
36: import java.lang.reflect.InvocationTargetException;
37:
38: import de.danet.an.util.EJBUtil;
39: import de.danet.an.util.ResourceNotAvailableException;
40: import de.danet.an.workflow.api.Batch;
41:
42: /**
43: * This class provides a {@link Batch <code>Batch</code>} implementation
44: * that looks up and returns the remote interface of the
45: * {@link SimpleApplicationDirectory <code>SimpleApplicationDirectory</code>}.
46: *
47: * @author Michael Lipp
48: */
49: public class SimpleApplicationDirectoryLookup implements Batch,
50: Serializable {
51:
52: /* (non-Javadoc)
53: * @see de.danet.an.workflow.api.Batch#execute(de.danet.an.workflow.api.Batch.Context)
54: */
55: public Object execute(Context ctx) throws InvocationTargetException {
56: try {
57: // The lookup works because batches are executed in the context
58: // of the WorkflowEngineEJB.
59: SimpleApplicationDirectory applDir = (SimpleApplicationDirectory) EJBUtil
60: .createSession(
61: SimpleApplicationDirectoryHome.class,
62: "java:comp/env/ejb/SimpleApplicationDirectory");
63: return applDir;
64: } catch (ResourceNotAvailableException e) {
65: throw new InvocationTargetException(e);
66: }
67: }
68: }
|