View Javadoc

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.events;
17  
18  /**
19   * @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
20   */
21  public interface MonitoringEventBus
22  {
23  
24      /**
25       * Adds the listener to the collection of listeners who will be notifed when
26       * any monitoring event occurs. <br/> If listener is <code>null</code>,
27       * no exception is thrown and no action is performed
28       * 
29       * @param listener the monitoring listener
30       * @see #removeListener(org.jmonit.events.MonitoringEventListener)
31       * @see MonitoringEventListener
32       */
33      public void addListener( final MonitoringEventListener listener );
34  
35      /**
36       * Removes the transfer listener from the collection of listeners so it no
37       * longer receives transfer events. <br/> If listener is <code>null</code>
38       * or specified listener was not added to this
39       * <code>MonitoringEventSupport</code> object no exception is thrown and
40       * no action is performed
41       * 
42       * @param listener the monitoring listener
43       * @see #addListener(org.jmonit.events.MonitoringEventListener)
44       */
45      public void removeListener( final MonitoringEventListener listener );
46  
47      /**
48       * Returns whether the specified instance of monitoring listener was added
49       * to the collection of listeners who will be notifed when an transfer event
50       * occurs
51       * 
52       * @param listener the transfer listener
53       * @return <code>true<code>
54       *         if given listener was added to the collection of listeners
55       *         <code>false</code> otherwise
56       * @see #addListener(org.jmonit.events.MonitoringEventListener)
57       */
58      public boolean hasListener( final MonitoringEventListener listener );
59  
60      /**
61       * Dispatches the given <code>MonitoringEvent</code> to all registred
62       * listeners (calls method
63       * {@link MonitoringEventListener#onMonitoringEvent(MonitoringEvent)} on all
64       * of them}.
65       * 
66       * @param event the MonitorTaggedEvent which will be dispached to listeners
67       */
68      public void fireMonitoringEvent( final MonitoringEvent event );
69  
70  }