com.atlassian.confluence.core
Class DefaultDataSourceFactory

java.lang.Object
  extended by com.atlassian.confluence.core.DefaultDataSourceFactory
All Implemented Interfaces:
DataSourceFactory, org.springframework.web.context.ServletContextAware

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


Constructor Summary
DefaultDataSourceFactory(UserAccessor userAccessor, AttachmentManager attachmentManager, ContentEntityObjectDao contentEntityObjectDao, MimetypesFileTypeMap mimetypesFileTypeMap, ThumbnailManager thumbnailManager)
           
 
Method Summary
 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 getURLResource(URL url, String name)
          //TODO caching datasource
 void setServletContext(javax.servlet.ServletContext servletContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDataSourceFactory

public DefaultDataSourceFactory(UserAccessor userAccessor,
                                AttachmentManager attachmentManager,
                                ContentEntityObjectDao contentEntityObjectDao,
                                MimetypesFileTypeMap mimetypesFileTypeMap,
                                ThumbnailManager thumbnailManager)
Method Detail

getAvatar

public DataSource getAvatar(com.atlassian.user.User user)
Description copied from interface: DataSourceFactory
Construct a DataSource for a user's 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.

getServletContainerResource

public 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 .

getDatasource

public DataSource getDatasource(Attachment attachment,
                                boolean useThumbnail)
                         throws IOException
Specified by:
getDatasource in interface DataSourceFactory
Throws:
IOException

getURLResource

public DataSource getURLResource(URL url,
                                 String name)
//TODO caching datasource

Specified by:
getURLResource in interface DataSourceFactory

setServletContext

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


Copyright © 2003-2012 Atlassian. All Rights Reserved.