org.apache.lenya.cms.site
Interface SiteManager

All Known Implementing Classes:
AbstractSiteManager, TopicMapSiteManager

public interface SiteManager

A site structure management component.

A site manager has a dependence relation, which is always applied to documents of a single language. This means a document may not require a document of another language. Dependence on a set of resources must be a strict partial order < :

Version:
$Id: SiteManager.java 475069 2006-11-15 00:01:13Z andreas $

Field Summary
static java.lang.String ROLE
          The Avalon role.
 
Method Summary
 void add(java.lang.String path, Document document)
          Adds a document to the site structure.
 boolean contains(Document resource)
          Checks if the site structure contains a certain resource in a certain area.
 boolean containsInAnyLanguage(Document resource)
          Checks if the site structure contains any language version of a certain resource in a certain area.
 void copy(Document sourceDocument, Document destinationDocument)
          Copies a document in the site structure.
 DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator locator)
          Checks if the document does already exist.
 Document[] getDocuments(DocumentFactory identityMap, Publication publication, java.lang.String area)
          Returns all documents in a certain area.
 DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator locator)
          Returns the resources which are required by a certain resource.
 SiteNode[] getRequiringResources(DocumentFactory map, SiteNode resource)
          Returns the resources which require a certain resource.
 SiteStructure getSiteStructure(DocumentFactory map, Publication publication, java.lang.String area)
           
 boolean isVisibleInNav(Document document)
          Returns the visibility of a node in the navigation.
 boolean requires(DocumentFactory map, SiteNode dependingResource, SiteNode requiredResource)
          Checks if a resource requires another one.
 void set(java.lang.String path, Document document)
          Sets a document to the site structure.
 void setVisibleInNav(Document document, boolean visibleInNav)
          Sets the visibility of a node in the navigation.
 SiteNode[] sortAscending(SiteNode[] nodes)
          Sorts a set of nodes using the "requires" relation.
 

Field Detail

ROLE

static final java.lang.String ROLE
The Avalon role.

Method Detail

requires

boolean requires(DocumentFactory map,
                 SiteNode dependingResource,
                 SiteNode requiredResource)
                 throws SiteException
Checks if a resource requires another one.

Parameters:
map - The identity map to operate on.
dependingResource - The depending resource.
requiredResource - The required resource.
Returns:
A boolean value.
Throws:
SiteException - if an error occurs.

getRequiredResources

DocumentLocator[] getRequiredResources(DocumentFactory map,
                                       DocumentLocator locator)
                                       throws SiteException
Returns the resources which are required by a certain resource.

Parameters:
map - The identity map to operate on.
locator - The depending locator.
Returns:
An array of resources.
Throws:
SiteException - if an error occurs.

getRequiringResources

SiteNode[] getRequiringResources(DocumentFactory map,
                                 SiteNode resource)
                                 throws SiteException
Returns the resources which require a certain resource.

Parameters:
map - The identity map to operate on.
resource - The required resource.
Returns:
An array of resources.
Throws:
SiteException - if an error occurs.

add

void add(java.lang.String path,
         Document document)
         throws SiteException
Adds a document to the site structure.

Parameters:
path - The path.
document - The document to add.
Throws:
SiteException - if the document is already contained.

set

void set(java.lang.String path,
         Document document)
         throws SiteException
Sets a document to the site structure.

Parameters:
path - The path.
document - The document to add.
Throws:
SiteException - if the document is already contained or if the path doesn't exist.

contains

boolean contains(Document resource)
                 throws SiteException
Checks if the site structure contains a certain resource in a certain area.

Parameters:
resource - The resource.
Returns:
A boolean value.
Throws:
SiteException - if an error occurs.

containsInAnyLanguage

boolean containsInAnyLanguage(Document resource)
                              throws SiteException
Checks if the site structure contains any language version of a certain resource in a certain area.

Parameters:
resource - The resource.
Returns:
A boolean value.
Throws:
SiteException - if an error occurs.

copy

void copy(Document sourceDocument,
          Document destinationDocument)
          throws SiteException
Copies a document in the site structure.

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

setVisibleInNav

void setVisibleInNav(Document document,
                     boolean visibleInNav)
                     throws SiteException
Sets the visibility of a node in the navigation. It is meant to hide specific nodes within the "public" navigation whereas the node is visible within the info/site area.

Parameters:
document - The document.
visibleInNav - The visibility.
Throws:
SiteException - if an error occurs.

isVisibleInNav

boolean isVisibleInNav(Document document)
                       throws SiteException
Returns the visibility of a node in the navigation.

Parameters:
document - The document.
Returns:
A boolean value.
Throws:
SiteException - if an error occurs.

getDocuments

Document[] getDocuments(DocumentFactory identityMap,
                        Publication publication,
                        java.lang.String area)
                        throws SiteException
Returns all documents in a certain area.

Parameters:
identityMap - The identityMap to use.
publication - The publication.
area - The area.
Returns:
An array of documents.
Throws:
SiteException - if an error occurs.

sortAscending

SiteNode[] sortAscending(SiteNode[] nodes)
                         throws SiteException
Sorts a set of nodes using the "requires" relation.

Parameters:
nodes - The set.
Returns:
A sorted array of nodes.
Throws:
SiteException - if an error occurs.

getSiteStructure

SiteStructure getSiteStructure(DocumentFactory map,
                               Publication publication,
                               java.lang.String area)
                               throws SiteException
Parameters:
map - The identity map.
publication - The publication.
area - The area.
Returns:
The object that holds the site structure information.
Throws:
SiteException - if an error occurs.

getAvailableLocator

DocumentLocator getAvailableLocator(DocumentFactory factory,
                                    DocumentLocator locator)
                                    throws SiteException
Checks if the document does already exist. If it does, returns a non-existing document with a similar document ID. If it does not, the original document is returned.

Parameters:
factory - The document factory.
locator - The locator.
Returns:
A locator.
Throws:
SiteException - if the new document could not be built.


Copyright 1999-2006 Apache Software Foundation. All Rights Reserved.