01: /*
02: * <copyright>
03: *
04: * Copyright 1997-2004 BBNT Solutions, LLC
05: * under sponsorship of the Defense Advanced Research Projects
06: * Agency (DARPA).
07: *
08: * You can redistribute this software and/or modify it under the
09: * terms of the Cougaar Open Source License as published on the
10: * Cougaar Open Source Website (www.cougaar.org).
11: *
12: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: *
24: * </copyright>
25: */
26:
27: package org.cougaar.lib.filter;
28:
29: import java.util.List;
30:
31: import org.cougaar.lib.callback.UTILFilterCallbackListener;
32: import org.cougaar.lib.param.ParamMap;
33: import org.cougaar.planning.ldm.plan.Task;
34:
35: /**
36: * The interface between the plugin and the BufferingThread.
37: *
38: * Defines a one-way flow of communication between the BufferingThread
39: * and the plugin.
40: *
41: * The buffering thread needs parameters from the plugin, a way to
42: * ask it which tasks are interesting (since it's the listener, not the
43: * plugin), it needs to be able to lock the container, and finally tell the
44: * plugin when it has buffered up the required number of tasks.
45: *
46: * Since processTasks takes an Enumeration, a BufferingThread subclass could
47: * give the BufferingPlugin a list of non-tasks (workflows? allocations?)
48: * that it wished to buffer.
49: */
50:
51: public interface UTILBufferingPlugin extends
52: UTILFilterCallbackListener, UTILTaskChecker {
53: /** get readable, unique name of plugin */
54: String getName();
55:
56: /** get parameters for plugin */
57: ParamMap getMyParams();
58:
59: /**
60: * Defines tasks you find interesting.
61: * @param t Task to check for interest
62: * @return boolean true if task is interesting
63: */
64: boolean interestingTask(Task t);
65:
66: /**
67: * Deal with the tasks that we have accumulated.
68: * Derived plugins must implement this.
69: * @param tasks the tasks to handle
70: */
71: void processTasks(List tasks);
72:
73: void examineBufferAgainIn(long millis);
74:
75: void wakeUp();
76: }
|