Class DataSourceFileResolver

  • All Implemented Interfaces:
    DataSourceResolver

    public class DataSourceFileResolver
    extends DataSourceBaseResolver
    Creates a DataSource based on an URL. The implementation also resolves file resources.
    Since:
    1.3
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File getBaseDir()
      Get the base directory used for resolving relative resource locations.
      javax.activation.DataSource resolve​(java.lang.String resourceLocation)
      Resolves the given resource location to a DataSource.
      javax.activation.DataSource resolve​(java.lang.String resourceLocation, boolean isLenient)
      Resolves the given resource location to a DataSource.
      • Methods inherited from class java.lang.Object

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

      • DataSourceFileResolver

        public DataSourceFileResolver()
        Constructor.
      • DataSourceFileResolver

        public DataSourceFileResolver​(java.io.File baseDir)
        Constructor.
        Parameters:
        baseDir - the base directory of the resource when resolving relative paths
      • DataSourceFileResolver

        public DataSourceFileResolver​(java.io.File baseDir,
                                      boolean lenient)
        Constructor.
        Parameters:
        baseDir - the base directory of the resource when resolving relative paths
        lenient - shall we ignore resources not found or complain with an exception
    • Method Detail

      • getBaseDir

        public java.io.File getBaseDir()
        Get the base directory used for resolving relative resource locations.
        Returns:
        the baseUrl
      • resolve

        public javax.activation.DataSource resolve​(java.lang.String resourceLocation)
                                            throws java.io.IOException
        Resolves the given resource location to a DataSource.
        Parameters:
        resourceLocation - the location of the resource
        Returns:
        the DataSource
        Throws:
        java.io.IOException - the resource was not found
      • resolve

        public javax.activation.DataSource resolve​(java.lang.String resourceLocation,
                                                   boolean isLenient)
                                            throws java.io.IOException
        Resolves the given resource location to a DataSource.
        Parameters:
        resourceLocation - the location of the resource
        isLenient - shall we ignore resources not found or complain with an exception?
        Returns:
        the data source containing the resource or null if the resource was not found in lenient mode
        Throws:
        java.io.IOException - resolving the resource failed