Package edu.university.ecs.lab.detection
Class DetectionService
java.lang.Object
edu.university.ecs.lab.detection.DetectionService
Service class for detection of antipatterns, architectural rule violations, and metrics
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
Count of antipatterns, metrics, and architectural rulesprivate static final int
private ARDetectionService
private static String
private static String
private static final String[]
Column labels for violation counts and metricsprivate final Config
private final String
Detection services and parametersprivate DeltaExtractionService
private final GitService
private IRExtractionService
private MergeService
private static final int
private org.apache.poi.xssf.usermodel.XSSFSheet
private final org.apache.poi.xssf.usermodel.XSSFWorkbook
-
Constructor Summary
ConstructorDescriptionDetectionService
(String configPath) Construct with given configuration file path -
Method Summary
Modifier and TypeMethodDescriptionprivate void
detectAntipatterns
(MicroserviceSystem microserviceSystem, Map<String, Integer> allAntiPatterns) Detect antipatterns in the given microserviceprivate void
detectMetrics
(MicroserviceSystem microserviceSystem, Map<String, Double> metrics, String oldIRPath) private List<org.eclipse.jgit.revwalk.RevCommit>
iterableToList
(Iterable<org.eclipse.jgit.revwalk.RevCommit> iterable) Convert iterable to a listvoid
Method to detect antipatterns, architectural rule violations, and metricsstatic com.google.gson.JsonArray
toJsonArray
(List<List<AbstractAR>> archRulesList) Create JSON array from list of architectural rule objectsprivate void
updateAntiPatterns
(int rowIndex, Map<String, Integer> allAntiPatterns) Update antipattern counts in excelprivate void
updateMetrics
(int rowIndex, Map<String, Double> metrics) Update metric counts in excelprivate void
updateRules
(int rowIndex, List<AbstractAR> currARs) Update counts of architectural rule violations in excelprivate void
writeEmptyRow
(int rowIndex) Write empty row to XSSFSheetprivate void
Write headers to XSSFSheet
-
Field Details
-
columnLabels
Column labels for violation counts and metrics -
ANTIPATTERNS
private static final int ANTIPATTERNSCount of antipatterns, metrics, and architectural rules- See Also:
-
METRICS
private static final int METRICS- See Also:
-
ARCHRULES
private static final int ARCHRULES- See Also:
-
BASE_DELTA_PATH
-
BASE_IR_PATH
-
configPath
Detection services and parameters -
config
-
gitService
-
irExtractionService
-
arDetectionService
-
deltaExtractionService
-
mergeService
-
workbook
private final org.apache.poi.xssf.usermodel.XSSFWorkbook workbook -
sheet
private org.apache.poi.xssf.usermodel.XSSFSheet sheet
-
-
Constructor Details
-
DetectionService
Construct with given configuration file path- Parameters:
configPath
- YAML file to extract microservice details from
-
-
Method Details
-
runDetection
public void runDetection()Method to detect antipatterns, architectural rule violations, and metrics -
writeHeaders
private void writeHeaders()Write headers to XSSFSheet -
writeEmptyRow
private void writeEmptyRow(int rowIndex) Write empty row to XSSFSheet- Parameters:
rowIndex
- index to write row to
-
iterableToList
private List<org.eclipse.jgit.revwalk.RevCommit> iterableToList(Iterable<org.eclipse.jgit.revwalk.RevCommit> iterable) Convert iterable to a list- Parameters:
iterable
- iterable object to convert- Returns:
- iterable object converted to a list
-
detectAntipatterns
private void detectAntipatterns(MicroserviceSystem microserviceSystem, Map<String, Integer> allAntiPatterns) Detect antipatterns in the given microservice- Parameters:
microserviceSystem
- microservice to scan for antipatternsallAntiPatterns
- map of antipattern names and integers to store antipattern counts
-
detectMetrics
private void detectMetrics(MicroserviceSystem microserviceSystem, Map<String, Double> metrics, String oldIRPath) -
updateRules
Update counts of architectural rule violations in excel- Parameters:
rowIndex
- XSSFSheet row indexcurrARs
- list of architectural rule violations
-
updateAntiPatterns
Update antipattern counts in excel- Parameters:
rowIndex
- XSSFSheet row indexallAntiPatterns
- map of antipatterns to integer count
-
updateMetrics
Update metric counts in excel- Parameters:
rowIndex
- XSSFSheet row indexmetrics
- map of metrics to double value
-
toJsonArray
Create JSON array from list of architectural rule objects- Parameters:
archRulesList
- list of AR objects- Returns:
- JSON array with list entities
-