com.atlassian.confluence.core
Interface DataSourceFactory

All Known Implementing Classes:
DefaultDataSourceFactory

public interface DataSourceFactory

Constructs DataSources for use in mail notifications.

Since:
4.0

Method Summary
 com.atlassian.fugue.Maybe<PluginDataSourceFactory> forPlugin(String pluginKey)
          Create a factory for a specific plugin.
 DataSource getAvatar(com.atlassian.user.User user)
          Construct a DataSource for a user's profile picture.
 DataSource getDatasource(Attachment attachment, boolean useThumbnail)
           
 DataSource getServletContainerResource(String path, String name)
           
 DataSource getSpaceLogo(Space space)
          Encapsulates the logo for the given Space in a DataSource.
 DataSource getURLResource(URL url, String name)
           
 

Method Detail

getAvatar

DataSource getAvatar(com.atlassian.user.User user)
Construct a DataSource for a user's profile picture.

Parameters:
user - The user to retrieve the avatar for. If null, "Anonymous" will be assumed.
Returns:
A DataSource containing the user's profile picture. DataSource.getName() will return the string "avatar_[hash]", where [hash] is an md5 hash of the user's name plus the avatar's filename.

getSpaceLogo

DataSource getSpaceLogo(Space space)
Encapsulates the logo for the given Space in a DataSource.

Parameters:
space - the space to retrieve the logo for
Returns:
a DataSource encapsulating the ...

  1. custom logo for a Space if configured
  2. default Space logo if configured
  3. default Confluence Space logo, SpaceLogo.DEFAULT_LOGO_PATH
DataSource.getName() will return "<spacekey>-space-logo"
Since:
5.2

getServletContainerResource

DataSource getServletContainerResource(String path,
                                       String name)
Parameters:
path - a path that must begin with a "/" and is interpreted as relative to the current context root
name - a custom name for the DataSource that will be returned.
Returns:
a DataSource containing the resource located at the path. DataSource.getName() will return the value of .

getURLResource

DataSource getURLResource(URL url,
                          String name)

getDatasource

DataSource getDatasource(Attachment attachment,
                         boolean useThumbnail)
                         throws IOException
Throws:
IOException

forPlugin

com.atlassian.fugue.Maybe<PluginDataSourceFactory> forPlugin(String pluginKey)
Create a factory for a specific plugin.

Allows the creation of DataSources from <resource> descriptors.

Parameters:
pluginKey - the key used to locate the plugin
Returns:
maybe the factory for the plugin if it could be located
Since:
5.2


Copyright © 2003–2015 Atlassian. All rights reserved.