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
FieldsModifier and TypeFieldDescriptionprivate static final intCount of antipatterns, metrics, and architectural rulesprivate static final intprivate ARDetectionServiceprivate static Stringprivate static Stringprivate static final String[]Column labels for violation counts and metricsprivate final Configprivate final StringDetection services and parametersprivate DeltaExtractionServiceprivate final GitServiceprivate IRExtractionServiceprivate MergeServiceprivate static final intprivate org.apache.poi.xssf.usermodel.XSSFSheetprivate final org.apache.poi.xssf.usermodel.XSSFWorkbook -
Constructor Summary
ConstructorsConstructorDescriptionDetectionService(String configPath) Construct with given configuration file path -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddetectAntipatterns(MicroserviceSystem microserviceSystem, Map<String, Integer> allAntiPatterns) Detect antipatterns in the given microserviceprivate voiddetectMetrics(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 listvoidMethod to detect antipatterns, architectural rule violations, and metricsstatic com.google.gson.JsonArraytoJsonArray(List<List<AbstractAR>> archRulesList) Create JSON array from list of architectural rule objectsprivate voidupdateAntiPatterns(int rowIndex, Map<String, Integer> allAntiPatterns) Update antipattern counts in excelprivate voidupdateMetrics(int rowIndex, Map<String, Double> metrics) Update metric counts in excelprivate voidupdateRules(int rowIndex, List<AbstractAR> currARs) Update counts of architectural rule violations in excelprivate voidwriteEmptyRow(int rowIndex) Write empty row to XSSFSheetprivate voidWrite 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
-