Class BaseModelLoader

  • All Implemented Interfaces:
    ModelLoader

    public class BaseModelLoader
    extends java.lang.Object
    implements ModelLoader
    Shared code for the ModelLoader implementations.
    • Constructor Detail

      • BaseModelLoader

        public BaseModelLoader​(MRL mrl)
        Constructs a ModelLoader given the repository, mrl, and version.
        Parameters:
        mrl - the mrl of the model to load
    • Method Detail

      • getArtifactId

        public java.lang.String getArtifactId()
        Returns the artifact ID of the ModelLoader.
        Specified by:
        getArtifactId in interface ModelLoader
        Returns:
        the artifact ID of the ModelLoader
      • getApplication

        public Application getApplication()
        Returns the application of the ModelLoader.
        Specified by:
        getApplication in interface ModelLoader
        Returns:
        the application of the ModelLoader
      • loadModel

        public <I,​O> ZooModel<I,​O> loadModel​(Criteria<I,​O> criteria)
                                                  throws java.io.IOException,
                                                         ModelNotFoundException,
                                                         MalformedModelException
        Loads the model with the given criteria.
        Specified by:
        loadModel in interface ModelLoader
        Type Parameters:
        I - the input data type
        O - the output data type
        Parameters:
        criteria - the criteria to match against the loaded model
        Returns:
        the loaded model
        Throws:
        java.io.IOException - for various exceptions loading data from the repository
        ModelNotFoundException - if no model with the specified criteria is found
        MalformedModelException - if the model data is malformed
      • listModels

        public java.util.List<Artifact> listModels()
                                            throws java.io.IOException
        Returns a list of the available artifacts that can be loaded.
        Specified by:
        listModels in interface ModelLoader
        Returns:
        a list of the available artifacts that can be loaded
        Throws:
        java.io.IOException - for errors reading the artifact list
      • createModel

        protected Model createModel​(java.nio.file.Path modelPath,
                                    java.lang.String name,
                                    Device device,
                                    Block block,
                                    java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                    java.lang.String engine)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getTranslatorFactory

        protected TranslatorFactory getTranslatorFactory​(Criteria<?,​?> criteria,
                                                         java.util.Map<java.lang.String,​java.lang.Object> arguments)