Class IRExtractionService
java.lang.Object
edu.university.ecs.lab.intermediate.create.services.IRExtractionService
Top-level service for extracting intermediate representation from remote repositories. Methods
are allowed to exit the program with an error code if an error occurs.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final String
CommitID of IR Extractionprivate final Config
Configuration objectprivate final GitService
Service to handle cloning from git -
Constructor Summary
ConstructorDescriptionIRExtractionService
(String configPath, Optional<String> commitID) This constructor initializes a new IRExtractionService and instantiates a GitService object for repository manipulation -
Method Summary
Modifier and TypeMethodDescriptionClone remote repositories and scan through each local repo and extract endpoints/callsfindRootDirectories
(String directory) Recursively search for directories containing a microservice (pom.xml file)void
generateIR
(String fileName) Intermediate extraction runner, generates IR from remote repository and writes to file.recursivelyScanFiles
(String rootMicroservicePath) Recursively scan the files in the given repository path and extract the endpoints and dependencies for a single microservice.void
scanDirectory
(File directory, Microservice microservice) Recursively scan the given directory for files and extract the endpoints and dependencies.private void
writeToFile
(Set<Microservice> microservices, String fileName) Write each service and endpoints to intermediate representation
-
Field Details
-
gitService
Service to handle cloning from git -
config
Configuration object -
commitID
CommitID of IR Extraction
-
-
Constructor Details
-
IRExtractionService
This constructor initializes a new IRExtractionService and instantiates a GitService object for repository manipulation- Parameters:
configPath
- path to configuration filecommitID
- optional commitID for extraction, if empty resolves to HEAD- See Also:
-
-
Method Details
-
generateIR
Intermediate extraction runner, generates IR from remote repository and writes to file.- Parameters:
fileName
- name of output file for IR extraction
-
cloneAndScanServices
Clone remote repositories and scan through each local repo and extract endpoints/calls- Returns:
- a map of services and their endpoints
-
findRootDirectories
Recursively search for directories containing a microservice (pom.xml file)- Parameters:
directory
- the directory to start the search from- Returns:
- a list of directory paths containing pom.xml
-
writeToFile
Write each service and endpoints to intermediate representation- Parameters:
microservices
- a list of microservices extracted from repositoryfileName
- the name of the output file for IR
-
recursivelyScanFiles
Recursively scan the files in the given repository path and extract the endpoints and dependencies for a single microservice.- Returns:
- model of a single service containing the extracted endpoints and dependencies
-
scanDirectory
Recursively scan the given directory for files and extract the endpoints and dependencies.- Parameters:
directory
- the directory to scan
-