org.sakaiproject.component.legacy.content
Class BasicContentTypeImageService

java.lang.Object
  extended byorg.sakaiproject.component.legacy.content.BasicContentTypeImageService
All Implemented Interfaces:
ContentTypeImageService

public class BasicContentTypeImageService
extends Object
implements ContentTypeImageService

BasicContentTypeImage implements the CHEF ContentTypeImageService.

Work Interfaces:

Implementation Design:

External Dependencies:

Version:
$Revision: 2866 $
Author:
University of Michigan, CHEF Software Development Team
See Also:
org.chefproject.service.ContentTypeImageService

Field Summary
protected static String DEFAULT_FILE
          Default file name for unknown types.
protected  Properties m_contentTypeDisplayNames
          Map content type to display name.
protected  Properties m_contentTypeExtensions
          Map content type to file extension.
protected  Properties m_contentTypeImages
          Map content type to image file name.
protected  Properties m_contentTypes
          Map file extension to content type.
protected  String m_extensionFileName
          The file name containing the extension definitions.
protected  String m_imageFileName
          The file name containing the image definitions.
protected  Logger m_logger
          Dependency: logging service
protected  SortedMap m_mimetypes
           
protected  String m_nameFileName
          The file name containing the name definitions.
protected static String UNKNOWN_TYPE
          Default content type for unknown extensions.
 
Fields inherited from interface org.sakaiproject.service.legacy.content.ContentTypeImageService
SERVICE_NAME
 
Constructor Summary
BasicContentTypeImageService()
           
 
Method Summary
 void destroy()
          Returns to uninitialized state.
 String getContentType(String extension)
          Get the content type string that is used for this file extension.
 String getContentTypeDisplayName(String contentType)
          Get the display name of the content type.
 String getContentTypeExtension(String contentType)
          Get the file extension value of the content type.
 String getContentTypeImage(String contentType)
          Get the image file name based on the content type.
 List getMimeCategories()
          Access an ordered list of all mimetype categories.
 List getMimeSubtypes(String category)
          Access an ordered list of all mimetype subtypes for a particular category.
 void init()
          Final initialization, once all dependencies are set.
 boolean isUnknownType(String contentType)
          Is the type one of the known types used when the file type is unknown?
 void setExtensionFile(String name)
          Set the file name containing the extension definitions.
 void setImageFile(String name)
          Set the file name containing the image definitions.
 void setLogger(Logger service)
          Dependency: logging service.
 void setNameFile(String name)
          Set the file name containing the name definitions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_contentTypeImages

protected Properties m_contentTypeImages
Map content type to image file name.


m_contentTypeDisplayNames

protected Properties m_contentTypeDisplayNames
Map content type to display name.


m_contentTypeExtensions

protected Properties m_contentTypeExtensions
Map content type to file extension.


m_contentTypes

protected Properties m_contentTypes
Map file extension to content type.


m_mimetypes

protected SortedMap m_mimetypes

DEFAULT_FILE

protected static final String DEFAULT_FILE
Default file name for unknown types.

See Also:
Constant Field Values

UNKNOWN_TYPE

protected static final String UNKNOWN_TYPE
Default content type for unknown extensions.

See Also:
Constant Field Values

m_imageFileName

protected String m_imageFileName
The file name containing the image definitions.


m_nameFileName

protected String m_nameFileName
The file name containing the name definitions.


m_extensionFileName

protected String m_extensionFileName
The file name containing the extension definitions.


m_logger

protected Logger m_logger
Dependency: logging service

Constructor Detail

BasicContentTypeImageService

public BasicContentTypeImageService()
Method Detail

setLogger

public void setLogger(Logger service)
Dependency: logging service.

Parameters:
service - The logging service.

setImageFile

public void setImageFile(String name)
Set the file name containing the image definitions.

Parameters:
name - the file name.

setNameFile

public void setNameFile(String name)
Set the file name containing the name definitions.

Parameters:
name - the file name.

setExtensionFile

public void setExtensionFile(String name)
Set the file name containing the extension definitions.

Parameters:
name - the file name.

init

public void init()
Final initialization, once all dependencies are set.


destroy

public void destroy()
Returns to uninitialized state.


getContentTypeImage

public String getContentTypeImage(String contentType)
Get the image file name based on the content type.

Specified by:
getContentTypeImage in interface ContentTypeImageService
Parameters:
contentType - The content type string.
Returns:
The image file name based on the content type.

getContentTypeDisplayName

public String getContentTypeDisplayName(String contentType)
Get the display name of the content type.

Specified by:
getContentTypeDisplayName in interface ContentTypeImageService
Parameters:
contentType - The content type string.
Returns:
The display name of the content type.

getContentTypeExtension

public String getContentTypeExtension(String contentType)
Get the file extension value of the content type.

Specified by:
getContentTypeExtension in interface ContentTypeImageService
Parameters:
contentType - The content type string.
Returns:
The file extension value of the content type.

getContentType

public String getContentType(String extension)
Get the content type string that is used for this file extension.

Specified by:
getContentType in interface ContentTypeImageService
Parameters:
extension - The file extension (to the right of the dot, not including the dot).
Returns:
The content type string that is used for this file extension.

isUnknownType

public boolean isUnknownType(String contentType)
Is the type one of the known types used when the file type is unknown?

Specified by:
isUnknownType in interface ContentTypeImageService
Parameters:
contentType - The content type string to test.
Returns:
true if the type is a type used for unknown file types, false if not.

getMimeCategories

public List getMimeCategories()
Access an ordered list of all mimetype categories.

Specified by:
getMimeCategories in interface ContentTypeImageService
Returns:
The list of mimetype categories in alphabetic order.

getMimeSubtypes

public List getMimeSubtypes(String category)
Access an ordered list of all mimetype subtypes for a particular category.

Specified by:
getMimeSubtypes in interface ContentTypeImageService
Parameters:
category - The category.
Returns:
The list of mimetype subtypes in alphabetic order.