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_STORAGE
Fields 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 assetPath
for the suppliedApplicationId
, performing any loading as needed.static File
getBareStorageDirectory
(File parent, ApplicationId applicationId) Used by theGitApplicationAssetLoader
instances to determine the bare storage directory for a particularApplicationId
.void
performInGit
(ApplicationId applicationId, BiConsumer<org.eclipse.jgit.api.Git, Path> gitConsumer) Opens aGit
instance for the suppliedApplicationId
which can be used to manipulate the various files within the repository.void
setGitStorageDirectory
(File gitStorageDirectory) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.getelements.elements.sdk.cluster.ApplicationAssetLoader
getAssetPath
Methods inherited from interface dev.getelements.elements.rt.git.GitApplicationAssetLoader
performInGit
-
Constructor Details
-
FilesystemGitApplicationAssetLoader
public FilesystemGitApplicationAssetLoader()
-
-
Method Details
-
getBareStorageDirectory
Used by theGitApplicationAssetLoader
instances 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 aFile
applicationId
- theApplicationId
- Returns:
- a
File
representing the bare storage directory for theApplicationId
-
performInGit
public void performInGit(ApplicationId applicationId, BiConsumer<org.eclipse.jgit.api.Git, Path> gitConsumer) Description copied from interface:GitApplicationAssetLoader
Opens aGit
instance for the suppliedApplicationId
which can be used to manipulate the various files within the repository. When call returns the suppliedGit
instance will be closed.- Specified by:
performInGit
in interfaceGitApplicationAssetLoader
- Parameters:
applicationId
- theApplicationId
for which to open aGit
instancegitConsumer
- consumes an instance ofGit
which will be used to perform the desired actions
-
getAssetPath
Description copied from interface:ApplicationAssetLoader
Gets the assetPath
for the suppliedApplicationId
, performing any loading as needed. The returnedPath
will be a location on disk from which to load the application's executable code.- Specified by:
getAssetPath
in interfaceApplicationAssetLoader
- Parameters:
applicationId
- theApplicationId
instance- Returns:
- the
Path
to the loaded asset
-
getGitStorageDirectory
-
setGitStorageDirectory
-