Package dev.getelements.elements.rt.git
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.-
Field Summary
Fields inherited from interface dev.getelements.elements.sdk.cluster.ApplicationAssetLoader
ELEMENT_STORAGEFields inherited from interface dev.getelements.elements.rt.git.GitApplicationAssetLoader
DEFAULT_MAIN_BRANCH, GIT_SUFFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAssetPath(ApplicationId applicationId) Gets the assetPathfor the suppliedApplicationId, performing any loading as needed.static FilegetBareStorageDirectory(File parent, ApplicationId applicationId) Used by theGitApplicationAssetLoaderinstances to determine the bare storage directory for a particularApplicationId.voidperformInGit(ApplicationId applicationId, BiConsumer<org.eclipse.jgit.api.Git, Path> gitConsumer) Opens aGitinstance for the suppliedApplicationIdwhich can be used to manipulate the various files within the repository.voidsetGitStorageDirectory(File gitStorageDirectory) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.getelements.elements.sdk.cluster.ApplicationAssetLoader
getAssetPathMethods inherited from interface dev.getelements.elements.rt.git.GitApplicationAssetLoader
performInGit
-
Constructor Details
-
FilesystemGitApplicationAssetLoader
public FilesystemGitApplicationAssetLoader()
-
-
Method Details
-
getBareStorageDirectory
Used by theGitApplicationAssetLoaderinstances to determine the bare storage directory for a particularApplicationId. This derives the path in a unique and consistent manner.- Parameters:
parent- the parent directory as expressed by aFileapplicationId- theApplicationId- Returns:
- a
Filerepresenting the bare storage directory for theApplicationId
-
performInGit
public void performInGit(ApplicationId applicationId, BiConsumer<org.eclipse.jgit.api.Git, Path> gitConsumer) Description copied from interface:GitApplicationAssetLoaderOpens aGitinstance for the suppliedApplicationIdwhich can be used to manipulate the various files within the repository. When call returns the suppliedGitinstance will be closed.- Specified by:
performInGitin interfaceGitApplicationAssetLoader- Parameters:
applicationId- theApplicationIdfor which to open aGitinstancegitConsumer- consumes an instance ofGitwhich will be used to perform the desired actions
-
getAssetPath
Description copied from interface:ApplicationAssetLoaderGets the assetPathfor the suppliedApplicationId, performing any loading as needed. The returnedPathwill be a location on disk from which to load the application's executable code.- Specified by:
getAssetPathin interfaceApplicationAssetLoader- Parameters:
applicationId- theApplicationIdinstance- Returns:
- the
Pathto the loaded asset
-
getGitStorageDirectory
-
setGitStorageDirectory
-