apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java/ConfigsImportService/importDataFromZipFile
class ConfigsImportService:  public void importDataFromZipFile(List<Env> importEnvs, ZipInputStream dataZip, boolean ignoreConflictNamespace)
      throws IOException {
    List<String> toImportApps = Lists.newArrayList();
    List<String> toImportAppNSs = Lists.newArrayList();
    List<String> toImportClusters = Lists.newArrayList();
    List<NamespaceImportData> toImportNSs = Lists.newArrayList();

    ZipEntry entry;
    while ((entry = dataZip.getNextEntry()) != null) {
      if (entry.isDirectory()) {
        continue;
      }

      String filePath = entry.getName();
      String content = readContent(dataZip);

      String[] info = filePath.split("/");

      String fileName;
      if (info.length == 1) {
        //app namespace metadata file. path format : ${namespaceName}.appnamespace.metadata
        fileName = info[0];
        if (fileName.endsWith(ConfigFileUtils.APP_NAMESPACE_METADATA_FILE_SUFFIX)) {
          toImportAppNSs.add(content);
        }
      } else if (info.length == 3) {
        fileName = info[2];
        if (fileName.equals(ConfigFileUtils.APP_METADATA_FILENAME)) {
          //app metadata file. path format : apollo/${appId}/app.metadata
          toImportApps.add(content);
        }
      } else {
        String env = info[2];
        fileName = info[3];
        if (fileName.endsWith(ConfigFileUtils.CLUSTER_METADATA_FILE_SUFFIX)) {
          //cluster metadata file. path format : apollo/${appId}/${env}/${clusterName}.cluster.metadata
          toImportClusters.add(content);
        } else {
          //namespace file.path format : apollo/${appId}/${env}/${appId}+${cluster}+${namespaceName}
          //only import for selected envs.
          for (Env importEnv : importEnvs) {
            if (Objects.equals(importEnv.getName(), env)) {
              toImportNSs.add(new NamespaceImportData(Env.valueOf(env), fileName, content, ignoreConflictNamespace));
            }
          }
        }
      }
    }

    try {
      LOGGER.info("Import data. app = {}, appns = {}, cluster = {}, namespace = {}", toImportApps.size(),
                  toImportAppNSs.size(),
                  toImportClusters.size(), toImportNSs.size());

      doImport(importEnvs, toImportApps, toImportAppNSs, toImportClusters, toImportNSs);

    } catch (Exception e) {
      LOGGER.error("import config error.", e);
      throw new ServerException("import config error.", e);
    }
  }