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

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.site.tree.DefaultSiteTree
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, org.apache.lenya.cms.repository.RepositoryItem, org.apache.lenya.cms.site.SiteStructure, SiteTree

public class DefaultSiteTree
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements SiteTree

Default sitetree implementation.

Version:
$Id: DefaultSiteTree.java 208764 2005-07-01 15:57:21Z andreas $

Field Summary
protected  org.apache.avalon.framework.service.ServiceManager manager
           
static java.lang.String NAMESPACE_URI
          The sitetree namespace.
static java.lang.String SITE_TREE_FILENAME
          The name of the sitetree file.
 
Fields inherited from interface org.apache.lenya.cms.site.tree.SiteTree
IDENTIFIABLE_TYPE
 
Constructor Summary
protected DefaultSiteTree(org.apache.lenya.cms.publication.DocumentFactory factory, org.apache.lenya.cms.publication.Publication publication, java.lang.String _area, org.apache.avalon.framework.service.ServiceManager manager, org.apache.avalon.framework.logger.Logger logger)
          Create a DefaultSiteTree
 
Method Summary
 org.apache.lenya.cms.site.SiteNode add(java.lang.String path)
           
 org.apache.lenya.cms.site.Link add(java.lang.String path, org.apache.lenya.cms.publication.Document doc)
           
 org.apache.lenya.cms.site.SiteNode add(java.lang.String path, java.lang.String followingSiblingPath)
           
protected  void addLabel(java.lang.String path, java.lang.String language, java.lang.String label)
           
protected  void addNode(SiteTreeNode node)
           
protected  void addNode(SiteTreeNode node, java.lang.String refpath)
           
protected  SiteTreeNodeImpl addNode(java.lang.String path, java.lang.String uuid, boolean visibleInNav, java.lang.String href, java.lang.String suffix, boolean link)
           
protected  SiteTreeNodeImpl addNode(java.lang.String path, java.lang.String uuid, boolean visibleInNav, java.lang.String href, java.lang.String suffix, boolean link, java.lang.String refpath)
           
protected  void addNode(java.lang.String parentid, java.lang.String id, java.lang.String uuid, boolean visibleInNav)
           
protected  SiteTreeNodeImpl addNode(java.lang.String parentid, java.lang.String id, java.lang.String uuid, boolean visibleInNav, java.lang.String href, java.lang.String suffix, boolean link)
           
protected  SiteTreeNodeImpl addNode(java.lang.String parentPath, java.lang.String name, java.lang.String uuid, boolean visibleInNav, java.lang.String href, java.lang.String suffix, boolean link, java.lang.String refpath)
           
 void changed()
           
 boolean contains(java.lang.String path)
           
 boolean contains(java.lang.String path, java.lang.String language)
           
 boolean containsByUuid(java.lang.String uuid, java.lang.String language)
           
 boolean containsInAnyLanguage(java.lang.String uuid)
           
protected  void copyLinks(SiteTreeNode source, SiteTreeNode target)
           
 org.w3c.dom.Document createDocument()
          Create a new DefaultSiteTree xml document.
protected  void createParents(java.lang.String path)
           
protected  org.w3c.dom.Node findNode(org.w3c.dom.Node node, java.util.List ids)
          Find a node in a subtree.
 java.lang.String getArea()
           
 org.apache.lenya.cms.site.Link getByUuid(java.lang.String uuid, java.lang.String language)
           
protected  org.apache.lenya.cms.site.SiteNode getByUuidInternal(java.lang.String uuid, java.lang.String language)
           
protected  org.apache.lenya.cms.publication.DocumentFactory getFactory()
           
 org.apache.lenya.cms.site.SiteNode getNode(java.lang.String path)
           
protected  org.apache.lenya.cms.site.SiteNode getNodeByXpath(java.lang.String xPath)
           
 org.apache.lenya.cms.site.SiteNode[] getNodes()
           
protected  org.apache.lenya.cms.site.SiteNode[] getNodesByXpath(java.lang.String xPath)
           
 org.apache.lenya.cms.publication.Publication getPublication()
           
 org.apache.lenya.cms.repository.Node getRepositoryNode()
           
protected  SiteTreeNodeImpl getRootNode()
           
 org.apache.lenya.cms.repository.Session getSession()
           
 org.apache.lenya.cms.site.SiteNode[] getTopLevelNodes()
           
 void moveDown(java.lang.String path)
          Move down the node amongst its siblings.
 void moveUp(java.lang.String path)
          Move up the node amongst its siblings.
 org.apache.lenya.cms.site.SiteNode[] preOrder()
           
protected  void removeLabel(java.lang.String path, java.lang.String language)
           
protected  SiteTreeNode removeNode(java.lang.String path)
           
 void save()
           
protected  void saveDocument()
           
protected  void setLabel(java.lang.String path, java.lang.String language, java.lang.String label)
           
 
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
 

Field Detail

NAMESPACE_URI

public static final java.lang.String NAMESPACE_URI
The sitetree namespace.

See Also:
Constant Field Values

SITE_TREE_FILENAME

public static final java.lang.String SITE_TREE_FILENAME
The name of the sitetree file.

See Also:
Constant Field Values

manager

protected org.apache.avalon.framework.service.ServiceManager manager
Constructor Detail

DefaultSiteTree

protected DefaultSiteTree(org.apache.lenya.cms.publication.DocumentFactory factory,
                          org.apache.lenya.cms.publication.Publication publication,
                          java.lang.String _area,
                          org.apache.avalon.framework.service.ServiceManager manager,
                          org.apache.avalon.framework.logger.Logger logger)
                   throws org.apache.lenya.cms.site.SiteException
Create a DefaultSiteTree

Parameters:
factory - The document factory.
publication - The publication.
_area - The area.
manager - The service manager.
logger - The logger.
Throws:
org.apache.lenya.cms.site.SiteException - if an error occurs.
Method Detail

saveDocument

protected void saveDocument()
                     throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

createDocument

public org.w3c.dom.Document createDocument()
                                    throws javax.xml.parsers.ParserConfigurationException
Create a new DefaultSiteTree xml document.

Returns:
the new site document
Throws:
javax.xml.parsers.ParserConfigurationException - if an error occurs

findNode

protected org.w3c.dom.Node findNode(org.w3c.dom.Node node,
                                    java.util.List ids)
Find a node in a subtree. The search is started at the given node. The list of ids contains the document-id split by "/".

Parameters:
node - where to start the search
ids - list of node ids
Returns:
the node that matches the path given in the list of ids

addNode

protected void addNode(SiteTreeNode node,
                       java.lang.String refpath)
                throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

copyLinks

protected void copyLinks(SiteTreeNode source,
                         SiteTreeNode target)
                  throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

addNode

protected void addNode(java.lang.String parentid,
                       java.lang.String id,
                       java.lang.String uuid,
                       boolean visibleInNav)
                throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

addNode

protected void addNode(SiteTreeNode node)
                throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

addNode

protected SiteTreeNodeImpl addNode(java.lang.String path,
                                   java.lang.String uuid,
                                   boolean visibleInNav,
                                   java.lang.String href,
                                   java.lang.String suffix,
                                   boolean link,
                                   java.lang.String refpath)
                            throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

addNode

protected SiteTreeNodeImpl addNode(java.lang.String path,
                                   java.lang.String uuid,
                                   boolean visibleInNav,
                                   java.lang.String href,
                                   java.lang.String suffix,
                                   boolean link)
                            throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

addNode

protected SiteTreeNodeImpl addNode(java.lang.String parentid,
                                   java.lang.String id,
                                   java.lang.String uuid,
                                   boolean visibleInNav,
                                   java.lang.String href,
                                   java.lang.String suffix,
                                   boolean link)
                            throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

createParents

protected void createParents(java.lang.String path)
                      throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

addNode

protected SiteTreeNodeImpl addNode(java.lang.String parentPath,
                                   java.lang.String name,
                                   java.lang.String uuid,
                                   boolean visibleInNav,
                                   java.lang.String href,
                                   java.lang.String suffix,
                                   boolean link,
                                   java.lang.String refpath)
                            throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

addLabel

protected void addLabel(java.lang.String path,
                        java.lang.String language,
                        java.lang.String label)

removeLabel

protected void removeLabel(java.lang.String path,
                           java.lang.String language)

removeNode

protected SiteTreeNode removeNode(java.lang.String path)

getNode

public org.apache.lenya.cms.site.SiteNode getNode(java.lang.String path)
                                           throws org.apache.lenya.cms.site.SiteException
Specified by:
getNode in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException
See Also:
SiteStructure.getNode(java.lang.String)

moveUp

public void moveUp(java.lang.String path)
            throws org.apache.lenya.cms.site.SiteException
Move up the node amongst its siblings.

Specified by:
moveUp in interface SiteTree
Parameters:
path - The document id for the node.
Throws:
org.apache.lenya.cms.site.SiteException - if the moving failed.

moveDown

public void moveDown(java.lang.String path)
              throws org.apache.lenya.cms.site.SiteException
Move down the node amongst its siblings.

Specified by:
moveDown in interface SiteTree
Parameters:
path - The document id for the node.
Throws:
org.apache.lenya.cms.site.SiteException - if the moving failed.

setLabel

protected void setLabel(java.lang.String path,
                        java.lang.String language,
                        java.lang.String label)

getRepositoryNode

public org.apache.lenya.cms.repository.Node getRepositoryNode()
Specified by:
getRepositoryNode in interface org.apache.lenya.cms.site.SiteStructure
See Also:
SiteStructure.getRepositoryNode()

save

public void save()
          throws org.apache.lenya.cms.repository.RepositoryException
Throws:
org.apache.lenya.cms.repository.RepositoryException

getArea

public java.lang.String getArea()
Specified by:
getArea in interface org.apache.lenya.cms.site.SiteStructure

getPublication

public org.apache.lenya.cms.publication.Publication getPublication()
Specified by:
getPublication in interface org.apache.lenya.cms.site.SiteStructure

contains

public boolean contains(java.lang.String path)
Specified by:
contains in interface org.apache.lenya.cms.site.SiteStructure

containsByUuid

public boolean containsByUuid(java.lang.String uuid,
                              java.lang.String language)
Specified by:
containsByUuid in interface org.apache.lenya.cms.site.SiteStructure

getByUuidInternal

protected org.apache.lenya.cms.site.SiteNode getByUuidInternal(java.lang.String uuid,
                                                               java.lang.String language)

getNodeByXpath

protected org.apache.lenya.cms.site.SiteNode getNodeByXpath(java.lang.String xPath)

getNodesByXpath

protected org.apache.lenya.cms.site.SiteNode[] getNodesByXpath(java.lang.String xPath)

getByUuid

public org.apache.lenya.cms.site.Link getByUuid(java.lang.String uuid,
                                                java.lang.String language)
                                         throws org.apache.lenya.cms.site.SiteException
Specified by:
getByUuid in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

getFactory

protected org.apache.lenya.cms.publication.DocumentFactory getFactory()

add

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

add

public org.apache.lenya.cms.site.SiteNode add(java.lang.String path)
                                       throws org.apache.lenya.cms.site.SiteException
Specified by:
add in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

containsInAnyLanguage

public boolean containsInAnyLanguage(java.lang.String uuid)
Specified by:
containsInAnyLanguage in interface org.apache.lenya.cms.site.SiteStructure

getNodes

public org.apache.lenya.cms.site.SiteNode[] getNodes()
Specified by:
getNodes in interface org.apache.lenya.cms.site.SiteStructure

add

public org.apache.lenya.cms.site.SiteNode add(java.lang.String path,
                                              java.lang.String followingSiblingPath)
                                       throws org.apache.lenya.cms.site.SiteException
Specified by:
add in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

getTopLevelNodes

public org.apache.lenya.cms.site.SiteNode[] getTopLevelNodes()
Specified by:
getTopLevelNodes in interface org.apache.lenya.cms.site.SiteStructure

getRootNode

protected SiteTreeNodeImpl getRootNode()

contains

public boolean contains(java.lang.String path,
                        java.lang.String language)
Specified by:
contains in interface org.apache.lenya.cms.site.SiteStructure

getSession

public org.apache.lenya.cms.repository.Session getSession()
Specified by:
getSession in interface org.apache.lenya.cms.repository.RepositoryItem

preOrder

public org.apache.lenya.cms.site.SiteNode[] preOrder()
Specified by:
preOrder in interface SiteTree
Returns:
The nodes in pre order.

changed

public void changed()


Copyright $ Apache Software Foundation. All Rights Reserved.