01: /*
02: * $Id: Listener.java 881 2007-02-12 07:54:31Z hengels $
03: * (c) Copyright 2004 con:cern development team.
04: *
05: * This file is part of con:cern (http://concern.sf.net).
06: *
07: * con:cern is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU Lesser General Public License
09: * as published by the Free Software Foundation; either version 2.1
10: * of the License, or (at your option) any later version.
11: *
12: * Please see COPYING for the complete licence.
13: */
14: package org.concern.controller;
15:
16: /**
17: * A Listener is basically a synchronous activity without a postcondition.
18: * It might be used to destroy the subject. Therefore just call:
19: * <pre>
20: * controller.destroySubject(subject);
21: * </pre>
22: */
23: public interface Listener<S> extends Node {
24: /**
25: * Retry to notify the listener after a delay.
26: * @return the retry delay
27: */
28: int getRetryDelay();
29:
30: /**
31: * Try to notify the listener at maximum n times.
32: * @return the maximum trials
33: */
34: int getTrials();
35:
36: String getPrecondition();
37:
38: /**
39: * This method is called by the controller when the precondition matches.
40: * @param subject
41: * @throws ActivityExecutionException
42: */
43: void notify(S subject) throws ActivityExecutionException;
44:
45: /**
46: * This method is called, when the timeout of an asynchronous activity is exceeded or n trials
47: * have failed.
48: * @param subject the subject
49: * @throws ActivityExecutionException
50: */
51: void escalate(S subject) throws ActivityExecutionException;
52: }
|