org.apache.lenya.cms.site.tree
Class TreeSiteManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.site.AbstractSiteManager
          extended by org.apache.lenya.cms.site.tree.TreeSiteManager
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.lenya.cms.site.SiteManager

public class TreeSiteManager
extends org.apache.lenya.cms.site.AbstractSiteManager
implements org.apache.avalon.framework.service.Serviceable

A tree-based site manager.

Version:
$Id: TreeSiteManager.java 208766 2005-07-01 16:05:00Z andreas $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lenya.cms.site.AbstractSiteManager
org.apache.lenya.cms.site.AbstractSiteManager.NodeComparator
 
Field Summary
 
Fields inherited from class org.apache.lenya.cms.site.AbstractSiteManager
manager
 
Fields inherited from interface org.apache.lenya.cms.site.SiteManager
ROLE
 
Constructor Summary
TreeSiteManager()
          Ctor.
 
Method Summary
 void add(java.lang.String path, org.apache.lenya.cms.publication.Document document)
           
protected  java.lang.String computeUniquePath(org.apache.lenya.cms.publication.DocumentFactory factory, org.apache.lenya.cms.publication.DocumentLocator locator)
          compute an unique document id
 boolean contains(org.apache.lenya.cms.publication.Document resource)
           
protected  boolean contains(org.apache.lenya.cms.publication.DocumentFactory factory, org.apache.lenya.cms.publication.DocumentLocator locator)
           
 boolean containsInAnyLanguage(org.apache.lenya.cms.publication.Document resource)
           
 void copy(org.apache.lenya.cms.publication.Document sourceDocument, org.apache.lenya.cms.publication.Document destinationDocument)
           
protected  java.util.List getAncestors(org.apache.lenya.cms.site.SiteNode node)
          Returns the ancestors of a resource, beginning with the parent.
 org.apache.lenya.cms.publication.DocumentLocator getAvailableLocator(org.apache.lenya.cms.publication.DocumentFactory factory, org.apache.lenya.cms.publication.DocumentLocator locator)
           
 org.apache.lenya.cms.publication.Document[] getDocuments(org.apache.lenya.cms.publication.DocumentFactory map, org.apache.lenya.cms.publication.Publication publication, java.lang.String area)
           
protected  java.lang.String getKey(org.apache.lenya.cms.publication.Publication publication, java.lang.String area)
           
protected  org.apache.lenya.cms.site.Link getLabelObject(org.apache.lenya.cms.publication.Document document)
          Returns the label object of a document.
protected  java.lang.String getPath(org.apache.lenya.cms.publication.DocumentFactory factory, org.apache.lenya.cms.publication.Publication pub, java.lang.String area, java.lang.String uuid, java.lang.String language)
           
 org.apache.lenya.cms.publication.DocumentLocator[] getRequiredResources(org.apache.lenya.cms.publication.DocumentFactory map, org.apache.lenya.cms.publication.DocumentLocator loc)
           
 org.apache.lenya.cms.site.SiteNode[] getRequiringResources(org.apache.lenya.cms.publication.DocumentFactory map, org.apache.lenya.cms.site.SiteNode resource)
           
 org.apache.lenya.cms.site.SiteStructure getSiteStructure(org.apache.lenya.cms.publication.DocumentFactory map, org.apache.lenya.cms.publication.Publication publiation, java.lang.String area)
           
protected  DefaultSiteTree getTree(org.apache.lenya.cms.publication.Document document)
           
 DefaultSiteTree getTree(org.apache.lenya.cms.publication.DocumentFactory map, org.apache.lenya.cms.publication.Publication publication, java.lang.String area)
          Returns the sitetree for a specific area of this publication.
protected  java.lang.String getUUID(org.apache.lenya.cms.publication.DocumentFactory factory, org.apache.lenya.cms.publication.Publication pub, java.lang.String area, java.lang.String path)
           
 boolean isVisibleInNav(org.apache.lenya.cms.publication.Document document)
           
 boolean requires(org.apache.lenya.cms.publication.DocumentFactory map, org.apache.lenya.cms.site.SiteNode dependingResource, org.apache.lenya.cms.site.SiteNode requiredResource)
           
 void set(java.lang.String path, org.apache.lenya.cms.publication.Document document)
           
 void setVisibleInNav(org.apache.lenya.cms.publication.Document document, boolean visibleInNav)
           
 
Methods inherited from class org.apache.lenya.cms.site.AbstractSiteManager
check, isAntisymmetric, isIrreflexive, isTransitive, service, sortAscending
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.framework.service.Serviceable
service
 

Constructor Detail

TreeSiteManager

public TreeSiteManager()
Ctor.

Method Detail

getTree

public DefaultSiteTree getTree(org.apache.lenya.cms.publication.DocumentFactory map,
                               org.apache.lenya.cms.publication.Publication publication,
                               java.lang.String area)
                        throws org.apache.lenya.cms.site.SiteException
Returns the sitetree for a specific area of this publication. Sitetrees are created on demand and are cached.

Parameters:
map - The document identity map.
publication - The publication.
area - The area.
Returns:
A site tree.
Throws:
org.apache.lenya.cms.site.SiteException - if an error occurs.

getTree

protected DefaultSiteTree getTree(org.apache.lenya.cms.publication.Document document)
                           throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

getAncestors

protected java.util.List getAncestors(org.apache.lenya.cms.site.SiteNode node)
                               throws org.apache.lenya.cms.site.SiteException
Returns the ancestors of a resource, beginning with the parent.

Parameters:
node - The resource.
Returns:
A list of resources.
Throws:
org.apache.lenya.cms.site.SiteException - if an error occurs.

requires

public boolean requires(org.apache.lenya.cms.publication.DocumentFactory map,
                        org.apache.lenya.cms.site.SiteNode dependingResource,
                        org.apache.lenya.cms.site.SiteNode requiredResource)
                 throws org.apache.lenya.cms.site.SiteException
Specified by:
requires in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.requires(org.apache.lenya.cms.publication.DocumentFactory, org.apache.lenya.cms.site.SiteNode, org.apache.lenya.cms.site.SiteNode)

getRequiredResources

public org.apache.lenya.cms.publication.DocumentLocator[] getRequiredResources(org.apache.lenya.cms.publication.DocumentFactory map,
                                                                               org.apache.lenya.cms.publication.DocumentLocator loc)
                                                                        throws org.apache.lenya.cms.site.SiteException
Specified by:
getRequiredResources in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException

getRequiringResources

public org.apache.lenya.cms.site.SiteNode[] getRequiringResources(org.apache.lenya.cms.publication.DocumentFactory map,
                                                                  org.apache.lenya.cms.site.SiteNode resource)
                                                           throws org.apache.lenya.cms.site.SiteException
Specified by:
getRequiringResources in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.getRequiringResources(org.apache.lenya.cms.publication.DocumentFactory, org.apache.lenya.cms.site.SiteNode)

contains

public boolean contains(org.apache.lenya.cms.publication.Document resource)
                 throws org.apache.lenya.cms.site.SiteException
Specified by:
contains in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.contains(org.apache.lenya.cms.publication.Document)

containsInAnyLanguage

public boolean containsInAnyLanguage(org.apache.lenya.cms.publication.Document resource)
                              throws org.apache.lenya.cms.site.SiteException
Specified by:
containsInAnyLanguage in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.containsInAnyLanguage(org.apache.lenya.cms.publication.Document)

copy

public void copy(org.apache.lenya.cms.publication.Document sourceDocument,
                 org.apache.lenya.cms.publication.Document destinationDocument)
          throws org.apache.lenya.cms.site.SiteException
Specified by:
copy in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.copy(org.apache.lenya.cms.publication.Document, org.apache.lenya.cms.publication.Document)

setVisibleInNav

public void setVisibleInNav(org.apache.lenya.cms.publication.Document document,
                            boolean visibleInNav)
                     throws org.apache.lenya.cms.site.SiteException
Specified by:
setVisibleInNav in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.setVisibleInNav(org.apache.lenya.cms.publication.Document, boolean)

getLabelObject

protected org.apache.lenya.cms.site.Link getLabelObject(org.apache.lenya.cms.publication.Document document)
                                                 throws org.apache.lenya.cms.site.SiteException
Returns the label object of a document.

Parameters:
document - The document.
Returns:
A label.
Throws:
org.apache.lenya.cms.site.SiteException - if an error occurs.

getDocuments

public org.apache.lenya.cms.publication.Document[] getDocuments(org.apache.lenya.cms.publication.DocumentFactory map,
                                                                org.apache.lenya.cms.publication.Publication publication,
                                                                java.lang.String area)
                                                         throws org.apache.lenya.cms.site.SiteException
Specified by:
getDocuments in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.getDocuments(org.apache.lenya.cms.publication.DocumentFactory, org.apache.lenya.cms.publication.Publication, java.lang.String)

add

public void add(java.lang.String path,
                org.apache.lenya.cms.publication.Document document)
         throws org.apache.lenya.cms.site.SiteException
Specified by:
add in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException

set

public void set(java.lang.String path,
                org.apache.lenya.cms.publication.Document document)
         throws org.apache.lenya.cms.site.SiteException
Specified by:
set in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException

getKey

protected java.lang.String getKey(org.apache.lenya.cms.publication.Publication publication,
                                  java.lang.String area)
Parameters:
publication - The publication.
area - The area.
Returns:
The key to store sitetree objects in the identity map.

getSiteStructure

public org.apache.lenya.cms.site.SiteStructure getSiteStructure(org.apache.lenya.cms.publication.DocumentFactory map,
                                                                org.apache.lenya.cms.publication.Publication publiation,
                                                                java.lang.String area)
                                                         throws org.apache.lenya.cms.site.SiteException
Specified by:
getSiteStructure in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.getSiteStructure(org.apache.lenya.cms.publication.DocumentFactory, org.apache.lenya.cms.publication.Publication, java.lang.String)

getAvailableLocator

public org.apache.lenya.cms.publication.DocumentLocator getAvailableLocator(org.apache.lenya.cms.publication.DocumentFactory factory,
                                                                            org.apache.lenya.cms.publication.DocumentLocator locator)
                                                                     throws org.apache.lenya.cms.site.SiteException
Specified by:
getAvailableLocator in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteManager.getAvailableLocator(DocumentFactory, org.apache.lenya.cms.publication.DocumentLocator)

computeUniquePath

protected java.lang.String computeUniquePath(org.apache.lenya.cms.publication.DocumentFactory factory,
                                             org.apache.lenya.cms.publication.DocumentLocator locator)
                                      throws org.apache.lenya.cms.site.SiteException
compute an unique document id

Parameters:
factory - The factory.
locator - The locator.
Returns:
the unique documentid
Throws:
org.apache.lenya.cms.site.SiteException - if an error occurs.

isVisibleInNav

public boolean isVisibleInNav(org.apache.lenya.cms.publication.Document document)
                       throws org.apache.lenya.cms.site.SiteException
Specified by:
isVisibleInNav in interface org.apache.lenya.cms.site.SiteManager
Throws:
org.apache.lenya.cms.site.SiteException

getPath

protected java.lang.String getPath(org.apache.lenya.cms.publication.DocumentFactory factory,
                                   org.apache.lenya.cms.publication.Publication pub,
                                   java.lang.String area,
                                   java.lang.String uuid,
                                   java.lang.String language)
                            throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

getUUID

protected java.lang.String getUUID(org.apache.lenya.cms.publication.DocumentFactory factory,
                                   org.apache.lenya.cms.publication.Publication pub,
                                   java.lang.String area,
                                   java.lang.String path)
                            throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

contains

protected boolean contains(org.apache.lenya.cms.publication.DocumentFactory factory,
                           org.apache.lenya.cms.publication.DocumentLocator locator)
                    throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException


Copyright $ Apache Software Foundation. All Rights Reserved.