Class FileUtils
java.lang.Object
edu.university.ecs.lab.common.utils.FileUtils
Manages all file paths and file path conversion functions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
This method returns the relative local path of the output directory as ./DEFAULT_OUTPUT_PATH.static String
getGitPathNoFileName
(String path) This method returns a Git path without the filename at the end.static String
Deprecated.static String
This method returns the relative local path of the output directory as ./DEFAULT_OUTPUT_PATH.static String
getRepositoryPath
(String repoName) This method returns the relative path of the cloned repository directory as ./DEFAULT_CLONE_PATH/repoName.static String
gitPathToLocalPath
(String localPath, String repoName) This method converts a path of the form .\clone\repoName\pathToFile to the form /pathToFilestatic boolean
isConfigurationFile
(String path) This method filters the static files present in the project, not including Java source file but configuration files onlystatic boolean
isValidFile
(String path) This method filters the file's that should be present in the projectstatic String
localPathToGitPath
(String localPath, String repoName) This method converts a path of the form .\clone\repoName\pathToFile to the form /pathToFilestatic void
makeDirs()
This method creates the default output and clone directories
-
Field Details
-
VALID_FILES
-
SYS_SEPARATOR
-
SPECIAL_SEPARATOR
-
DEFAULT_OUTPUT_PATH
- See Also:
-
DEFAULT_CLONE_PATH
- See Also:
-
DOT
- See Also:
-
GIT_SEPARATOR
- See Also:
-
-
Constructor Details
-
FileUtils
private FileUtils()Private constructor to prevent instantiation.
-
-
Method Details
-
getRepositoryPath
This method returns the relative path of the cloned repository directory as ./DEFAULT_CLONE_PATH/repoName. This will be a working relative path to the repository directory on the local file system.- Parameters:
repoName
- the name of the repo- Returns:
- the relative path string where that repository is cloned to
-
getOutputPath
This method returns the relative local path of the output directory as ./DEFAULT_OUTPUT_PATH. This will be a working relative path to the output directory on the local file system.- Returns:
- the relative path string where the output will exist
-
getClonePath
This method returns the relative local path of the output directory as ./DEFAULT_OUTPUT_PATH. This will be a working relative path to the output directory on the local file system.- Returns:
- the relative path string where the output will exist
-
localPathToGitPath
This method converts a path of the form .\clone\repoName\pathToFile to the form /pathToFile- Parameters:
localPath
- the local path to be convertedrepoName
- the name of the repo cloned locally- Returns:
- the relative repo path
-
gitPathToLocalPath
This method converts a path of the form .\clone\repoName\pathToFile to the form /pathToFile- Parameters:
localPath
- the local path to be convertedrepoName
- the name of the repo cloned locally- Returns:
- the relative repo path
-
getMicroserviceNameFromPath
Deprecated. -
getGitPathNoFileName
This method returns a Git path without the filename at the end.- Parameters:
path
- the path to remove filename from- Returns:
- the path without the file name or if too short just GIT_SEPARATOR
-
makeDirs
public static void makeDirs()This method creates the default output and clone directories -
isValidFile
This method filters the file's that should be present in the project- Parameters:
path
- the file for checking- Returns:
- boolean true if it belongs in the project
-
isConfigurationFile
This method filters the static files present in the project, not including Java source file but configuration files only- Parameters:
path
- the file for checking- Returns:
- boolean true if it is a configuration file
-