jackhalfalltrades commented on code in PR #307: URL: https://github.com/apache/atlas/pull/307#discussion_r1995969174
########## webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java: ########## @@ -679,6 +681,105 @@ public AtlasImportResult importData(@DefaultValue("{}") @FormDataParam("request" return result; } + @POST + @Path("/asyncImport") + @Produces(Servlets.JSON_MEDIA_TYPE) + @Consumes(MediaType.MULTIPART_FORM_DATA) + public AtlasAsyncImportRequest importAsync(@DefaultValue("{}") @FormDataParam("request") String jsonData, + @FormDataParam("data") InputStream inputStream) throws AtlasBaseException { + if (LOG.isDebugEnabled()) { + LOG.debug("==> AdminResource.importAsync(jsonData={}, inputStream={})", jsonData, (inputStream != null)); + } + AtlasAuthorizationUtils.verifyAccess(new AtlasAdminAccessRequest(AtlasPrivilege.ADMIN_IMPORT), "asyncImportData"); + AtlasAsyncImportRequest asyncImportRequest = null; + boolean preventMultipleRequests = true; + try { + AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class); + preventMultipleRequests = request != null && request.getOptions() != null + && !request.getOptions().containsKey(AtlasImportRequest.OPTION_KEY_REPLICATED_FROM); + + if (preventMultipleRequests) { + acquireExportImportLock("import"); + } + asyncImportRequest = importService.run(request, inputStream, Servlets.getUserName(httpServletRequest), + Servlets.getHostName(httpServletRequest), AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest)); + } catch (AtlasBaseException excp) { + if (excp.getAtlasErrorCode().equals(AtlasErrorCode.IMPORT_ATTEMPTING_EMPTY_ZIP)) { Review Comment: @mneethiraj This scenario arises, when there are no changes in between subsequent Export Import. During these cases, the import is assumed to have skipped. This is an existing logic extended for this feature and not new one. You can find the same in line 658. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@atlas.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org