org.apache.jackrabbit.core.version
Interface VersionManager

All Known Implementing Classes:
VersionManagerImpl, XAVersionManager

public interface VersionManager

This interface defines the version manager. It gives access to the underlying persistence layer of the versioning.


Method Summary
 Version checkin(NodeImpl node, Calendar cal)
          invokes the checkin() on the persistent version manager and remaps the newly created version objects.
 void close()
          Close this version manager.
 InternalVersion getHeadVersionOfNode(NodeId id)
          Returns the head version of the node with the given id. this is always the last of all versions. this only works correctly for liner version graphs (i.e. simple versioning)
 InternalVersion getVersion(NodeId id)
          Returns the version with the given id
 InternalVersionHistory getVersionHistory(NodeId id)
          Returns the version history with the given id
 VersionHistoryInfo getVersionHistory(Session session, NodeState node)
          Returns information about the version history of the specified node.
 InternalVersionHistory getVersionHistoryOfNode(NodeId id)
          Returns the version history for the versionable node with the given id.
 VirtualItemStateProvider getVirtualItemStateProvider()
          returns the virtual item state provider that exposes the internal versions as items.
 void removeVersion(VersionHistory history, Name versionName)
          Removes the specified version from the given version history.
 Version setVersionLabel(VersionHistory history, Name version, Name label, boolean move)
          Sets the version label to the given version.
 

Method Detail

getVirtualItemStateProvider

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

Returns:
the virtual item state provider.

getVersionHistory

VersionHistoryInfo getVersionHistory(Session session,
                                     NodeState node)
                                     throws RepositoryException
Returns information about the version history of the specified node. If the given node does not already have an associated version history, then an empty history is automatically created. This method should only be called by code that already knows that the specified node is versionable.

Parameters:
session - workspace session
node - node whose version history should be returned
Returns:
identifiers of the version history and root version nodes
Throws:
RepositoryException - if an error occurs

checkin

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

Parameters:
node - node to checkin
cal - create time of the new version, or null
Returns:
the newly created version
Throws:
RepositoryException - if an error occurs

removeVersion

void removeVersion(VersionHistory history,
                   Name versionName)
                   throws RepositoryException
Removes the specified version from the given version history.

Parameters:
history - version history to remove the version from
versionName - name of the version
Throws:
RepositoryException - if an error occurs

setVersionLabel

Version setVersionLabel(VersionHistory history,
                        Name version,
                        Name 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.

Parameters:
history - version history
version - name of the version
label - new label
move - if true label will be moved
Returns:
the version that had the label or null
Throws:
RepositoryException - if an error occurs

getVersionHistory

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

Parameters:
id - id of the version history
Returns:
the version history.
Throws:
RepositoryException - if an error occurs

getVersionHistoryOfNode

InternalVersionHistory getVersionHistoryOfNode(NodeId id)
                                               throws RepositoryException
Returns the version history for the versionable node with the given id.

Parameters:
id - id of the node to retrieve the version history for
Returns:
the version history
Throws:
RepositoryException - if an error occurs or the history does not exit

getVersion

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

Parameters:
id - id of the version to retrieve
Returns:
the version.
Throws:
RepositoryException - if an error occurs

getHeadVersionOfNode

InternalVersion getHeadVersionOfNode(NodeId id)
                                     throws RepositoryException
Returns the head version of the node with the given id. this is always the last of all versions. this only works correctly for liner version graphs (i.e. simple versioning)

Parameters:
id - id of the node to retrieve the version for
Returns:
the version.
Throws:
RepositoryException - if an error occurs

close

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

Throws:
Exception - if an error occurs


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