Class TemplateSourceResolver
java.lang.Object
com.pragma.archetype.infrastructure.adapter.out.template.TemplateSourceResolver
Resolves the source from which templates should be loaded.
Determines whether to use local filesystem or remote repository based on
configuration.
Resolution order:
1. Check for configured localPath in TemplateConfig
2. Auto-detect ../backend-architecture-design-archetype-generator-templates
3. Fall back to remote repository with branch support
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException thrown when template source resolution or validation fails. -
Constructor Summary
ConstructorsConstructorDescriptionTemplateSourceResolver(TemplateConfig config) Creates a resolver with the given template configuration. -
Method Summary
Modifier and TypeMethodDescriptionGets the resolved local path if in local mode.Gets the resolved template source.Gets a description of the resolved source for logging.booleanChecks if the resolved source is local mode (configured or auto-detected).booleanChecks if the resolved source is remote mode.Resolves the template source based on configuration and filesystem state.voidValidates that the resolved source is accessible.
-
Constructor Details
-
TemplateSourceResolver
Creates a resolver with the given template configuration.- Parameters:
config- template configuration
-
-
Method Details
-
resolveSource
Resolves the template source based on configuration and filesystem state.- Returns:
- the resolved template source
- Throws:
TemplateSourceResolver.TemplateSourceException- if configured local path does not exist
-
isLocalMode
public boolean isLocalMode()Checks if the resolved source is local mode (configured or auto-detected).- Returns:
- true if using local filesystem, false otherwise
-
isRemoteMode
public boolean isRemoteMode()Checks if the resolved source is remote mode.- Returns:
- true if using remote repository, false otherwise
-
getLocalPath
Gets the resolved local path if in local mode.- Returns:
- the local path, or null if in remote mode
-
getResolvedSource
Gets the resolved template source.- Returns:
- the resolved source
-
validateSource
public void validateSource()Validates that the resolved source is accessible. For local mode, checks that the path exists and is a directory. For remote mode, validates that repository URL and branch are configured.- Throws:
TemplateSourceResolver.TemplateSourceException- if validation fails
-
getSourceDescription
Gets a description of the resolved source for logging.- Returns:
- human-readable description of the template source
-