Package com.atlassian.confluence.core
Class DefaultPluginDataSourceFactory
- java.lang.Object
-
- com.atlassian.confluence.core.DefaultPluginDataSourceFactory
-
- All Implemented Interfaces:
PluginDataSourceFactory
public class DefaultPluginDataSourceFactory extends Object implements PluginDataSourceFactory
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.core.PluginDataSourceFactory
PluginDataSourceFactory.FilterByType, PluginDataSourceFactory.ResourceView
-
-
Constructor Summary
Constructors Constructor Description DefaultPluginDataSourceFactory(javax.activation.FileTypeMap fileTypeMap, com.google.common.base.Function<com.atlassian.fugue.Pair<com.atlassian.plugin.Plugin,PluginDataSourceFactory.ResourceView>,InputStream> resourceStreamFactory, com.atlassian.plugin.Plugin plugin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<javax.activation.DataSource>
getResourceFromModuleByName(String moduleKey, String resourceName)
Extract a resource identified by name from a module and expose it asDataSource
.Optional<Iterable<javax.activation.DataSource>>
getResourcesFromModules(String moduleKey)
Extract all resources from a module and expose them asDataSources
.Optional<Iterable<javax.activation.DataSource>>
getResourcesFromModules(String moduleKey, @Nullable Predicate<PluginDataSourceFactory.ResourceView> filter)
Extract resources from a module and expose them asDataSources
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.core.PluginDataSourceFactory
resourceFromModuleByName, resourcesFromModules
-
-
-
-
Constructor Detail
-
DefaultPluginDataSourceFactory
public DefaultPluginDataSourceFactory(javax.activation.FileTypeMap fileTypeMap, com.google.common.base.Function<com.atlassian.fugue.Pair<com.atlassian.plugin.Plugin,PluginDataSourceFactory.ResourceView>,InputStream> resourceStreamFactory, com.atlassian.plugin.Plugin plugin)
-
-
Method Detail
-
getResourcesFromModules
public Optional<Iterable<javax.activation.DataSource>> getResourcesFromModules(String moduleKey)
Description copied from interface:PluginDataSourceFactory
Extract all resources from a module and expose them asDataSources
.- Specified by:
getResourcesFromModules
in interfacePluginDataSourceFactory
- Parameters:
moduleKey
-- Returns:
- a container with the resources from the module, empty if the module could not be located
- See Also:
PluginDataSourceFactory.getResourcesFromModules(String, Predicate)
-
getResourcesFromModules
public Optional<Iterable<javax.activation.DataSource>> getResourcesFromModules(String moduleKey, @Nullable Predicate<PluginDataSourceFactory.ResourceView> filter)
Description copied from interface:PluginDataSourceFactory
Extract resources from a module and expose them asDataSources
.- Specified by:
getResourcesFromModules
in interfacePluginDataSourceFactory
- Parameters:
moduleKey
- the key used to locate the modulefilter
- an optional filter for resources- Returns:
- maybe the
DataSources
if the module could be located, the container is empty if the filter did not match anything
-
getResourceFromModuleByName
public Optional<javax.activation.DataSource> getResourceFromModuleByName(String moduleKey, String resourceName)
Description copied from interface:PluginDataSourceFactory
Extract a resource identified by name from a module and expose it asDataSource
.- Specified by:
getResourceFromModuleByName
in interfacePluginDataSourceFactory
- Parameters:
moduleKey
- the key used to locate the moduleresourceName
- the name of the resource- Returns:
- Optional.empty() if the module could not be located or did not contain a resource with the given name or Optional.of(DataSource) if the module could be located and contained a resource with the given name
-
-