org.restlet.service
Class MetadataService

java.lang.Object
  extended by org.restlet.service.MetadataService

public class MetadataService
extends Object

Service providing access to metadata and their associated extension names.

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
MetadataService()
          Constructor.
 
Method Summary
 void addCommonExtensions()
          Adds a common list of associations from extensions to metadata.
 void addExtension(String extension, Metadata metadata)
          Maps an extension to some metadata (media type, language or character set) to an extension.
 Encoding getDefaultEncoding()
          Returns the default encoding for local representations.
 Language getDefaultLanguage()
          Returns the default language for local representations.
 MediaType getDefaultMediaType()
          Returns the default media type for local representations.
 String getExtension(Metadata metadata)
          Returns the first extension mapping to this metadata.
 Map<String,Metadata> getMappings()
          Returns the mappings from extension names to metadata.
 Metadata getMetadata(String extension)
          Returns the metadata associated to this extension.
 void setDefaultEncoding(Encoding defaultEncoding)
          Sets the default encoding for local representations.
 void setDefaultLanguage(Language defaultLanguage)
          Sets the default language for local representations.
 void setDefaultMediaType(MediaType defaultMediaType)
          Sets the default media type for local representations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataService

public MetadataService()
Constructor.

Method Detail

addCommonExtensions

public void addCommonExtensions()
Adds a common list of associations from extensions to metadata. The list of languages extensions:

The list of media type extensions:


addExtension

public void addExtension(String extension,
                         Metadata metadata)
Maps an extension to some metadata (media type, language or character set) to an extension.

Parameters:
extension - The extension name.
metadata - The metadata to map.

getDefaultEncoding

public Encoding getDefaultEncoding()
Returns the default encoding for local representations.

Returns:
The default encoding for local representations.

getDefaultLanguage

public Language getDefaultLanguage()
Returns the default language for local representations.

Returns:
The default language for local representations.

getDefaultMediaType

public MediaType getDefaultMediaType()
Returns the default media type for local representations.

Returns:
The default media type for local representations.

getExtension

public String getExtension(Metadata metadata)
Returns the first extension mapping to this metadata.

Parameters:
metadata - The metadata to find.
Returns:
The first extension mapping to this metadata.

getMappings

public Map<String,Metadata> getMappings()
Returns the mappings from extension names to metadata.

Returns:
The mappings from extension names to metadata.

getMetadata

public Metadata getMetadata(String extension)
Returns the metadata associated to this extension. It returns null if the extension was not declared.

Parameters:
extension - The extension name without any delimiter.
Returns:
The metadata associated to this extension.

setDefaultEncoding

public void setDefaultEncoding(Encoding defaultEncoding)
Sets the default encoding for local representations.

Parameters:
defaultEncoding - The default encoding for local representations.

setDefaultLanguage

public void setDefaultLanguage(Language defaultLanguage)
Sets the default language for local representations.

Parameters:
defaultLanguage - The default language for local representations.

setDefaultMediaType

public void setDefaultMediaType(MediaType defaultMediaType)
Sets the default media type for local representations.

Parameters:
defaultMediaType - The default media type for local representations.


Copyright © 2005-2007 Noelios Technologies.