@Override
    public void read() throws Exception {
        try {
            current = nextToken();

            if (current != JsonToken.START_OBJECT) {
                throw new IllegalStateException("Expected start object at root");
            }

            while (nextToken() != JsonToken.END_OBJECT) {
                GlobalElementsEnum fieldName = GlobalElementsEnum.valueOf(jp.getCurrentName());
                current = nextToken();

                switch(fieldName) {
                case Metadata:
                    processEntity(MetadataBean.class, dispatcher::metadata);
                    break;
                case Gateways:
                    processEntities(GatewayBean.class, dispatcher::gateway);
                    break;
                case Plugins:
                    processEntities(PluginBean.class, dispatcher::plugin);
                    break;
                case Roles:
                    processEntities(RoleBean.class, dispatcher::role);
                    break;
                case PolicyDefinitions:
                    processEntities(PolicyDefinitionBean.class, dispatcher::policyDef);
                    break;
                case Users:
                    processEntities(UserBean.class, dispatcher::user);
                    break;
                case Orgs:
                    readOrgs();
                    break;
                case Developers:
                    processEntities(DeveloperBean.class, dispatcher::developer);
                    break;
                case Blobs:
                    processEntities(ExportedBlobDto.class, dispatcher::blob);
                    break;
                default:
                    throw new IllegalArgumentException("Unhandled field: " + fieldName);
                }
            }

            dispatcher.close();
        } catch (ImportNotNeededException t) {
            logger.info(t.getMessage());
            dispatcher.cancel();
        } catch (Throwable t) {
            logger.error(t);
            dispatcher.cancel();
        } finally {
            IOUtils.closeQuietly(in);
        }
    }
@see io.apiman.manager.api.exportimport.read.IImportReader#setDispatcher(io.apiman.manager.api.exportimport.read.IImportReaderDispatcher)
manager/api/export-import/src/main/java/io/apiman/manager/api/exportimport/json/JsonImportReader.java