Class FileUtils

java.lang.Object
edu.university.ecs.lab.common.utils.FileUtils

public class FileUtils extends Object
Manages all file paths and file path conversion functions.
  • Field Details

  • Constructor Details

    • FileUtils

      private FileUtils()
      Private constructor to prevent instantiation.
  • Method Details

    • getRepositoryPath

      public static String getRepositoryPath(String repoName)
      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

      public static String 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

      public static String 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

      public static String localPathToGitPath(String localPath, String repoName)
      This method converts a path of the form .\clone\repoName\pathToFile to the form /pathToFile
      Parameters:
      localPath - the local path to be converted
      repoName - the name of the repo cloned locally
      Returns:
      the relative repo path
    • gitPathToLocalPath

      public static String gitPathToLocalPath(String localPath, String repoName)
      This method converts a path of the form .\clone\repoName\pathToFile to the form /pathToFile
      Parameters:
      localPath - the local path to be converted
      repoName - the name of the repo cloned locally
      Returns:
      the relative repo path
    • getMicroserviceNameFromPath

      @Deprecated public static String getMicroserviceNameFromPath(String path)
      Deprecated.
    • getGitPathNoFileName

      public static String getGitPathNoFileName(String path)
      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

      public static boolean isValidFile(String path)
      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

      public static boolean isConfigurationFile(String path)
      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