org.apache.lenya.cms.site.tree2
Class SiteTreeImpl

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

public class SiteTreeImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.lenya.cms.site.SiteStructure, SiteTree, org.apache.lenya.cms.repository.Persistable

Simple site tree implementation.


Field Summary
protected  org.apache.avalon.framework.service.ServiceManager manager
           
protected static java.lang.String NAMESPACE
           
 
Fields inherited from interface org.apache.lenya.cms.site.tree.SiteTree
IDENTIFIABLE_TYPE
 
Constructor Summary
SiteTreeImpl(org.apache.avalon.framework.service.ServiceManager manager, org.apache.lenya.cms.publication.Area area, org.apache.avalon.framework.logger.Logger logger)
           
 
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 changed()
           
protected  void checkInvariants()
           
 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)
           
 java.lang.String getArea()
           
 org.apache.lenya.cms.site.Link getByUuid(java.lang.String uuid, java.lang.String language)
           
protected  java.lang.String getKey(org.apache.lenya.cms.site.Link link)
           
protected  java.lang.String getKey(java.lang.String uuid, java.lang.String language)
           
 org.apache.lenya.cms.site.SiteNode getNode(java.lang.String path)
           
protected  org.apache.lenya.cms.repository.NodeFactory getNodeFactory()
           
 org.apache.lenya.cms.site.SiteNode[] getNodes()
           
protected  TreeNode getParent(TreeNode node)
           
protected  java.lang.String getParentPath(java.lang.String path)
           
protected  java.lang.String getPath()
           
protected  java.util.Map getPath2Node()
           
 org.apache.lenya.cms.publication.Publication getPublication()
           
 org.apache.lenya.cms.repository.Node getRepositoryNode()
           
protected  int getRevision(org.apache.lenya.cms.repository.Node repoNode)
           
protected  RootNode getRoot()
           
 org.apache.lenya.cms.repository.Session getSession()
           
protected  java.lang.String getSourceUri()
           
 org.apache.lenya.cms.site.SiteNode[] getTopLevelNodes()
           
protected  TreeNodeImpl getTreeNode(java.lang.String path)
           
protected  java.util.Map getUuidLanguage2Link()
           
protected  void initRoot()
           
 boolean isModified()
           
protected  void linkAdded(org.apache.lenya.cms.site.Link link)
           
protected  void linkRemoved(java.lang.String uuid, java.lang.String language)
           
protected  void load()
           
protected  void loadLinks(TreeNodeImpl node, org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element element)
           
protected  void loadNodes(TreeNode parent, org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element element)
           
 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.
protected  void nodeAdded(org.apache.lenya.cms.site.SiteNode node)
           
protected  void nodeRemoved(java.lang.String path)
           
 org.apache.lenya.cms.site.SiteNode[] preOrder()
           
protected  void reset()
           
 void save()
           
protected  void saveLinks(org.apache.lenya.cms.site.SiteNode node, org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element nodeElement)
           
protected  void saveNodes(TreeNode parent, org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element parentElement)
           
 
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

manager

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

NAMESPACE

protected static final java.lang.String NAMESPACE
See Also:
Constant Field Values
Constructor Detail

SiteTreeImpl

public SiteTreeImpl(org.apache.avalon.framework.service.ServiceManager manager,
                    org.apache.lenya.cms.publication.Area area,
                    org.apache.avalon.framework.logger.Logger logger)
Parameters:
manager - The service manager.
area - The area.
logger - The logger.
Method Detail

initRoot

protected void initRoot()

getSourceUri

protected java.lang.String getSourceUri()

load

protected void load()

reset

protected void reset()

getRoot

protected RootNode getRoot()

loadNodes

protected void loadNodes(TreeNode parent,
                         org.apache.lenya.xml.NamespaceHelper helper,
                         org.w3c.dom.Element element)

loadLinks

protected void loadLinks(TreeNodeImpl node,
                         org.apache.lenya.xml.NamespaceHelper helper,
                         org.w3c.dom.Element element)

save

public void save()
          throws org.apache.lenya.cms.repository.RepositoryException
Specified by:
save in interface org.apache.lenya.cms.repository.Persistable
Throws:
org.apache.lenya.cms.repository.RepositoryException

getRevision

protected int getRevision(org.apache.lenya.cms.repository.Node repoNode)

saveNodes

protected void saveNodes(TreeNode parent,
                         org.apache.lenya.xml.NamespaceHelper helper,
                         org.w3c.dom.Element parentElement)
                  throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

saveLinks

protected void saveLinks(org.apache.lenya.cms.site.SiteNode node,
                         org.apache.lenya.xml.NamespaceHelper helper,
                         org.w3c.dom.Element nodeElement)
                  throws org.apache.lenya.cms.site.SiteException
Throws:
org.apache.lenya.cms.site.SiteException

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

getTreeNode

protected TreeNodeImpl getTreeNode(java.lang.String path)
                            throws org.apache.lenya.cms.site.SiteException
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

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

getParentPath

protected java.lang.String getParentPath(java.lang.String path)

nodeAdded

protected void nodeAdded(org.apache.lenya.cms.site.SiteNode node)

linkAdded

protected void linkAdded(org.apache.lenya.cms.site.Link link)

getKey

protected java.lang.String getKey(org.apache.lenya.cms.site.Link link)

getKey

protected java.lang.String getKey(java.lang.String uuid,
                                  java.lang.String language)

nodeRemoved

protected void nodeRemoved(java.lang.String path)

getUuidLanguage2Link

protected java.util.Map getUuidLanguage2Link()

getPath2Node

protected java.util.Map getPath2Node()

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

containsInAnyLanguage

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

getArea

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

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

checkInvariants

protected void checkInvariants()

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

getNodes

public org.apache.lenya.cms.site.SiteNode[] getNodes()
Specified by:
getNodes 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

getSession

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

getNodeFactory

protected org.apache.lenya.cms.repository.NodeFactory getNodeFactory()

getRepositoryNode

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

getTopLevelNodes

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

linkRemoved

protected void linkRemoved(java.lang.String uuid,
                           java.lang.String language)

getPath

protected java.lang.String getPath()

preOrder

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

moveDown

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

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

moveUp

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

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

getParent

protected TreeNode getParent(TreeNode node)
                      throws org.apache.lenya.cms.site.SiteException
Parameters:
node - A node.
Returns:
The parent of the node, which is the root node for top level nodes.
Throws:
org.apache.lenya.cms.site.SiteException - if an error occurs.

contains

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

changed

protected void changed()

isModified

public boolean isModified()
Specified by:
isModified in interface org.apache.lenya.cms.repository.Persistable


Copyright © $ Apache Software Foundation. All Rights Reserved.