Version 4

    redirect the output to a file.  This creates the SQL to create the mailboxen on MySQL.  IT does not create user repository entries (aka static or ldap user repository).



    1. = prefix for the user ie the test in "test1000"

    2. = domain for the user ie the foobar in "test1000@foobar" or in ""

    3. = start  for first user (inclusive).

    4. = end  for last user (inclusive)



    class test {
        public static void main(String[] args) {
            String prefix = args[0];
            String domain = args[1];
            int start = Integer.parseInt(args[2]);
            int end = Integer.parseInt(args[3]);
            if(args.length < 4) {
                 System.err.println("expected: prefix, domain, start, end");
                for (int k = start; k < end+1; k++) {
                   System.out.println("insert into Folder (name, parent_id,defaultinFolder_id, defaultoutfolder_id,type,id) values (null,null, null , null ,'org.jboss.mail.mailbox.Mailbox', null );");
                   System.out.println("SELECT @last := LAST_INSERT_ID();");
                   System.out.println("insert into Folder (name, parent_id,defaultinfolder_id, defaultoutfolder_id,type,id) values ('INBOX',@last ,null,null,'org.jboss.mail.mailbox.Folder',null);");
                   System.out.println("update Folder set defaultinfolder_id = last_insert_id() , defaultoutfolder_id = last_insert_id() where id = @last;");
                   System.out.println("insert into alias(id,name,folder_id) values (null,'"+prefix+k+"', @last);");
                   System.out.println("insert into alias(id,name,folder_id) values (null ,'"+prefix+k+"@"+domain+"', @last);");