4158 |
22 Feb 08 |
nicklas |
1 |
/** |
4207 |
04 Apr 08 |
nicklas |
$Id:ExtensionPoint.java 4187 2008-03-20 11:15:25Z nicklas $ |
4158 |
22 Feb 08 |
nicklas |
3 |
|
4158 |
22 Feb 08 |
nicklas |
Copyright (C) Authors contributing to this file. |
4158 |
22 Feb 08 |
nicklas |
5 |
|
4158 |
22 Feb 08 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
4158 |
22 Feb 08 |
nicklas |
Available at http://base.thep.lu.se/ |
4158 |
22 Feb 08 |
nicklas |
8 |
|
4158 |
22 Feb 08 |
nicklas |
BASE is free software; you can redistribute it and/or |
4158 |
22 Feb 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 |
4158 |
22 Feb 08 |
nicklas |
of the License, or (at your option) any later version. |
4158 |
22 Feb 08 |
nicklas |
13 |
|
4158 |
22 Feb 08 |
nicklas |
BASE is distributed in the hope that it will be useful, |
4158 |
22 Feb 08 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4158 |
22 Feb 08 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4158 |
22 Feb 08 |
nicklas |
GNU General Public License for more details. |
4158 |
22 Feb 08 |
nicklas |
18 |
|
4158 |
22 Feb 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/>. |
4158 |
22 Feb 08 |
nicklas |
21 |
*/ |
4158 |
22 Feb 08 |
nicklas |
22 |
package net.sf.basedb.util.extensions; |
4158 |
22 Feb 08 |
nicklas |
23 |
|
4170 |
07 Mar 08 |
nicklas |
24 |
import net.sf.basedb.util.extensions.xml.XmlLoader; |
4163 |
28 Feb 08 |
nicklas |
25 |
|
4170 |
07 Mar 08 |
nicklas |
26 |
|
4158 |
22 Feb 08 |
nicklas |
27 |
/** |
4158 |
22 Feb 08 |
nicklas |
An extension point is a place, defined by a client application, that |
4158 |
22 Feb 08 |
nicklas |
can be extended. Each extension point is identified by an ID which |
4158 |
22 Feb 08 |
nicklas |
must be unique. We recommend that ID:s are generated in the same |
4158 |
22 Feb 08 |
nicklas |
way as Java package names. An extension point must also define |
4158 |
22 Feb 08 |
nicklas |
what kind of {@link Action} it is possible to add to it. This |
4158 |
22 Feb 08 |
nicklas |
is done with the {@link #getActionClass()}. It is also possible |
4158 |
22 Feb 08 |
nicklas |
to define a default render class and if an extension is allowed |
4158 |
22 Feb 08 |
nicklas |
to override it or not. |
4163 |
28 Feb 08 |
nicklas |
36 |
|
4163 |
28 Feb 08 |
nicklas |
<p> |
4163 |
28 Feb 08 |
nicklas |
Extension points can, for example, be created: |
4163 |
28 Feb 08 |
nicklas |
<ul> |
4163 |
28 Feb 08 |
nicklas |
<li>Programmatically, using {@link ExtensionPointBean} object |
4163 |
28 Feb 08 |
nicklas |
<li>Loaded from extension definition XML files using a {@link XmlLoader}. |
4163 |
28 Feb 08 |
nicklas |
<li>Or, in any other way by providing a custom implementation of this interface |
4163 |
28 Feb 08 |
nicklas |
</ul> |
4158 |
22 Feb 08 |
nicklas |
44 |
|
4163 |
28 Feb 08 |
nicklas |
<p> |
4163 |
28 Feb 08 |
nicklas |
Before extension points can be used the must be registered with |
7703 |
11 Apr 19 |
nicklas |
{@link Registry#registerExtensionPoint(ExtensionPoint, ClassLoader)}. Extensions to |
4163 |
28 Feb 08 |
nicklas |
an extension point are registered in the same registry with |
7703 |
11 Apr 19 |
nicklas |
{@link Registry#registerExtension(Extension, ClassLoader)}. To load and use all |
4170 |
07 Mar 08 |
nicklas |
registered extensions use |
4207 |
04 Apr 08 |
nicklas |
{@link Registry#useExtensions(ClientContext, ExtensionsFilter, String...)}. |
4163 |
28 Feb 08 |
nicklas |
52 |
|
4158 |
22 Feb 08 |
nicklas |
@author nicklas |
4158 |
22 Feb 08 |
nicklas |
@version 2.7 |
4207 |
04 Apr 08 |
nicklas |
@base.modified $Date:2008-03-20 12:15:25 +0100 (Thu, 20 Mar 2008) $ |
4163 |
28 Feb 08 |
nicklas |
@see ExtensionPointBean |
4163 |
28 Feb 08 |
nicklas |
@see XmlLoader |
4158 |
22 Feb 08 |
nicklas |
58 |
*/ |
4158 |
22 Feb 08 |
nicklas |
59 |
public interface ExtensionPoint<A extends Action> |
4158 |
22 Feb 08 |
nicklas |
60 |
{ |
4158 |
22 Feb 08 |
nicklas |
61 |
|
4158 |
22 Feb 08 |
nicklas |
62 |
/** |
4158 |
22 Feb 08 |
nicklas |
Get the ID of the extension point. |
4158 |
22 Feb 08 |
nicklas |
@return A non-null unique identifier value |
4158 |
22 Feb 08 |
nicklas |
65 |
*/ |
4158 |
22 Feb 08 |
nicklas |
66 |
public String getId(); |
4158 |
22 Feb 08 |
nicklas |
67 |
|
4158 |
22 Feb 08 |
nicklas |
68 |
/** |
4168 |
04 Mar 08 |
nicklas |
Get the name of the extension point. This is just for display |
4168 |
04 Mar 08 |
nicklas |
purposes and the value is optional. If no name is given the |
4168 |
04 Mar 08 |
nicklas |
ID can be used instead. |
4168 |
04 Mar 08 |
nicklas |
72 |
*/ |
4168 |
04 Mar 08 |
nicklas |
73 |
public String getName(); |
4168 |
04 Mar 08 |
nicklas |
74 |
|
4168 |
04 Mar 08 |
nicklas |
75 |
/** |
4158 |
22 Feb 08 |
nicklas |
Get a description of the extension point. This value is optional |
4158 |
22 Feb 08 |
nicklas |
but we recommend that the description contains a text documenting |
4158 |
22 Feb 08 |
nicklas |
the extension point and has information that is useful for everyone |
4158 |
22 Feb 08 |
nicklas |
who wants to implement extensions for the extension point. |
4158 |
22 Feb 08 |
nicklas |
This should include context specific information. |
4158 |
22 Feb 08 |
nicklas |
@return An optional description |
4158 |
22 Feb 08 |
nicklas |
82 |
*/ |
4158 |
22 Feb 08 |
nicklas |
83 |
public String getDescription(); |
4158 |
22 Feb 08 |
nicklas |
84 |
|
4158 |
22 Feb 08 |
nicklas |
85 |
/** |
4158 |
22 Feb 08 |
nicklas |
Get the class object that represents the type of action that |
4158 |
22 Feb 08 |
nicklas |
can be added to this extension point. The class must implement |
4158 |
22 Feb 08 |
nicklas |
the {@link Action} interface. Extensions that are extending this |
4158 |
22 Feb 08 |
nicklas |
extension point must provide an {@link ActionFactory} that is capable |
4158 |
22 Feb 08 |
nicklas |
of creating instances of the specified class. |
4170 |
07 Mar 08 |
nicklas |
91 |
|
4158 |
22 Feb 08 |
nicklas |
@return The class of the actions that can be used on this extension point |
4170 |
07 Mar 08 |
nicklas |
(required) |
4158 |
22 Feb 08 |
nicklas |
94 |
*/ |
4158 |
22 Feb 08 |
nicklas |
95 |
public Class<A> getActionClass(); |
4158 |
22 Feb 08 |
nicklas |
96 |
|
4158 |
22 Feb 08 |
nicklas |
97 |
/** |
4158 |
22 Feb 08 |
nicklas |
This is an optional factory for creating {@link Renderer} |
4158 |
22 Feb 08 |
nicklas |
instances. Renderers are not a required part of the extension |
4158 |
22 Feb 08 |
nicklas |
system, but will make it easier to write the code for extension |
4158 |
22 Feb 08 |
nicklas |
points. |
4158 |
22 Feb 08 |
nicklas |
102 |
|
4158 |
22 Feb 08 |
nicklas |
@return A renderer factory or null |
4158 |
22 Feb 08 |
nicklas |
104 |
*/ |
4170 |
07 Mar 08 |
nicklas |
105 |
public RendererFactory<? super A> getRendererFactory(); |
4158 |
22 Feb 08 |
nicklas |
106 |
|
4158 |
22 Feb 08 |
nicklas |
107 |
/** |
4158 |
22 Feb 08 |
nicklas |
If an extension is allowed to override the renderer factory with an |
4158 |
22 Feb 08 |
nicklas |
implementation of its own. This can be seen as a possibility where |
4158 |
22 Feb 08 |
nicklas |
extensions can create their own look and feel. If strict compliance is |
4158 |
22 Feb 08 |
nicklas |
needed overriding should of course not be allowed. |
4158 |
22 Feb 08 |
nicklas |
@return TRUE to allow extensions to override, FALSE otherwise |
4158 |
22 Feb 08 |
nicklas |
113 |
*/ |
4158 |
22 Feb 08 |
nicklas |
114 |
public boolean allowRendererOverride(); |
4158 |
22 Feb 08 |
nicklas |
115 |
|
5486 |
12 Nov 10 |
nicklas |
116 |
/** |
5486 |
12 Nov 10 |
nicklas |
Get the error handler factory that should be used with this |
5486 |
12 Nov 10 |
nicklas |
extension point. |
5486 |
12 Nov 10 |
nicklas |
@return An error handler factory, or null to use the system default |
5486 |
12 Nov 10 |
nicklas |
@since 2.17 |
5486 |
12 Nov 10 |
nicklas |
121 |
*/ |
5486 |
12 Nov 10 |
nicklas |
122 |
public ErrorHandlerFactory<? super A> getErrorHandlerFactory(); |
4158 |
22 Feb 08 |
nicklas |
123 |
} |