Package org.apache.commons.mail.resolver
Class DataSourceCompositeResolver
- java.lang.Object
-
- org.apache.commons.mail.resolver.DataSourceBaseResolver
-
- org.apache.commons.mail.resolver.DataSourceCompositeResolver
-
- All Implemented Interfaces:
DataSourceResolver
public class DataSourceCompositeResolver extends DataSourceBaseResolver
A composite data source resolver. It allows to resolve data sources coming from multiple locations such as the classpath, the file system or an URL.- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor Description DataSourceCompositeResolver(DataSourceResolver[] dataSourceResolvers)
Constructor.DataSourceCompositeResolver(DataSourceResolver[] dataSourceResolvers, boolean isLenient)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataSourceResolver[]
getDataSourceResolvers()
Get the underlying data source resolvers.javax.activation.DataSource
resolve(java.lang.String resourceLocation)
Resolves the given resource location to aDataSource
.javax.activation.DataSource
resolve(java.lang.String resourceLocation, boolean isLenient)
Resolves the given resource location to aDataSource
.-
Methods inherited from class org.apache.commons.mail.resolver.DataSourceBaseResolver
isLenient
-
-
-
-
Constructor Detail
-
DataSourceCompositeResolver
public DataSourceCompositeResolver(DataSourceResolver[] dataSourceResolvers)
Constructor.- Parameters:
dataSourceResolvers
- a list of of resolvers being used
-
DataSourceCompositeResolver
public DataSourceCompositeResolver(DataSourceResolver[] dataSourceResolvers, boolean isLenient)
Constructor.- Parameters:
dataSourceResolvers
- a list of of resolvers being usedisLenient
- shall we ignore resources not found or throw an exception?
-
-
Method Detail
-
getDataSourceResolvers
public DataSourceResolver[] getDataSourceResolvers()
Get the underlying data source resolvers.- Returns:
- underlying data source resolvers
-
resolve
public javax.activation.DataSource resolve(java.lang.String resourceLocation) throws java.io.IOException
Resolves the given resource location to aDataSource
.- 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 aDataSource
.- Parameters:
resourceLocation
- the location of the resourceisLenient
- 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
-
-