private void doImport(File importFile, IApimanLogger logger) throws IOException {

        File migratedImportFile = File.createTempFile("apiman_import_migrated", ".json"); //$NON-NLS-1$ //$NON-NLS-2$
        migratedImportFile.deleteOnExit();

        // Migrate the data (if necessary)
        migrator.migrate(importFile, migratedImportFile, logger);

        // Now import the migrated data
        InputStream importData = null;
        IImportReader reader;
        try {
            importData = new FileInputStream(migratedImportFile);
            reader = new JsonImportReader(logger, importData);
        } catch (IOException e) {
            IOUtils.closeQuietly(importData);
            throw new UncheckedIOException(e);
        }

        try {
            importer.start(migratedImportFile.getAbsolutePath(), logger);
            reader.setDispatcher(importer);
            reader.read();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            IOUtils.closeQuietly(importData);
            FileUtils.deleteQuietly(importFile);
            FileUtils.deleteQuietly(migratedImportFile);
        }
    }
@author Marc Savy {@literal <marc@blackparrotlabs.io>}
manager/api/rest-impl/src/main/java/io/apiman/manager/api/service/ImportExportService.java