epersonID    = Integer.parseInt( argv[1] );
    public static void main(String argv[])        throws Exception    {        String usage = "Itemimport has three modes of operation:\n" +                       "  add     = import contents of source_dir, and create mapfile\n" +                       "  replace = use mapfile from previously imported items and replace\n" +                       "  remove  = use mapfile from previously imported items and delete them\n" +                       "\n" +                       "ItemImport add EPersonID collectionID source_dir mapfile\n" +                       "ItemImport replace EPersonID collectionID source_dir mapfile\n" +                       "ItemImport remove mapfile\n";        Context c = null;        ItemImport myloader = new ItemImport();        int collectionID = -1;        int epersonID    = -1;        String sourceDir = null;        String mapFile   = null;        Collection mycollection = null;                if( argv.length < 3 )        {            System.out.println( usage );            System.exit( 1 );        }        // now get the args        if( argv[0].equals( "remove" ) && (argv.length == 3) )        {//            collectionID = Integer.parseInt( argv[1] );            mapFile      = argv[2];        }        else if( argv[0].equals( "add" ) && (argv.length == 5) )        {            epersonID    = Integer.parseInt( argv[1] );            collectionID = Integer.parseInt( argv[2] );            sourceDir    = argv[3];            mapFile      = argv[4];        }        else if( argv[0].equals( "replace" ) && (argv.length == 5) )        {            epersonID    = Integer.parseInt( argv[1] );            collectionID = Integer.parseInt( argv[2] );            sourceDir    = argv[3];            mapFile      = argv[4];        }        else        {            System.out.println( usage );            System.exit( 1 );        }        try        {            c = new Context();            if( epersonID != -1 )            {                EPerson ep = EPerson.find(c, epersonID);                c.setCurrentUser( ep );            }            c.setIgnoreAuthorization( true );                        if( argv[0].equals( "add" ) )            {                mycollection = Collection.find( c, collectionID );                myloader.addItems( c, mycollection, sourceDir, mapFile );            }            else if( argv[0].equals( "replace" ) )            {                mycollection = Collection.find( c, collectionID );                myloader.replaceItems( c, mycollection, sourceDir, mapFile );            }            else if( argv[0].equals( "remove" ) )            {                myloader.removeItems( c, mycollection, mapFile );            }            // complete all transactions            c.complete();        }        catch( Exception e )        {            // abort all operations            c.abort();            e.printStackTrace();            System.out.println( e );        }    }