org.apache.jackrabbit.jcr2spi.hierarchy
Class PropertyEntryImpl

java.lang.Object
  extended by org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntryImpl
All Implemented Interfaces:
HierarchyEntry, PropertyEntry

public class PropertyEntryImpl
extends Object
implements PropertyEntry

PropertyEntryImpl implements a reference to a property state.


Field Summary
protected  EntryFactory factory
          The item state factory to create the item state.
 long generation
          The required generation of this entry.
protected  Name name
          The name of the target item state.
protected  NodeEntryImpl parent
          Hard reference to the parent NodeEntry.
 
Method Summary
 void calculateStatus()
          Calculates the status of the underlying ItemState: any pending changes to the underlying ItemState are applied.
 void complete(Operation operation)
          Clean up this entry upon Operation.undo() or Operation.persisted().
 boolean denotesNode()
          Returns false.
 long getGeneration()
          The required generation of this HierarchyEntry .
 PropertyId getId()
           
protected  IdFactory getIdFactory()
          Shortcut for EntryFactory.getIdFactory()
protected  EntryFactory.InvalidationStrategy getInvalidationStrategy()
           
 ItemState getItemState()
          If this HierarchyEntry has already been resolved before (see HierarchyEntry.isAvailable()), that ItemState is returned.
protected  TransientItemStateFactory getItemStateFactory()
          Shortcut for EntryFactory.getItemStateFactory()
 Name getName()
           
 NodeEntry getParent()
          Returns the NodeEntry being parent to this HierarchyEntry.
 Path getPath()
           
protected  PathFactory getPathFactory()
          Shortcut for EntryFactory.getPathFactory()
 PropertyState getPropertyState()
           
 int getStatus()
          If this HierarchyEntry provides an underlying ItemState this method returns the status of that state, otherwise it returns Status._UNDEFINED_.
 PropertyId getWorkspaceId()
          Returns the ID that must be used for resolving this entry OR loading its children entries from the persistent layer.
 Path getWorkspacePath()
           
 void invalidate(boolean recursive)
          Invalidates the underlying ItemState if available and if it is not transiently modified.
protected  void invalidateInternal(boolean recursive)
          Invalidates the underlying ItemState.
 boolean isAvailable()
          Returns true if the referenced ItemState is available.
 void reload(boolean recursive)
          Reloads this hierarchy entry and the corresponding ItemState, if this entry has already been resolved.
 void remove()
          Removes this HierarchyEntry from its parent and sets the status of the underlying ItemState to Status.REMOVED or to Status.STALE_DESTROYED, respectively.
 void revert()
          Traverses the hierarchy and reverts all transient modifications such as adding, modifying or removing item states.
 void setItemState(ItemState state)
          Set the ItemState this hierarchyEntry will be resolved to.
 void transientRemove()
          Traverses the hierarchy and marks all available item states as transiently removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry
calculateStatus, getGeneration, getItemState, getName, getParent, getPath, getStatus, getWorkspacePath, invalidate, isAvailable, reload, remove, revert, setItemState, transientRemove
 

Field Detail

generation

public long generation
The required generation of this entry. This is used by the ItemInfoCache to determine wheter an item info in the cache is up to date or not. That is whether the generation of the item info in the cache is the same or more recent as the required generation of this entry.


name

protected Name name
The name of the target item state.


parent

protected NodeEntryImpl parent
Hard reference to the parent NodeEntry.


factory

protected final EntryFactory factory
The item state factory to create the item state.

Method Detail

getId

public PropertyId getId()
                 throws InvalidItemStateException,
                        RepositoryException
Specified by:
getId in interface PropertyEntry
Returns:
the NodeId of this child node entry.
Throws:
InvalidItemStateException
RepositoryException
See Also:
PropertyEntry.getId()

getWorkspaceId

public PropertyId getWorkspaceId()
                          throws InvalidItemStateException,
                                 RepositoryException
Description copied from interface: PropertyEntry
Returns the ID that must be used for resolving this entry OR loading its children entries from the persistent layer. This is the same as getId() unless any of its ancestors has been transiently moved.

Specified by:
getWorkspaceId in interface PropertyEntry
Returns:
Throws:
InvalidItemStateException
RepositoryException
See Also:
PropertyEntry.getWorkspaceId()

getPropertyState

public PropertyState getPropertyState()
                               throws ItemNotFoundException,
                                      RepositoryException
Specified by:
getPropertyState in interface PropertyEntry
Returns:
the referenced PropertyState.
Throws:
ItemNotFoundException - if the PropertyState does not exist anymore.
RepositoryException - if an error occurs while retrieving the PropertyState.
See Also:
PropertyEntry.getPropertyState()

denotesNode

public boolean denotesNode()
Returns false.

Specified by:
denotesNode in interface HierarchyEntry
Returns:
See Also:
HierarchyEntry.denotesNode()

complete

public void complete(Operation operation)
              throws RepositoryException
Description copied from interface: HierarchyEntry
Clean up this entry upon Operation.undo() or Operation.persisted().

Specified by:
complete in interface HierarchyEntry
Throws:
RepositoryException
See Also:
HierarchyEntry.complete(Operation)

getItemStateFactory

protected TransientItemStateFactory getItemStateFactory()
Shortcut for EntryFactory.getItemStateFactory()

Returns:

getPathFactory

protected PathFactory getPathFactory()
Shortcut for EntryFactory.getPathFactory()

Returns:

getIdFactory

protected IdFactory getIdFactory()
Shortcut for EntryFactory.getIdFactory()

Returns:

getInvalidationStrategy

protected EntryFactory.InvalidationStrategy getInvalidationStrategy()

invalidateInternal

protected void invalidateInternal(boolean recursive)
Invalidates the underlying ItemState. If recursive is true also invalidates the underlying item states of all child entries.

Parameters:
recursive -

getName

public Name getName()
Specified by:
getName in interface HierarchyEntry
Returns:
the name of this hierarchy entry.
See Also:
HierarchyEntry.getName()

getPath

public Path getPath()
             throws RepositoryException
Specified by:
getPath in interface HierarchyEntry
Returns:
the path of this hierarchy entry.
Throws:
RepositoryException
See Also:
HierarchyEntry.getPath()

getWorkspacePath

public Path getWorkspacePath()
                      throws RepositoryException
Specified by:
getWorkspacePath in interface HierarchyEntry
Returns:
If this entry has not been modified this method returns the same as HierarchyEntry.getPath(). In case of moved items this method return the original path as it is present on the persistent layer.
Throws:
RepositoryException
See Also:
HierarchyEntry.getWorkspacePath()

getParent

public NodeEntry getParent()
Description copied from interface: HierarchyEntry
Returns the NodeEntry being parent to this HierarchyEntry.

Specified by:
getParent in interface HierarchyEntry
Returns:
the parent HierarchyEntry
See Also:
HierarchyEntry.getParent()

getStatus

public int getStatus()
Description copied from interface: HierarchyEntry
If this HierarchyEntry provides an underlying ItemState this method returns the status of that state, otherwise it returns Status._UNDEFINED_.

Specified by:
getStatus in interface HierarchyEntry
Returns:
Status of the ItemState or Status._UNDEFINED_ if this entry has not been resolved yet.
See Also:
HierarchyEntry.getStatus()

isAvailable

public boolean isAvailable()
Description copied from interface: HierarchyEntry
Returns true if the referenced ItemState is available. That is, the referenced ItemState has already been resolved.
Note, that the validity of the ItemState is not checked.

Specified by:
isAvailable in interface HierarchyEntry
Returns:
true if the ItemState is available; otherwise false.
See Also:
HierarchyEntry.isAvailable()

getItemState

public ItemState getItemState()
                       throws ItemNotFoundException,
                              RepositoryException
If this HierarchyEntry has already been resolved before (see HierarchyEntry.isAvailable()), that ItemState is returned. Note however, that the validity of the State is not asserted.
If the entry has not been resolved yet an attempt is made to resolve this entry, which may fail if there exists no accessible ItemState or if the corresponding state has been removed in the mean time.

Specified by:
getItemState in interface HierarchyEntry
Returns:
the referenced ItemState.
Throws:
ItemNotFoundException - if the ItemState does not exist anymore.
RepositoryException - If an error occurs while retrieving the ItemState.
See Also:
HierarchyEntry.getItemState()

setItemState

public void setItemState(ItemState state)
Set the ItemState this hierarchyEntry will be resolved to.

Specified by:
setItemState in interface HierarchyEntry
See Also:
HierarchyEntry.setItemState(ItemState)

invalidate

public void invalidate(boolean recursive)
Invalidates the underlying ItemState if available and if it is not transiently modified. If the recursive flag is true, also invalidates the child entries recursively.
Note, that in contrast to HierarchyEntry.reload(boolean) this method only sets the status of this item state to Status.INVALIDATED and does not actually update it with the persistent state in the repository.

Specified by:
invalidate in interface HierarchyEntry
See Also:
HierarchyEntry.invalidate(boolean)

calculateStatus

public void calculateStatus()
Description copied from interface: HierarchyEntry
Calculates the status of the underlying ItemState: any pending changes to the underlying ItemState are applied.

Specified by:
calculateStatus in interface HierarchyEntry

revert

public void revert()
            throws RepositoryException
Traverses the hierarchy and reverts all transient modifications such as adding, modifying or removing item states. 'Existing' item states are reverted to their initial state and their status is reset to Status.EXISTING.

Specified by:
revert in interface HierarchyEntry
Throws:
RepositoryException - if an error occurs.
See Also:
HierarchyEntry.revert()

reload

public void reload(boolean recursive)
Reloads this hierarchy entry and the corresponding ItemState, if this entry has already been resolved. If 'recursive' the complete hierarchy below this entry is reloaded as well.

Specified by:
reload in interface HierarchyEntry
See Also:
HierarchyEntry.reload(boolean)

transientRemove

public void transientRemove()
                     throws InvalidItemStateException,
                            RepositoryException
Traverses the hierarchy and marks all available item states as transiently removed. They will change their status to either Status.EXISTING_REMOVED if the item is existing in the persistent storage or Status.REMOVED if the item has been transiently added before. In the latter case, the corresponding HierarchyEntries can be removed as well from their parent.

Specified by:
transientRemove in interface HierarchyEntry
Throws:
InvalidItemStateException - if this entry has been removed in the mean time.
RepositoryException - if an error occurs while removing any of the item states e.g. an item state is not valid anymore.
See Also:
HierarchyEntry.transientRemove()

remove

public void remove()
Description copied from interface: HierarchyEntry
Removes this HierarchyEntry from its parent and sets the status of the underlying ItemState to Status.REMOVED or to Status.STALE_DESTROYED, respectively. If this entry is a NodeEntry all descending ItemStates must get their status changed as well.

Specified by:
remove in interface HierarchyEntry
See Also:
HierarchyEntry.remove()

getGeneration

public long getGeneration()
Description copied from interface: HierarchyEntry
The required generation of this HierarchyEntry . This is used by the ItemInfoCache to determine wheter an item info in the cache is up to date or not. That is whether the generation of the item info in the cache is the same or more recent as the required generation of this entry.

Specified by:
getGeneration in interface HierarchyEntry


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