Package com.atlassian.bamboo.avatar
Class DelegatingCacheableAvatarSupplier
- java.lang.Object
 - 
- com.atlassian.bamboo.avatar.DelegatingCacheableAvatarSupplier
 
 
- 
- All Implemented Interfaces:
 AvatarSupplier,CacheableAvatarSupplier,InputSupplier<InputStream>
public class DelegatingCacheableAvatarSupplier extends Object implements CacheableAvatarSupplier
AnCacheableAvatarSupplierimplementation which delegates to anAvatarSupplier, storing the avatar'smodification timestampseparately. This class can be used to promote an ordinaryAvatarSupplierto aCacheableAvatarSupplier.- Since:
 - 9.5
 
 
- 
- 
Field Summary
- 
Fields inherited from interface com.atlassian.bamboo.avatar.CacheableAvatarSupplier
TIMESTAMP_ETERNAL, TIMESTAMP_UNKNOWN 
 - 
 
- 
Constructor Summary
Constructors Constructor Description DelegatingCacheableAvatarSupplier(@NotNull AvatarSupplier supplier)Constructs a newDelegatingCacheableAvatarSupplierwith anunknowntimestamp.DelegatingCacheableAvatarSupplier(@NotNull AvatarSupplier supplier, long timestamp)Constructs a newDelegatingCacheableAvatarSupplierwith the providedtimestamp. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentType()The content type of the avatar, e.g., "image/png"longgetTimestamp()The timestamp at which the avatar was last modified, in milliseconds.@NotNull InputStreamopen()Provides anInputStreamto read the avatar. 
 - 
 
- 
- 
Constructor Detail
- 
DelegatingCacheableAvatarSupplier
public DelegatingCacheableAvatarSupplier(@NotNull @NotNull AvatarSupplier supplier)Constructs a newDelegatingCacheableAvatarSupplierwith anunknowntimestamp.- Parameters:
 supplier- theAvatarSuppliercontaining the avatar's content type andInputStream- See Also:
 DelegatingCacheableAvatarSupplier(AvatarSupplier, long),CacheableAvatarSupplier.TIMESTAMP_UNKNOWN
 
- 
DelegatingCacheableAvatarSupplier
public DelegatingCacheableAvatarSupplier(@NotNull @NotNull AvatarSupplier supplier, long timestamp)Constructs a newDelegatingCacheableAvatarSupplierwith the providedtimestamp.- Parameters:
 supplier- theAvatarSuppliercontaining the avatar's content type andInputStreamtimestamp- the avatar's modification timestamp, which may beCacheableAvatarSupplier.TIMESTAMP_UNKNOWNif no modification timestamp is known, orCacheableAvatarSupplier.TIMESTAMP_ETERNALif the avatar is unmodifiable
 
 - 
 
- 
Method Detail
- 
getContentType
public String getContentType()
Description copied from interface:AvatarSupplierThe content type of the avatar, e.g., "image/png"- Specified by:
 getContentTypein interfaceAvatarSupplier- Returns:
 - the string representing the content type
 
 
- 
open
@NotNull public @NotNull InputStream open() throws IOException
Description copied from interface:AvatarSupplierProvides anInputStreamto read the avatar. Each call to this method will produce a new stream.- Specified by:
 openin interfaceAvatarSupplier- Specified by:
 openin interfaceInputSupplier<InputStream>- Returns:
 - a stream from the avatar
 - Throws:
 IOException- in case the avatar could not be opened or read
 
- 
getTimestamp
public long getTimestamp()
Description copied from interface:CacheableAvatarSupplierThe timestamp at which the avatar was last modified, in milliseconds.To account for differences in avatar repository implementations:
- If timestamp information is not available, implementations shall return 
CacheableAvatarSupplier.TIMESTAMP_UNKNOWN. Avatars without timestamps should not be cached, as it may not be possible to reliably detect updates. - If the avatar cannot be updated, implementations shall return 
CacheableAvatarSupplier.TIMESTAMP_ETERNAL. Such avatars may be cached more aggressively, as they cannot change. 
- Specified by:
 getTimestampin interfaceCacheableAvatarSupplier- Returns:
 - the avatar's modification timestamp in milliseconds, or 
CacheableAvatarSupplier.TIMESTAMP_UNKNOWNif no modification date is available, orCacheableAvatarSupplier.TIMESTAMP_ETERNALif the avatar is unmodifiable 
 - If timestamp information is not available, implementations shall return 
 
 - 
 
 -