public interface FileSystemService
| Modifier and Type | Method and Description |
|---|---|
boolean |
areHashesBetweenFilesEqual(byte[] fileContentA,
byte[] fileContentB) |
boolean |
areHashesBetweenFilesEqual(Path fileA,
Path fileB) |
void |
checkEnoughUsableSpace(Path oldMule,
Path newMule,
List<Path> paths)
Validates whether there is potentially enough writable space on the file system for the upgrade.
|
void |
checkIsADirectory(Path path)
Checks whether a given path corresponds to a directory.
|
void |
checkReadingAccess(Path parentPath,
List<Path> relativePaths)
Checks whether the JVM has reading access to all file trees determined by the given relative paths when resolved against the
given parent path.
|
void |
checkWritingAccess(Path parentPath,
List<Path> relativePaths)
Check whether the JVM has writing access to all file trees determined by the given relative paths when resolved against the
given parent path.
|
void |
copyFile(File source,
File dest,
boolean isDryRunMode)
Copy the file from the given source file to the destination file.
|
void |
copyFiles(Path srcDir,
Path destDir,
List<Path> paths,
List<Path> excludedPaths,
boolean isDryRunMode)
Recursively copy all the files and directories determined by the given relative paths from the given source directory to the
given destination directory.
|
void |
copyFilesInsideADistro(Path sourceMuleDistroPath,
Path destMuleDistroPath,
List<String> fileNamesList,
boolean isDryRunMode)
Copies a list of files from a Mule Runtime Distribution to another.
|
void |
deleteFilesInsideADistro(Path distroPath,
List<String> fileNamesList,
boolean isDryRunMode)
Deletes a list of files from a Mule Runtime Distribution.
|
void |
deleteUpgradeFolderIfEmpty(Path muleHome,
boolean dryRun)
Deletes the upgrade-tool folder inside a distro if the folder is empty to try to clean the environment after an upgrade or a
backup
|
boolean |
isWindowsOs()
Checks whether the underlying OS is Windows.
|
void checkIsADirectory(Path path) throws NotDirectoryException
path - the path to an expected directory.NotDirectoryException - if given path is not a directory.void checkWritingAccess(Path parentPath, List<Path> relativePaths) throws IOException
parentPath - the parent path which is used for resolving the relative paths.relativePaths - list of all paths whose underlying tree will be validated for writing access.AccessDeniedException - if any path does not have writing accessibility.IOException - if any I/O error occurs.void checkReadingAccess(Path parentPath, List<Path> relativePaths) throws IOException
parentPath - the parent path which is used for resolving the relative paths.relativePaths - list of all paths whose underlying tree will be validated for reading access.AccessDeniedException - if any path does not have reading accessibility.IOException - if any I/O error occurs.void checkEnoughUsableSpace(Path oldMule, Path newMule, List<Path> paths) throws IOException
oldMule - the directory where the old Mule distro is located.newMule - the directory where the new Mule distro is located.paths - the relative paths of files involved in the upgrade process.{@link - IOException} In case of not finding enough usable space.IOExceptionboolean isWindowsOs()
void copyFiles(Path srcDir, Path destDir, List<Path> paths, List<Path> excludedPaths, boolean isDryRunMode) throws IOException
srcDir - the directory where the files will be copied from.destDir - the directory where the files will be copied to.paths - the relative paths that will be resolved against the source dir for copying them to the destination
directory.excludedPaths - the relative paths that will be resolved against the source dir which are going to be excluded when
copying them to the destination directory.isDryRunMode - if isDryRunMode is true, the method logs in debug level the files and directories that would be copied
without actually copying them.IOException - if any I/O error occurs.void copyFile(File source, File dest, boolean isDryRunMode) throws IOException
source - the source file.dest - the destination file where it will be copied to.isDryRunMode - if isDryRunMode is true, the method logs in trace level the files and directories that would be copied
without actually copying them.IOException - if any I/O error occurs.void copyFilesInsideADistro(Path sourceMuleDistroPath, Path destMuleDistroPath, List<String> fileNamesList, boolean isDryRunMode) throws IOException
sourceMuleDistroPath - New Mule Runtime Distribution.destMuleDistroPath - Old Mule Runtime Distribution.fileNamesList - List of files names.isDryRunMode - Dry Run Mode flag.IOException - IOException.void deleteFilesInsideADistro(Path distroPath, List<String> fileNamesList, boolean isDryRunMode) throws IOException
distroPath - Current Mule Runtime Distribution.fileNamesList - List of files names.isDryRunMode - Dry Run Mode flag.IOException - IOException.boolean areHashesBetweenFilesEqual(Path fileA, Path fileB) throws IOException
fileA - First file to compare the sha256fileB - Second file to compare the sha256IOException - IOException.boolean areHashesBetweenFilesEqual(byte[] fileContentA,
byte[] fileContentB)
throws IOException
fileContentA - First byte[] to compare the sha256fileContentB - Second byte[] to compare the sha256IOException - IOException.void deleteUpgradeFolderIfEmpty(Path muleHome, boolean dryRun) throws IOException
muleHome - Mule Home path where it is going to try to delete the empty upgrade-tool folderdryRun - Dry Run flag, if is in true don't delete the folder and only do the loggingIOException - IOException.Copyright © 2022 MuleSoft, Inc.. All rights reserved.