Package org.apache.jackrabbit.core.state
Class ItemState
- java.lang.Object
- 
- org.apache.jackrabbit.core.state.ItemState
 
- 
- Direct Known Subclasses:
- NodeState,- PropertyState
 
 public abstract class ItemState extends Object ItemStaterepresents the state of anItem.
- 
- 
Field SummaryFields Modifier and Type Field Description protected ItemStateoverlayedStatethe backing persistent item state (may be null)protected intstatusthe internal status of this item statestatic intSTATUS_EXISTING'existing', i.e.static intSTATUS_EXISTING_MODIFIED'existing', i.e.static intSTATUS_EXISTING_REMOVED'existing', i.e.static intSTATUS_NEW'new' statestatic intSTATUS_STALE_DESTROYED'existing', i.e.static intSTATUS_UNDEFINEDthe status is undefined
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedItemState(int initialStatus, boolean isTransient)Constructs a new unconnected item stateprotectedItemState(ItemState overlayedState, int initialStatus, boolean isTransient)Constructs a new item state that is initially connected to an overlayed state.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract longcalculateMemoryFootprint()Returns the approximate memory consumption of this state.voidconnect(ItemState overlayedState)Connect this state to some underlying overlayed state.abstract voidcopy(ItemState state, boolean syncModCount)Copy state information from another state into this statevoiddiscard()Discards this instance, i.e.protected voiddisconnect()Disconnect this state from the underlying overlayed state.ItemStateListenergetContainer()Return the parent container that will receive notifications about changes to this state.abstract ItemIdgetId()Returns the identifier of this item.shortgetModCount()Returns the modification count.ItemStategetOverlayedState()Returns the persistent state backing this transient state ornullif there is no persistent state (i.e..abstract NodeIdgetParentId()Returns the NodeId of the parentNodeStateornullif either this item state represents the root node or this item state is 'free floating', i.e.intgetStatus()Returns the status of this item.booleanhasOverlayedState()Determines if this item state is overlying persistent state.protected booleanisConnected()Return a flag indicating whether this state is connected to some other state.abstract booleanisNode()Determines if this item state represents a node.booleanisStale()Determines whether this item state has become stale.booleanisTransient()Returnstrueif this item state represents new or modified state (i.e.protected voidnotifyStateCreated()Notify the parent container about changes to this state.protected voidnotifyStateDestroyed()Notify the parent container about changes to this state.protected voidnotifyStateDiscarded()Notify the parent container about changes to this state.voidnotifyStateUpdated()Notify the parent container about changes to this state.protected voidreconnect()Reconnect this state to the overlayed state that it has been disconnected from earlier.voidsetContainer(ItemStateListener container)Set the parent container that will receive notifications about changes to this state.voidsetModCount(short modCount)Sets the modification count.voidsetStatus(int newStatus)Sets the new status of this item.
 
- 
- 
- 
Field Detail- 
STATUS_UNDEFINEDpublic static final int STATUS_UNDEFINED the status is undefined- See Also:
- Constant Field Values
 
 - 
STATUS_EXISTINGpublic static final int STATUS_EXISTING 'existing', i.e. persistent state- See Also:
- Constant Field Values
 
 - 
STATUS_EXISTING_MODIFIEDpublic static final int STATUS_EXISTING_MODIFIED 'existing', i.e. persistent state that has been transiently modified (copy-on-write)- See Also:
- Constant Field Values
 
 - 
STATUS_EXISTING_REMOVEDpublic static final int STATUS_EXISTING_REMOVED 'existing', i.e. persistent state that has been transiently removed (copy-on-write)- See Also:
- Constant Field Values
 
 - 
STATUS_NEWpublic static final int STATUS_NEW 'new' state- See Also:
- Constant Field Values
 
 - 
STATUS_STALE_DESTROYEDpublic static final int STATUS_STALE_DESTROYED 'existing', i.e. persistent state that has been destroyed by somebody else- See Also:
- Constant Field Values
 
 - 
statusprotected int status the internal status of this item state
 - 
overlayedStateprotected ItemState overlayedState the backing persistent item state (may be null)
 
- 
 - 
Constructor Detail- 
ItemStateprotected ItemState(int initialStatus, boolean isTransient)Constructs a new unconnected item state- Parameters:
- initialStatus- the initial status of the item state object
- isTransient- flag indicating whether this state is transient or not
 
 - 
ItemStateprotected ItemState(ItemState overlayedState, int initialStatus, boolean isTransient) Constructs a new item state that is initially connected to an overlayed state.- Parameters:
- overlayedState- the backing item state being overlayed
- initialStatus- the initial status of the new- ItemStateinstance
- isTransient- flag indicating whether this state is transient or not
 
 
- 
 - 
Method Detail- 
copypublic abstract void copy(ItemState state, boolean syncModCount) Copy state information from another state into this state- Parameters:
- state- source state information
- syncModCount- if the modCount should be synchronized.
 
 - 
connectpublic void connect(ItemState overlayedState) throws ItemStateException Connect this state to some underlying overlayed state.- Throws:
- ItemStateException
 
 - 
reconnectprotected void reconnect() throws ItemStateExceptionReconnect this state to the overlayed state that it has been disconnected from earlier.- Throws:
- ItemStateException
 
 - 
disconnectprotected void disconnect() Disconnect this state from the underlying overlayed state.
 - 
isConnectedprotected boolean isConnected() Return a flag indicating whether this state is connected to some other state.- Returns:
- trueif this state is connected,- falseotherwise.
 
 - 
notifyStateDiscardedprotected void notifyStateDiscarded() Notify the parent container about changes to this state.
 - 
notifyStateCreatedprotected void notifyStateCreated() Notify the parent container about changes to this state.
 - 
notifyStateUpdatedpublic void notifyStateUpdated() Notify the parent container about changes to this state.
 - 
notifyStateDestroyedprotected void notifyStateDestroyed() Notify the parent container about changes to this state.
 - 
isNodepublic abstract boolean isNode() Determines if this item state represents a node.- Returns:
- true if this item state represents a node, otherwise false.
 
 - 
getIdpublic abstract ItemId getId() Returns the identifier of this item.- Returns:
- the id of this item.
 
 - 
isTransientpublic boolean isTransient() Returnstrueif this item state represents new or modified state (i.e. the result of copy-on-write) orfalseif it represents existing, unmodified state.- Returns:
- trueif this item state is modified or new, otherwise- false
 
 - 
isStalepublic boolean isStale() Determines whether this item state has become stale.- Returns:
- true if this item state has become stale, false otherwise.
 
 - 
getParentIdpublic abstract NodeId getParentId() Returns the NodeId of the parentNodeStateornullif either this item state represents the root node or this item state is 'free floating', i.e. not attached to the repository's hierarchy.- Returns:
- the parent NodeState's Id
 
 - 
getStatuspublic int getStatus() Returns the status of this item.- Returns:
- the status of this item.
 
 - 
setStatuspublic void setStatus(int newStatus) Sets the new status of this item.- Parameters:
- newStatus- the new status
 
 - 
getModCountpublic short getModCount() Returns the modification count.- Returns:
- the modification count.
 
 - 
setModCountpublic void setModCount(short modCount) Sets the modification count.- Parameters:
- modCount- the modification count of this item
 
 - 
discardpublic void discard() Discards this instance, i.e. renders it 'invalid'.
 - 
hasOverlayedStatepublic boolean hasOverlayedState() Determines if this item state is overlying persistent state.- Returns:
- trueif this item state is overlying persistent state, otherwise- false.
 
 - 
getOverlayedStatepublic ItemState getOverlayedState() Returns the persistent state backing this transient state ornullif there is no persistent state (i.e.. this state is purely transient).- Returns:
- the persistent item state or nullif there is no persistent state.
 
 - 
setContainerpublic void setContainer(ItemStateListener container) Set the parent container that will receive notifications about changes to this state.- Parameters:
- container- container to be informed on modifications
 
 - 
getContainerpublic ItemStateListener getContainer() Return the parent container that will receive notifications about changes to this state. Returnsnullif none has been yet assigned.- Returns:
- container or null
 
 - 
calculateMemoryFootprintpublic abstract long calculateMemoryFootprint() Returns the approximate memory consumption of this state.- Returns:
- the approximate memory consumption of this state.
 
 
- 
 
-