Class PluginRegistry

  • Direct Known Subclasses:
    DefaultPluginRegistry

    public abstract class PluginRegistry
    extends Object
    Central point where plugins are loaded and handled. The class is abstract and must be personalized as needed. The used implementation can be specified with the 'logicaldoc.app.pluginregistry' system property.
    Since:
    3.0
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • PluginRegistry

        public PluginRegistry()
    • Method Detail

      • init

        public void init​(String pluginsDir)
        Initializes all found plugins
        Parameters:
        pluginsDir - the root folder where the plugins files are located
      • getManager

        public org.java.plugin.PluginManager getManager()
      • getExtensions

        public Collection<org.java.plugin.registry.Extension> getExtensions​(String pluginId,
                                                                            String extensionPoint)
        Returns the extensions connected to the specified extension point
        Parameters:
        pluginId - The plugin identifier
        extensionPoint - The extension point id
        Returns:
        List of connected extensions
      • getSortedExtensions

        public List<org.java.plugin.registry.Extension> getSortedExtensions​(String pluginId,
                                                                            String extensionPoint,
                                                                            String sortingParameter)
        Returns the extensions connected to the specified extension point
        Parameters:
        pluginId - The plugin identifier
        extensionPoint - The extension point id
        sortingParameter - Extensions will be sorted by this parameter (if null 'position' parameter is used)
        Returns:
        List of connected extensions
      • getPlugins

        public Collection<org.java.plugin.registry.PluginDescriptor> getPlugins()
        Retrieves the list of registered plugins
        Returns:
        The list of registered plugins descriptors
      • getPlugin

        public org.java.plugin.registry.PluginDescriptor getPlugin​(String pluginId)
        Retrieve the plugin descriptor
        Parameters:
        pluginId - identifier of the plugin
        Returns:
        The plugin descriptor
      • isRestartRequired

        public boolean isRestartRequired()
      • setRestartRequired

        public void setRestartRequired()
      • getPluginHome

        public static File getPluginHome​(String pluginName)
        This method retrieves the folder of the given plugin. If not exists, it creates the folder. The folder is: conf.plugindir/pluginName
        Parameters:
        pluginName - The plugin name
        Returns:
        the directory used as plugin's home
      • getPluginsDir

        public static File getPluginsDir()
        This method retrieves the plugins root folder. If not exists, it creates the folder. The folder is: conf.plugindir
        Returns:
        root of the plugins data folders
      • getPluginResource

        public static File getPluginResource​(String pluginName,
                                             String path)
        This method retrieves a plugin folder resource (file or folder). If the resource is a folder and not exists, it creates the folder. The folder will be: conf.plugindir/pluginName/path
        Parameters:
        pluginName - The plugin name
        path - The resource path
        Returns:
        the plugin's resource