-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ArDoCo/feature/directly-load-acm-files
Add an option to ArCoTL to load ACM Code File directly
- Loading branch information
Showing
19 changed files
with
234 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/agents/ArchitectureConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Licensed under MIT 2024. */ | ||
package edu.kit.kastel.mcse.ardoco.tlr.models.agents; | ||
|
||
import java.io.File; | ||
|
||
import edu.kit.kastel.mcse.ardoco.core.api.models.ArchitectureModelType; | ||
import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.Extractor; | ||
import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.architecture.pcm.PcmExtractor; | ||
import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.architecture.uml.UmlExtractor; | ||
|
||
public record ArchitectureConfiguration(File architectureFile, ArchitectureModelType type) { | ||
public ArchitectureConfiguration { | ||
if (architectureFile == null || type == null) { | ||
throw new IllegalArgumentException("Architecture file and type must not be null"); | ||
} | ||
if (!architectureFile.exists() || !architectureFile.isFile()) { | ||
throw new IllegalArgumentException("Architecture file must exist and be a file"); | ||
} | ||
} | ||
|
||
public Extractor extractor() { | ||
return switch (type) { | ||
case PCM -> new PcmExtractor(architectureFile.getAbsolutePath()); | ||
case UML -> new UmlExtractor(architectureFile.getAbsolutePath()); | ||
}; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...rovider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/agents/CodeConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* Licensed under MIT 2024. */ | ||
package edu.kit.kastel.mcse.ardoco.tlr.models.agents; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItemRepository; | ||
import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.Extractor; | ||
import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.AllLanguagesExtractor; | ||
import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.CodeExtractor; | ||
|
||
public record CodeConfiguration(File code, CodeConfigurationType type) { | ||
|
||
public CodeConfiguration { | ||
if (code == null || type == null) { | ||
throw new IllegalArgumentException("Code file and type must not be null"); | ||
} | ||
|
||
if (!code.exists()) { | ||
throw new IllegalArgumentException("Code file must exist"); | ||
} | ||
|
||
if (type == CodeConfigurationType.DIRECTORY && code.isFile()) { | ||
throw new IllegalArgumentException("Code file must be a directory in DIRECTORY mode"); | ||
} | ||
|
||
if (type == CodeConfigurationType.ACM_FILE && !code.isFile()) { | ||
throw new IllegalArgumentException("Code file must be a file in ACM_FILE mode"); | ||
} | ||
} | ||
|
||
public List<Extractor> extractors() { | ||
if (type == CodeConfigurationType.DIRECTORY) { | ||
CodeItemRepository codeItemRepository = new CodeItemRepository(); | ||
CodeExtractor codeExtractor = new AllLanguagesExtractor(codeItemRepository, code.getAbsolutePath()); | ||
return List.of(codeExtractor); | ||
} | ||
throw new IllegalStateException("CodeConfigurationType not supported"); | ||
} | ||
|
||
public enum CodeConfigurationType { | ||
DIRECTORY, ACM_FILE | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.