public static void main()

in bulkloader/src/main/java/org/apache/directory/mavibot/btree/MavibotPartitionBuilder.java [1327:1430]


    public static void main( String[] args ) throws Exception
    {
        String inFile = null;
        String configDir = null;
        String outDirPath = null;
        int numKeysInNode = 16;
        int rid = 1;
        boolean cleanOutDir = false;
        boolean verifyMasterTable = false;

        if ( args.length < 2 )
        {
           help();
           System.exit( 0 );
        }
        
        for( int i =0; i < args.length; i++ )
        {
            Option opt = Option.getOpt( args[i] );
            
            switch( opt )
            {
                case HELP :
                    help();
                    System.exit( 0 );
                    break;
                    
                case INPUT_FILE :
                    inFile = getArgAt( ++i, opt, args );
                    break;

                case OUT_DIR :
                    outDirPath = getArgAt( ++i, opt, args );
                    break;

                case CLEAN_OUT_DIR :
                    cleanOutDir = true;
                    break;

                case VERIFY_MASTER_TABLE :
                    verifyMasterTable = true;
                    break;

                case NUM_KEYS_PER_NODE :
                    numKeysInNode = Integer.parseInt( getArgAt( ++i, opt, args ) );
                    break;

                case DS_RID :
                    rid = Integer.parseInt( getArgAt( ++i, opt, args ) );
                    break;
                    
                case CONFIG_DIR :
                    configDir = getArgAt( ++i, opt, args );
                    break;

                case UNKNOWN :
                    System.out.println( "Unknown option " + args[i] );
                    continue;
            }
        }
        
        if( ( inFile == null ) || ( inFile.trim().length() == 0 ) )
        {
            System.out.println( "Invalid input file" );
            return;
        }
        
        if( !new File( inFile ).exists() )
        {
            System.out.println( "The input file " + inFile + " doesn't exist" );
            return;
        }
        
        //calcLevels( 502, 16 );
        
        File outDir = new File( outDirPath );
        
        if( outDir.exists() )
        {
            if( !cleanOutDir )
            {
                System.out.println( "The output directory is not empty, pass " + Option.CLEAN_OUT_DIR.getText() + " to force delete the contents or specify a different directory"  );
                return;
            }
            
            FileUtils.deleteDirectory( outDir );
        }
        
        MavibotPartitionBuilder builder = new MavibotPartitionBuilder( configDir, inFile, outDirPath, numKeysInNode, rid );
        
        long start = System.currentTimeMillis();
        
        builder.buildPartition();
        
        long end = System.currentTimeMillis();
        
        System.out.println( "Total time taken " + ( end - start ) + "msec" );
        
        if ( verifyMasterTable )
        {
            System.out.println( "Verifying the contents of master table" );
            builder.testBTree( "master" );
        }
    }