Class FilesystemGitApplicationAssetLoader

java.lang.Object
dev.getelements.elements.rt.git.FilesystemGitApplicationAssetLoader
All Implemented Interfaces:
GitApplicationAssetLoader, ApplicationAssetLoader

public class FilesystemGitApplicationAssetLoader extends Object implements GitApplicationAssetLoader
A special class which will load an ApplicationId's code to a local temporary directory where it can be processed and run. The source of the Repository is a path on the file system, and therefore it clones from a git repository stored elsewhere on disk. This is specified using the FileSystemScriptStorageGitLoaderProvider.ELEMENT_STORAGE_DIRECTORY configuration parameter. Note that the GitApplicationAssetLoader interface essentially calls for unpacking of the ApplicationId code to a local directory. The designation "Filesystem" refers to the source of the repository as opposed to the id of the working directory. Created by patricktwohig on 8/19/17.
  • Constructor Details

    • FilesystemGitApplicationAssetLoader

      public FilesystemGitApplicationAssetLoader()
  • Method Details

    • getBareStorageDirectory

      public static File getBareStorageDirectory(File parent, ApplicationId applicationId)
      Used by the GitApplicationAssetLoader instances to determine the bare storage directory for a particular ApplicationId. This derives the path in a unique and consistent manner.
      Parameters:
      parent - the parent directory as expressed by a File
      applicationId - the ApplicationId
      Returns:
      a File representing the bare storage directory for the ApplicationId
    • performInGit

      public void performInGit(ApplicationId applicationId, BiConsumer<org.eclipse.jgit.api.Git,Path> gitConsumer)
      Description copied from interface: GitApplicationAssetLoader
      Opens a Git instance for the supplied ApplicationId which can be used to manipulate the various files within the repository. When call returns the supplied Git instance will be closed.
      Specified by:
      performInGit in interface GitApplicationAssetLoader
      Parameters:
      applicationId - the ApplicationId for which to open a Git instance
      gitConsumer - consumes an instance of Git which will be used to perform the desired actions
    • getAssetPath

      public Path getAssetPath(ApplicationId applicationId)
      Description copied from interface: ApplicationAssetLoader
      Gets the asset Path for the supplied ApplicationId, performing any loading as needed. The returned Path will be a location on disk from which to load the application's executable code.
      Specified by:
      getAssetPath in interface ApplicationAssetLoader
      Parameters:
      applicationId - the ApplicationId instance
      Returns:
      the Path to the loaded asset
    • getGitStorageDirectory

      public File getGitStorageDirectory()
    • setGitStorageDirectory

      public void setGitStorageDirectory(File gitStorageDirectory)