Package com.smeup.kokos.sdk.util
Class SourceManager
java.lang.Object
com.smeup.kokos.sdk.util.SourceManager
- Author:
- mattia.bonardi
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanupFolderRecursively(Path basePath, String folder) Cleans up a folder recursively by deleting all files and directories under the specified folder name, starting from the base directory.static voidcleanUpTemporaryEnvironmentFiles(String environmentName) Clean up the kokos tmp folderstatic voidcopyAndPasteResource(String resourceFileName, Path targetPath) Copy and paste resource if it doesn't existstatic voiddeleteDirectoryRecursively(Path directory) Delete a folder recursively.static PathfindFilePath(Map<String, SourceLibrary> libs, Path filePath) Find a specified file inside a list of libs.static PathfindFilePathInResources(Path filePath) Find a specified file inside resources.static InputStreamgetFileAsStream(Map<String, SourceLibrary> libs, Path filePath) Find file and return the relative InputStreamstatic StringgetFileFromResource(String resourceFilePath) Return the content of a file located into resourcesstatic InputStreamgetFileFromResourceAsStream(Path filePath) Return the content of a file located into resourcesstatic PathgetFilePathFromResource(String resourceFilePath) Return the path of a file located into resourcesstatic Path[]List all files in a folderlistFilesNamesInResourceFolder(Path folderPath, String ext)
-
Field Details
-
SCP_SCH_EXT
- See Also:
-
SCP_SET_EXT
- See Also:
-
SCP_LAY_EXT
- See Also:
-
SCP_CLO_EXT
- See Also:
-
RPGLE_EXT
- See Also:
-
RPGLE_COMPILED_EXT
- See Also:
-
RELOAD_METADATA_EXT
- See Also:
-
CLASS
- See Also:
-
-
Constructor Details
-
SourceManager
public SourceManager()
-
-
Method Details
-
listFiles
List all files in a folder- Parameters:
path-- Returns:
- Throws:
IOException
-
getFileAsStream
public static InputStream getFileAsStream(Map<String, SourceLibrary> libs, Path filePath) throws ExceptionFind file and return the relative InputStream- Parameters:
libs-filePath-- Returns:
- InputStream
- Throws:
Exception- if file isn't found
-
findFilePath
Find a specified file inside a list of libs. Return null if file not exists- Parameters:
libs-filePath-- Returns:
- Path
-
findFilePathInResources
Find a specified file inside resources. Return null if file not exists- Parameters:
filePath-- Returns:
- Path
-
copyAndPasteResource
public static void copyAndPasteResource(String resourceFileName, Path targetPath) throws IOException, URISyntaxException Copy and paste resource if it doesn't exist- Parameters:
resourceFileName-targetPath-- Throws:
IOExceptionURISyntaxException
-
getFileFromResource
public static String getFileFromResource(String resourceFilePath) throws URISyntaxException, IOException Return the content of a file located into resources- Parameters:
resourceFilePath-- Returns:
- the content of the file as string
- Throws:
URISyntaxExceptionIOException
-
getFilePathFromResource
public static Path getFilePathFromResource(String resourceFilePath) throws URISyntaxException, IOException Return the path of a file located into resources- Parameters:
resourceFilePath-- Returns:
- the path of the file
- Throws:
URISyntaxExceptionIOException
-
getFileFromResourceAsStream
Return the content of a file located into resources- Parameters:
filePath-- Returns:
- the content of the file as string
- Throws:
URISyntaxExceptionIOExceptionException
-
listFilesNamesInResourceFolder
public static List<String> listFilesNamesInResourceFolder(Path folderPath, String ext) throws Exception - Throws:
Exception
-
cleanUpTemporaryEnvironmentFiles
Clean up the kokos tmp folder- Parameters:
environmentName- the name of environment- Throws:
IOException- Exception
-
deleteDirectoryRecursively
Delete a folder recursively. Delete all files and sub folders.- Parameters:
directory- path- Throws:
IOException- Exception
-
cleanupFolderRecursively
Cleans up a folder recursively by deleting all files and directories under the specified folder name, starting from the base directory.- Parameters:
basePath- the base path to start.folder- the name of the folder to clean up within the basePath.- Throws:
IOException- if an I/O error occurs during the cleanup process.
-