|
Lobo Browser Plugin HOWTO
Lobo can be extended via plugins written in
Java (or a language compiled to .class files).
Extensible Features
Since version 0.97 of Lobo, the browser can be
extended in the following ways.
- Alteration of browser window: Addition and modification
of top-level menues, address bar components, tool bars,
and status bar components.
- Clientlet selectors: You can add handlers
(clientlets)
for various content types. This can be leveraged
to have Lobo render UI languages other than
HTML. The HTML and JavaFX rendering capabilities of Lobo are
implemented as clientlets.
- URL protocol stream handlers: You can add
protocol handler factories for protocols other
than HTTP, FTP, etc.
- Events: You can add listeners for various browser
navigation and error events.
API
Lobo extensions have access to the standard Java API, plus the
Lobo Clientlet and Extensions API.
The JAR file that accompanies this API is lobo-pub.jar, which
is found in the installation directory of the Lobo browser.
Extensions are required to implement
the NavigatorExtension interface.
Packaging
Extensions are packaged as JAR files, with the peculiarty that
the root level of the JAR file must include an entry
named lobo-extension.properties definining
the following properties.
- extension.class: The fully-qualified name of a class
that implements NavigatorExtension.
- extension.name: The name of the extension.
- extension.description: A description of the extension.
- extension.version: The version of the extension.
- extension.priority: The priority of the extension, which
is a number from 0 to 9.
Installation
As of version 0.97 of Lobo, extension JAR files are installed
by copying them into the ext directory that is
found in a Lobo installation.
Separate library JAR files that the extension relies on can
be copied into the ext directory as well.
Each extension JAR file is loaded by a separate class loader.
Libraries in the ext directory (i.e. JAR files
without a lobo-extension.properties file) are
all loaded by a single class loader that is the parent of all
extension class loaders.
For testing purposes, the ext directory may also
contain directories in place of JAR files.
Extension Priority
Each extension has a priority, which is a number from 0 to 9, as specified
by the extension.priority property in lobo-extension.properties.
The primary browser extension (identified as a JAR file whose
name is primary.jar) is allowed to have a priority of 10.
The primary extension in Lobo is in charge of rendering HTML, images, processing
downloads, showing most of the browser GUI, implementing all default menues, etc.
The API documentation indicates how priorities are used by different facilities.
Initialization Sequence
When Lobo starts up, it looks for extension JAR files by scanning
the ext directory. The class specified by the
extension.class property in lobo-extensions.properties
is loaded, and its init() method executed.
At this point the extension can register clientlet selectors, custom protocol handlers or add listeners for
generic browser events.
Execution of the init() method can occur in any thread, and several
extensions could have their init() methods execute concurrently.
When a Lobo window is about to be opened, the
windowOpening()
method is called. At this point, the extension can add menues, toolbars and other components
to the browser window. Lobo invokes the windowOpening() method sequentially in
order of descending extension priority.
It is possible for one extension
to look up a menu added by a previously initialized extension, and add menu items to it.
There is a standard identification convention for Lobo menues,
as explained in the
getMenu()
documentation.
When a Lobo window is about to be closed, the
windowClosing()
method is called.
Licensing Note
While the Lobo browser and its API are released under the GPL license, and Cobra
is released under a LGPL license, the clientlet and extensions API (lobo-pub.jar)
is released under a FreeBSD style license. The FreeBSD license is
a permissive license that is compatible with the GPL according to
the FSF.
Note that the clientlet and extensions API is not dependent
on any other part of the Lobo Project. Instead, the Lobo browser is
an "implementor" of the API.
See Also
External Links
Support The Project
|