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_IMAGE_DARK_FEATURE, THUMBNAIL_PATH_SUFFIX
 
Constructor Summary
DefaultThumbnailManager()
           
 
Method Summary
 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.
 com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment, ImageDimensions imageDimensions)
          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)
          Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system.
 InputStream getThumbnailData(Attachment attachment, ImageDimensions imageDimensions)
          Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system.
 File getThumbnailFile(Attachment attachment)
          Returns the path to the thumbnail for this attachment
 File getThumbnailFile(Attachment attachment, ImageDimensions imageDimensions)
          Returns the path to the thumbnail for this attachment
 File getThumbnailFile(long attachmentId, int version, long contentId)
           
 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, ImageDimensions imageDimensions)
          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.
 ThumbnailInfo getThumbnailInfo(Attachment attachment, String remoteAttachmentPath, ImageDimensions imageDimensions)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 DelegatingThumbnailRenderer getThumbnailRenderer()
          Deprecated. since 5.4
 Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Collection<Attachment> attachments)
          Deprecated. 
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)
          Check the thumbnail information to determine whether a thumbnail can be created from it
 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(@Nullable
                               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
Parameters:
attachment - the attachment
Returns:
true if the attachment can have thumbnail, otherwise false

isThumbnailable

public static boolean isThumbnailable(String mimeType)

isThumbnailable

public boolean isThumbnailable(@Nullable
                               ThumbnailInfo info)
Description copied from interface: ThumbnailManager
Check the thumbnail information to determine whether a thumbnail can be created from it

Specified by:
isThumbnailable in interface ThumbnailManager
Parameters:
info - the thumbnail information
Returns:
true if it can have thumbnail, otherwise false

isThumbnailable

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

Specified by:
isThumbnailable in interface ThumbnailManager

getThumbnailData

public InputStream getThumbnailData(@Nonnull
                                    Attachment attachment)
                             throws FileNotFoundException
Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system. This function assumes that the thumbnail has been created i.e getThumbnail has been called.

Specified by:
getThumbnailData in interface ThumbnailManager
Parameters:
attachment - the attachment
Returns:
the input stream of the thumbnail
Throws:
FileNotFoundException - if the thumbnail file is not found

getThumbnailData

public InputStream getThumbnailData(@Nonnull
                                    Attachment attachment,
                                    @Nullable
                                    ImageDimensions imageDimensions)
                             throws FileNotFoundException
Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system. This function assumes that the thumbnail has been created. i.e getThumbnail has been called.

Specified by:
getThumbnailData in interface ThumbnailManager
Parameters:
attachment - the attachment
imageDimensions - image dimensions of the thumbnail
Returns:
the input stream of the thumbnail
Throws:
FileNotFoundException - if the thumbnail file is not found

getThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@Nonnull
                                                                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
Parameters:
attachment - the attachment
Returns:
the thumbnail if the attachment
Throws:
IllegalArgumentException - if the attachment is an inappropriate type for thumbnailing, i.e. ThumbnailManager.isThumbnailable(Attachment) returns false

getThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@Nonnull
                                                                Attachment attachment,
                                                                @Nullable
                                                                ImageDimensions imageDimensions)
                                                         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 in parameters, if it doesn't exist, then use the application's configuration.

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

getThumbnailInfo

public ThumbnailInfo getThumbnailInfo(@Nonnull
                                      Attachment attachment)
                               throws CannotGenerateThumbnailException
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
Parameters:
attachment - the attachment
Returns:
the thumbnail information of the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail

getThumbnailInfo

public ThumbnailInfo getThumbnailInfo(@Nonnull
                                      Attachment attachment,
                                      @Nullable
                                      ImageDimensions imageDimensions)
                               throws CannotGenerateThumbnailException
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 set in parameters, if it doesn't exist, then taken from the global settings.

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

getThumbnailInfo

public ThumbnailInfo getThumbnailInfo(@Nonnull
                                      Attachment attachment,
                                      @Nullable
                                      String remoteAttachmentPath)
                               throws CannotGenerateThumbnailException
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
Parameters:
attachment - the attachment
remoteAttachmentPath - path to the thumbnail, excepting the thumbnail itself. Eg the value returned by ConfluenceRenderUtils.getAttachmentRemotePath(com.atlassian.confluence.pages.Attachment).
Returns:
the thumbnail information of the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail

getThumbnailInfo

public ThumbnailInfo getThumbnailInfo(@Nonnull
                                      Attachment attachment,
                                      @Nullable
                                      String remoteAttachmentPath,
                                      @Nullable
                                      ImageDimensions imageDimensions)
                               throws CannotGenerateThumbnailException
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 set in parameters, if it doesn't exist, then taken from the global settings.

Specified by:
getThumbnailInfo in interface ThumbnailManager
Parameters:
attachment - the attachment
remoteAttachmentPath - path to the thumbnail, excepting the thumbnail itself. Eg the value returned by ConfluenceRenderUtils.getAttachmentRemotePath(com.atlassian.confluence.pages.Attachment).
imageDimensions - image dimensions of the thumbnail
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

@Deprecated
public Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Collection<Attachment> attachments)
                                                                      throws Exception
Deprecated. 

Specified by:
getThumbnails in interface ThumbnailManager
Throws:
Exception

getThumbnailsFolder

protected File getThumbnailsFolder(Attachment attachment)

getThumbnailFile

public File getThumbnailFile(@Nonnull
                             Attachment attachment)
Returns the path to the thumbnail for this attachment

Specified by:
getThumbnailFile in interface ThumbnailManager
Parameters:
attachment - the attachment
Returns:
the thumbnail file

getThumbnailFile

public File getThumbnailFile(@Nonnull
                             Attachment attachment,
                             @Nullable
                             ImageDimensions imageDimensions)
Returns the path to the thumbnail for this attachment

Specified by:
getThumbnailFile in interface ThumbnailManager
Parameters:
attachment - the attachment
imageDimensions - image dimensions of the thumbnail
Returns:
the thumbnail file

getThumbnailFile

public File getThumbnailFile(long attachmentId,
                             int version,
                             long contentId)
Specified by:
getThumbnailFile in interface ThumbnailManager

removeThumbnail

public boolean removeThumbnail(@Nonnull
                               Attachment attachment)
Removes the thumbnail for the specified attachment

Specified by:
removeThumbnail in interface ThumbnailManager
Parameters:
attachment - the attachment
Returns:
true if the thumbnail was found and was successfully removed, false if no thumbnail was found or the thumbnail could not be removed

getThumber

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


getThumbnailRenderer

@Deprecated
public DelegatingThumbnailRenderer getThumbnailRenderer()
Deprecated. since 5.4


setThumbnailRenderer

public void setThumbnailRenderer(DelegatingThumbnailRenderer thumbnailRenderer)

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

setImageDetailsManager

public void setImageDetailsManager(ImageDetailsManager imageDetailsManager)


Copyright © 2003–2015 Atlassian. All rights reserved.