Class DefaultDirectoryHierarchy

java.lang.Object
edu.ie3.datamodel.io.naming.DefaultDirectoryHierarchy
All Implemented Interfaces:
FileHierarchy

public class DefaultDirectoryHierarchy extends Object implements FileHierarchy
Default directory hierarchy for input models
  • Field Details

    • FILE_SEPARATOR

      protected static final String FILE_SEPARATOR
      Use the unix file separator here.
  • Constructor Details

    • DefaultDirectoryHierarchy

      public DefaultDirectoryHierarchy(String baseDirectory, String gridName)
  • Method Details

    • validate

      public void validate() throws FileException
      Checks, if the structure beneath baseDirectory is okay.
      Throws:
      FileException - if not
    • createDirs

      public void createDirs() throws IOException
      Creates all mandatory subdirectories of this default directory hierarchy
      Throws:
      IOException - If the creation of sub directories is not possible
    • createDirs

      public void createDirs(boolean withOptionals) throws IOException
      Creates all subdirectories of this default directory hierarchy. Upon request, also the optional directories are created.
      Parameters:
      withOptionals - if true, also optional directories get created.
      Throws:
      IOException - If the creation of sub directories is not possible
    • getBaseDirectory

      public Optional<String> getBaseDirectory()
      Gives the baseDirectory).
      Specified by:
      getBaseDirectory in interface FileHierarchy
      Returns:
      An Option to the base directory as a string
    • getSubDirectory

      public Optional<String> getSubDirectory(Class<? extends UniqueEntity> cls, String fileSeparator)
      Gives the correct sub directory (w.r.t. baseDirectory) for the provided class.
      Specified by:
      getSubDirectory in interface FileHierarchy
      Parameters:
      cls - Class to define the sub directory for
      fileSeparator - The file separator to use
      Returns:
      An Option to the regarding sub directory as a string