org.apache.jackrabbit.jcr2spi
Class ItemImpl

java.lang.Object
  extended by org.apache.jackrabbit.jcr2spi.ItemImpl
All Implemented Interfaces:
javax.jcr.Item, ItemStateLifeCycleListener
Direct Known Subclasses:
NodeImpl, PropertyImpl

public abstract class ItemImpl
extends Object
implements javax.jcr.Item, ItemStateLifeCycleListener

ItemImpl...


Field Summary
protected  Map listeners
          Listeners (weak references)
protected  SessionImpl session
          The session that created this item.
 
Constructor Summary
ItemImpl(SessionImpl session, ItemState state, ItemLifeCycleListener[] listeners)
           
 
Method Summary
abstract  void accept(javax.jcr.ItemVisitor visitor)
           
protected  void checkIsWritable()
          Checks if the repository supports level 2 (writing) and the status of this item.
protected  void checkStatus()
          Performs a sanity check on this item and the associated session.
 javax.jcr.Item getAncestor(int depth)
           
 int getDepth()
           
protected  ItemManager getItemManager()
          Returns the ItemManager associated with this item's Session.
protected  ItemState getItemState()
          Returns the item-state associated with this Item.
abstract  String getName()
           
 javax.jcr.Node getParent()
           
 String getPath()
           
 javax.jcr.Session getSession()
           
 boolean isModified()
           
 boolean isNew()
           
abstract  boolean isNode()
           
 boolean isSame(javax.jcr.Item otherItem)
           
protected  boolean isWritable()
          Returns true if the repository supports level 2 (writing).
 void refresh(boolean keepChanges)
           
 void remove()
           
 void save()
           
 void statusChanged(ItemState state, int previousStatus)
          Called after an ItemState has changed its status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected SessionImpl session
The session that created this item.


listeners

protected final Map listeners
Listeners (weak references)

Constructor Detail

ItemImpl

public ItemImpl(SessionImpl session,
                ItemState state,
                ItemLifeCycleListener[] listeners)
Method Detail

getPath

public String getPath()
               throws javax.jcr.RepositoryException
Specified by:
getPath in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException
See Also:
Item.getPath()

getName

public abstract String getName()
                        throws javax.jcr.RepositoryException
Specified by:
getName in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException
See Also:
Item.getName()

getAncestor

public javax.jcr.Item getAncestor(int depth)
                           throws javax.jcr.ItemNotFoundException,
                                  javax.jcr.AccessDeniedException,
                                  javax.jcr.RepositoryException
Specified by:
getAncestor in interface javax.jcr.Item
Throws:
javax.jcr.ItemNotFoundException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException
See Also:
Item.getAncestor(int)

getParent

public javax.jcr.Node getParent()
                         throws javax.jcr.ItemNotFoundException,
                                javax.jcr.AccessDeniedException,
                                javax.jcr.RepositoryException
Specified by:
getParent in interface javax.jcr.Item
Throws:
javax.jcr.ItemNotFoundException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException
See Also:
Item.getParent()

getDepth

public int getDepth()
             throws javax.jcr.RepositoryException
Specified by:
getDepth in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException
See Also:
Item.getDepth()

getSession

public javax.jcr.Session getSession()
                             throws javax.jcr.RepositoryException
Specified by:
getSession in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException
See Also:
Item.getSession()

isNew

public boolean isNew()
Specified by:
isNew in interface javax.jcr.Item
See Also:
Item.isNew()

isModified

public boolean isModified()
Specified by:
isModified in interface javax.jcr.Item
See Also:
Item.isModified()

isSame

public boolean isSame(javax.jcr.Item otherItem)
               throws javax.jcr.RepositoryException
Specified by:
isSame in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException
See Also:
Item.isSame(Item)

accept

public abstract void accept(javax.jcr.ItemVisitor visitor)
                     throws javax.jcr.RepositoryException
Specified by:
accept in interface javax.jcr.Item
Throws:
javax.jcr.RepositoryException
See Also:
Item.accept(ItemVisitor)

isNode

public abstract boolean isNode()
Specified by:
isNode in interface javax.jcr.Item
See Also:
Item.isNode()

save

public void save()
          throws javax.jcr.AccessDeniedException,
                 javax.jcr.nodetype.ConstraintViolationException,
                 javax.jcr.InvalidItemStateException,
                 javax.jcr.ReferentialIntegrityException,
                 javax.jcr.version.VersionException,
                 javax.jcr.lock.LockException,
                 javax.jcr.RepositoryException
Specified by:
save in interface javax.jcr.Item
Throws:
javax.jcr.AccessDeniedException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.InvalidItemStateException
javax.jcr.ReferentialIntegrityException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.RepositoryException
See Also:
Item.save()

refresh

public void refresh(boolean keepChanges)
             throws javax.jcr.InvalidItemStateException,
                    javax.jcr.RepositoryException
Specified by:
refresh in interface javax.jcr.Item
Throws:
javax.jcr.InvalidItemStateException
javax.jcr.RepositoryException
See Also:
Item.refresh(boolean)

remove

public void remove()
            throws javax.jcr.version.VersionException,
                   javax.jcr.lock.LockException,
                   javax.jcr.nodetype.ConstraintViolationException,
                   javax.jcr.RepositoryException
Specified by:
remove in interface javax.jcr.Item
Throws:
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
See Also:
Item.remove()

statusChanged

public void statusChanged(ItemState state,
                          int previousStatus)
Description copied from interface: ItemStateLifeCycleListener
Called after an ItemState has changed its status. The new status can be retrieved by calling ItemState.getStatus().

Specified by:
statusChanged in interface ItemStateLifeCycleListener
Parameters:
state -
previousStatus -

checkStatus

protected void checkStatus()
                    throws javax.jcr.RepositoryException
Performs a sanity check on this item and the associated session. If the underlying item state is in an invalidated state then it will be refreshed to get the current status of the item state. The status check is then performed on the newly retrieved status.

Throws:
javax.jcr.RepositoryException - if this item has been rendered invalid for some reason

checkIsWritable

protected void checkIsWritable()
                        throws javax.jcr.UnsupportedRepositoryOperationException,
                               javax.jcr.nodetype.ConstraintViolationException,
                               javax.jcr.RepositoryException
Checks if the repository supports level 2 (writing) and the status of this item. Note, that this method does not perform any additional validation checks such as access restrictions, locking, checkin status or protection that affect the writing to nodes and properties.

Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
javax.jcr.nodetype.ConstraintViolationException
See Also:
ItemStateValidator

isWritable

protected boolean isWritable()
                      throws javax.jcr.RepositoryException
Returns true if the repository supports level 2 (writing). Note, that this method does not perform any additional validation tests such as access restrictions, locking, checkin status or protection that affect the writing to nodes and properties.

Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException - if the sanity check on this item fails. See checkStatus().
See Also:
ItemStateValidator

getItemState

protected ItemState getItemState()
Returns the item-state associated with this Item.

Returns:
state associated with this Item

getItemManager

protected ItemManager getItemManager()
Returns the ItemManager associated with this item's Session.

Returns:
ItemManager


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.