org.apache.jackrabbit.core
Class ItemValidator

java.lang.Object
  extended byorg.apache.jackrabbit.core.ItemValidator
Direct Known Subclasses:
BatchedItemOperations

public class ItemValidator
extends Object

Utility class for validating an item against constraints specified by its definition.


Field Summary
protected  HierarchyManager hierMgr
          hierarchy manager used for generating error msg's that contain human readable paths
protected  NamespaceResolver nsResolver
          namespace resolver used for generating error msg's that contain human readable paths
protected  NodeTypeRegistry ntReg
          node type registry
 
Constructor Summary
ItemValidator(NodeTypeRegistry ntReg, HierarchyManager hierMgr, NamespaceResolver nsResolver)
          Creates a new ItemValidator instance.
 
Method Summary
 EffectiveNodeType getEffectiveNodeType(NodeState nodeState)
          Helper method that builds the effective (i.e.
 String safeGetJCRPath(ItemId id)
          Failsafe translation of internal ItemId to JCR path for use in error messages etc.
 String safeGetJCRPath(Path path)
          Failsafe conversion of internal Path to JCR path for use in error messages etc.
 void validate(NodeState nodeState)
          Checks whether the given node state satisfies the constraints specified by its primary and mixin node types.
 void validate(PropertyState propState)
          Checks whether the given property state satisfies the constraints specified by its definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ntReg

protected final NodeTypeRegistry ntReg
node type registry


hierMgr

protected final HierarchyManager hierMgr
hierarchy manager used for generating error msg's that contain human readable paths

See Also:
safeGetJCRPath(ItemId)

nsResolver

protected final NamespaceResolver nsResolver
namespace resolver used for generating error msg's that contain human readable paths

See Also:
safeGetJCRPath(Path)
Constructor Detail

ItemValidator

public ItemValidator(NodeTypeRegistry ntReg,
                     HierarchyManager hierMgr,
                     NamespaceResolver nsResolver)
Creates a new ItemValidator instance.

Parameters:
ntReg - node type registry
hierMgr - hierarchy manager
nsResolver - namespace resolver
Method Detail

validate

public void validate(NodeState nodeState)
              throws ConstraintViolationException,
                     RepositoryException
Checks whether the given node state satisfies the constraints specified by its primary and mixin node types. The following validations/checks are performed:

Parameters:
nodeState - state of node to be validated
Throws:
ConstraintViolationException - if any of the validations fail
RepositoryException - if another error occurs

validate

public void validate(PropertyState propState)
              throws ConstraintViolationException,
                     RepositoryException
Checks whether the given property state satisfies the constraints specified by its definition. The following validations/checks are performed:

Parameters:
propState - state of property to be validated
Throws:
ConstraintViolationException - if any of the validations fail
RepositoryException - if another error occurs

getEffectiveNodeType

public EffectiveNodeType getEffectiveNodeType(NodeState nodeState)
                                       throws RepositoryException
Helper method that builds the effective (i.e. merged and resolved) node type representation of the specified node's primary and mixin node types.

Parameters:
nodeState -
Returns:
the effective node type
Throws:
RepositoryException

safeGetJCRPath

public String safeGetJCRPath(Path path)
Failsafe conversion of internal Path to JCR path for use in error messages etc.

Parameters:
path - path to convert
Returns:
JCR path

safeGetJCRPath

public String safeGetJCRPath(ItemId id)
Failsafe translation of internal ItemId to JCR path for use in error messages etc.

Parameters:
id - id to translate
Returns:
JCR path


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.