Package org.pf4j

Class AbstractExtensionFinder

    • Field Detail

      • log

        private static final org.slf4j.Logger log
      • entries

        protected volatile java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> entries
      • extensionInfos

        protected volatile java.util.Map<java.lang.String,​ExtensionInfo> extensionInfos
      • checkForExtensionDependencies

        protected java.lang.Boolean checkForExtensionDependencies
    • Constructor Detail

      • AbstractExtensionFinder

        public AbstractExtensionFinder​(PluginManager pluginManager)
    • Method Detail

      • readPluginsStorages

        public abstract java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> readPluginsStorages()
      • readClasspathStorages

        public abstract java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> readClasspathStorages()
      • find

        public <T> java.util.List<ExtensionWrapper<T>> find​(java.lang.Class<T> type)
        Description copied from interface: ExtensionFinder
        Retrieves a list with all extensions found for an extension point.
        Specified by:
        find in interface ExtensionFinder
      • find

        public <T> java.util.List<ExtensionWrapper<T>> find​(java.lang.Class<T> type,
                                                            java.lang.String pluginId)
        Description copied from interface: ExtensionFinder
        Retrieves a list with all extensions found for an extension point and a plugin.
        Specified by:
        find in interface ExtensionFinder
      • findClassNames

        public java.util.Set<java.lang.String> findClassNames​(java.lang.String pluginId)
        Description copied from interface: ExtensionFinder
        Retrieves a list with all extension class names found for a plugin.
        Specified by:
        findClassNames in interface ExtensionFinder
      • isCheckForExtensionDependencies

        public final boolean isCheckForExtensionDependencies()
        Returns true, if the extension finder checks extensions for its required plugins. This feature has to be enabled, in order check the availability of Extension.plugins() configured by an extension.

        This feature is enabled by default, if at least one available plugin makes use of optional plugin dependencies. Those optional plugins might not be available at runtime. Therefore any extension is checked by default against available plugins before its instantiation.

        Notice: This feature requires the optional ASM library to be available on the applications classpath.

        Returns:
        true, if the extension finder checks extensions for its required plugins
      • setCheckForExtensionDependencies

        public void setCheckForExtensionDependencies​(boolean checkForExtensionDependencies)
        Plugin developers may enable / disable checks for required plugins of an extension. This feature has to be enabled, in order check the availability of Extension.plugins() configured by an extension.

        This feature is enabled by default, if at least one available plugin makes use of optional plugin dependencies. Those optional plugins might not be available at runtime. Therefore any extension is checked by default against available plugins before its instantiation.

        Notice: This feature requires the optional ASM library to be available on the applications classpath.

        Parameters:
        checkForExtensionDependencies - true to enable checks for optional extensions, otherwise false
      • debugExtensions

        protected void debugExtensions​(java.util.Set<java.lang.String> extensions)
      • readStorages

        private java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> readStorages()
      • getEntries

        private java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getEntries()
      • getExtensionInfo

        private ExtensionInfo getExtensionInfo​(java.lang.String className,
                                               java.lang.ClassLoader classLoader)
        Returns the parameters of an Extension annotation without loading the corresponding class into the class loader.
        Parameters:
        className - name of the class, that holds the requested Extension annotation
        classLoader - class loader to access the class
        Returns:
        the contents of the Extension annotation or null, if the class does not have an Extension annotation
      • createExtensionWrapper

        private ExtensionWrapper createExtensionWrapper​(java.lang.Class<?> extensionClass)
      • findExtensionAnnotation

        private Extension findExtensionAnnotation​(java.lang.Class<?> clazz)
      • checkDifferentClassLoaders

        private void checkDifferentClassLoaders​(java.lang.Class<?> type,
                                                java.lang.Class<?> extensionClass)