01: /*
02: * This file is part of the WfMOpen project.
03: * Copyright (C) 2001-2005 Danet GmbH (www.danet.de), GS-AN.
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: EventSubscriber.java,v 1.3 2006/09/29 12:32:07 drmlipp Exp $
21: *
22: * $Log: EventSubscriber.java,v $
23: * Revision 1.3 2006/09/29 12:32:07 drmlipp
24: * Consistently using WfMOpen as projct name now.
25: *
26: * Revision 1.2 2005/04/08 11:28:03 drmlipp
27: * Merged changes from 1.3 branch up to 1.3p6.
28: *
29: * Revision 1.1.2.1 2005/04/06 15:42:06 drmlipp
30: * Added additional support for accessing the event queue to
31: * WorkflowService.
32: *
33: */
34: package de.danet.an.workflow.api;
35:
36: import java.io.IOException;
37:
38: import de.danet.an.workflow.omgcore.WfAuditEvent;
39: import de.danet.an.workflow.omgcore.WfAuditHandler;
40: import de.danet.an.workflow.omgcore.WfObject;
41:
42: /**
43: * An <code>EventSubscriber</code> represents a connection to the
44: * workflow engine's event queue. From its creation with {@link
45: * WorkflowService#createEventSubscriber
46: * <code>WorkflowService.createEventSubscriber</code>} until its
47: * destruction with {@link WorkflowService#release
48: * <code>WorkflowService.release</code>} all events from the workflow
49: * engine are delivered to the <code>EventSubscriber</code>.
50: * <code>EventSubscriber</code>s should be released using {@link
51: * WorkflowService#release <code>WorkflowService.release</code>} when
52: * no longer needed as they may consume considerable resources.
53: *
54: * @author <a href="mailto:lipp@danet.de">Michael Lipp</a>
55: * @version $Revision: 1.3 $
56: */
57: public interface EventSubscriber extends WfObject {
58:
59: /**
60: * Receives the next audit event. This method blocks until the
61: * next event is received.
62: * @return the audit event
63: * @throws IOException if an error occurs
64: */
65: WfAuditEvent receive() throws IOException;
66:
67: /**
68: * Receives the next audit event that arrives within the specified
69: * timeout interval.
70: * @param timeout the timeout value (in milliseconds). If 0, the
71: * method blocks until a message is received.
72: * @return the audit event or <code>null</code> if the timeout
73: * expires
74: * @throws IOException if an error occurs
75: */
76: WfAuditEvent receive(long timeout) throws IOException;
77:
78: /**
79: * Receives the next audit event if one is immediately available.
80: * @return the audit event or <code>null</code> if no event is
81: * available
82: * @throws IOException if an error occurs
83: */
84: WfAuditEvent receiveNoWait() throws IOException;
85:
86: /**
87: * Sets a handler for received events that is automatically
88: * invoked. If a handler has been set, the <code>receive</code>
89: * methods may not be called.
90: * @param handler the event handler
91: * @throws IOException if an error occurs
92: */
93: void setEventHandler(WfAuditHandler handler) throws IOException;
94: }
|