4320 |
29 May 08 |
nicklas |
1 |
/** |
4320 |
29 May 08 |
nicklas |
$Id$ |
4320 |
29 May 08 |
nicklas |
3 |
|
4320 |
29 May 08 |
nicklas |
Copyright (C) 2008 Nicklas Nordborg |
4320 |
29 May 08 |
nicklas |
5 |
|
4320 |
29 May 08 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
4320 |
29 May 08 |
nicklas |
Available at http://base.thep.lu.se/ |
4320 |
29 May 08 |
nicklas |
8 |
|
4320 |
29 May 08 |
nicklas |
BASE is free software; you can redistribute it and/or |
4320 |
29 May 08 |
nicklas |
modify it under the terms of the GNU General Public License |
4479 |
05 Sep 08 |
jari |
as published by the Free Software Foundation; either version 3 |
4320 |
29 May 08 |
nicklas |
of the License, or (at your option) any later version. |
4320 |
29 May 08 |
nicklas |
13 |
|
4320 |
29 May 08 |
nicklas |
BASE is distributed in the hope that it will be useful, |
4320 |
29 May 08 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4320 |
29 May 08 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4320 |
29 May 08 |
nicklas |
GNU General Public License for more details. |
4320 |
29 May 08 |
nicklas |
18 |
|
4320 |
29 May 08 |
nicklas |
You should have received a copy of the GNU General Public License |
4515 |
11 Sep 08 |
jari |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4320 |
29 May 08 |
nicklas |
21 |
*/ |
4320 |
29 May 08 |
nicklas |
22 |
package net.sf.basedb.util.extensions.events; |
4320 |
29 May 08 |
nicklas |
23 |
|
4320 |
29 May 08 |
nicklas |
24 |
import net.sf.basedb.util.extensions.Extension; |
4320 |
29 May 08 |
nicklas |
25 |
import net.sf.basedb.util.extensions.ExtensionPoint; |
4320 |
29 May 08 |
nicklas |
26 |
|
4320 |
29 May 08 |
nicklas |
27 |
/** |
4320 |
29 May 08 |
nicklas |
Event filter that only passes events for a specific extension point. |
4320 |
29 May 08 |
nicklas |
29 |
|
4320 |
29 May 08 |
nicklas |
@author nicklas |
4320 |
29 May 08 |
nicklas |
@version 2.8 |
4320 |
29 May 08 |
nicklas |
@base.modified $Date$ |
4320 |
29 May 08 |
nicklas |
33 |
*/ |
4320 |
29 May 08 |
nicklas |
34 |
public class ExtensionPointEventFilter |
4320 |
29 May 08 |
nicklas |
35 |
implements EventFilter |
4320 |
29 May 08 |
nicklas |
36 |
{ |
4320 |
29 May 08 |
nicklas |
37 |
private final String id; |
4320 |
29 May 08 |
nicklas |
38 |
|
4320 |
29 May 08 |
nicklas |
39 |
/** |
4320 |
29 May 08 |
nicklas |
Create a new extension point event filter. |
4320 |
29 May 08 |
nicklas |
@param extensionPoint The extension point to pass events for |
4320 |
29 May 08 |
nicklas |
42 |
*/ |
6875 |
20 Apr 15 |
nicklas |
43 |
public ExtensionPointEventFilter(ExtensionPoint<?> extensionPoint) |
4320 |
29 May 08 |
nicklas |
44 |
{ |
4320 |
29 May 08 |
nicklas |
45 |
this.id = extensionPoint.getId(); |
4320 |
29 May 08 |
nicklas |
46 |
} |
4320 |
29 May 08 |
nicklas |
47 |
|
4320 |
29 May 08 |
nicklas |
48 |
/** |
4320 |
29 May 08 |
nicklas |
Create a new extension point event filter |
4320 |
29 May 08 |
nicklas |
@param id The ID of the extension point |
4320 |
29 May 08 |
nicklas |
51 |
*/ |
4320 |
29 May 08 |
nicklas |
52 |
public ExtensionPointEventFilter(String id) |
4320 |
29 May 08 |
nicklas |
53 |
{ |
4320 |
29 May 08 |
nicklas |
54 |
this.id = id; |
4320 |
29 May 08 |
nicklas |
55 |
} |
4320 |
29 May 08 |
nicklas |
56 |
|
4320 |
29 May 08 |
nicklas |
57 |
/** |
4320 |
29 May 08 |
nicklas |
@return TRUE if the extension point has the same ID as the one |
4320 |
29 May 08 |
nicklas |
given in the constructor |
4320 |
29 May 08 |
nicklas |
60 |
*/ |
4320 |
29 May 08 |
nicklas |
61 |
@Override |
4320 |
29 May 08 |
nicklas |
62 |
public boolean shouldSend(EventType event, ExtensionPoint<?> extensionPoint, |
4320 |
29 May 08 |
nicklas |
63 |
Extension<?> extension) |
4320 |
29 May 08 |
nicklas |
64 |
{ |
4320 |
29 May 08 |
nicklas |
65 |
return id.equals(extensionPoint.getId()); |
4320 |
29 May 08 |
nicklas |
66 |
} |
4320 |
29 May 08 |
nicklas |
67 |
|
4320 |
29 May 08 |
nicklas |
68 |
} |