01: /*
02: * $Id: AbstractListener.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: import org.concern.ControllerException;
17: import org.concern.Loader;
18: import org.concern.model.parser.ParseException;
19:
20: public abstract class AbstractListener<S> extends AbstractNode
21: implements Listener<S> {
22: protected AbstractListener() {
23: }
24:
25: protected AbstractListener(String name) {
26: environment.put("listener.name", name);
27: }
28:
29: public final String getName() {
30: return (String) environment.get("listener.name");
31: }
32:
33: public void setController(Controller controller) {
34: super .setController(controller);
35: }
36:
37: protected Loader getLoader() {
38: return controller.getLoader();
39: }
40:
41: public final String getPrecondition() {
42: return (String) environment.get("listener.precondition");
43: }
44:
45: public void escalate(S subject) throws ActivityExecutionException {
46: }
47:
48: public int getRetryDelay() {
49: Integer integer = (Integer) getEnvironment().get(
50: "listener.retryDelay");
51: return integer != null ? integer.intValue() : 0;
52: }
53:
54: public int getTrials() {
55: Integer integer = (Integer) getEnvironment().get(
56: "listener.trials");
57: return integer != null ? integer.intValue() : 1;
58: }
59: }
|