!!! Userdatabase conversion

During the past few years the format of the JSPWiki userdatabase (userdatabase.xml) has changed a bit.

* The passwords were first in plain text, later on they were (SHA) hashed.
* The format of the date fields have changed.


If you want to upgrade to a newer version of JSPWiki you might have to change the contents of your userdatabase.
\\There is now a prototype conversion utility available that does this for you.

!! Usage

# You give it your userdatabase.xml file, and it will create a new one for you in the new format, with both hashed passwords and correct dateformats.
# The input userdatabase file will first be validated against an XML Schema, it will stop when the validation fails.
# If you have plaintext passwords, they will be changed. 
# The conversion utility will try to parse the dates with three different patterns:
{{{
	public static final String c_oldLinuxFormat = "dd/MM/yyyy HH:mm:ss";
	public static final String c_oldWin32Format = "MMM dd, yyyy hh:mm:ss aa";
	public static final String c_NewFormat = "yyyy.MM.dd 'at' HH:mm:ss:SSS z";
}}}
So, if you have a mixture of different date formats, they will automatically be transformed to the new one.

You can start it as follows :
{{{
java -cp udbconversion.jar:jdom.jar com.ecyrd.jspwiki.converter.UserDBConverter userdatabase.xml myWonderfullNewUserdatabase.xml
}}}

I have tested it with all userdatabase that I had available, please let me know what your experiences are.
\\Here is an example output of this utility:
{{{
metskem@bismarck:/tmp$ java -cp udbconversion.jar:jdom.jar com.ecyrd.jspwiki.converter.UserDBConverter userdatabase.xml new.xml
validating xml document userdatabase.xml
Schema validation completed in 0 seconds
fatal errors occured:false
      errors occured:false
    warnings occured:false
starting conversion:  /tmp/userdatabase.xml ==> /tmp/new.xml
parsing failed for dateString : 2006.09.19 at 16:15:21 CET
date conversion failed for user baduserid1 (Catweazle) , skipping this user
XML Document built, writing to file new.xml
51 users processed in 0 seconds
}}}

!! Download


Attached you find the necessary code to run it, it also contains the source so that you can verify first what it will do :-) .
You can here download the [udbconversion.jar] and [jdom.jar]