In this section, we will give an overview of the extension points defined by BASE. Most extension points are used in the web client to add buttons and menu items, but there are a few for the core API as well.
Menu items can be added to the top-level
MenuItemAction
The MenuItemAction.getMenuType()
provides support
for MENUITEM
, SUBMENU
and
SEPARATOR
menus. Which of the other properties that
are needed depend on the menu type. Read the javadoc for more information.
This extension point doesn't support custom javascripts or stylesheets and
the rendering is internal (eg. extensions can't provide their own renderers).
BASE ships with two action factories:
FixedMenuItemFactory
PermissionMenuItemFactory
Most toolbars on all list and single-item view pages can
be extended with extra buttons. Actions should implement
the interface: ButtonAction
ToolbarButtonRendererFactory
BASE ships with two action factories:
FixedButtonFactory
PermissionButtonFactory
Most item edit dialogs can be extended with additional tabs.
Actions should implement the interface: TabAction
BASE ships with two action factories:
FixedTabFactory
IncludeContentTabFactory
JspContext.ATTRIBUTE_KEY
.
A JSP or servlet should use this to hook into the current flow. Here is a code example:
// Get the JspContext that was created on the main edit page final JspContext jspContext = (JspContext)request.getAttribute(JspContext.ATTRIBUTE_KEY); // The current item is found in the context. NOTE! Can be null if a new item final BasicItem item = (BasicItem)jspContext.getCurrentItem(); // Get the DbControl and SessionControl used to handle the request (do not close!) final DbControl dc = jspContext.getDbControl(); final SessionControl sc = dc.getSessionControl();
The extra tab need to be paired with an extension that is invoked when
the edit form is saved. Each edit-dialog extension point has a corresponding
on-save extension point. Actions should implement the interface: OnSaveAction
OnSaveAction.onSave()
method is called first, but not until all regular properties have been
updated. If the transaction is committed the OnSaveAction.onCommit()
method is also called, otherwise the OnSaveAction.onRollback()
is called. The onSave()
method can throw an exception that
will be displayed to the user. The other callback method should not throw exceptions
at all, since that may result in undefined behaviour and can be confusing for the user.
The bioassay set listing for an experiment has a Tools
column which can be extended by extensions. This extension point is similar
to the toolbar extension points and actions should implement
the interface: ButtonAction
Note that the list can contain
BioAssaySet
Transformation
ExtraValue
JspContext.getItem()
method to examine the
current item.
The bioassay set page has a tab Overview plots.
The contents of this tab is supposed to be some kind of images
that have been generated from the data in the current bioassay set.
What kind of plots that can be generated typically depends on the
kind of data you have. BASE ships with an extension
(MAPlotFactory
OverviewPlotAction
PlotGenerator
Application.getStaticCache()
to get a
StaticCache
PlotServlet
A service is a piece of code that is loaded when the BASE web
server starts up. The service is then running as long as the BASE web
server is running. It is possible to manually stop and start services.
This extension point is different from most others in that it doesn't
affects the visible interface. Since services are loaded at startup time,
this also means that the context passed to ActionFactory methods will
not have any ClientContext
associated with it
(eg. the InvokationContext.getClientContext()
always return null). There is also no meaning for extensions to specify
a RendererFactory
. Service actions should
implement the interface:
ServiceControllerAction
start()
and
stop()
methods for controlling the service.
BASE doesn't ship with any service, but there is an FTP service
available at the BASE plug-ins site:
http://baseplugins.thep.lu.se/wiki/net.sf.basedb.ftp
This extension point adds support for using external files
in BASE. This is a core extension point and is available
independently of the web client. Actions should implement
the interface:
ConnectionManagerFactory
The getDisplayName()
and getDescription()
methods are used in the gui when a user manually selects which connection
manager to use. The supports(URI)
is used when auto-selecting
a connection manager based on the URI of the resource.
BASE ships with factory that supports HTTP and HTTPS file
references: HttpConnectionManagerFactory
See also
In those cases where files are used to store data instead
of importing it to the database, BASE can use extensions to
check that the supplied files are valid and also to extract
metadata from the files. For example, the
CelValidationAction
Validation and metadata extraction actions should implement
the ValidationAction
This extension point is a bit more complex than most other extension
points. To begin with, the factory class will be called with the
owner of the file set as the current item. Eg. the
ClientContext.getCurrentItem()
should return a
FileStoreEnabled
CelValidationFactory
RawBioAssay
Each file in the file set is then passed to the
ValidationAction.acceptFile(FileSetMember)
which may accept or reject the file. If the file is accepted it may
be accepted for immediate validation or later validation. The latter option
is useful in more complex scenarios were files need to be validated as a group.
If the file is accepted the ValidationAction.validateAndExtractMetadata()
is called, which is were the real work should happen.
The extensions for this extension point is also called when a file is replaced
or removed from the file set. The calling sequence to set up the validation is
more or less the same as described above, but the last step is to
call ValidationAction.resetMetadata()
instead
of ValidationAction.validateAndExtractMetadata()
.