org.apache.lenya.cms.publication
Class DefaultDocumentIdToPathMapper

java.lang.Object
  extended by org.apache.lenya.cms.publication.DefaultDocumentIdToPathMapper
All Implemented Interfaces:
DocumentIdToPathMapper, PathToDocumentIdMapper

public class DefaultDocumentIdToPathMapper
extends java.lang.Object
implements DocumentIdToPathMapper, PathToDocumentIdMapper


Field Summary
static java.lang.String BASE_FILENAME_PREFIX
           
static java.lang.String BASE_FILENAME_SUFFIX
           
 
Constructor Summary
DefaultDocumentIdToPathMapper()
           
 
Method Summary
 java.io.File getDirectory(Publication publication, java.lang.String area, java.lang.String documentId)
          Deprecated. because language is missing (non-Javadoc)
 java.io.File getDirectory(Publication publication, java.lang.String area, java.lang.String documentId, java.lang.String language)
          (non-Javadoc)
 java.lang.String getDocumentId(Publication publication, java.lang.String area, java.io.File file)
          Returns the document ID for a certain file.
 java.io.File getFile(Publication publication, java.lang.String area, java.lang.String documentId, java.lang.String language)
          Compute the document-path for a given publication, area, document-id and language
protected  java.lang.String getFilename(java.lang.String language)
          Constructs the filename for a given language.
 java.lang.String getLanguage(java.io.File file)
          Returns the language for a certain file
 java.lang.String getPath(java.lang.String documentId, java.lang.String language)
          Compute the document-path for a given publication, area and document-id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_FILENAME_PREFIX

public static final java.lang.String BASE_FILENAME_PREFIX
See Also:
Constant Field Values

BASE_FILENAME_SUFFIX

public static final java.lang.String BASE_FILENAME_SUFFIX
See Also:
Constant Field Values
Constructor Detail

DefaultDocumentIdToPathMapper

public DefaultDocumentIdToPathMapper()
Method Detail

getFile

public java.io.File getFile(Publication publication,
                            java.lang.String area,
                            java.lang.String documentId,
                            java.lang.String language)
Description copied from interface: DocumentIdToPathMapper
Compute the document-path for a given publication, area, document-id and language

Specified by:
getFile in interface DocumentIdToPathMapper
Parameters:
publication - the publication of the document
area - the area of the document
documentId - the document-id of the document
language - the language of the document
Returns:
the path to the document
See Also:
DocumentIdToPathMapper.getFile(org.apache.lenya.cms.publication.Publication, java.lang.String, java.lang.String, java.lang.String)

getDirectory

public java.io.File getDirectory(Publication publication,
                                 java.lang.String area,
                                 java.lang.String documentId,
                                 java.lang.String language)
(non-Javadoc)

Specified by:
getDirectory in interface DocumentIdToPathMapper
Parameters:
publication - The publication.
area - The area.
documentId - The document id.
language - The language of the document.
Returns:
The directory where all the files with the same document-id are located
See Also:
DocumentIdToPathMapper.getDirectory(org.apache.lenya.cms.publication.Publication, java.lang.String, java.lang.String)

getDirectory

public java.io.File getDirectory(Publication publication,
                                 java.lang.String area,
                                 java.lang.String documentId)
Deprecated. because language is missing (non-Javadoc)

Specified by:
getDirectory in interface DocumentIdToPathMapper
Parameters:
publication - The publication.
area - The area.
documentId - The document id.
Returns:
The directory where all the files with the same document-id are located
See Also:
DocumentIdToPathMapper.getDirectory(org.apache.lenya.cms.publication.Publication, java.lang.String, java.lang.String)

getPath

public java.lang.String getPath(java.lang.String documentId,
                                java.lang.String language)
Description copied from interface: DocumentIdToPathMapper
Compute the document-path for a given publication, area and document-id. The file separator is the slash (/).

Specified by:
getPath in interface DocumentIdToPathMapper
Parameters:
documentId - the document-id of the document
language - the language of the document
Returns:
the path to the document, without publication ID and area
See Also:
DocumentIdToPathMapper.getPath(java.lang.String, java.lang.String)

getFilename

protected java.lang.String getFilename(java.lang.String language)
Constructs the filename for a given language.

Parameters:
language - The language.
Returns:
A string value.

getDocumentId

public java.lang.String getDocumentId(Publication publication,
                                      java.lang.String area,
                                      java.io.File file)
                               throws DocumentDoesNotExistException
Returns the document ID for a certain file.

Specified by:
getDocumentId in interface PathToDocumentIdMapper
Parameters:
publication - The publication.
area - The area.
file - The file representing the document.
Returns:
the document-id of the document associated with the given file.
Throws:
DocumentDoesNotExistException - when the document referenced by the file does not exist.

getLanguage

public java.lang.String getLanguage(java.io.File file)
Returns the language for a certain file

Specified by:
getLanguage in interface PathToDocumentIdMapper
Parameters:
file - the document file
Returns:
the language for the given document file or null if the file has no language.


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.