Interface ModelFileFinder

    • Method Detail

      • getFile

        java.io.File getFile​(ModelFile modelFile,
                             JMadKernel kernel)
        returns an accessible file that is searched according to the given ModelFile, but (in case coming from an archive) extracted in a way that it is unique for the given kerne. This avoids potential name conflicts between files coming from different model packages used in kernels that are concurrently running.
        Parameters:
        modelFile - the instance of ModelFile which describes where to find the file
        kernel - the jmad kernel relative to whose temp path files should be placed.
        Returns:
        the file
      • getStream

        java.io.InputStream getStream​(ModelFile modelFile)
        returns the content of the model file as input stream. This is useful e.g. for copying the file or for packing it into a zip archive.
        Parameters:
        modelFile - the model file for which to get the stream
        Returns:
        the input stream
      • getLocalSourceFile

        java.util.Optional<java.io.File> getLocalSourceFile​(ModelFile modelFile)
        Returns an optional file that is the source of the given model file. This will return an empty optional in case the source of this model file is not a plain file, but is supposed to be extracted from an archive. In other words, the model definition for which this file finder is responsible is not coming from a file.
        Parameters:
        modelFile - the model file for which to retrieve the source file
        Returns:
        an optional of the source file for the given model file, or Optional.empty() if the source of the model definition does not come from a file
      • getRepositoryPath

        java.lang.String getRepositoryPath​(ModelFile modelFile)
        puts together the path within the repository
        Parameters:
        modelFile - the model file for which to put together the path
        Returns:
        the absolute path to the file
      • getArchivePath

        java.lang.String getArchivePath​(ModelFile modelFile)
        puts together the resource path for the file
        Parameters:
        modelFile - the ModelFile for which to put together the resource path
        Returns:
        the relative path used in jars below ModelDefinitionUtil.PACKAGE_OFFSET and in zip archives.
      • setRepositoryFilePriority

        void setRepositoryFilePriority​(ModelFileFinder.RepositoryFilePriority priority)
        set the priority mode for searching repository files.
        Parameters:
        priority - the new priority