Class TLcyXMLAddOnLoader
Class that handles the addon loading. It creates addons as specified in an xml-file. The path
to this xml file can be set with the setSourceName(String)
method.
The class names in the <class/>
elements should point to a class
extending ALcyAddOn
. The addon is configured
with the configuration source name with the setConfigSourceName
method, and
plugged in into the Lucy environment.
<addon/>
elements can also have a <priority/>
elements. The contents of the priority element
should be an integer or one of the following strings:
- early, equivalent to the integer value of
ADDON_PRIORITY_EARLY
data_producer
data_consumer
default
late
Addons files can also include other addons files by using a <include/>
element. The addons
listed in the specified file will then be inserted at that point in the addons file. The filenames
specified in this element should be relative to the current working directory or to the classpath.
The structure of the addons.xml file is also specified in the accompanying schema 'addons.xsd'. This schema documents the allowed tags and values. It also contains several more examples of when to use each priority value.
Customizing the add-ons used by your application
Developers of Lucy-based applications typically want to:
- Include a subset of the default Lucy add-ons without any changes to their configuration files while excluding the unwanted add-ons to keep the application lean and usable.
- Include some of the default Lucy add-ons but alter the configuration file
- Include some extensions of the default Lucy add-ons, possibly with a modified configuration file
- Include their own add-ons
The recommended way to do this is to create your own addons.xml
file, which includes the default add-ons,
and modifies them where necessary.
The Lucy developer guide contains an example of this in the chapter "Setup of a Lucy-based development project".
The major benefit of this approach is that it allows you to leave the original addons files untouched, making
it easier to upgrade.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The priority corresponding to the 'data_consumer' value of a <priority/> element.static final int
The priority corresponding to the 'data_producer' value of a <priority/> element.static final int
The priority corresponding to the 'default' value of a <priority/> element.static final int
The priority corresponding to the 'early' value of a <priority/> element.static final int
The priority corresponding to the 'late' value of a <priority/> element. -
Constructor Summary
ConstructorDescriptionCreates a newTLcyXMLAddOnLoader
.TLcyXMLAddOnLoader
(ILcyLucyEnv aLucyEnv, String aSourceName) Creates a newTLcyXMLAddOnLoader
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the lucy environment where the addons are plugged into.Returns the source name of the addons file that will be parsed.boolean
Deprecated.This method has been deprecated.void
This method loads all addons.protected void
Plugs the given addon into the setILcyLucyEnv
.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setLucyEnv
(ILcyLucyEnv aLucyEnv) Sets the lucy environment where the addons are plugged into.void
setSourceName
(String aSourceName) Sets the source name of the addons file that will be parsed.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
Unloads all addons from theILcyLucyEnv
associated with this addon loader.
-
Field Details
-
ADDON_PRIORITY_EARLY
public static final int ADDON_PRIORITY_EARLYThe priority corresponding to the 'early' value of a <priority/> element.- See Also:
-
ADDON_PRIORITY_DATA_PRODUCER
public static final int ADDON_PRIORITY_DATA_PRODUCERThe priority corresponding to the 'data_producer' value of a <priority/> element.- See Also:
-
ADDON_PRIORITY_DATA_CONSUMER
public static final int ADDON_PRIORITY_DATA_CONSUMERThe priority corresponding to the 'data_consumer' value of a <priority/> element.- See Also:
-
ADDON_PRIORITY_DEFAULT
public static final int ADDON_PRIORITY_DEFAULTThe priority corresponding to the 'default' value of a <priority/> element. Also the default priority for addons that don't explicitely declare their priority in aelement. - See Also:
-
ADDON_PRIORITY_LATE
public static final int ADDON_PRIORITY_LATEThe priority corresponding to the 'late' value of a <priority/> element.- See Also:
-
-
Constructor Details
-
TLcyXMLAddOnLoader
public TLcyXMLAddOnLoader()Creates a newTLcyXMLAddOnLoader
. Note that you will have to set the lucy env and source name before using this class.- See Also:
-
TLcyXMLAddOnLoader
Creates a newTLcyXMLAddOnLoader
.- Parameters:
aLucyEnv
- The lucy environment to plug the decoded addons in.aSourceName
- The addons file (xml) where the addons will be loaded from.
-
-
Method Details
-
setClassTraceOn
Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
getLucyEnv
Returns the lucy environment where the addons are plugged into.- Returns:
- the lucy environment where the addons are plugged into.
- See Also:
-
setLucyEnv
Sets the lucy environment where the addons are plugged into.- Parameters:
aLucyEnv
- the lucy environment where the addons are plugged into.- See Also:
-
getSourceName
Returns the source name of the addons file that will be parsed.- Returns:
- the source name of the addons file that will be parsed.
- See Also:
-
setSourceName
Sets the source name of the addons file that will be parsed.- Parameters:
aSourceName
- the source name of the addons file that will be parsed.- See Also:
-
loadAddOns
public void loadAddOns()This method loads all addons. The addons are retrieved from the set source name. The loaded addons are plugged into the setILcyLucyEnv
. -
unLoadAddOns
public void unLoadAddOns()Unloads all addons from theILcyLucyEnv
associated with this addon loader. -
plugAddOn
Plugs the given addon into the setILcyLucyEnv
.- Parameters:
aAddOn
- The addon to plug into lucy env.
-