4158 |
22 Feb 08 |
nicklas |
1 |
/** |
4158 |
22 Feb 08 |
nicklas |
$Id$ |
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 |
|
4163 |
28 Feb 08 |
nicklas |
24 |
import net.sf.basedb.core.plugin.About; |
4170 |
07 Mar 08 |
nicklas |
25 |
import net.sf.basedb.util.extensions.xml.XmlLoader; |
4163 |
28 Feb 08 |
nicklas |
26 |
|
4158 |
22 Feb 08 |
nicklas |
27 |
/** |
4158 |
22 Feb 08 |
nicklas |
Represents a concrete implementation of an extension to an |
4158 |
22 Feb 08 |
nicklas |
extension point. Each extension must have a unique ID. We recommend |
4158 |
22 Feb 08 |
nicklas |
that ID:s are generated in the same way as Java package names. |
4158 |
22 Feb 08 |
nicklas |
An extension defines an {@link ActionFactory} which is a factory class |
4158 |
22 Feb 08 |
nicklas |
that knows how to create actions. The actions should be of the same |
4158 |
22 Feb 08 |
nicklas |
class (or a subclass) as specified by the |
4158 |
22 Feb 08 |
nicklas |
{@link ExtensionPoint#getActionClass()} method of the extension point that |
4158 |
22 Feb 08 |
nicklas |
the extension is extending. |
4158 |
22 Feb 08 |
nicklas |
<p> |
4158 |
22 Feb 08 |
nicklas |
If the extension point allows it, the extension may also provide a |
4158 |
22 Feb 08 |
nicklas |
{@link RendererFactory}. See {@link ExtensionPoint#allowRendererOverride()}. |
4158 |
22 Feb 08 |
nicklas |
39 |
|
4163 |
28 Feb 08 |
nicklas |
<p> |
4163 |
28 Feb 08 |
nicklas |
Extensions can, for example, be created: |
4163 |
28 Feb 08 |
nicklas |
<ul> |
4170 |
07 Mar 08 |
nicklas |
<li>Programmatically, using an {@link ExtensionBean} object. |
4163 |
28 Feb 08 |
nicklas |
<li>Loaded from extension definition XML files using a {@link XmlLoader}. |
4170 |
07 Mar 08 |
nicklas |
<li>Or, in any other way by providing a custom implementation of this interface. |
4163 |
28 Feb 08 |
nicklas |
</ul> |
4163 |
28 Feb 08 |
nicklas |
47 |
|
4163 |
28 Feb 08 |
nicklas |
<p> |
4163 |
28 Feb 08 |
nicklas |
Before an extension can be used it must be registered with |
7703 |
11 Apr 19 |
nicklas |
{@link Registry#registerExtension(Extension, ClassLoader)}. The extension point that |
4163 |
28 Feb 08 |
nicklas |
the extension extends must of course already be registered in the same |
4163 |
28 Feb 08 |
nicklas |
registry. |
4163 |
28 Feb 08 |
nicklas |
53 |
|
4158 |
22 Feb 08 |
nicklas |
@author nicklas |
4158 |
22 Feb 08 |
nicklas |
@version 2.7 |
4158 |
22 Feb 08 |
nicklas |
@base.modified $Date$ |
4158 |
22 Feb 08 |
nicklas |
57 |
*/ |
4158 |
22 Feb 08 |
nicklas |
58 |
public interface Extension<A extends Action> |
4158 |
22 Feb 08 |
nicklas |
59 |
{ |
4158 |
22 Feb 08 |
nicklas |
60 |
|
4158 |
22 Feb 08 |
nicklas |
61 |
/** |
4158 |
22 Feb 08 |
nicklas |
Get the ID of the extension. |
4158 |
22 Feb 08 |
nicklas |
@return A non-null unique identifier value |
4158 |
22 Feb 08 |
nicklas |
64 |
*/ |
4158 |
22 Feb 08 |
nicklas |
65 |
public String getId(); |
4158 |
22 Feb 08 |
nicklas |
66 |
|
4158 |
22 Feb 08 |
nicklas |
67 |
/** |
4158 |
22 Feb 08 |
nicklas |
Get the ID of the extension point this extension is extending. |
4158 |
22 Feb 08 |
nicklas |
@return A non-null identifier value |
4158 |
22 Feb 08 |
nicklas |
70 |
*/ |
4158 |
22 Feb 08 |
nicklas |
71 |
public String getExtends(); |
4158 |
22 Feb 08 |
nicklas |
72 |
|
4158 |
22 Feb 08 |
nicklas |
73 |
/** |
4170 |
07 Mar 08 |
nicklas |
The extensions in an extension point are by default ordered by their |
4163 |
28 Feb 08 |
nicklas |
index value. Extensions with a low value are ordered before |
4170 |
07 Mar 08 |
nicklas |
extensions with a high value. The ordering may be overridden by providing |
4170 |
07 Mar 08 |
nicklas |
an external {@link ExtensionsFilter} implementation. |
4163 |
28 Feb 08 |
nicklas |
@return The index value |
4158 |
22 Feb 08 |
nicklas |
79 |
*/ |
4163 |
28 Feb 08 |
nicklas |
80 |
public float getIndex(); |
4158 |
22 Feb 08 |
nicklas |
81 |
|
4158 |
22 Feb 08 |
nicklas |
82 |
/** |
4163 |
28 Feb 08 |
nicklas |
Get information about the extensions. This is optional, but |
4163 |
28 Feb 08 |
nicklas |
we recommend that at least some documentation and contact |
4163 |
28 Feb 08 |
nicklas |
information is given. |
4163 |
28 Feb 08 |
nicklas |
@return Optional information about the extension |
4163 |
28 Feb 08 |
nicklas |
87 |
*/ |
4163 |
28 Feb 08 |
nicklas |
88 |
public About getAbout(); |
4163 |
28 Feb 08 |
nicklas |
89 |
|
4163 |
28 Feb 08 |
nicklas |
90 |
/** |
4158 |
22 Feb 08 |
nicklas |
Get the factory class for creating actions. The factory must create |
4158 |
22 Feb 08 |
nicklas |
objects of the same class or a subclass as the {@link ExtensionPoint#getActionClass()} |
4158 |
22 Feb 08 |
nicklas |
method of the extended extension point returns. |
4170 |
07 Mar 08 |
nicklas |
@return An action factory (required) |
4158 |
22 Feb 08 |
nicklas |
95 |
*/ |
4170 |
07 Mar 08 |
nicklas |
96 |
public ActionFactory<? extends A> getActionFactory(); |
4158 |
22 Feb 08 |
nicklas |
97 |
|
4158 |
22 Feb 08 |
nicklas |
98 |
/** |
4158 |
22 Feb 08 |
nicklas |
Get an optional factory class for creating renderers for the actions. |
4158 |
22 Feb 08 |
nicklas |
This factory will only be used if the extension point allows it. |
4158 |
22 Feb 08 |
nicklas |
101 |
|
4158 |
22 Feb 08 |
nicklas |
@return A renderer factory or null |
4158 |
22 Feb 08 |
nicklas |
@see ExtensionPoint#allowRendererOverride() |
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 |
} |