Package com.atlassian.confluence.core
Class DefaultPluginDataSourceFactory
java.lang.Object
com.atlassian.confluence.core.DefaultPluginDataSourceFactory
- All Implemented Interfaces:
PluginDataSourceFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.confluence.core.PluginDataSourceFactory
PluginDataSourceFactory.FilterByType, PluginDataSourceFactory.ResourceView
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPluginDataSourceFactory
(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
Modifier and TypeMethodDescriptionOptional<javax.activation.DataSource>
getResourceFromModuleByName
(String moduleKey, String resourceName) Extract a resource identified by name from a module and expose it asDataSource
.getResourcesFromModules
(String moduleKey) Extract all resources from a module and expose them asDataSources
.getResourcesFromModules
(String moduleKey, @Nullable Predicate<PluginDataSourceFactory.ResourceView> filter) Extract resources from a module and expose them asDataSources
.
-
Constructor Details
-
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 Details
-
getResourcesFromModules
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:
-
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
-