src/core/net/sf/basedb/util/extensions/ExtensionPoint.java

Code
Comments
Other
Rev Date Author Line
4158 22 Feb 08 nicklas 1 /**
4207 04 Apr 08 nicklas 2   $Id:ExtensionPoint.java 4187 2008-03-20 11:15:25Z nicklas $
4158 22 Feb 08 nicklas 3
4158 22 Feb 08 nicklas 4   Copyright (C) Authors contributing to this file.
4158 22 Feb 08 nicklas 5
4158 22 Feb 08 nicklas 6   This file is part of BASE - BioArray Software Environment.
4158 22 Feb 08 nicklas 7   Available at http://base.thep.lu.se/
4158 22 Feb 08 nicklas 8
4158 22 Feb 08 nicklas 9   BASE is free software; you can redistribute it and/or
4158 22 Feb 08 nicklas 10   modify it under the terms of the GNU General Public License
4479 05 Sep 08 jari 11   as published by the Free Software Foundation; either version 3
4158 22 Feb 08 nicklas 12   of the License, or (at your option) any later version.
4158 22 Feb 08 nicklas 13
4158 22 Feb 08 nicklas 14   BASE is distributed in the hope that it will be useful,
4158 22 Feb 08 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
4158 22 Feb 08 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4158 22 Feb 08 nicklas 17   GNU General Public License for more details.
4158 22 Feb 08 nicklas 18
4158 22 Feb 08 nicklas 19   You should have received a copy of the GNU General Public License
4515 11 Sep 08 jari 20   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 28   An extension point is a place, defined by a client application, that
4158 22 Feb 08 nicklas 29   can be extended. Each extension point is identified by an ID which
4158 22 Feb 08 nicklas 30   must be unique. We recommend that ID:s are generated in the same
4158 22 Feb 08 nicklas 31   way as Java package names. An extension point must also define
4158 22 Feb 08 nicklas 32   what kind of {@link Action} it is possible to add to it. This
4158 22 Feb 08 nicklas 33   is done with the {@link #getActionClass()}. It is also possible
4158 22 Feb 08 nicklas 34   to define a default render class and if an extension is allowed
4158 22 Feb 08 nicklas 35   to override it or not.
4163 28 Feb 08 nicklas 36   
4163 28 Feb 08 nicklas 37   <p>
4163 28 Feb 08 nicklas 38   Extension points can, for example, be created:
4163 28 Feb 08 nicklas 39   <ul>
4163 28 Feb 08 nicklas 40   <li>Programmatically, using {@link ExtensionPointBean} object
4163 28 Feb 08 nicklas 41   <li>Loaded from extension definition XML files using a {@link XmlLoader}.
4163 28 Feb 08 nicklas 42   <li>Or, in any other way by providing a custom implementation of this interface
4163 28 Feb 08 nicklas 43   </ul>
4158 22 Feb 08 nicklas 44
4163 28 Feb 08 nicklas 45   <p>
4163 28 Feb 08 nicklas 46   Before extension points can be used the must be registered with
7703 11 Apr 19 nicklas 47   {@link Registry#registerExtensionPoint(ExtensionPoint, ClassLoader)}. Extensions to
4163 28 Feb 08 nicklas 48   an extension point are registered in the same registry with 
7703 11 Apr 19 nicklas 49   {@link Registry#registerExtension(Extension, ClassLoader)}. To load and use all
4170 07 Mar 08 nicklas 50   registered extensions use 
4207 04 Apr 08 nicklas 51   {@link Registry#useExtensions(ClientContext, ExtensionsFilter, String...)}.
4163 28 Feb 08 nicklas 52
4158 22 Feb 08 nicklas 53   @author nicklas
4158 22 Feb 08 nicklas 54   @version 2.7
4207 04 Apr 08 nicklas 55   @base.modified $Date:2008-03-20 12:15:25 +0100 (Thu, 20 Mar 2008) $
4163 28 Feb 08 nicklas 56   @see ExtensionPointBean
4163 28 Feb 08 nicklas 57   @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 63     Get the ID of the extension point.
4158 22 Feb 08 nicklas 64     @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 69     Get the name of the extension point. This is just for display
4168 04 Mar 08 nicklas 70     purposes and the value is optional. If no name is given the
4168 04 Mar 08 nicklas 71     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 76     Get a description of the extension point. This value is optional
4158 22 Feb 08 nicklas 77     but we recommend that the description contains a text documenting
4158 22 Feb 08 nicklas 78     the extension point and has information that is useful for everyone
4158 22 Feb 08 nicklas 79     who wants to implement extensions for the extension point. 
4158 22 Feb 08 nicklas 80     This should include context specific information.
4158 22 Feb 08 nicklas 81     @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 86     Get the class object that represents the type of action that
4158 22 Feb 08 nicklas 87     can be added to this extension point. The class must implement
4158 22 Feb 08 nicklas 88     the {@link Action} interface. Extensions that are extending this
4158 22 Feb 08 nicklas 89     extension point must provide an {@link ActionFactory} that is capable
4158 22 Feb 08 nicklas 90     of creating instances of the specified class.
4170 07 Mar 08 nicklas 91     
4158 22 Feb 08 nicklas 92     @return The class of the actions that can be used on this extension point
4170 07 Mar 08 nicklas 93       (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 98     This is an optional factory for creating {@link Renderer} 
4158 22 Feb 08 nicklas 99     instances. Renderers are not a required part of the extension 
4158 22 Feb 08 nicklas 100     system, but will make it easier to write the code for extension
4158 22 Feb 08 nicklas 101     points.
4158 22 Feb 08 nicklas 102     
4158 22 Feb 08 nicklas 103     @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 108     If an extension is allowed to override the renderer factory with an
4158 22 Feb 08 nicklas 109     implementation of its own. This can be seen as a possibility where
4158 22 Feb 08 nicklas 110     extensions can create their own look and feel. If strict compliance is
4158 22 Feb 08 nicklas 111     needed overriding should of course not be allowed.
4158 22 Feb 08 nicklas 112     @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 117     Get the error handler factory that should be used with this
5486 12 Nov 10 nicklas 118     extension point. 
5486 12 Nov 10 nicklas 119     @return An error handler factory, or null to use the system default
5486 12 Nov 10 nicklas 120     @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 }