Class PluginDirectoryProvider

java.lang.Object
com.mwdle.bitwarden.PluginDirectoryProvider

public final class PluginDirectoryProvider extends Object
A thread-safe utility class for providing a stable, dedicated data directory for the plugin.

This class ensures that all plugin data (such as the downloaded CLI, cache files, and CLI configuration) is stored in a consistent location within the Jenkins home directory. It uses a double-checked locking pattern to efficiently find and create this directory only once.

  • Method Details

    • getPluginDataDirectory

      public static File getPluginDataDirectory()
      Gets the single, stable data directory for this plugin.

      On the first call, this method will find or create the directory $JENKINS_HOME/bitwarden-credentials-provider-data and cache the path for all subsequent calls. The lookup and creation are performed in a thread-safe manner.

      Returns:
      The File object representing the plugin's data directory.
      Throws:
      RuntimeException - if the directory cannot be created, which may indicate a file permissions issue.