org.apache.slide.structure
Class StructureImpl

java.lang.Object
  extended byorg.apache.slide.structure.StructureImpl
All Implemented Interfaces:
Structure

public class StructureImpl
extends java.lang.Object
implements Structure

Default implementation of the Structure interface.

Version:
$Revision: 1.55 $

Constructor Summary
StructureImpl(Namespace namespace, NamespaceConfig namespaceConfig, Security securityHelper, Lock lockHelper)
          Constructor.
 
Method Summary
 void addBinding(SlideToken token, ObjectNode collectionNode, java.lang.String segment, ObjectNode sourceNode)
          Modifies the collection identified by collectionNode, by adding a new binding from the specified segment to the resource identified by sourceNode.
 void create(SlideToken token, ObjectNode object, java.lang.String strUri)
          Creates a new node in the namespace.
 void createLink(SlideToken token, LinkNode link, java.lang.String linkUri, ObjectNode linkedObject)
          Creates a link to another node in the namespace.
 java.lang.String generateUniqueUri(SlideToken token, java.lang.String parentUri)
          Generates an URI that is guranteed to be unqiue globally.
 java.util.Enumeration getChildren(SlideToken token, ObjectNode object)
          Returns the children of a node.
 ObjectNode getParent(SlideToken token, ObjectNode object)
          Returns the parent of a node.
 java.util.List getParents(SlideToken token, ObjectNode object, boolean pathOnly, boolean storeOnly, boolean includeSelf)
          Return all parents of this object node.
 void remove(SlideToken token, ObjectNode object)
          Method remove
 void removeBinding(SlideToken token, ObjectNode collectionNode, java.lang.String segment)
          Modifies the collection identified by collectionNode, by removing the binding for the specified segment.
 ObjectNode retrieve(SlideToken token, java.lang.String strUri)
          Retrieves a node by URI, following any links.
 ObjectNode retrieve(SlideToken token, java.lang.String strUri, boolean translateLastUriElement)
          Retrieves a node by URI.
 void store(SlideToken token, ObjectNode object)
          Stores/updates an object.
protected  void store(SlideToken token, ObjectNode object, boolean setModificationDate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureImpl

public StructureImpl(Namespace namespace,
                     NamespaceConfig namespaceConfig,
                     Security securityHelper,
                     Lock lockHelper)
Constructor.

Parameters:
namespace - the namespace associated with the helper object
namespaceConfig - configuration of the namespace
securityHelper - the associated security helper
lockHelper - the associated lock helper
Method Detail

generateUniqueUri

public java.lang.String generateUniqueUri(SlideToken token,
                                          java.lang.String parentUri)
                                   throws ServiceAccessException
Description copied from interface: Structure
Generates an URI that is guranteed to be unqiue globally. If this is not possible null will be returned.

Specified by:
generateUniqueUri in interface Structure
Parameters:
token - the slide token
parentUri - the parent of the unique URI that shall be created
Returns:
a globally unique URI or null if not possible
Throws:
ServiceAccessException - low level service access exception

getChildren

public java.util.Enumeration getChildren(SlideToken token,
                                         ObjectNode object)
                                  throws ServiceAccessException,
                                         ObjectNotFoundException,
                                         LinkedObjectNotFoundException,
                                         VetoException
Description copied from interface: Structure
Returns the children of a node.

Specified by:
getChildren in interface Structure
Parameters:
token - the slide token
object - the node
Returns:
Enumeration of ObjectNode objects
Throws:
ServiceAccessException - low level service access exception
LinkedObjectNotFoundException - cannot happen
ObjectNotFoundException - one of the children specified by the object was not found
VetoException
See Also:
ObjectNode.enumerateChildren()

getParent

public ObjectNode getParent(SlideToken token,
                            ObjectNode object)
                     throws ServiceAccessException,
                            ObjectNotFoundException,
                            LinkedObjectNotFoundException,
                            AccessDeniedException,
                            VetoException
Description copied from interface: Structure
Returns the parent of a node.

Specified by:
getParent in interface Structure
Parameters:
token - the slide token
object - the node
Returns:
the node's parent, or null if the object specified is the root node of the namespace
Throws:
ServiceAccessException - low level service access exception
ObjectNotFoundException - the parent object specified by the object was not found
AccessDeniedException - credentials token does not have permission to perform the action
LinkedObjectNotFoundException - cannot happen (a link cannot have children)
VetoException
See Also:
ObjectNode.enumerateChildren()

retrieve

public ObjectNode retrieve(SlideToken token,
                           java.lang.String strUri)
                    throws ServiceAccessException,
                           ObjectNotFoundException,
                           LinkedObjectNotFoundException,
                           AccessDeniedException,
                           VetoException
Description copied from interface: Structure
Retrieves a node by URI, following any links.

Specified by:
retrieve in interface Structure
Parameters:
token - the slide token
strUri - the URI of the object to retrieve
Returns:
the node specified by the URI or the node linked to by the node at the URI.
Throws:
ServiceAccessException - low level service access exception
LinkedObjectNotFoundException - A link object encountered during URI resolution doesn't have a valid target
ObjectNotFoundException - if no node exists at the URI
AccessDeniedException - credentials token does not have permission to perform the action
VetoException

retrieve

public ObjectNode retrieve(SlideToken token,
                           java.lang.String strUri,
                           boolean translateLastUriElement)
                    throws ServiceAccessException,
                           ObjectNotFoundException,
                           LinkedObjectNotFoundException,
                           AccessDeniedException,
                           VetoException
Description copied from interface: Structure
Retrieves a node by URI.

Specified by:
retrieve in interface Structure
Parameters:
token - the slide token
strUri - the URI of the object to retrieve
translateLastUriElement - if set to true and the URI is associated with a link, this method will return the target of the link, otherwise the link itself is returned
Returns:
the node specified by the URI, or the node linked to by the node at the URI, if translateLastUriElement is true
Throws:
ServiceAccessException - low level service access exception
LinkedObjectNotFoundException - A link object encountered during URI resolution doesn't have a valid target
AccessDeniedException - credentials token does not have permission to perform the action
ObjectNotFoundException - if no node exists at the URI
VetoException

create

public void create(SlideToken token,
                   ObjectNode object,
                   java.lang.String strUri)
            throws ServiceAccessException,
                   ObjectAlreadyExistsException,
                   ObjectNotFoundException,
                   LinkedObjectNotFoundException,
                   AccessDeniedException,
                   ObjectLockedException,
                   VetoException
Description copied from interface: Structure
Creates a new node in the namespace.

Specified by:
create in interface Structure
Parameters:
token - the slide token
object - the object that should be created
strUri - location in the namespace where we the object should be created
Throws:
ServiceAccessException - low level service access exception
ObjectNotFoundException - Update of the parent object failed because the parent object does no longer exist. Should not happen, and indicates a critical error if it does
AccessDeniedException - credentials token does not have permission to perform the action
LinkedObjectNotFoundException - retrieval of a link target failed during URI resolution
ObjectAlreadyExistsException
ObjectLockedException
VetoException

createLink

public void createLink(SlideToken token,
                       LinkNode link,
                       java.lang.String linkUri,
                       ObjectNode linkedObject)
                throws ServiceAccessException,
                       ObjectAlreadyExistsException,
                       ObjectNotFoundException,
                       LinkedObjectNotFoundException,
                       AccessDeniedException,
                       ObjectLockedException,
                       VetoException
Description copied from interface: Structure
Creates a link to another node in the namespace.

Specified by:
createLink in interface Structure
Parameters:
token - the slide token
link - the link object that should be created
linkUri - location in the namespace where the link object should be created
linkedObject - target object of the link
Throws:
LinkedObjectNotFoundException - Retrieval of a link target failed during Uri resolution
AccessDeniedException - credentials token does not have permission to perform the action
ObjectNotFoundException - Update of the parent object failed because the parent object does no longer exist. Should not happen, and indicate a critical error if it does
ServiceAccessException - Low level service access exception
ObjectAlreadyExistsException
ObjectLockedException
VetoException

store

public void store(SlideToken token,
                  ObjectNode object)
           throws ServiceAccessException,
                  ObjectNotFoundException,
                  AccessDeniedException,
                  LinkedObjectNotFoundException,
                  VetoException
Description copied from interface: Structure
Stores/updates an object.

Specified by:
store in interface Structure
Parameters:
token - the slide token
object - the object to update
Throws:
LinkedObjectNotFoundException - retrieval of a link target failed during URI resolution
ServiceAccessException - low level service access exception
AccessDeniedException - credentials token does not have permission to perform the action
ObjectNotFoundException - the update failed because one object was not found during URI resolution
VetoException

store

protected void store(SlideToken token,
                     ObjectNode object,
                     boolean setModificationDate)
              throws ServiceAccessException,
                     ObjectNotFoundException,
                     AccessDeniedException,
                     LinkedObjectNotFoundException,
                     VetoException
Throws:
ServiceAccessException
ObjectNotFoundException
AccessDeniedException
LinkedObjectNotFoundException
VetoException

remove

public void remove(SlideToken token,
                   ObjectNode object)
            throws ServiceAccessException,
                   ObjectNotFoundException,
                   ObjectHasChildrenException,
                   AccessDeniedException,
                   LinkedObjectNotFoundException,
                   ObjectLockedException,
                   VetoException
Method remove

Specified by:
remove in interface Structure
Parameters:
token - a SlideToken
object - an ObjectNode
Throws:
ServiceAccessException
ObjectNotFoundException
ObjectHasChildrenException
AccessDeniedException
LinkedObjectNotFoundException
ObjectLockedException
VetoException

addBinding

public void addBinding(SlideToken token,
                       ObjectNode collectionNode,
                       java.lang.String segment,
                       ObjectNode sourceNode)
                throws ServiceAccessException,
                       ObjectNotFoundException,
                       AccessDeniedException,
                       LinkedObjectNotFoundException,
                       ObjectLockedException,
                       CrossServerBindingException,
                       VetoException
Modifies the collection identified by collectionNode, by adding a new binding from the specified segment to the resource identified by sourceNode.

Specified by:
addBinding in interface Structure
Parameters:
token - a SlideToken
collectionNode - an ObjectNode
segment - a String
sourceNode - an ObjectNode
Throws:
ServiceAccessException
ObjectNotFoundException
AccessDeniedException
LinkedObjectNotFoundException
ObjectLockedException
CrossServerBindingException
VetoException

removeBinding

public void removeBinding(SlideToken token,
                          ObjectNode collectionNode,
                          java.lang.String segment)
                   throws ServiceAccessException,
                          ObjectNotFoundException,
                          AccessDeniedException,
                          LinkedObjectNotFoundException,
                          ObjectLockedException,
                          VetoException
Modifies the collection identified by collectionNode, by removing the binding for the specified segment.

Specified by:
removeBinding in interface Structure
Parameters:
token - a SlideToken
collectionNode - an ObjectNode
segment - a String
Throws:
ServiceAccessException
ObjectNotFoundException
AccessDeniedException
LinkedObjectNotFoundException
ObjectLockedException
VetoException

getParents

public java.util.List getParents(SlideToken token,
                                 ObjectNode object,
                                 boolean pathOnly,
                                 boolean storeOnly,
                                 boolean includeSelf)
                          throws ServiceAccessException,
                                 ObjectNotFoundException,
                                 LinkedObjectNotFoundException,
                                 AccessDeniedException,
                                 VetoException
Return all parents of this object node. If pathOnly=true, only parents on the path of the specified ObjectNode are returned, all parents (binding!) otherwise. If storeOnly=true, only parents within the scope of the store in charge of the specified ObjectNode are returned, parents up to the root ObjectNode (uri="/") otherwise.

Specified by:
getParents in interface Structure
Parameters:
token - a SlideToken
object - an ObjectNode
pathOnly - if true, only parents on the path of the specified ObjectNode are returned, all parents (binding!) otherwise
storeOnly - if true, only parents within the scope of the store in charge of the specified ObjectNode are returned, parents up to the root ObjectNode (uri="/") otherwise
includeSelf - if true, the ObjectNode specified by object is included, otherwise, it is excluded
Returns:
a List of ObjectNode instances
Throws:
ServiceAccessException
ObjectNotFoundException
LinkedObjectNotFoundException
AccessDeniedException
VetoException