Class MetadataInputResolverContext


  • public class MetadataInputResolverContext
    extends Object
    Class that uses different MetadataInputResolver instances to resolve the spring-configuration-metadata.json file from different inputs.
    Since:
    0.1.0
    Author:
    nandorholozsnyak
    • Constructor Detail

      • MetadataInputResolverContext

        public MetadataInputResolverContext()
    • Method Detail

      • getInputStreamFromFile

        public InputStream getInputStreamFromFile​(Project project,
                                                  File input)
        Returns the requested file from the given input.

        The input can be a file, a directory or a ZIP/JAR file, these are the supported inputs now and this method will use different MetadataInputResolver instances to resolve the metadata file.

        It will run the resolvers in the following order:

        1. JarFileMetadataInputResolver - First it will check if it is a ZIP/JAR file or not
        2. FileMetadataInputResolver - Second it will check if it is file or not
        3. DirectoryMetadataInputResolver - Third it will check if it is directory, if yes it will search the Project.getPossibleMetadataFilePaths() for the spring-configuration-metadata.json file
        Parameters:
        project - project instance.
        input - input.
        Returns:
        the file's content in an InputStream instance.
        Throws:
        DocumentGenerationException - if none of the resolvers are able to find the file.