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)
          Returns a thumbnail for this attachment having ensured the thumbnail exists in the filesystem, generating it only if it doesn't already exist.
 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
 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, java.lang.String remoteAttachmentPath)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 java.util.Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(java.util.Collection<Attachment> attachments)
          not currently used
protected  java.io.File getThumbnailsFolder(Attachment attachment)
           
 boolean isThumbnailable(Attachment attachment)
          Deprecated. since 3.0 This only checks the content type, not the mime type of the attachment itself.
 boolean isThumbnailable(java.io.InputStream imageData)
           
static boolean isThumbnailable(java.lang.String mimeType)
           
 boolean isThumbnailable(ThumbnailInfo info)
           
 boolean removeThumbnail(Attachment attachment)
          Removes the thumbnail for the specified attachment.
 void setAttachmentManager(AttachmentManager attachmentManager)
           
 void setBootstrapManager(BootstrapManager bootstrapManager)
           
 void setImageDetailsManager(ImageDetailsManager imageDetailsManager)
           
 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. since 3.0 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

isThumbnailable

public static boolean isThumbnailable(java.lang.String mimeType)

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

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
Throws:
java.io.FileNotFoundException

getThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
                                                         throws java.lang.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:
java.lang.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,
                                      java.lang.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 java.util.Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(java.util.Collection<Attachment> 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

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

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)

setImageDetailsManager

public void setImageDetailsManager(ImageDetailsManager imageDetailsManager)


Copyright © 2003-2010 Atlassian. All Rights Reserved.