SDF's Site

You are here: start » projects » sdf_irc » help » how_plug-ins_are_loaded

Page Tools

Site Tools

Plug-in Loading

When the program starts it will start the PluginProvider. The PluginProvider will look for the plugins directory which should be in the same directory as the scripts or executable. When it passes over zipped files it'll open them to see if there is a plug-in manifest, this will contain details about the plug-in such as version support, author and so on; it'll also contain where the main class is for the plug-in.

If any of the plug-ins are set to start automatically they will be loaded and started. Otherwise details will be kept, but the plug-in will not get loaded until the plug-in is needed.

  1. Program starts
  2. Get provider and find plug-ins
  3. If plug-ins are set to run and are compatible/pass checks start them.
  4. Other plug-ins are set as stopped.
  5. Plug-ins that are not compatible are marked disabled.

New Plug-in Loading

A redesign to be added in the next few versions.

Start up

  1. The program starts
  2. Plug-in Provider Service gets started
    1. The service searches the plug-in directory, finding each file loading the class defined within the manifest.
    2. It reads the details from the class annotations getting the supported API version.
      1. If the API version is not supported an exception is thrown and the plug-in is disabled.
  3. The program asks for plug-ins that should be started by default.
    1. The plug-in service gets the list from settings.
  4. The program starts each plug-in.

Loading and Starting Plug-ins

  1. A request is put to the Plug-in Provider Service
    1. Once the class is instantiated the settings and descriptor for the class is loaded, from settings or from scratch.
      1. If it is to be created from scratch then plug-in's initSettings() method will be called.
    2. The plug-in's start() method gets called.

Stopping the Plug-in

  1. A request is put to the Plug-in Provider Service
    1. The provider calls the Plug-in's stop() method.
    2. The provider stores the settings of the plug-in descriptor in the settings.
    3. The provider tells the plug-in loader that the classes are unused for that plug-in.
      1. The plug-in loader makes the classes available to be garbage collected.