Class ItemDelegate
- java.lang.Object
-
- org.apache.jackrabbit.oak.jcr.delegate.ItemDelegate
-
- Direct Known Subclasses:
NodeDelegate,PropertyDelegate
public abstract class ItemDelegate extends Object
Abstract base class forNodeDelegateandPropertyDelegate
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionDelegatesessionDelegate
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheckAlive()Performs a sanity check on this item and the associated session.protected booleancheckUpdate()Checks whether the session has changed since this delegate instance was last accessed, thus triggering anupdateof the internal state of this delegate.abstract booleanexists()Determine whether the underlying item existsabstract @NotNull StringgetName()Get the name of this itemabstract @Nullable NodeDelegategetParent()Get the parent of this item ornull.abstract @NotNull StringgetPath()Get the path of this itemabstract @Nullable Tree.StatusgetStatus()Get the status of this item.abstract booleanisProtected()abstract booleanremove()Removes this item.voidsave()Save the subtree rooted at this item.protected voidupdate()Called bycheckUpdate()to update the internal state of this delegate.
-
-
-
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 anupdateof the internal state of this delegate.- Returns:
trueif the session was recently updated,falseif not
-
update
protected void update()
Called bycheckUpdate()to update the internal state of this delegate.
-
checkAlive
public void checkAlive() throws RepositoryExceptionPerforms a sanity check on this item and the associated session.- Throws:
RepositoryException- if this item has been rendered invalid for some reason or the associated session has been logged out
-
getName
@NotNull public abstract @NotNull String getName()
Get the name of this item- Returns:
- oak name of this item
-
getPath
@NotNull public abstract @NotNull String getPath()
Get the path of this item- Returns:
- oak path of this item
-
getParent
@Nullable public abstract @Nullable NodeDelegate getParent()
Get the parent of this item ornull.- Returns:
- parent of this item or
nullfor root or if the parent is not accessible.
-
getStatus
@Nullable public abstract @Nullable Tree.Status getStatus()
Get the status of this item.- Returns:
Tree.Statusof this item ornullif not available.
-
isProtected
public abstract boolean isProtected() throws InvalidItemStateException- Throws:
InvalidItemStateException
-
exists
public abstract boolean exists()
Determine whether the underlying item exists- Returns:
truethe underlying tree exists,falseotherwise.
-
remove
public abstract boolean remove() throws InvalidItemStateExceptionRemoves this item.- Returns:
trueif this item was removed; orfalseif this is the root node that can't be removed- Throws:
InvalidItemStateException
-
save
public void save() throws RepositoryExceptionSave the subtree rooted at this item.- Throws:
RepositoryException
-
-