com.atlassian.confluence.pages.thumbnail
Class DefaultThumbnailManager

java.lang.Object
  extended by com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager
All Implemented Interfaces:
ThumbnailManager

public class DefaultThumbnailManager
extends Object
implements ThumbnailManager


Field Summary
 
Fields inherited from interface com.atlassian.confluence.pages.thumbnail.ThumbnailManager
THUMBNAIL_PATH_SUFFIX
 
Constructor Summary
DefaultThumbnailManager()
           
 
Method Summary
 boolean checkToolkit()
          Deprecated. since 3.5 - not used
 int getMaxHeight()
           
 int getMaxWidth()
           
 com.atlassian.core.util.thumbnail.Thumber getThumber()
          Deprecated. since 3.5
 com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
          Returns a thumbnail for this attachment having ensured the thumbnail exists in the filesystem, generating it only if it doesn't already exist.
 InputStream getThumbnailData(Attachment attachment)
          We only store a thumbnail of the latest version of an image attachment in the format thumb_foo.jpg When new versions of the attachment are added, this thumbnail is removed and regenerated the next time its requested.
 File getThumbnailFile(Attachment attachment)
          returns the path to the thumbnail for this attachment
 ThumbnailInfo getThumbnailInfo(Attachment attachment)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 ThumbnailInfo getThumbnailInfo(Attachment attachment, String remoteAttachmentPath)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 DelegatingThumbnailRenderer getThumbnailRenderer()
           
 Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Collection<Attachment> attachments)
          not currently used
protected  File getThumbnailsFolder(Attachment attachment)
           
 boolean isThumbnailable(Attachment attachment)
          checks the content type/mime type of the attachment to determine whether a thumbnail can be created from it
 boolean isThumbnailable(InputStream imageData)
          Deprecated. since 3.5 - not used
static boolean isThumbnailable(String mimeType)
           
 boolean isThumbnailable(ThumbnailInfo info)
           
 boolean removeThumbnail(Attachment attachment)
          Removes the thumbnail for the specified attachment.
 void setBootstrapManager(BootstrapManager bootstrapManager)
           
 void setImageDetailsManager(ImageDetailsManager imageDetailsManager)
           
 void setSettingsManager(SettingsManager settingsManager)
           
 void setThumbnailRenderer(DelegatingThumbnailRenderer thumbnailRenderer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultThumbnailManager

public DefaultThumbnailManager()
Method Detail

isThumbnailable

public boolean isThumbnailable(Attachment attachment)
Description copied from interface: ThumbnailManager
checks the content type/mime type of the attachment to determine whether a thumbnail can be created from it

Specified by:
isThumbnailable in interface ThumbnailManager

isThumbnailable

public static boolean isThumbnailable(String mimeType)

isThumbnailable

public boolean isThumbnailable(ThumbnailInfo info)
Specified by:
isThumbnailable in interface ThumbnailManager

isThumbnailable

@Deprecated
public boolean isThumbnailable(InputStream imageData)
Deprecated. since 3.5 - not used

Specified by:
isThumbnailable in interface ThumbnailManager

checkToolkit

@Deprecated
public boolean checkToolkit()
Deprecated. since 3.5 - not used

Description copied from interface: ThumbnailManager
checks whether the users system has AWT toolkit required to create thumbnails

Specified by:
checkToolkit in interface ThumbnailManager

getThumbnailData

public InputStream getThumbnailData(Attachment attachment)
                             throws FileNotFoundException
We only store a thumbnail of the latest version of an image attachment in the format thumb_foo.jpg When new versions of the attachment are added, this thumbnail is removed and regenerated the next time its requested.

HACK: This function assumes that the thumbnail has been created i.e getThumbnail has been called.

Specified by:
getThumbnailData in interface ThumbnailManager
Throws:
FileNotFoundException

getThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
                                                         throws IllegalArgumentException
Returns a thumbnail for this attachment having ensured the thumbnail exists in the filesystem, generating it only if it doesn't already exist. The size of the thumbnail is set by the application's configuration.

Specified by:
getThumbnail in interface ThumbnailManager
Throws:
IllegalArgumentException - if the attachment is an inappropriate type for thumbnailing, i.e. ThumbnailManager.isThumbnailable(Attachment) returns false

getThumbnailInfo

public ThumbnailInfo getThumbnailInfo(Attachment attachment)
                               throws CannotGenerateThumbnailException
Description copied from interface: ThumbnailManager
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk. The address of the thumbnail will be rooted at the context path, rather than the base url. The thumbnail maximum size is taken from the global settings.

Specified by:
getThumbnailInfo in interface ThumbnailManager
Returns:
thumbnail information for the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail.

getThumbnailInfo

public ThumbnailInfo getThumbnailInfo(Attachment attachment,
                                      String remoteAttachmentPath)
                               throws CannotGenerateThumbnailException
Description copied from interface: ThumbnailManager
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk. The address of the thumbnail will be rooted at the context path, rather than the base url. The thumbnail maximum size is taken from the global settings.

Specified by:
getThumbnailInfo in interface ThumbnailManager
remoteAttachmentPath - path to the thumbnail, excepting the thumbnail itself. Eg the value returned by ConfluenceRenderUtils.getAttachmentRemotePath(com.atlassian.confluence.pages.Attachment).
Returns:
thumbnail information for the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail.

setBootstrapManager

public void setBootstrapManager(BootstrapManager bootstrapManager)

getThumbnails

public Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Collection<Attachment> attachments)
                                                                      throws Exception
not currently used

Specified by:
getThumbnails in interface ThumbnailManager
Throws:
Exception

getThumbnailsFolder

protected File getThumbnailsFolder(Attachment attachment)

getThumbnailFile

public File getThumbnailFile(Attachment attachment)
Description copied from interface: ThumbnailManager
returns the path to the thumbnail for this attachment

Specified by:
getThumbnailFile in interface ThumbnailManager

removeThumbnail

public boolean removeThumbnail(Attachment attachment)
Description copied from interface: ThumbnailManager
Removes the thumbnail for the specified attachment.

Specified by:
removeThumbnail in interface ThumbnailManager
Returns:
true if the thumbnail was found and was successfully removed. False if no thumbnail was found or the thumbnail could not be removed.

getMaxHeight

public int getMaxHeight()
Specified by:
getMaxHeight in interface ThumbnailManager
Returns:
the maximum height of thumbnails generated by ThumbnailManager.getThumbnail(Attachment) and ThumbnailManager.getThumbnailInfo(Attachment) without providing dimensions

getMaxWidth

public int getMaxWidth()
Specified by:
getMaxWidth in interface ThumbnailManager
Returns:
the maximum width of thumbnails generated by ThumbnailManager.getThumbnail(Attachment) and ThumbnailManager.getThumbnailInfo(Attachment) without providing dimensions

getThumber

@Deprecated
public com.atlassian.core.util.thumbnail.Thumber getThumber()
Deprecated. since 3.5


getThumbnailRenderer

public DelegatingThumbnailRenderer getThumbnailRenderer()

setThumbnailRenderer

public void setThumbnailRenderer(DelegatingThumbnailRenderer thumbnailRenderer)

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

setImageDetailsManager

public void setImageDetailsManager(ImageDetailsManager imageDetailsManager)


Copyright © 2003-2013 Atlassian. All Rights Reserved.