Class DataSourceClassPathResolver

java.lang.Object
org.apache.commons.mail2.jakarta.resolver.DataSourceBaseResolver
org.apache.commons.mail2.jakarta.resolver.DataSourceClassPathResolver
All Implemented Interfaces:
DataSourceResolver

Creates a DataSource based on an class path.
Since:
1.3
  • Constructor Details

    • DataSourceClassPathResolver

      Constructs a new instance.
    • DataSourceClassPathResolver

      public DataSourceClassPathResolver(String classPathBase)
      Constructs a new instance.
      Parameters:
      classPathBase - a base class path
    • DataSourceClassPathResolver

      public DataSourceClassPathResolver(String classPathBase, boolean lenient)
      Constructs a new instance.
      Parameters:
      classPathBase - a base class path
      lenient - shall we ignore resources not found or throw an exception?
  • Method Details

    • getClassPathBase

      Gets the class path base.
      Returns:
      the classPathBase
    • resolve

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

      public jakarta.activation.DataSource resolve(String resourceLocation, boolean isLenient) throws 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:
      IOException - resolving the resource failed