org.apache.jackrabbit.oak.jcr.delegate
Class ItemDelegate

java.lang.Object
  extended by org.apache.jackrabbit.oak.jcr.delegate.ItemDelegate
Direct Known Subclasses:
NodeDelegate, PropertyDelegate

public abstract class ItemDelegate
extends Object

Abstract base class for NodeDelegate and PropertyDelegate


Field Summary
protected  SessionDelegate sessionDelegate
           
 
Method Summary
 void checkAlive()
          Performs a sanity check on this item and the associated session.
protected  boolean checkUpdate()
          Checks whether the session has changed since this delegate instance was last accessed, thus triggering an update of the internal state of this delegate.
abstract  boolean exists()
          Determine whether the underlying item exists
abstract  String getName()
          Get the name of this item
abstract  NodeDelegate getParent()
          Get the parent of this item or null.
abstract  String getPath()
          Get the path of this item
abstract  org.apache.jackrabbit.oak.api.Tree.Status getStatus()
          Get the status of this item.
abstract  boolean isProtected()
           
abstract  boolean remove()
          Removes this item.
 void save()
          Save the subtree rooted at this item.
protected  void update()
          Called by checkUpdate() to update the internal state of this delegate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionDelegate

protected final SessionDelegate sessionDelegate
Method Detail

checkUpdate

protected boolean checkUpdate()
Checks whether the session has changed since this delegate instance was last accessed, thus triggering an update of the internal state of this delegate.

Returns:
true if the session was recently updated, false if not

update

protected void update()
Called by checkUpdate() to update the internal state of this delegate.


checkAlive

public void checkAlive()
                throws javax.jcr.RepositoryException
Performs a sanity check on this item and the associated session.

Throws:
javax.jcr.RepositoryException - if this item has been rendered invalid for some reason or the associated session has been logged out

getName

@Nonnull
public abstract String getName()
Get the name of this item

Returns:
oak name of this item

getPath

@Nonnull
public abstract String getPath()
Get the path of this item

Returns:
oak path of this item

getParent

@CheckForNull
public abstract NodeDelegate getParent()
Get the parent of this item or null.

Returns:
parent of this item or null for root or if the parent is not accessible.

getStatus

@CheckForNull
public abstract org.apache.jackrabbit.oak.api.Tree.Status getStatus()
Get the status of this item.

Returns:
Tree.Status of this item or null if not available.

isProtected

public abstract boolean isProtected()
                             throws javax.jcr.InvalidItemStateException
Throws:
javax.jcr.InvalidItemStateException

exists

public abstract boolean exists()
Determine whether the underlying item exists

Returns:
true the underlying tree exists, false otherwise.

remove

public abstract boolean remove()
                        throws javax.jcr.InvalidItemStateException
Removes this item.

Returns:
true if this item was removed; or false if this is the root node that can't be removed
Throws:
javax.jcr.InvalidItemStateException

save

public void save()
          throws javax.jcr.RepositoryException
Save the subtree rooted at this item.

Throws:
javax.jcr.RepositoryException


Copyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.