Class StorageLocationServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.storage.location.StorageLocationServiceImpl
-
- All Implemented Interfaces:
StorageLocationService
public class StorageLocationServiceImpl extends Object implements StorageLocationService
-
-
Field Summary
Fields Modifier and Type Field Description static String
BUILD_LOGS_DIRECTORY
-
Constructor Summary
Constructors Constructor Description StorageLocationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArtifactDirectoryBuilder
getArtifactDirectoryBuilder(File rootStorageDirectory)
Returns an ArtifactDirectoryBuilder which can be used to buildFile
objects pointing to artifacts stored on the local filesystem.ArtifactPathBuilder
getArtifactPathBuilder(char separatorChar)
Returns an ArtifactPathBuilder which can be used to construct paths to stored artifacts.ArtifactPathBuilder
getArtifactPathBuilder(String rootStoragePath, char separatorChar)
Returns an ArtifactPathBuilder which can be used to construct paths to stored artifacts.File
getBuildDataDirectory(Key key)
Returns the top level build data directory for a plan or deployment project.File
getBuildDownloadDataDirectory(Key key)
Returns the "download data" directory for a plan or deployment project.File
getBuildLogsDirectory(Key key)
Eg.File
getBuildResultsDirectory(Key buildKey)
Eg.@NotNull ArtifactDirectoryBuilder
getDefaultArtifactDirectoryBuilder()
This method will only work on the server, not on remote agents.File
getLogFile(@NotNull ResultKey resultKey, @Nullable String suffix)
Returns the location of the log file for the specified build or deployment.File
getLogFile(Key entityKey, int resultNumber)
Returns the location of the log file for the specified build or deployment.File
getLogFile(Key entityKey, long resultNumber)
Returns the location of the log file for the specified build or deployment.File
getLogFile(ResultKey resultKey)
Returns the location of the log file for the specified build or deployment.String
getLogFileName(@NotNull Key entityKey, int resultNumber)
Returns the standard name of the log file for the specified build or deployment.String
getLogFileName(@NotNull Key entityKey, long resultNumber)
Returns the standard name of the log file for the specified build or deployment.String
getLogFileName(ResultKey resultKey)
Returns the standard name of the log file for the specified build or deployment.List<String>
getLogsFileNames(@NotNull ResultKey resultKey)
Return all log filenames sorted by age (newest first).List<String>
getOldLogsFileNames(@NotNull ResultKey resultKey)
If a result has logs from previous runs, return their filenames sorted by age (newest first).File
getRootBuildDataDirectory()
Returns the root build data directory for all plans and deployment projects.void
renameOldBuildLogsIfNeeded(@NotNull ResultKey resultKey)
Makes sure that build log file for the current result is empty, by renaming any pre-existing build logs.
-
-
-
Field Detail
-
BUILD_LOGS_DIRECTORY
public static final String BUILD_LOGS_DIRECTORY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootBuildDataDirectory
public File getRootBuildDataDirectory()
Description copied from interface:StorageLocationService
Returns the root build data directory for all plans and deployment projects.- Specified by:
getRootBuildDataDirectory
in interfaceStorageLocationService
-
getBuildDataDirectory
public File getBuildDataDirectory(Key key)
Description copied from interface:StorageLocationService
Returns the top level build data directory for a plan or deployment project. This is the common parent directory for storing build and deployment metadata related to the plan or project. Build results and logs are stored in subdirectories under this directory. Eg. ".../xml-data/builds/plan-12345-JOB1/"- Specified by:
getBuildDataDirectory
in interfaceStorageLocationService
-
getBuildResultsDirectory
public File getBuildResultsDirectory(Key buildKey)
Description copied from interface:StorageLocationService
Eg. ".../xml-data/builds/plan-12345-JOB1/results/"- Specified by:
getBuildResultsDirectory
in interfaceStorageLocationService
-
getBuildDownloadDataDirectory
public File getBuildDownloadDataDirectory(Key key)
Description copied from interface:StorageLocationService
Returns the "download data" directory for a plan or deployment project. Eg. ".../xml-data/builds/plan-12345-JOB1/download-data/"- Specified by:
getBuildDownloadDataDirectory
in interfaceStorageLocationService
-
getBuildLogsDirectory
public File getBuildLogsDirectory(Key key)
Description copied from interface:StorageLocationService
Eg. ".../xml-data/builds/plan-12345-JOB1/download-data/build_logs/"- Specified by:
getBuildLogsDirectory
in interfaceStorageLocationService
-
getLogFileName
public String getLogFileName(@NotNull @NotNull Key entityKey, int resultNumber)
Description copied from interface:StorageLocationService
Returns the standard name of the log file for the specified build or deployment.- Specified by:
getLogFileName
in interfaceStorageLocationService
-
getLogFileName
public String getLogFileName(@NotNull @NotNull Key entityKey, long resultNumber)
Description copied from interface:StorageLocationService
Returns the standard name of the log file for the specified build or deployment.- Specified by:
getLogFileName
in interfaceStorageLocationService
-
getLogFileName
public String getLogFileName(ResultKey resultKey)
Description copied from interface:StorageLocationService
Returns the standard name of the log file for the specified build or deployment.- Specified by:
getLogFileName
in interfaceStorageLocationService
-
getLogFile
public File getLogFile(Key entityKey, int resultNumber)
Description copied from interface:StorageLocationService
Returns the location of the log file for the specified build or deployment.- Specified by:
getLogFile
in interfaceStorageLocationService
-
getLogFile
public File getLogFile(Key entityKey, long resultNumber)
Description copied from interface:StorageLocationService
Returns the location of the log file for the specified build or deployment.- Specified by:
getLogFile
in interfaceStorageLocationService
-
getLogFile
public File getLogFile(ResultKey resultKey)
Description copied from interface:StorageLocationService
Returns the location of the log file for the specified build or deployment.- Specified by:
getLogFile
in interfaceStorageLocationService
-
getLogFile
public File getLogFile(@NotNull @NotNull ResultKey resultKey, @Nullable @Nullable String suffix)
Description copied from interface:StorageLocationService
Returns the location of the log file for the specified build or deployment. Optional suffix parameter allows getting logs from previous runs.- Specified by:
getLogFile
in interfaceStorageLocationService
-
renameOldBuildLogsIfNeeded
public void renameOldBuildLogsIfNeeded(@NotNull @NotNull ResultKey resultKey)
Description copied from interface:StorageLocationService
Makes sure that build log file for the current result is empty, by renaming any pre-existing build logs.- Specified by:
renameOldBuildLogsIfNeeded
in interfaceStorageLocationService
-
getOldLogsFileNames
public List<String> getOldLogsFileNames(@NotNull @NotNull ResultKey resultKey)
Description copied from interface:StorageLocationService
If a result has logs from previous runs, return their filenames sorted by age (newest first). See alsoStorageLocationService.renameOldBuildLogsIfNeeded(ResultKey)
- Specified by:
getOldLogsFileNames
in interfaceStorageLocationService
-
getLogsFileNames
public List<String> getLogsFileNames(@NotNull @NotNull ResultKey resultKey)
Description copied from interface:StorageLocationService
Return all log filenames sorted by age (newest first).- Specified by:
getLogsFileNames
in interfaceStorageLocationService
-
getDefaultArtifactDirectoryBuilder
@NotNull public @NotNull ArtifactDirectoryBuilder getDefaultArtifactDirectoryBuilder()
This method will only work on the server, not on remote agents.- Specified by:
getDefaultArtifactDirectoryBuilder
in interfaceStorageLocationService
-
getArtifactPathBuilder
public ArtifactPathBuilder getArtifactPathBuilder(String rootStoragePath, char separatorChar)
Description copied from interface:StorageLocationService
Returns an ArtifactPathBuilder which can be used to construct paths to stored artifacts. This version of the method takes a rootArtifactPath parameter, returning an instance that builds absolute paths.- Specified by:
getArtifactPathBuilder
in interfaceStorageLocationService
-
getArtifactPathBuilder
public ArtifactPathBuilder getArtifactPathBuilder(char separatorChar)
Description copied from interface:StorageLocationService
Returns an ArtifactPathBuilder which can be used to construct paths to stored artifacts. This version of the method returns an instance that builds relative paths, not absolute paths. All the paths produced by this builder must be appended to a root artifact storage location before being used to locate artifacts.- Specified by:
getArtifactPathBuilder
in interfaceStorageLocationService
-
getArtifactDirectoryBuilder
public ArtifactDirectoryBuilder getArtifactDirectoryBuilder(File rootStorageDirectory)
Description copied from interface:StorageLocationService
Returns an ArtifactDirectoryBuilder which can be used to buildFile
objects pointing to artifacts stored on the local filesystem. This version of the method takes a rootArtifactDirectory parameter.- Specified by:
getArtifactDirectoryBuilder
in interfaceStorageLocationService
-
-