Class TLcyXMLAddOnLoader

java.lang.Object
com.luciad.lucy.TLcyXMLAddOnLoader

public class TLcyXMLAddOnLoader extends Object

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:

Addons are then loaded in ascending order of priority. This means that addons with a low priority number will be loaded first. If no priority element is present for an addon, the default priority is assumed.

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 Details

    • ADDON_PRIORITY_EARLY

      public static final int ADDON_PRIORITY_EARLY
      The priority corresponding to the 'early' value of a <priority/> element.
      See Also:
    • ADDON_PRIORITY_DATA_PRODUCER

      public static final int ADDON_PRIORITY_DATA_PRODUCER
      The priority corresponding to the 'data_producer' value of a <priority/> element.
      See Also:
    • ADDON_PRIORITY_DATA_CONSUMER

      public static final int ADDON_PRIORITY_DATA_CONSUMER
      The priority corresponding to the 'data_consumer' value of a <priority/> element.
      See Also:
    • ADDON_PRIORITY_DEFAULT

      public static final int ADDON_PRIORITY_DEFAULT
      The priority corresponding to the 'default' value of a <priority/> element. Also the default priority for addons that don't explicitely declare their priority in a element.
      See Also:
    • ADDON_PRIORITY_LATE

      public static final int ADDON_PRIORITY_LATE
      The priority corresponding to the 'late' value of a <priority/> element.
      See Also:
  • Constructor Details

    • TLcyXMLAddOnLoader

      public TLcyXMLAddOnLoader()
      Creates a new TLcyXMLAddOnLoader. Note that you will have to set the lucy env and source name before using this class.
      See Also:
    • TLcyXMLAddOnLoader

      public TLcyXMLAddOnLoader(ILcyLucyEnv aLucyEnv, String aSourceName)
      Creates a new TLcyXMLAddOnLoader.
      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 public static void setClassTraceOn(boolean aClassTraceOn)
      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 is true 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 public void setTraceOn(boolean aTraceOn)
      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 either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false 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 public boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • getLucyEnv

      public ILcyLucyEnv getLucyEnv()
      Returns the lucy environment where the addons are plugged into.
      Returns:
      the lucy environment where the addons are plugged into.
      See Also:
    • setLucyEnv

      public void setLucyEnv(ILcyLucyEnv aLucyEnv)
      Sets the lucy environment where the addons are plugged into.
      Parameters:
      aLucyEnv - the lucy environment where the addons are plugged into.
      See Also:
    • getSourceName

      public String 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

      public void setSourceName(String aSourceName)
      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 set ILcyLucyEnv.
    • unLoadAddOns

      public void unLoadAddOns()
      Unloads all addons from the ILcyLucyEnv associated with this addon loader.
    • plugAddOn

      protected void plugAddOn(ALcyAddOn aAddOn)
      Plugs the given addon into the set ILcyLucyEnv.
      Parameters:
      aAddOn - The addon to plug into lucy env.