|
Jive Forums API (5.5.8) Developer Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.forum.database.DbAttachmentManager
public class DbAttachmentManager
Database implementation of the AttachmentManager interface. Support for storing attachments can be enabled by setting the attachments.databaseModeEnabled property to true. When the database attachment mode is enabled, attachments will be cached on the file system in the attachment directory of jiveHome. Cached attachments on the file system will be deleted after 30 days. Therefore, care should be taken if switching between file system and database mode since file system attachments will be assumed to be out-dated cached items and then deleted (possibly before you have a chance to copy attachments into the database).
| Nested Class Summary | |
|---|---|
static class |
DbAttachmentManager.AttachmentSettingsTask
|
| Method Summary | |
|---|---|
void |
addAllowedType(java.lang.String contentType)
Adds a content type to the list of explicitly allowed types. |
void |
addDisallowedType(java.lang.String contentType)
Adds a content type to the list of explicitly disallowed types. |
protected void |
addToAttachDirSize(long size)
Adds to the size of the attachment directory. |
java.util.Iterator |
allowedTypes()
Returns an Iterator for the list of explicitly allowed types. |
void |
destroy()
Notifies the manager to release any resources that may be holding on too. |
java.util.Iterator |
disallowedTypes()
Returns an Iterator for the list of explicitly disallowed types. |
boolean |
getAllowAllByDefault()
Returns true if in the "allow all content types by default" mode. |
static java.io.File |
getAttachmentDir()
Returns the directory that attachments are stored in. |
long |
getAttachmentDirectorySize()
Returns the size (in bytes) of the attachment directory on the file system. |
int |
getImagePreviewMaxSize()
Returns the max dimension of generated thumbnails (ie, the max value for the width or height). |
static DbAttachmentManager |
getInstance()
|
int |
getMaxAttachmentSize()
Returns the maximum size of an individual attachment in kilobytes. |
int |
getMaxAttachmentsPerMessage()
Returns the maximum number of attachments per message. |
long |
getMaxFilesystemCacheSize()
Returns the maximum amount of storage (in bytes) that will be used by the file system cache when database attachment mode is enabled. |
static java.lang.String |
getThumbnailImage(java.lang.String contentType)
Returns a Map for the list of content types to image names. |
void |
initialize()
Initialize the manager. |
boolean |
isDatabaseModeEnabled()
Returns true if the binary attachment data is stored in the database. |
boolean |
isImagePreviewEnabled()
Returns true if image preview support is enabled. |
boolean |
isImagePreviewRatioEnabled()
Returns true if the aspect ratio of thumbnails should be preserved. |
boolean |
isValidType(java.lang.String contentType)
Returns true if the content type is valid based on the current settings of the allowAllByDefault flag and the allowed and disallowed types list. |
void |
removeAllowedType(java.lang.String contentType)
Removes a content type fromt he list of explicitly allowed types. |
void |
removeDisallowedType(java.lang.String contentType)
Removes a content type from the list of explicitly disallowed types. |
void |
setAllowAllByDefault(boolean allowAllByDefault)
Sets the default allowed content types mode. |
void |
setDatabaseModeEnabled(boolean enabled)
Enables or disables storage of binary attachment data in the database. |
void |
setDatabaseModeEnabled(boolean enabled,
boolean synchronous)
Enables or disables storage of binary attachment data in the database. |
void |
setImagePreviewEnabled(boolean imagePreviewEnabled)
Toggles whether image preview support is enabled. |
void |
setImagePreviewMaxSize(int imagePreviewMaxSize)
Sets the max dimension of generated thumbnails (ie, the max value for the width or height). |
void |
setImagePreviewRatioEnabled(boolean imagePreviewRatioEnabled)
Toggles whether the aspect ratio of thumbnails should be preserved. |
void |
setMaxAttachmentSize(int maxAttachmentSize)
Sets the maximum size of an individual attachment in kilobytes. |
void |
setMaxAttachmentsPerMessage(int maxAttachmentsPerMessage)
Sets the maximum number of attachments per message. |
void |
setMaxFilesystemCacheSize(long maxSize)
Sets the maximum amount of storage (in bytes) that will be used by the file system cache when database attachment mode is enabled. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static DbAttachmentManager getInstance()
public void initialize()
JiveManagerThis method is used internally by Jive during application startup and should not be called during normal usage of the class.
initialize in interface JiveManagerpublic void destroy()
JiveManager
destroy in interface JiveManagerpublic boolean isDatabaseModeEnabled()
AttachmentManagerWhen database attachment mode is enabled, attachment data will be cached on the file system in the attachment directory in order to relieve load on the database.
isDatabaseModeEnabled in interface AttachmentManagerpublic void setDatabaseModeEnabled(boolean enabled)
AttachmentManagerWhen database attachment mode is enabled, attachment data will be cached on the file system in the attachment directory in order to relieve load on the database.
setDatabaseModeEnabled in interface AttachmentManagerenabled - true if attachment data should be stored in the database.
public void setDatabaseModeEnabled(boolean enabled,
boolean synchronous)
When database attachment mode is enabled, attachment data will be cached on the file system in the attachment directory in order to relieve load on the database.
This version of the method can be invoked synchronously, which means that the mode will be changed before this method returns.
enabled - true if attachment data should be stored in the database.synchronous - true to execute this method synchronously.
public long getAttachmentDirectorySize()
throws UnauthorizedException
AttachmentManagerThe size of the attachment directory is computed asynchronously at system startup. Therefore, when the the size of the directory is not known, this method will return -1.
getAttachmentDirectorySize in interface AttachmentManagerUnauthorizedException - if not a system administrator.
public long getMaxFilesystemCacheSize()
throws UnauthorizedException
AttachmentManager
getMaxFilesystemCacheSize in interface AttachmentManagerUnauthorizedException - if not a system administrator.
public void setMaxFilesystemCacheSize(long maxSize)
throws UnauthorizedException
AttachmentManager
setMaxFilesystemCacheSize in interface AttachmentManagermaxSize - the max size of the file system cache for attachment data (in bytes).
UnauthorizedException - if not a system administrator.public int getMaxAttachmentSize()
AttachmentManager
getMaxAttachmentSize in interface AttachmentManagerpublic void setMaxAttachmentSize(int maxAttachmentSize)
AttachmentManager
setMaxAttachmentSize in interface AttachmentManagermaxAttachmentSize - the max size in kilobytes of any single
attachment.public int getMaxAttachmentsPerMessage()
AttachmentManager
getMaxAttachmentsPerMessage in interface AttachmentManagerpublic void setMaxAttachmentsPerMessage(int maxAttachmentsPerMessage)
AttachmentManager
setMaxAttachmentsPerMessage in interface AttachmentManagermaxAttachmentsPerMessage - the max number of attachments allowed
per message.public boolean isValidType(java.lang.String contentType)
AttachmentManager
isValidType in interface AttachmentManagercontentType - the content type to test.
public void addAllowedType(java.lang.String contentType)
AttachmentManager
addAllowedType in interface AttachmentManagercontentType - a content type to add to the explicitly allowed types
list.public void removeAllowedType(java.lang.String contentType)
AttachmentManager
removeAllowedType in interface AttachmentManagercontentType - a content type to remove from the explicitly allowed
types list.public java.util.Iterator allowedTypes()
AttachmentManager
allowedTypes in interface AttachmentManagerpublic void addDisallowedType(java.lang.String contentType)
AttachmentManager
addDisallowedType in interface AttachmentManagercontentType - a content type to add to the explicitly disallowed
types list.public void removeDisallowedType(java.lang.String contentType)
AttachmentManager
removeDisallowedType in interface AttachmentManagercontentType - a content type to remove from the explicitly disallowed
types list.public java.util.Iterator disallowedTypes()
AttachmentManager
disallowedTypes in interface AttachmentManagerpublic boolean getAllowAllByDefault()
AttachmentManager
getAllowAllByDefault in interface AttachmentManagerpublic void setAllowAllByDefault(boolean allowAllByDefault)
AttachmentManager
setAllowAllByDefault in interface AttachmentManagerallowAllByDefault - true if all content types should be
allowed by default.public boolean isImagePreviewEnabled()
AttachmentManager
isImagePreviewEnabled in interface AttachmentManagerpublic void setImagePreviewEnabled(boolean imagePreviewEnabled)
AttachmentManager
setImagePreviewEnabled in interface AttachmentManagerimagePreviewEnabled - true if thumbnail support should be enabled.public int getImagePreviewMaxSize()
AttachmentManager
getImagePreviewMaxSize in interface AttachmentManagerpublic void setImagePreviewMaxSize(int imagePreviewMaxSize)
AttachmentManager
setImagePreviewMaxSize in interface AttachmentManagerimagePreviewMaxSize - the max dimension of a thumbnail.public boolean isImagePreviewRatioEnabled()
AttachmentManager
isImagePreviewRatioEnabled in interface AttachmentManagerpublic void setImagePreviewRatioEnabled(boolean imagePreviewRatioEnabled)
AttachmentManager
setImagePreviewRatioEnabled in interface AttachmentManagerimagePreviewRatioEnabled - true if the aspect ration should be preserved.public static java.lang.String getThumbnailImage(java.lang.String contentType)
public static java.io.File getAttachmentDir()
protected void addToAttachDirSize(long size)
size - size of the attachment.
|
Jive Forums Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||