public static void main(String[] args)
    {
        String[] argsDefault = {};
//        String[] argsDefault = {"local=Jdbc", "remote=Jdbc", "table=Jdbc", "databaseproduct=cloudscape"};
        if ((args == null) || (args.length == 0))
            args = argsDefault;
        Map<String,Object> properties = new Hashtable<String,Object>();
        Util.parseArgs(properties, args);
        if (properties.get(DBParams.LOCAL) == null)
            properties.put(DBParams.LOCAL, DBParams.JDBC);
        if (properties.get(DBParams.REMOTE) == null)
            properties.put(DBParams.REMOTE, DBParams.JDBC);
        if (properties.get(DBParams.TABLE) == null)
            properties.put(DBParams.TABLE, DBParams.JDBC);
        String archiveRoot = (String)properties.get("archiveDir");
        if (archiveRoot == null)
        	archiveRoot = "./" + DEFAULT_ARCHIVE_DIR;
        String recordClass = "org.jbundle.main.user.db.UserGroup";
        if (properties.get(DBParams.RECORD) != null)
            recordClass = properties.get(DBParams.RECORD).toString();

        Environment env = new Environment(properties);
        Application app = new MainApplication(env, properties, null);
        Task task = new AutoTask(app, null, null);
        XmlInOut test = new XmlInOut(task, null, null);
        if ((archiveRoot.endsWith("/")) || (archiveRoot.endsWith(File.separator)))
            archiveRoot = archiveRoot.substring(0, archiveRoot.length() - 1);
        test.archiveRoot = archiveRoot;
        boolean bAllFiles = false;
        if (DBConstants.TRUE.equalsIgnoreCase((String)properties.get("allFiles")))
            bAllFiles = true;
        if (bAllFiles)
            test.importArchives(archiveRoot, null);    // Import the entire archive
        else
        {
            Record record = Record.makeRecordFromClassName(recordClass, test);
            String archiveFile = "/main_user/org/jbundle/main/user/db/UserGroup.xml";
            if (properties.get("archiveFile") != null)
            	archiveFile = properties.get("archiveFile").toString();
            if (!test.importXML(record.getTable(), archiveRoot + archiveFile, null))     // Import the menu file.
                System.exit(1);
//            Record record = new org.jbundle.main.db.Menus(recordOwner);
//            test.importXML(record, "archive/main/db/Menus.xml");     // Import the menu file.
            record.free();
        }
        test.free();
        test = null;
        Environment.getEnvironment(null).free();
        System.exit(0);
    }
public static void main ( String [ ] args ) { String [ ] argsDefault = { } ; if ( ( args == null ) || ( args . length == 0 ) ) args = argsDefault ; Map < String , Object > properties = new Hashtable < String , Object > ( ) ; Util . parseArgs ( properties , args ) ; if ( properties . get ( DBParams . LOCAL ) == null ) properties . put ( DBParams . LOCAL , DBParams . JDBC ) ; if ( properties . get ( DBParams . REMOTE ) == null ) properties . put ( DBParams . REMOTE , DBParams . JDBC ) ; if ( properties . get ( DBParams . TABLE ) == null ) properties . put ( DBParams . TABLE , DBParams . JDBC ) ; String archiveRoot = ( String ) properties . get ( "archiveDir" ) ; if ( archiveRoot == null ) archiveRoot = "./" + DEFAULT_ARCHIVE_DIR ; String recordClass = "org.jbundle.main.user.db.UserGroup" ; if ( properties . get ( DBParams . RECORD ) != null ) recordClass = properties . get ( DBParams . RECORD ) . toString ( ) ; Environment env = new Environment ( properties ) ; Application app = new MainApplication ( env , properties , null ) ; Task task = new AutoTask ( app , null , null ) ; XmlInOut test = new XmlInOut ( task , null , null ) ; if ( ( archiveRoot . endsWith ( "/" ) ) || ( archiveRoot . endsWith ( File . separator ) ) ) archiveRoot = archiveRoot . substring ( 0 , archiveRoot . length ( ) - 1 ) ; test . archiveRoot = archiveRoot ; boolean bAllFiles = false ; if ( DBConstants . TRUE . equalsIgnoreCase ( ( String ) properties . get ( "allFiles" ) ) ) bAllFiles = true ; if ( bAllFiles ) test . importArchives ( archiveRoot , null ) ; else { Record record = Record . makeRecordFromClassName ( recordClass , test ) ; String archiveFile = "/main_user/org/jbundle/main/user/db/UserGroup.xml" ; if ( properties . get ( "archiveFile" ) != null ) archiveFile = properties . get ( "archiveFile" ) . toString ( ) ; if ( ! test . importXML ( record . getTable ( ) , archiveRoot + archiveFile , null ) ) System . exit ( 1 ) ; record . free ( ) ; } test . free ( ) ; test = null ; Environment . getEnvironment ( null ) . free ( ) ; System . exit ( 0 ) ; }
This stand-alone method is to be used only when the bootstrap (menu) files need to be imported.
You probably want to comment out the check security line in Application. (= NORMAL_RETURN)
Typical usage:
java org.jbundle.base.db.xmlutil.XmlInOut allFiles=true loadInitialData=false \
archiveDir=/home/don/workspace/workspace/tourgeek/res/data/data/src/main/webapp/com/tourgeek/res/data/initial_data/current_initial_data/