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 java.lang.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()
          checks whether the users system has AWT toolkit required to create thumbnails
 int getMaxHeight()
           
 int getMaxWidth()
           
 com.atlassian.core.util.thumbnail.Thumber getThumber()
           
 com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
          Retrieves the thumbnail for attachment
 java.io.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.
 java.io.File getThumbnailFile(Attachment attachment)
          returns the path to the thumbnail for this attachment
 java.util.Collection getThumbnails(java.util.Collection attachments)
          not currently used
protected  java.io.File getThumbnailsFolder(Attachment attachment)
           
 boolean isThumbnailable(Attachment attachment)
          Deprecated. This only checks the content type, not the mime type of the attachment itself.
 boolean isThumbnailable(java.io.InputStream imageData)
           
 boolean isThumbnailable(ThumbnailInfo info)
           
 boolean removeThumbnail(Attachment attachment)
          Removes the thumbnail for the specified attachment.
 void setAttachmentManager(AttachmentManager attachmentManager)
           
 void setBootstrapManager(BootstrapManager bootstrapManager)
           
 void setSettingsManager(SettingsManager settingsManager)
           
 void setThumber(com.atlassian.core.util.thumbnail.Thumber thumber)
           
 
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)
Deprecated. This only checks the content type, not the mime type of the attachment itself.

Description copied from interface: ThumbnailManager
checks the mime type of the attachment to determine whether a thumbnail can be created from it

Specified by:
isThumbnailable in interface ThumbnailManager
Returns:

isThumbnailable

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

isThumbnailable

public boolean isThumbnailable(java.io.InputStream imageData)
Specified by:
isThumbnailable in interface ThumbnailManager

checkToolkit

public boolean checkToolkit()
Description copied from interface: ThumbnailManager
checks whether the users system has AWT toolkit required to create thumbnails

Specified by:
checkToolkit in interface ThumbnailManager
Returns:

getThumbnailData

public java.io.InputStream getThumbnailData(Attachment attachment)
                                     throws java.io.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
Returns:
Throws:
java.io.FileNotFoundException

getThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
                                                         throws java.net.MalformedURLException,
                                                                java.io.FileNotFoundException
Retrieves the thumbnail for attachment

Specified by:
getThumbnail in interface ThumbnailManager
Parameters:
attachment - the Attachment the thumbnail belongs to
Returns:
a Thumbnail representing the image
Throws:
java.net.MalformedURLException
java.io.FileNotFoundException
java.lang.IllegalArgumentException - if a thumbnail cannot be created from attachment

setBootstrapManager

public void setBootstrapManager(BootstrapManager bootstrapManager)

getThumbnails

public java.util.Collection getThumbnails(java.util.Collection attachments)
                                   throws java.lang.Exception
not currently used

Specified by:
getThumbnails in interface ThumbnailManager
Throws:
java.lang.Exception

getThumbnailsFolder

protected java.io.File getThumbnailsFolder(Attachment attachment)

getThumbnailFile

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

Specified by:
getThumbnailFile in interface ThumbnailManager
Returns:

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 the generated thumbnail

getMaxWidth

public int getMaxWidth()
Specified by:
getMaxWidth in interface ThumbnailManager
Returns:
the maximum width of the generated thumbnail

getThumber

public com.atlassian.core.util.thumbnail.Thumber getThumber()

setThumber

public void setThumber(com.atlassian.core.util.thumbnail.Thumber thumber)

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

setAttachmentManager

public void setAttachmentManager(AttachmentManager attachmentManager)


Copyright © 2003-2009 Atlassian Pty Ltd. All Rights Reserved.