org.apache.lenya.cms.publication
Class AbstractPublication

java.lang.Object
  extended by org.apache.lenya.cms.publication.AbstractPublication
All Implemented Interfaces:
Publication
Direct Known Subclasses:
FilePublication

public abstract class AbstractPublication
extends java.lang.Object
implements Publication

A publication.


Field Summary
 
Fields inherited from interface org.apache.lenya.cms.publication.Publication
ADMIN_AREA, ARCHIVE_AREA, ATTRIBUTE_TYPE, AUTHORING_AREA, BREADCRUMB_PREFIX, CONFIGURATION_FILE, CONFIGURATION_PATH, CONTENT_PATH, DEFAULT_LANGUAGE_ATTR, DELETE_PATH, ELEMENT_DOCUMENT_BUILDER, ELEMENT_PATH_MAPPER, ELEMENT_SITE_STRUCTURE, INFO_AREA_PREFIX, LANGUAGE, LANGUAGES, LIVE_AREA, LIVE_MOUNT_POINT, PENDING_PATH, PUBLICATION_PREFIX, PUBLICATION_PREFIX_URI, SEARCH_AREA_PREFIX, SSL_PREFIX, STAGING_AREA, TRASH_AREA
 
Constructor Summary
protected AbstractPublication(java.lang.String id, java.lang.String servletContextPath)
          Creates a new instance of Publication
 
Method Summary
 void copyDocument(Document sourceDocument, Document destinationDocument)
          Template method to copy a document.
protected abstract  void copyDocumentSource(Document sourceDocument, Document destinationDocument)
          Copies a document source.
protected  void copySiteStructure(Document sourceDocument, Document destinationDocument)
          Copies a document in the site structure.
 void deleteDocument(Document document)
          Deletes a document.
protected abstract  void deleteDocumentSource(Document document)
          Deletes the source of a document.
protected  void deleteFromSiteStructure(Document document)
          Deletes a document from the site structure.
 boolean equals(java.lang.Object object)
           
 Document getAreaVersion(Document document, java.lang.String area)
          Creates a version of the document object in another area.
 java.lang.String getBreadcrumbPrefix()
          Get the breadcrumb prefix.
 java.io.File getContentDirectory(java.lang.String area)
          Return the directory of a specific area.
protected  java.lang.Object getContentDirKey(java.lang.String area)
           
 java.lang.String getDefaultLanguage()
          Get the default language
 java.io.File getDirectory()
          Returns the publication directory.
 DocumentBuilder getDocumentBuilder()
          Returns the document builder of this instance.
 PublishingEnvironment getEnvironment()
          Deprecated. It is planned to decouple the environments from the publication.
 java.lang.String getId()
          Returns the publication ID.
 java.lang.String[] getLanguages()
          Get all available languages for this publication
 java.lang.String getLiveMountPoint()
          Get the Live mount point.
 DocumentIdToPathMapper getPathMapper()
          Returns the path mapper.
 Proxy getProxy(Document document, boolean isSslProtected)
          Returns the proxy which is used for a particular document.
protected  java.lang.Object getProxyKey(java.lang.String area, boolean isSslProtected)
          Generates a hash key for a area-SSL combination.
 java.lang.String[] getRewriteAttributeXPaths()
          Returns an array of XPaths representing attributes to be rewritten when a document URL has changed.
 java.io.File getServletContext()
          Returns the servlet context this publication belongs to (usually, the webapps/lenya directory).
 DefaultSiteTree getSiteTree(java.lang.String area)
          Deprecated. Please use getTree() because this method returns the interface and not a specific implementation
 java.lang.String getSSLPrefix()
          Get the SSL prefix.
 SiteTree getTree(java.lang.String area)
          Get the sitetree for a specific area of this publication.
 int hashCode()
           
static boolean isValidArea(java.lang.String area)
          Returns if a given string is a valid area name.
 void moveDocument(Document sourceDocument, Document destinationDocument)
          Moves a document from one location to another.
 void setDefaultLanguage(java.lang.String language)
          Set the default language
 void setPathMapper(DefaultDocumentIdToPathMapper mapper)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.lenya.cms.publication.Publication
copyDocumentSetToArea, copyDocumentToArea
 

Constructor Detail

AbstractPublication

protected AbstractPublication(java.lang.String id,
                              java.lang.String servletContextPath)
                       throws PublicationException
Creates a new instance of Publication

Parameters:
id - the publication id
servletContextPath - the servlet context of this publication
Throws:
PublicationException - if there was a problem reading the config file
Method Detail

getId

public java.lang.String getId()
Returns the publication ID.

Specified by:
getId in interface Publication
Returns:
A string value.

getEnvironment

public PublishingEnvironment getEnvironment()
Deprecated. It is planned to decouple the environments from the publication.

Returns the publishing environment of this publication.

Specified by:
getEnvironment in interface Publication
Returns:
A PublishingEnvironmentobject.

getServletContext

public java.io.File getServletContext()
Returns the servlet context this publication belongs to (usually, the webapps/lenya directory).

Specified by:
getServletContext in interface Publication
Returns:
A File object.

getDirectory

public java.io.File getDirectory()
Returns the publication directory.

Specified by:
getDirectory in interface Publication
Returns:
A File object.

getContentDirectory

public java.io.File getContentDirectory(java.lang.String area)
Return the directory of a specific area.

Specified by:
getContentDirectory in interface Publication
Parameters:
area - a File representing the root of the area content directory.
Returns:
the directory of the given content area.

setPathMapper

public void setPathMapper(DefaultDocumentIdToPathMapper mapper)
DOCUMENT ME!

Specified by:
setPathMapper in interface Publication
Parameters:
mapper - DOCUMENT ME!

getPathMapper

public DocumentIdToPathMapper getPathMapper()
Returns the path mapper.

Specified by:
getPathMapper in interface Publication
Returns:
a DocumentIdToPathMapper

isValidArea

public static boolean isValidArea(java.lang.String area)
Returns if a given string is a valid area name.

Parameters:
area - The area string to test.
Returns:
A boolean value.

getDefaultLanguage

public java.lang.String getDefaultLanguage()
Get the default language

Specified by:
getDefaultLanguage in interface Publication
Returns:
the default language

setDefaultLanguage

public void setDefaultLanguage(java.lang.String language)
Set the default language

Specified by:
setDefaultLanguage in interface Publication
Parameters:
language - the default language

getLanguages

public java.lang.String[] getLanguages()
Get all available languages for this publication

Specified by:
getLanguages in interface Publication
Returns:
an Array of languages

getBreadcrumbPrefix

public java.lang.String getBreadcrumbPrefix()
Get the breadcrumb prefix. It can be used as a prefix if a publication is part of a larger site

Specified by:
getBreadcrumbPrefix in interface Publication
Returns:
the breadcrumb prefix

getSSLPrefix

public java.lang.String getSSLPrefix()
Get the SSL prefix. If you want to serve SSL-protected pages through a special site, use this prefix. This can come in handy if you have multiple sites that need SSL protection and you want to share one SSL certificate.

Specified by:
getSSLPrefix in interface Publication
Returns:
the SSL prefix

getLiveMountPoint

public java.lang.String getLiveMountPoint()
Get the Live mount point. The live mount point is used to rewrite links that are of the form /contextprefix/publication/area/documentid to /livemountpoint/documentid This is useful if you serve your live area through mod_proxy. to enable this functionality, set the Live mount point to / or something else. An empty mount point disables the feature.

Specified by:
getLiveMountPoint in interface Publication
Returns:
the Live mount point

getTree

public SiteTree getTree(java.lang.String area)
                 throws SiteTreeException
Get the sitetree for a specific area of this publication. Sitetrees are created on demand and are cached.

Specified by:
getTree in interface Publication
Parameters:
area - the area
Returns:
the sitetree for the specified area
Throws:
SiteTreeException - if an error occurs

getSiteTree

public DefaultSiteTree getSiteTree(java.lang.String area)
                            throws SiteTreeException
Deprecated. Please use getTree() because this method returns the interface and not a specific implementation

Get the sitetree for a specific area of this publication. Sitetrees are created on demand and are cached.

Specified by:
getSiteTree in interface Publication
Parameters:
area - the area
Returns:
the sitetree for the specified area
Throws:
SiteTreeException - if an error occurs
See Also:
getTree()

getDocumentBuilder

public DocumentBuilder getDocumentBuilder()
Returns the document builder of this instance.

Specified by:
getDocumentBuilder in interface Publication
Returns:
A document builder.

getAreaVersion

public Document getAreaVersion(Document document,
                               java.lang.String area)
                        throws PublicationException
Creates a version of the document object in another area.

Specified by:
getAreaVersion in interface Publication
Parameters:
document - The document to clone.
area - The destination area.
Returns:
A document.
Throws:
PublicationException - when an error occurs.

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

copyDocument

public void copyDocument(Document sourceDocument,
                         Document destinationDocument)
                  throws PublicationException
Template method to copy a document. Override copyDocumentSource(Document, Document) to implement access to a custom repository.

Specified by:
copyDocument in interface Publication
Parameters:
sourceDocument - The document to copy.
destinationDocument - The destination document.
Throws:
PublicationException - if a document which destinationDocument depends on does not exist.
See Also:
Publication.copyDocument(org.apache.lenya.cms.publication.Document, org.apache.lenya.cms.publication.Document)

copySiteStructure

protected void copySiteStructure(Document sourceDocument,
                                 Document destinationDocument)
                          throws PublicationException
Copies a document in the site structure.

Parameters:
sourceDocument - The source document.
destinationDocument - The destination document.
Throws:
PublicationException - when something went wrong.

copyDocumentSource

protected abstract void copyDocumentSource(Document sourceDocument,
                                           Document destinationDocument)
                                    throws PublicationException
Copies a document source.

Parameters:
sourceDocument - The source document.
destinationDocument - The destination document.
Throws:
PublicationException - when something went wrong.

deleteDocument

public void deleteDocument(Document document)
                    throws PublicationException
Description copied from interface: Publication
Deletes a document.

Specified by:
deleteDocument in interface Publication
Parameters:
document - The document to delete.
Throws:
PublicationException - when something went wrong.
See Also:
Publication.deleteDocument(org.apache.lenya.cms.publication.Document)

deleteFromSiteStructure

protected void deleteFromSiteStructure(Document document)
                                throws PublicationException
Deletes a document from the site structure.

Parameters:
document - The document to remove.
Throws:
PublicationException - when something went wrong.

deleteDocumentSource

protected abstract void deleteDocumentSource(Document document)
                                      throws PublicationException
Deletes the source of a document.

Parameters:
document - The document to delete.
Throws:
PublicationException - when something went wrong.

moveDocument

public void moveDocument(Document sourceDocument,
                         Document destinationDocument)
                  throws PublicationException
Description copied from interface: Publication
Moves a document from one location to another.

Specified by:
moveDocument in interface Publication
Parameters:
sourceDocument - The source document.
destinationDocument - The destination document.
Throws:
PublicationException - if a document which the destination document depends on does not exist.
See Also:
Publication.moveDocument(org.apache.lenya.cms.publication.Document, org.apache.lenya.cms.publication.Document)

getProxyKey

protected java.lang.Object getProxyKey(java.lang.String area,
                                       boolean isSslProtected)
Generates a hash key for a area-SSL combination.

Parameters:
area - The area.
isSslProtected - If the proxy is assigned for SSL-protected pages.
Returns:
An object.

getProxy

public Proxy getProxy(Document document,
                      boolean isSslProtected)
Description copied from interface: Publication
Returns the proxy which is used for a particular document.

Specified by:
getProxy in interface Publication
Parameters:
document - The document.
isSslProtected - A boolean value.
Returns:
A proxy or null if no proxy is defined for this version.
See Also:
Publication.getProxy(org.apache.lenya.cms.publication.Document, boolean)

getRewriteAttributeXPaths

public java.lang.String[] getRewriteAttributeXPaths()
Description copied from interface: Publication
Returns an array of XPaths representing attributes to be rewritten when a document URL has changed.

Specified by:
getRewriteAttributeXPaths in interface Publication
Returns:
An array of strings.
See Also:
Publication.getRewriteAttributeXPaths()

getContentDirKey

protected java.lang.Object getContentDirKey(java.lang.String area)


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