Package org.machanism.machai.project
Class ProjectProcessor
java.lang.Object
org.machanism.machai.project.ProjectProcessor
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.LoggerLogger used to record module traversal. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetProjectLayout(File projectDir) Returns the detectedProjectLayoutfor the specified project directory.abstract voidprocessFolder(ProjectLayout processor) Processes one detected leaf project layout.protected voidprocessModule(File projectDir, String module) Processes a reported project module by recursively scanning its directory.voidscanFolder(File projectDir) Detects the layout of the specified directory and processes its leaf projects.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERLogger used to record module traversal.
-
-
Constructor Details
-
ProjectProcessor
protected ProjectProcessor()Creates a project processor instance.
-
-
Method Details
-
scanFolder
Detects the layout of the specified directory and processes its leaf projects. A layout withnullmodules 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
Processes a reported project module by recursively scanning its directory.- Parameters:
projectDir- the main project directorymodule- the module path relative toprojectDir- Throws:
IOException- if recursive scanning encounters an I/O error
-
processFolder
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
Returns the detectedProjectLayoutfor 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
-