org.apache.jackrabbit.core.version
Class VersionManagerImpl

java.lang.Object
  extended byorg.apache.jackrabbit.core.version.VersionManagerImpl
All Implemented Interfaces:
VersionManager

public class VersionManagerImpl
extends Object
implements VersionManager

This Class implements a VersionManager.


Constructor Summary
VersionManagerImpl(PersistenceManager pMgr, NodeTypeRegistry ntReg, DelegatingObservationDispatcher obsMgr, String rootUUID, String rootParentUUID)
          Creates a bew vesuion manager
 
Method Summary
 Version checkin(NodeImpl node)
          invokes the checkin() on the persistent version manager and remaps the newly created version objects.
 void close()
          Close this version manager.
 VersionHistory createVersionHistory(Session session, NodeState node)
          Creates a new version history.
 List getItemReferences(InternalVersionItem item)
          {@inheritDoc}
 InternalVersion getVersion(String id)
          Returns the version with the given id
 VersionHistory getVersionHistory(Session session, NodeState node)
          Returns the version history of the specified node or null if the given node doesn't (yet) have an associated version history.
 InternalVersionHistory getVersionHistory(String id)
          Returns the version history with the given id
 VirtualItemStateProvider getVirtualItemStateProvider()
          returns the virtual item state provider that exposes the internal versions as items.
 boolean hasItem(String id)
          checks, if the node with the given id exists
 boolean hasVersion(String id)
          Checks if the version with the given id exists
 boolean hasVersionHistory(String id)
          Checks if the version history with the given id exists
 void removeVersion(VersionHistory history, QName name)
          Removes the specified version from the history
 void setItemReferences(InternalVersionItem item, List references)
          {@inheritDoc}
 boolean setNodeReferences(NodeReferences refs)
           
 Version setVersionLabel(VersionHistory history, QName version, QName label, boolean move)
          Sets the version label to the given version. If the label is already assigned to another version, a VersionException is thrown unless move is true. If version is null, the label is removed from the respective version. In either case, the version the label was previously assigned is returned, or null of the label was not moved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionManagerImpl

public VersionManagerImpl(PersistenceManager pMgr,
                          NodeTypeRegistry ntReg,
                          DelegatingObservationDispatcher obsMgr,
                          String rootUUID,
                          String rootParentUUID)
                   throws RepositoryException
Creates a bew vesuion manager

Method Detail

getVirtualItemStateProvider

public VirtualItemStateProvider getVirtualItemStateProvider()
returns the virtual item state provider that exposes the internal versions as items.

Specified by:
getVirtualItemStateProvider in interface VersionManager
Returns:

close

public void close()
           throws Exception
Close this version manager. After having closed a persistence manager, further operations on this object are treated as illegal and throw

Specified by:
close in interface VersionManager
Throws:
Exception - if an error occurs

createVersionHistory

public VersionHistory createVersionHistory(Session session,
                                           NodeState node)
                                    throws RepositoryException
Creates a new version history. This action is needed either when creating a new 'mix:versionable' node or when adding the 'mix:versionalbe' mixin to a node.

Specified by:
createVersionHistory in interface VersionManager
Parameters:
node -
Returns:
Throws:
RepositoryException
See Also:
VersionManager.getVersionHistory(Session, NodeState)

getVersionHistory

public VersionHistory getVersionHistory(Session session,
                                        NodeState node)
                                 throws RepositoryException
Returns the version history of the specified node or null if the given node doesn't (yet) have an associated version history.

Specified by:
getVersionHistory in interface VersionManager
Parameters:
session -
node - node whose version history should be returned
Returns:
the version history of the specified node or null if the given node doesn't (yet) have an associated version history.
Throws:
RepositoryException - if an error occurs
See Also:
VersionManager.createVersionHistory(Session, NodeState)

hasVersionHistory

public boolean hasVersionHistory(String id)
Checks if the version history with the given id exists

Specified by:
hasVersionHistory in interface VersionManager
Parameters:
id -
Returns:

getVersionHistory

public InternalVersionHistory getVersionHistory(String id)
                                         throws RepositoryException
Returns the version history with the given id

Specified by:
getVersionHistory in interface VersionManager
Parameters:
id -
Returns:
Throws:
RepositoryException

hasVersion

public boolean hasVersion(String id)
Checks if the version with the given id exists

Specified by:
hasVersion in interface VersionManager
Parameters:
id -
Returns:

getVersion

public InternalVersion getVersion(String id)
                           throws RepositoryException
Returns the version with the given id

Specified by:
getVersion in interface VersionManager
Parameters:
id -
Returns:
Throws:
RepositoryException

hasItem

public boolean hasItem(String id)
checks, if the node with the given id exists

Parameters:
id -
Returns:

checkin

public Version checkin(NodeImpl node)
                throws RepositoryException
invokes the checkin() on the persistent version manager and remaps the newly created version objects.

Specified by:
checkin in interface VersionManager
Parameters:
node -
Returns:
Throws:
RepositoryException

removeVersion

public void removeVersion(VersionHistory history,
                          QName name)
                   throws VersionException,
                          RepositoryException
Removes the specified version from the history

Specified by:
removeVersion in interface VersionManager
Parameters:
history - the version history from where to remove the version.
name - the name of the version to remove.
Throws:
VersionException - if the version history does not have a version with name.
RepositoryException - if any other error occurs.

setVersionLabel

public Version setVersionLabel(VersionHistory history,
                               QName version,
                               QName label,
                               boolean move)
                        throws RepositoryException
Sets the version label to the given version. If the label is already assigned to another version, a VersionException is thrown unless move is true. If version is null, the label is removed from the respective version. In either case, the version the label was previously assigned is returned, or null of the label was not moved.

Specified by:
setVersionLabel in interface VersionManager
Parameters:
history -
version -
label -
move -
Returns:
Throws:
RepositoryException

setNodeReferences

public boolean setNodeReferences(NodeReferences refs)

setItemReferences

public void setItemReferences(InternalVersionItem item,
                              List references)
{@inheritDoc}


getItemReferences

public List getItemReferences(InternalVersionItem item)
{@inheritDoc}



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