String sourceDir, String mapFile) throws Exception
String sourceDir, String mapFile, boolean template) throws Exception
    private void addItems(Context c, Collection[] mycollections,            String sourceDir, String mapFile) throws Exception    {        Map skipItems = new HashMap(); // set of items to skip if in 'resume'        // mode        System.out.println("Adding items from directory: " + sourceDir);        System.out.println("Generating mapfile: " + mapFile);        // create the mapfile        File outFile = null;        if (!isTest)        {            // get the directory names of items to skip (will be in keys of            // hash)            if (isResume)            {                skipItems = readMapFile(mapFile);            }            // sneaky isResume == true means open file in append mode            outFile = new File(mapFile);            mapOut = new PrintWriter(new FileWriter(outFile, isResume));            if (mapOut == null)            {                throw new Exception("can't open mapfile: " + mapFile);            }        }        // open and process the source directory        File d = new java.io.File(sourceDir);        if (d == null)        {            System.out.println("Error, cannot open source directory "                    + sourceDir);            System.exit(1);        }        String[] dircontents = d.list(directoryFilter);        for (int i = 0; i < dircontents.length; i++)        {            if (skipItems.containsKey(dircontents[i]))            {                System.out.println("Skipping import of " + dircontents[i]);            }            else            {                addItem(c, mycollections, sourceDir, dircontents[i], mapOut);                System.out.println(i + " " + dircontents[i]);            }        }    }