01: package org.jicengine.operation;
02:
03: /**
04: * An executable operation.
05: *
06: * <p>
07: * Copyright (C) 2004 Timo Laitinen
08: * </p>
09: * @author Timo Laitinen
10: * @created 2004-09-20
11: * @since JICE-0.10
12: */
13:
14: public interface Operation {
15:
16: /**
17: * So clients may query whether this operation needs
18: * any parameters at all.
19: */
20: public boolean needsParameters();
21:
22: /**
23: * <p>
24: * So clients may query if this operation needs a particular
25: * parameter. a return value 'true' means that in order to execute this
26: * parameter, a parameter with the given name must exist in the context.
27: * </p>
28: * <p>
29: * if the parmeter in question is an optional parameter, a true must be
30: * returned.
31: * </p>
32: */
33: public boolean needsParameter(String name);
34:
35: /**
36: * <p>
37: * executes the operation in a given context. objects in the context
38: * might be used in evaluation, or operation could produce
39: * more objects into the context.
40: * </p>
41: * <p>
42: * NOTE: operations must be re-executable.
43: * </p>
44: */
45: public Object execute(Context context) throws OperationException;
46:
47: }
|