Class DefaultDataSourceFactory

  • All Implemented Interfaces:
    DataSourceFactory, org.springframework.beans.factory.Aware, org.springframework.web.context.ServletContextAware

    public class DefaultDataSourceFactory
    extends Object
    implements DataSourceFactory, org.springframework.web.context.ServletContextAware
    • Method Detail

      • getAvatar

        public javax.activation.DataSource getAvatar​(com.atlassian.user.User user)
        Construct a DataSource for a user's profile picture. Always returns PNG version for default or anonymous profile picture
        Specified by:
        getAvatar in interface DataSourceFactory
        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

        public javax.activation.DataSource getSpaceLogo​(Space space)
        Description copied from interface: DataSourceFactory
        Encapsulates the logo for the given Space in a DataSource.
        Specified by:
        getSpaceLogo in interface DataSourceFactory
        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"
      • getServletContainerResource

        public javax.activation.DataSource getServletContainerResource​(String path,
                                                                       String name)
        Specified by:
        getServletContainerResource in interface DataSourceFactory
        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 {@param name}.
      • setServletContext

        public void setServletContext​(javax.servlet.ServletContext servletContext)
        Specified by:
        setServletContext in interface org.springframework.web.context.ServletContextAware
      • createForPlugin

        public Optional<PluginDataSourceFactory> createForPlugin​(String pluginKey)
        Description copied from interface: DataSourceFactory
        Create a factory for a specific plugin.

        Allows the creation of DataSources from <resource> descriptors.

        Specified by:
        createForPlugin in interface DataSourceFactory
        Parameters:
        pluginKey - the key used to locate the plugin
        Returns:
        Optional factory for the plugin if it could be located