org.apache.jackrabbit.core.version
Interface InternalVersionManager

All Known Implementing Classes:
InternalVersionManagerImpl, InternalXAVersionManager

public interface InternalVersionManager

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


Method Summary
 NodeId canCheckout(NodeStateEx state, NodeId activityId)
          invokes the checkout() on the persistent version manager.
 InternalVersion checkin(Session session, NodeStateEx node, Calendar created)
          invokes the checkin() on the persistent version manager and remaps the newly created version objects.
 void close()
          Close this version manager.
 NodeId createActivity(Session session, String title)
          Creates a new activity
 InternalActivity getActivity(NodeId id)
          Returns the activity with the given id
 InternalBaseline getBaseline(NodeId id)
          Returns the baseline with the given id
 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 vNode, NodeId copiedFrom)
          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 removeActivity(Session session, NodeId nodeId)
          Removes an activity and all
 void removeVersion(Session session, InternalVersionHistory history, Name versionName)
          Removes the specified version from the given version history.
 InternalVersion setVersionLabel(Session session, InternalVersionHistory 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 vNode,
                                     NodeId copiedFrom)
                                     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
vNode - node whose version history should be returned
copiedFrom - the node id for the jcr:copiedFrom property use for copied nodes
Returns:
identifiers of the version history and root version nodes
Throws:
RepositoryException - if an error occurs

checkin

InternalVersion checkin(Session session,
                        NodeStateEx node,
                        Calendar created)
                        throws RepositoryException
invokes the checkin() on the persistent version manager and remaps the newly created version objects.

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

canCheckout

NodeId canCheckout(NodeStateEx state,
                   NodeId activityId)
                   throws RepositoryException
invokes the checkout() on the persistent version manager.

Parameters:
state - node to checkout
activityId - node id if the current activity
Returns:
the base version id
Throws:
RepositoryException - if an error occurs

removeVersion

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

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

setVersionLabel

InternalVersion setVersionLabel(Session session,
                                InternalVersionHistory 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:
session - the session that performs the operation
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 or null
Throws:
RepositoryException - if an error occurs

getBaseline

InternalBaseline getBaseline(NodeId id)
                             throws RepositoryException
Returns the baseline with the given id

Parameters:
id - id of the baseline version to retrieve
Returns:
the baseline or null if not found
Throws:
RepositoryException - if an error occurs

getActivity

InternalActivity getActivity(NodeId id)
                             throws RepositoryException
Returns the activity with the given id

Parameters:
id - id of the activity to retrieve
Returns:
the activity.
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

createActivity

NodeId createActivity(Session session,
                      String title)
                      throws RepositoryException
Creates a new activity

Parameters:
session - the current session
title - title of the new activity
Returns:
the nodeid of the new activity
Throws:
RepositoryException - if an error occurs

removeActivity

void removeActivity(Session session,
                    NodeId nodeId)
                    throws RepositoryException
Removes an activity and all

Parameters:
session - the current session
nodeId - id of the activity to remove
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-2010 The Apache Software Foundation. All Rights Reserved.