Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.webservices.server
Class AttachmentManagerServiceImpl

java.lang.Object
  extended by com.jivesoftware.forum.webservices.server.AttachmentManagerServiceImpl
All Implemented Interfaces:
AttachmentManagerService

public class AttachmentManagerServiceImpl
extends java.lang.Object
implements AttachmentManagerService


Constructor Summary
AttachmentManagerServiceImpl()
           
 
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.
 java.lang.String[] allowedTypes()
          Returns a String[] for the list of explicitly allowed types.
 java.lang.String[] 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.
 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).
 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.
 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 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
 

Constructor Detail

AttachmentManagerServiceImpl

public AttachmentManagerServiceImpl()
Method Detail

isDatabaseModeEnabled

public boolean isDatabaseModeEnabled()
Description copied from interface: AttachmentManagerService
Returns true if the binary attachment data is stored in the database. If false, attachments are stored on the file system. Not all databases may support storing attachment data in the database, so the mode is disabled by default. Those using clustering, or a database that does work with database attachments may wish to turn this mode on.

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.

Specified by:
isDatabaseModeEnabled in interface AttachmentManagerService
Returns:
true if database attachment mode is enabled.

setDatabaseModeEnabled

public void setDatabaseModeEnabled(boolean enabled)
                            throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Enables or disables storage of binary attachment data in the database. If false, attachments are stored on the file system. Not all databases may support storing attachment data in the database, so the mode is disabled by default. Those using clustering, or a database that does work with database attachments may wish to turn this mode on.

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.

Specified by:
setDatabaseModeEnabled in interface AttachmentManagerService
Parameters:
enabled - true if attachment data should be stored in the database.
Throws:
UnauthorizedException - if not a system administrator.

getAttachmentDirectorySize

public long getAttachmentDirectorySize()
                                throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Returns the size (in bytes) of the attachment directory on the file system. When in file system storage mode, the attachment directory is where all binary data is stored. In database attachment mode, the attachment directory is used as a cache for attachment data in order to relieve load on the database.

The 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.

Specified by:
getAttachmentDirectorySize in interface AttachmentManagerService
Returns:
the size of the attachment directory in bytes, or -1 if the size of the directory is not known..
Throws:
UnauthorizedException - if not a system administrator.

getMaxFilesystemCacheSize

public long getMaxFilesystemCacheSize()
                               throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Returns the maximum amount of storage (in bytes) that will be used by the file system cache when database attachment mode is enabled. The default maximum size is 512 MB. When the cache size is exceeded, files will be deleted until at least 10% of the cache is free.

Specified by:
getMaxFilesystemCacheSize in interface AttachmentManagerService
Returns:
the max size of the file system cache for attachment data (in bytes).
Throws:
UnauthorizedException - if not a system administrator.

setMaxFilesystemCacheSize

public void setMaxFilesystemCacheSize(long maxSize)
                               throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Sets the maximum amount of storage (in bytes) that will be used by the file system cache when database attachment mode is enabled. The default maximum size is 512 MB. When the cache size is exceeded, files will be deleted until at least 10% of the cache is free.

Specified by:
setMaxFilesystemCacheSize in interface AttachmentManagerService
Parameters:
maxSize - the max size of the file system cache for attachment data (in bytes).
Throws:
UnauthorizedException - if not a system administrator.

getMaxAttachmentSize

public int getMaxAttachmentSize()
Description copied from interface: AttachmentManagerService
Returns the maximum size of an individual attachment in kilobytes. Trying to create an attachment larger than the max size will fail with an exception. The default maximum attachment size is 1 megabyte, or 1,024 K.

Specified by:
getMaxAttachmentSize in interface AttachmentManagerService
Returns:
the max size in kilobytes of any single attachment.

setMaxAttachmentSize

public void setMaxAttachmentSize(int maxAttachmentSize)
                          throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Sets the maximum size of an individual attachment in kilobytes. Trying to create an attachment larger than the max size will fail with an exception. The default maximum attachment size is 1 megabyte, or 1024 K.

Specified by:
setMaxAttachmentSize in interface AttachmentManagerService
Parameters:
maxAttachmentSize - the max size in kilobytes of any single attachment.
Throws:
UnauthorizedException - if not an administrator.

getMaxAttachmentsPerMessage

public int getMaxAttachmentsPerMessage()
Description copied from interface: AttachmentManagerService
Returns the maximum number of attachments per message. The default is 5 attachments.

Specified by:
getMaxAttachmentsPerMessage in interface AttachmentManagerService
Returns:
the max number of attachments allowed per message.

setMaxAttachmentsPerMessage

public void setMaxAttachmentsPerMessage(int maxAttachmentsPerMessage)
                                 throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Sets the maximum number of attachments per message. The default is 5 attachments.

Specified by:
setMaxAttachmentsPerMessage in interface AttachmentManagerService
Parameters:
maxAttachmentsPerMessage - the max number of attachments allowed per message.
Throws:
UnauthorizedException - if not an administrator.

isValidType

public boolean isValidType(java.lang.String contentType)
Description copied from interface: AttachmentManagerService
Returns true if the content type is valid based on the current settings of the allowAllByDefault flag and the allowed and disallowed types list.

Specified by:
isValidType in interface AttachmentManagerService
Parameters:
contentType - the content type to test.
Returns:
true if the content type is valid.

addAllowedType

public void addAllowedType(java.lang.String contentType)
                    throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Adds a content type to the list of explicitly allowed types.

Specified by:
addAllowedType in interface AttachmentManagerService
Parameters:
contentType - a content type to add to the explicitly allowed types list.
Throws:
UnauthorizedException - if not an administrator.

removeAllowedType

public void removeAllowedType(java.lang.String contentType)
                       throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Removes a content type fromt he list of explicitly allowed types. If the given content type does not exist in the list, this method does nothing.

Specified by:
removeAllowedType in interface AttachmentManagerService
Parameters:
contentType - a content type to remove from the explicitly allowed types list.
Throws:
UnauthorizedException - if not an administrator.

allowedTypes

public java.lang.String[] allowedTypes()
Description copied from interface: AttachmentManagerService
Returns a String[] for the list of explicitly allowed types.

Specified by:
allowedTypes in interface AttachmentManagerService
Returns:
a String[] for the list of all explicitly allowed types.

addDisallowedType

public void addDisallowedType(java.lang.String contentType)
                       throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Adds a content type to the list of explicitly disallowed types.

Specified by:
addDisallowedType in interface AttachmentManagerService
Parameters:
contentType - a content type to add to the explicitly disallowed types list.
Throws:
UnauthorizedException - if not an administrator.

removeDisallowedType

public void removeDisallowedType(java.lang.String contentType)
                          throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Removes a content type from the list of explicitly disallowed types.

Specified by:
removeDisallowedType in interface AttachmentManagerService
Parameters:
contentType - a content type to remove from the explicitly disallowed types list.
Throws:
UnauthorizedException - if not an administrator.

disallowedTypes

public java.lang.String[] disallowedTypes()
Description copied from interface: AttachmentManagerService
Returns an Iterator for the list of explicitly disallowed types.

Specified by:
disallowedTypes in interface AttachmentManagerService
Returns:
an iterator for the list of all explicitly disallowed types.

getAllowAllByDefault

public boolean getAllowAllByDefault()
Description copied from interface: AttachmentManagerService
Returns true if in the "allow all content types by default" mode. The alternative is that all content types are disallowed unless they're on the "allowed" list.

Specified by:
getAllowAllByDefault in interface AttachmentManagerService
Returns:
true if all content types are allowed by default.

setAllowAllByDefault

public void setAllowAllByDefault(boolean allowAllByDefault)
                          throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Sets the default allowed content types mode. The value true means that all content types will be allowed unless they're on the "disallowed list". If false, no content types will be allowed unless on the "allowed list".

Specified by:
setAllowAllByDefault in interface AttachmentManagerService
Parameters:
allowAllByDefault - true if all content types should be allowed by default.
Throws:
UnauthorizedException

isImagePreviewEnabled

public boolean isImagePreviewEnabled()
Description copied from interface: AttachmentManagerService
Returns true if image preview support is enabled. When enabled, the JiveServlet will generate thumbnails for image attachments. False by default.

Specified by:
isImagePreviewEnabled in interface AttachmentManagerService
Returns:
true if thumbnail support is enabled.

setImagePreviewEnabled

public void setImagePreviewEnabled(boolean imagePreviewEnabled)
                            throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Toggles whether image preview support is enabled. When enabled, the JiveServlet will generate thumbnails for image attachments. False by default.

Specified by:
setImagePreviewEnabled in interface AttachmentManagerService
Parameters:
imagePreviewEnabled - true if thumbnail support should be enabled.
Throws:
UnauthorizedException - if not a system administrator.

getImagePreviewMaxSize

public int getImagePreviewMaxSize()
Description copied from interface: AttachmentManagerService
Returns the max dimension of generated thumbnails (ie, the max value for the width or height). The default value is 25.

Specified by:
getImagePreviewMaxSize in interface AttachmentManagerService
Returns:
the max dimension of a thumbnail.

setImagePreviewMaxSize

public void setImagePreviewMaxSize(int imagePreviewMaxSize)
                            throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Sets the max dimension of generated thumbnails (ie, the max value for the width or height). The default value is 25.

Specified by:
setImagePreviewMaxSize in interface AttachmentManagerService
Parameters:
imagePreviewMaxSize - the max dimension of a thumbnail.
Throws:
UnauthorizedException - if not a system administrator.

isImagePreviewRatioEnabled

public boolean isImagePreviewRatioEnabled()
Description copied from interface: AttachmentManagerService
Returns true if the aspect ratio of thumbnails should be preserved. When enabled, the aspect ratio of the original image will be preserved when generating the thumbnail. When false, the thumbnail will always be a square (which may distort the image). The default is true..

Specified by:
isImagePreviewRatioEnabled in interface AttachmentManagerService
Returns:
true if the aspect ration should be preserved.

setImagePreviewRatioEnabled

public void setImagePreviewRatioEnabled(boolean imagePreviewRatioEnabled)
                                 throws UnauthorizedException
Description copied from interface: AttachmentManagerService
Toggles whether the aspect ratio of thumbnails should be preserved. When enabled, the aspect ratio of the original image will be preserved when generating the thumbnail. When false, the thumbnail will always be a square (which may distort the image). The default is true..

Specified by:
setImagePreviewRatioEnabled in interface AttachmentManagerService
Parameters:
imagePreviewRatioEnabled - true if the aspect ration should be preserved.
Throws:
UnauthorizedException - if not a system administrator.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.