Class ProjectProcessor

java.lang.Object
org.machanism.machai.project.ProjectProcessor

public abstract class ProjectProcessor extends Object
Traverses a detected project structure and delegates leaf-folder processing to subclasses.

When a layout reports null modules, this processor invokes processFolder(ProjectLayout) for that layout. Otherwise, it scans every reported module recursively. Consequently, a layout that reports an empty module list does not invoke processFolder.

Usage


 ProjectProcessor processor = createProcessor();
 processor.scanFolder(new File("path/to/project"));
 

Since:
0.0.2
Author:
Viktor Tovstyi
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
      Logger used to record module traversal.
  • Constructor Details

    • ProjectProcessor

      protected ProjectProcessor()
      Creates a project processor instance.
  • Method Details

    • scanFolder

      public void scanFolder(File projectDir) throws IOException
      Detects the layout of the specified directory and processes its leaf projects. A layout with null modules is processed directly; a layout with a non-null module list causes each listed module to be scanned recursively.
      Parameters:
      projectDir - the root project directory to scan
      Throws:
      IOException - if layout detection or processing encounters an I/O error
    • processModule

      protected void processModule(File projectDir, String module) throws IOException
      Processes a reported project module by recursively scanning its directory.
      Parameters:
      projectDir - the main project directory
      module - the module path relative to projectDir
      Throws:
      IOException - if recursive scanning encounters an I/O error
    • processFolder

      public abstract void processFolder(ProjectLayout processor) throws IOException
      Processes one detected leaf project layout. Subclasses implement this hook to perform their repository-specific work.
      Parameters:
      processor - the layout representing the folder structure to process
      Throws:
      IOException - if processing the folder or its contents encounters an I/O error
    • getProjectLayout

      public ProjectLayout getProjectLayout(File projectDir) throws FileNotFoundException
      Returns the detected ProjectLayout for the specified project directory.
      Parameters:
      projectDir - the root project directory to analyze
      Returns:
      the detected and configured project layout
      Throws:
      FileNotFoundException - if the directory does not exist