1 /*
2 ~ Copyright 2006-2007 Nicolas De Loof.
3 ~
4 ~ Licensed under the Apache License, Version 2.0 (the "License");
5 ~ you may not use this file except in compliance with the License.
6 ~ You may obtain a copy of the License at
7 ~
8 ~ http://www.apache.org/licenses/LICENSE-2.0
9 ~
10 ~ Unless required by applicable law or agreed to in writing, software
11 ~ distributed under the License is distributed on an "AS IS" BASIS,
12 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ~ See the License for the specific language governing permissions and
14 ~ limitations under the License.
15 */
16 package org.jmonit.spi;
17
18 import org.jmonit.Monitor;
19 import org.jmonit.events.MonitoringEventBus;
20
21 /**
22 * A feature enhances jMonit API and computation capabilities by providing new
23 * features. It can communicate with other features via the monitoring event
24 * bus, either by listening to events, or by emitting custom ones.
25 * <p>
26 * A feature is identified by the feature class it exposes to application.
27 *
28 * @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
29 */
30 public interface Plugin<F>
31 {
32 /**
33 * Set the event bus used to dispatch monitoring events between the monitor
34 * and it's features.
35 *
36 * @param bus the event bus
37 */
38 void setMonitoringEventBus( MonitoringEventBus bus );
39
40 /**
41 * Set the monitor this plugin extends. Can be used for direct acces to
42 * other features.
43 *
44 * @param monitor the extended monitor
45 */
46 void setMonitor( Monitor monitor );
47
48 /**
49 * A feature is identified by the <code>class</code> it exposes to the
50 * monitored application.
51 *
52 * @return the public API of this feature
53 */
54 F getFeature();
55 }