01: /*
02: * <copyright>
03: *
04: * Copyright 2001-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: package org.cougaar.core.plugin;
27:
28: import org.cougaar.core.blackboard.BlackboardClientComponent;
29: import org.cougaar.util.ConfigFinder;
30:
31: /**
32: * This component is a base class for standard blackboard-client
33: * "plugins".
34: * <p>
35: * Create a derived class by implementing
36: * <tt>setupSubscriptions()</tt> and <tt>execute()</tt>.
37: * <p>
38: * Note that both "precycle()" and "cycle()" will be run by the
39: * scheduler. This means that the scheduling order <i>in relation to
40: * other scheduled Components</i> may be *random* (i.e. this
41: * ComponentPlugin might load first but be precycled last!). In
42: * general a Component should <b>not</b> make assumptions about the
43: * load or schedule ordering.
44: */
45: public abstract class ComponentPlugin extends BlackboardClientComponent
46: implements PluginBase {
47: public ComponentPlugin() {
48: }
49:
50: // 10.0: Old method PluginBindingSite getBindingSite() is gone!
51: // If you want the AgentIdentifier, you may simply call getAgentIdentifier()
52: // -- inherited from BlackboardClientComponent
53:
54: /**
55: * Called once after initialization, as a "pre-execute()".
56: */
57: protected abstract void setupSubscriptions();
58:
59: /**
60: * Called every time this component is scheduled to run.
61: */
62: protected abstract void execute();
63:
64: //
65: // misc utility methods:
66: //
67:
68: protected ConfigFinder getConfigFinder() {
69: return ConfigFinder.getInstance();
70: }
71:
72: }
|