Class ConfigFileLoaderManager

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkUniqueSchemes()
      Method is called by spring and verifies that there is only one plugin per URI scheme.
      java.util.Set<java.lang.String> getSupportedUriSchemes()
      Return all URI schemes that are supported in the system.
      java.lang.String getUriScheme()
      Returns the URI scheme that this loader supports.
      boolean isAccessible​(java.net.URI fileURI)
      Check if the configuration File exists.
      boolean isAccessible​(java.net.URI configFileUri, java.lang.String pathToSubResource)
      check if the file exists and can be accessed by the user/template/config/etc...
      java.util.Optional<java.lang.Long> lastModified​(java.net.URI fileURI)
      return the last modified time of the file URI.
      byte[] loadFile​(java.net.URI fileURI)
      Load the config data.
      byte[] loadFile​(java.net.URI configFileUri, java.lang.String pathToSubResource)
      Load the file related to the configuration file.
      java.util.Optional<java.io.File> toFile​(java.net.URI fileUri)
      Return the file object the uri refers to if it refers to a file.
      java.util.Optional<java.io.File> toFile​(java.net.URI configFileUri, java.lang.String pathToSubResource)
      Return the file object the uri refers to if it refers to a file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigFileLoaderManager

        public ConfigFileLoaderManager()
    • Method Detail

      • checkUniqueSchemes

        @PostConstruct
        public void checkUniqueSchemes()
        Method is called by spring and verifies that there is only one plugin per URI scheme.
      • toFile

        public java.util.Optional<java.io.File> toFile​(java.net.URI fileUri)
        Description copied from interface: ConfigFileLoaderPlugin
        Return the file object the uri refers to if it refers to a file. Otherwise Optional.absent().
        Specified by:
        toFile in interface ConfigFileLoaderPlugin
        Parameters:
        fileUri - the uri to use to resolve to a file (or not).
      • getSupportedUriSchemes

        public java.util.Set<java.lang.String> getSupportedUriSchemes()
        Return all URI schemes that are supported in the system.
      • lastModified

        public java.util.Optional<java.lang.Long> lastModified​(java.net.URI fileURI)
        Description copied from interface: ConfigFileLoaderPlugin
        return the last modified time of the file URI.
        Specified by:
        lastModified in interface ConfigFileLoaderPlugin
        Parameters:
        fileURI - the uri of the config file to load.
        Returns:
        return the last modified date of the file
      • isAccessible

        public boolean isAccessible​(java.net.URI fileURI)
        Description copied from interface: ConfigFileLoaderPlugin
        Check if the configuration File exists.
        Specified by:
        isAccessible in interface ConfigFileLoaderPlugin
        Parameters:
        fileURI - the uri of the file to load.
      • loadFile

        public byte[] loadFile​(java.net.URI fileURI)
                        throws java.io.IOException
        Description copied from interface: ConfigFileLoaderPlugin
        Load the config data.
        Specified by:
        loadFile in interface ConfigFileLoaderPlugin
        Parameters:
        fileURI - the uri of the config file to load.
        Returns:
        the file that make up the file.
        Throws:
        java.io.IOException
      • isAccessible

        public boolean isAccessible​(java.net.URI configFileUri,
                                    java.lang.String pathToSubResource)
                             throws java.io.IOException
        Description copied from interface: ConfigFileLoaderPlugin
        check if the file exists and can be accessed by the user/template/config/etc...
        Specified by:
        isAccessible in interface ConfigFileLoaderPlugin
        Parameters:
        configFileUri - the uri of the configuration file
        pathToSubResource - a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).
        Throws:
        java.io.IOException
      • loadFile

        public byte[] loadFile​(java.net.URI configFileUri,
                               java.lang.String pathToSubResource)
                        throws java.io.IOException
        Description copied from interface: ConfigFileLoaderPlugin
        Load the file related to the configuration file.
        Specified by:
        loadFile in interface ConfigFileLoaderPlugin
        Parameters:
        configFileUri - the uri of the configuration file
        pathToSubResource - a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).
        Throws:
        java.io.IOException
      • toFile

        public java.util.Optional<java.io.File> toFile​(java.net.URI configFileUri,
                                                       java.lang.String pathToSubResource)
                                                throws java.io.IOException
        Description copied from interface: ConfigFileLoaderPlugin
        Return the file object the uri refers to if it refers to a file. Otherwise Optional.absent().
        Specified by:
        toFile in interface ConfigFileLoaderPlugin
        Parameters:
        configFileUri - the uri of the configuration file
        pathToSubResource - a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).
        Throws:
        java.io.IOException