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).
  • Method Details

    • processTemplate

      String processTemplate(String templatePath, Map<String,Object> context)
      Loads and processes a template with the given context.
      Parameters:
      templatePath - path to the template file
      context - context data for template processing
      Returns:
      processed template content
      Throws:
      TemplateRepository.TemplateNotFoundException - if template is not found
      TemplateRepository.TemplateProcessingException - if template processing fails
    • templateExists

      boolean templateExists(String templatePath)
      Checks if a template exists.
      Parameters:
      templatePath - path to the template file
      Returns:
      true if template exists, false otherwise
    • getTemplateContent

      String getTemplateContent(String templatePath)
      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

      StructureMetadata loadStructureMetadata(ArchitectureType architecture)
      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 AdapterMetadata loadAdapterMetadata(String adapterName)
      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 adapter
      framework - 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

      ValidationResult validateTemplate(String templatePath)
      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

      Set<String> extractRequiredVariables(String templatePath)
      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