jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jervis Liu <jervis...@gmail.com>
Subject How to remove all version histories for the whole repository?
Date Wed, 15 Sep 2010 17:00:54 GMT

I have a use case that users need a mechanism that they can play/work
with the data in the repository then they decide that they did sth
wrong they want to give up all the changes since and start from fresh
again. I.e., they want to clean up the whole repository, then import
fresh data from a xml file again. This is currently done by calling
Node.remove() on the root node of the repository, then calling
Workspace().importXML to import data from a xml file which was dumped
from the repository previously by Session.exportSystemView(). I expect
this will give me a brand new repository. However the newly imported
nodes still have version history information from the old repository.
A closer look shows that this is because the newly imported nodes
still have the same UUID as the nodes in the old repository as the xml
dump file contains UUID for every nodes. The VersionHistory is never
cleaned thus it always returns uncleaned version information for the
same UUID even though that node has been removed and recreated.

I understand for this post [1] that VersionHistory is not designed to
be removed completely. However I believe my use case described about
is still a valid one, isn't it? Surely I can traverse every nodes in
my repository then call VersionHistory.removeVersion() on each
versions. But given the fact that I may have thousands of nodes in my
repository this does not sound like a practical solution. There must
be a way to tell VersionHistory that all history information it
contains has become invalid please clean yourself up, right?

If playing with VersionHistory is not the way out, I wonder if there
is a different way to clean up the whole repository more thoroughly
instead of using Node.remove() on the root node? As all I want is to
set the repository to an absolute clean stage before
Workspace().importXML is called. For example, is
Workspace.deleteWorkspace() designed to do this job? However,
Workspace.deleteWorkspace()  throws
UnsupportedRepositoryOperationException with JackRabbit version 2.1.

Any comments or suggestions will be highly welcome. Thanks!

[1]. http://jackrabbit.510166.n4.nabble.com/Deleting-a-node-also-delete-version-history-of-the-node-td522136.html

Jervis Liu

View raw message