Class ConfluencePluginUtils


  • public class ConfluencePluginUtils
    extends Object
    • Field Detail

      • PARENT_DIRECTORY_PROPERTY_KEY

        public static final String PARENT_DIRECTORY_PROPERTY_KEY
        Setting this system property will place all the plugin system's directories in a particular parent directory in confluence-home. This is used by the continuous deployment system (internal to Atlassian) to ensure that bringing up a new Confluence instance does not conflict with the plugin working directories of the previous instance. It is not meant for use in general production.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ConfluencePluginUtils

        public ConfluencePluginUtils()
    • Method Detail

      • instantiatePluginModule

        public static <T> T instantiatePluginModule​(com.atlassian.plugin.Plugin plugin,
                                                    Class<T> cls)
        Instantiates a plugin module. First tries to let the plugin autowire the class, if ContainerManagedPlugin is implemented, otherwise falls back to creation and autowiring by the internal Spring container.
        Parameters:
        plugin - The plugin that contains the module
        cls - The class to instantiate and autowire
        Returns:
        The created and autowired object
      • getPluginsBaseDirectory

        public static File getPluginsBaseDirectory​(String homeLocation)
      • createDirectoryIfDoesntExist

        public static File createDirectoryIfDoesntExist​(File directory)
        Create a directory if there is no directory, otherwise do nothing. Consider using commons.io.FileUtils.forceMkdir() instead as it has more explicit error handling.
        Parameters:
        directory - the directory to create.
        Returns:
        the file object that was passed in.
        Throws:
        com.atlassian.core.exception.InfrastructureException - if a directory could not be created at that location