Interface TemplateRepository
- All Known Implementing Classes:
FreemarkerTemplateRepository
public interface TemplateRepository
Port for accessing and processing templates.
This is an output port (drives external template system).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classException thrown when a template is not found.static classException thrown when template processing fails. -
Method Summary
Modifier and TypeMethodDescriptionextractRequiredVariables(String templatePath) Extracts required variables from a template.getTemplateContent(String templatePath) Gets the raw content of a template without processing.loadAdapterMetadata(String adapterName) Deprecated.loadAdapterMetadata(String adapterName, String framework, String paradigm, String adapterType) Loads adapter metadata for a given adapter using framework-aware structure.loadStructureMetadata(ArchitectureType architecture) Loads structure metadata for a given architecture type.processTemplate(String templatePath, Map<String, Object> context) Loads and processes a template with the given context.booleantemplateExists(String templatePath) Checks if a template exists.validateTemplate(String templatePath) Validates a template for syntax errors and existence.
-
Method Details
-
processTemplate
Loads and processes a template with the given context.- Parameters:
templatePath- path to the template filecontext- context data for template processing- Returns:
- processed template content
- Throws:
TemplateRepository.TemplateNotFoundException- if template is not foundTemplateRepository.TemplateProcessingException- if template processing fails
-
templateExists
Checks if a template exists.- Parameters:
templatePath- path to the template file- Returns:
- true if template exists, false otherwise
-
getTemplateContent
Gets the raw content of a template without processing.- Parameters:
templatePath- path to the template file- Returns:
- raw template content
- Throws:
TemplateRepository.TemplateNotFoundException- if template is not found
-
loadStructureMetadata
Loads structure metadata for a given architecture type.- Parameters:
architecture- the architecture type- Returns:
- structure metadata for the architecture
- Throws:
TemplateRepository.TemplateNotFoundException- if structure.yml is not found
-
loadAdapterMetadata
Deprecated.Loads adapter metadata for a given adapter name (legacy method). This method uses the legacy flat structure: adapters/{adapterName}/metadata.yml- Parameters:
adapterName- the name of the adapter- Returns:
- adapter metadata for the adapter
- Throws:
TemplateRepository.TemplateNotFoundException- if metadata.yml is not found
-
loadAdapterMetadata
AdapterMetadata loadAdapterMetadata(String adapterName, String framework, String paradigm, String adapterType) Loads adapter metadata for a given adapter using framework-aware structure. Path: frameworks/{framework}/{paradigm}/adapters/{adapterType}/{adapterName}/metadata.yml- Parameters:
adapterName- the name of the adapterframework- the framework (e.g., "spring", "quarkus")paradigm- the paradigm (e.g., "reactive", "imperative")adapterType- the adapter type (e.g., "driven-adapters", "entry-points")- Returns:
- adapter metadata for the adapter
- Throws:
TemplateRepository.TemplateNotFoundException- if metadata.yml is not found
-
validateTemplate
Validates a template for syntax errors and existence. This is used for validation-before-modification pattern.- Parameters:
templatePath- path to the template file- Returns:
- ValidationResult indicating if the template is valid
-
extractRequiredVariables
Extracts required variables from a template. Parses the template to find all variable references.- Parameters:
templatePath- path to the template file- Returns:
- set of required variable names
- Throws:
TemplateRepository.TemplateNotFoundException- if template is not found
-
loadAdapterMetadata(String, String, String, String)instead