@Test public void testGetMapping() { Response resp = service.getMappingRequest(JSON, 3); assertEquals(byte[].class, resp.getEntity().getClass()); }
@GET @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) public Response getMappingRequest( @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat, @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId) { LOG.debug("getMappingRequest: {} '{}'", mappingFormat, mappingDefinitionId); ADMArchiveHandler admHandler = loadExplodedMappingDirectory(mappingDefinitionId); switch (mappingFormat) { case JSON: byte[] serialized = null; try { serialized = admHandler.getMappingDefinitionBytes(); } catch (Exception e) { LOG.error("Error retrieving mapping definition file for ID:" + mappingDefinitionId, e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } if (LOG.isDebugEnabled() && serialized != null) { LOG.debug(new String(serialized)); } if (serialized == null) { LOG.debug("Mapping definition not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(serialized).build(); case GZ: try { if (admHandler.getGzippedADMDigestBytes() == null) { LOG.debug("ADM Digest file not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(admHandler.getGzippedADMDigestBytes()).build(); } catch (Exception e) { LOG.error("Error getting compressed ADM digest file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } case ZIP: try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { admHandler.setIgnoreLibrary(false); admHandler.setLibraryDirectory(Paths.get(this.libFolder)); admHandler.export(out); return Response.ok().entity(out.toByteArray()).build(); } catch (Exception e) { LOG.error("Error getting ADM archive file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } default: throw new WebApplicationException("Unrecognized mapping format: " + mappingFormat, Status.INTERNAL_SERVER_ERROR); } }
AtlasService { @GET @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) public Response getMappingRequest( @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat, @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId) { LOG.debug("getMappingRequest: {} '{}'", mappingFormat, mappingDefinitionId); ADMArchiveHandler admHandler = loadExplodedMappingDirectory(mappingDefinitionId); switch (mappingFormat) { case JSON: byte[] serialized = null; try { serialized = admHandler.getMappingDefinitionBytes(); } catch (Exception e) { LOG.error("Error retrieving mapping definition file for ID:" + mappingDefinitionId, e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } if (LOG.isDebugEnabled() && serialized != null) { LOG.debug(new String(serialized)); } if (serialized == null) { LOG.debug("Mapping definition not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(serialized).build(); case GZ: try { if (admHandler.getGzippedADMDigestBytes() == null) { LOG.debug("ADM Digest file not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(admHandler.getGzippedADMDigestBytes()).build(); } catch (Exception e) { LOG.error("Error getting compressed ADM digest file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } case ZIP: try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { admHandler.setIgnoreLibrary(false); admHandler.setLibraryDirectory(Paths.get(this.libFolder)); admHandler.export(out); return Response.ok().entity(out.toByteArray()).build(); } catch (Exception e) { LOG.error("Error getting ADM archive file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } default: throw new WebApplicationException("Unrecognized mapping format: " + mappingFormat, Status.INTERNAL_SERVER_ERROR); } } }
AtlasService { @GET @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) public Response getMappingRequest( @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat, @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId) { LOG.debug("getMappingRequest: {} '{}'", mappingFormat, mappingDefinitionId); ADMArchiveHandler admHandler = loadExplodedMappingDirectory(mappingDefinitionId); switch (mappingFormat) { case JSON: byte[] serialized = null; try { serialized = admHandler.getMappingDefinitionBytes(); } catch (Exception e) { LOG.error("Error retrieving mapping definition file for ID:" + mappingDefinitionId, e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } if (LOG.isDebugEnabled() && serialized != null) { LOG.debug(new String(serialized)); } if (serialized == null) { LOG.debug("Mapping definition not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(serialized).build(); case GZ: try { if (admHandler.getGzippedADMDigestBytes() == null) { LOG.debug("ADM Digest file not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(admHandler.getGzippedADMDigestBytes()).build(); } catch (Exception e) { LOG.error("Error getting compressed ADM digest file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } case ZIP: try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { admHandler.setIgnoreLibrary(false); admHandler.setLibraryDirectory(Paths.get(this.libFolder)); admHandler.export(out); return Response.ok().entity(out.toByteArray()).build(); } catch (Exception e) { LOG.error("Error getting ADM archive file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } default: throw new WebApplicationException("Unrecognized mapping format: " + mappingFormat, Status.INTERNAL_SERVER_ERROR); } } AtlasService(); }
AtlasService { @GET @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) public Response getMappingRequest( @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat, @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId) { LOG.debug("getMappingRequest: {} '{}'", mappingFormat, mappingDefinitionId); ADMArchiveHandler admHandler = loadExplodedMappingDirectory(mappingDefinitionId); switch (mappingFormat) { case JSON: byte[] serialized = null; try { serialized = admHandler.getMappingDefinitionBytes(); } catch (Exception e) { LOG.error("Error retrieving mapping definition file for ID:" + mappingDefinitionId, e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } if (LOG.isDebugEnabled() && serialized != null) { LOG.debug(new String(serialized)); } if (serialized == null) { LOG.debug("Mapping definition not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(serialized).build(); case GZ: try { if (admHandler.getGzippedADMDigestBytes() == null) { LOG.debug("ADM Digest file not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(admHandler.getGzippedADMDigestBytes()).build(); } catch (Exception e) { LOG.error("Error getting compressed ADM digest file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } case ZIP: try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { admHandler.setIgnoreLibrary(false); admHandler.setLibraryDirectory(Paths.get(this.libFolder)); admHandler.export(out); return Response.ok().entity(out.toByteArray()).build(); } catch (Exception e) { LOG.error("Error getting ADM archive file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } default: throw new WebApplicationException("Unrecognized mapping format: " + mappingFormat, Status.INTERNAL_SERVER_ERROR); } } AtlasService(); @GET @Path("/fieldActions") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List FieldActions", description = "Retrieves a list of available field action") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ActionDetails.class)) , description = "Return a list of field action detail")) Response listFieldActions(@Context UriInfo uriInfo); @Deprecated @GET @Path("/mappings") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List Mappings", description = "Retrieves a list of mapping file name saved with specified mappingDefinitionId") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StringMap.class)) , description = "Return a list of a pair of mapping file name and content")) Response listMappingsOld(@Context UriInfo uriInfo, @QueryParam("filter") final String filter); @GET @Path("/mappings/{mappingDefinitionId}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List Mappings", description = "Retrieves a list of mapping file name saved with specified mappingDefinitionId") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StringMap.class)) , description = "Return a list of a pair of mapping file name and content")) Response listMappings(@Context UriInfo uriInfo, @QueryParam("filter") final String filter,
                                 @Parameter(description = "Mapping Definition ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @Deprecated @DELETE @Path("/mapping") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping", description = "Remove a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Specified mapping file was removed successfully"), @ApiResponse(responseCode = "204", description = "Mapping file was not found")}) Response removeMappingRequestOld(); @DELETE @Path("/mapping/{mappingDefinitionId}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping", description = "Remove a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Specified mapping file was removed successfully"), @ApiResponse(responseCode = "204", description = "Mapping file was not found")}) Response removeMappingRequest(@Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @Deprecated @DELETE @Path("/mapping/RESET") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping by ID", description = "Remove mapping file and catalogs related to specified ID") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Mapping file and Catalogs were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove mapping file and Catalogs for the specified ID")}) Response resetMappingByIdOld(); @DELETE @Path("/mapping/RESET/{mappingDefinitionId}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping by ID", description = "Remove mapping file and catalogs related to specified ID") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Mapping file and Catalogs were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove mapping file and Catalogs for the specified ID")}) Response resetMappingById(@Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @DELETE @Path("/mapping/RESET/ALL") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove All Mappings", description = "Remove all mapping files and catalogs saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "All mapping files were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove all mapping files")}) Response resetAllMappings(); @DELETE @Path("/mapping/resetLibs") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove All User-Defined JAR libraries", description = "Remove all user-defined JAR files saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "All user-defined JAR files were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove all user-defined JAR files")}) Response resetUserLibs(); @Deprecated @GET @Path("/mapping/{mappingFormat}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) Response getMappingRequestOld(
      @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat); @GET @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) Response getMappingRequest(
      @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat,
      @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @Deprecated @PUT @Path("/mapping/{mappingFormat}") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Create Mapping", description = "Save a mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses({ @ApiResponse(responseCode = "200", description = "Succeeded"), @ApiResponse(responseCode = "500", description = "Mapping file save error")}) Response createMappingRequestOld(InputStream mapping,
    @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat,
    @Context UriInfo uriInfo); @PUT @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Create Mapping", description = "Save a mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses({ @ApiResponse(responseCode = "200", description = "Succeeded"), @ApiResponse(responseCode = "500", description = "Mapping file save error")}) Response createMappingRequest(InputStream mapping,
      @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat,
      @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId,
      @Context UriInfo uriInfo); @Deprecated @POST @Path("/mapping") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Update Mapping", description = "Update existing mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", description = "Succeeded")) Response updateMappingRequestOld(
            InputStream mapping,
            @Context UriInfo uriInfo); @POST @Path("/mapping/{mappingDefinitionId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Update Mapping", description = "Update existing mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", description = "Succeeded")) Response updateMappingRequest(
            InputStream mapping,
            @Parameter(description = "Mapping Definition ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId,
            @Context UriInfo uriInfo); @Deprecated @PUT @Path("/mapping/validate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Validate Mapping", description = "Validate mapping file") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Validations.class)), description = "Return a validation result")) Response validateMappingRequestOld(InputStream mapping,
                                           @Context UriInfo uriInfo); @PUT @Path("/mapping/validate/{mappingDefinitionId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Validate Mapping", description = "Validate mapping file") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Validations.class)), description = "Return a validation result")) Response validateMappingRequest(InputStream mapping,
                                           @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId,
                                           @Context UriInfo uriInfo); @PUT @Path("/mapping/process") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Process Mapping", description = "Process Mapping by feeding input data") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessMappingResponse.class)), description = "Return a mapping result"), @ApiResponse(responseCode = "204", description = "Skipped empty mapping execution") }) Response processMappingRequest(InputStream request, @Context UriInfo uriInfo); @GET @Path("/ping") @Operation(summary = "Ping", description = "Simple liveness check method used in liveness checks. Must not be protected via authetication.") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(type = "string")), description = "Return 'pong'")) Response ping(); @GET @Path("/library/list") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List Library Classes", description = "Retrieves a list of available Java library class names from uploaded JARs.") @ApiResponses(@ApiResponse( responseCode = "200", content = @Content(schema = @Schema(type = "ArrayList<String>")), description = "Return a list of loadable class names")) Response listLibraryClasses(@Context UriInfo uriInfo); @PUT @Path("/library") @Operation(summary = "Upload Library", description = "Upload a Java library archive file") @Consumes({MediaType.APPLICATION_OCTET_STREAM}) @ApiResponses(@ApiResponse( responseCode = "200", description = "Library upload successful.")) Response uploadLibrary(InputStream requestIn); AtlasLibraryLoader getLibraryLoader(); }
AtlasService { @GET @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) public Response getMappingRequest( @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat, @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId) { LOG.debug("getMappingRequest: {} '{}'", mappingFormat, mappingDefinitionId); ADMArchiveHandler admHandler = loadExplodedMappingDirectory(mappingDefinitionId); switch (mappingFormat) { case JSON: byte[] serialized = null; try { serialized = admHandler.getMappingDefinitionBytes(); } catch (Exception e) { LOG.error("Error retrieving mapping definition file for ID:" + mappingDefinitionId, e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } if (LOG.isDebugEnabled() && serialized != null) { LOG.debug(new String(serialized)); } if (serialized == null) { LOG.debug("Mapping definition not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(serialized).build(); case GZ: try { if (admHandler.getGzippedADMDigestBytes() == null) { LOG.debug("ADM Digest file not found for ID:{}", mappingDefinitionId); return Response.noContent().build(); } return Response.ok().entity(admHandler.getGzippedADMDigestBytes()).build(); } catch (Exception e) { LOG.error("Error getting compressed ADM digest file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } case ZIP: try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { admHandler.setIgnoreLibrary(false); admHandler.setLibraryDirectory(Paths.get(this.libFolder)); admHandler.export(out); return Response.ok().entity(out.toByteArray()).build(); } catch (Exception e) { LOG.error("Error getting ADM archive file.\n" + e.getMessage(), e); throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR); } default: throw new WebApplicationException("Unrecognized mapping format: " + mappingFormat, Status.INTERNAL_SERVER_ERROR); } } AtlasService(); @GET @Path("/fieldActions") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List FieldActions", description = "Retrieves a list of available field action") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ActionDetails.class)) , description = "Return a list of field action detail")) Response listFieldActions(@Context UriInfo uriInfo); @Deprecated @GET @Path("/mappings") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List Mappings", description = "Retrieves a list of mapping file name saved with specified mappingDefinitionId") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StringMap.class)) , description = "Return a list of a pair of mapping file name and content")) Response listMappingsOld(@Context UriInfo uriInfo, @QueryParam("filter") final String filter); @GET @Path("/mappings/{mappingDefinitionId}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List Mappings", description = "Retrieves a list of mapping file name saved with specified mappingDefinitionId") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StringMap.class)) , description = "Return a list of a pair of mapping file name and content")) Response listMappings(@Context UriInfo uriInfo, @QueryParam("filter") final String filter,
                                 @Parameter(description = "Mapping Definition ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @Deprecated @DELETE @Path("/mapping") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping", description = "Remove a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Specified mapping file was removed successfully"), @ApiResponse(responseCode = "204", description = "Mapping file was not found")}) Response removeMappingRequestOld(); @DELETE @Path("/mapping/{mappingDefinitionId}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping", description = "Remove a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Specified mapping file was removed successfully"), @ApiResponse(responseCode = "204", description = "Mapping file was not found")}) Response removeMappingRequest(@Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @Deprecated @DELETE @Path("/mapping/RESET") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping by ID", description = "Remove mapping file and catalogs related to specified ID") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Mapping file and Catalogs were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove mapping file and Catalogs for the specified ID")}) Response resetMappingByIdOld(); @DELETE @Path("/mapping/RESET/{mappingDefinitionId}") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove Mapping by ID", description = "Remove mapping file and catalogs related to specified ID") @ApiResponses({ @ApiResponse(responseCode = "200", description = "Mapping file and Catalogs were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove mapping file and Catalogs for the specified ID")}) Response resetMappingById(@Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @DELETE @Path("/mapping/RESET/ALL") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove All Mappings", description = "Remove all mapping files and catalogs saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "All mapping files were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove all mapping files")}) Response resetAllMappings(); @DELETE @Path("/mapping/resetLibs") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Remove All User-Defined JAR libraries", description = "Remove all user-defined JAR files saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", description = "All user-defined JAR files were removed successfully"), @ApiResponse(responseCode = "204", description = "Unable to remove all user-defined JAR files")}) Response resetUserLibs(); @Deprecated @GET @Path("/mapping/{mappingFormat}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) Response getMappingRequestOld(
      @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat); @GET @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Operation(summary = "Get Mapping", description = "Retrieve a mapping file saved on the server") @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AtlasMapping.class)), description = "Return a mapping file content"), @ApiResponse(responseCode = "204", description = "Mapping file was not found"), @ApiResponse(responseCode = "500", description = "Mapping file access error")}) Response getMappingRequest(
      @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat,
      @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId); @Deprecated @PUT @Path("/mapping/{mappingFormat}") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Create Mapping", description = "Save a mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses({ @ApiResponse(responseCode = "200", description = "Succeeded"), @ApiResponse(responseCode = "500", description = "Mapping file save error")}) Response createMappingRequestOld(InputStream mapping,
    @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat,
    @Context UriInfo uriInfo); @PUT @Path("/mapping/{mappingFormat}/{mappingDefinitionId}") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_OCTET_STREAM}) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Create Mapping", description = "Save a mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses({ @ApiResponse(responseCode = "200", description = "Succeeded"), @ApiResponse(responseCode = "500", description = "Mapping file save error")}) Response createMappingRequest(InputStream mapping,
      @Parameter(description = "Mapping Format") @PathParam("mappingFormat") MappingFileType mappingFormat,
      @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId,
      @Context UriInfo uriInfo); @Deprecated @POST @Path("/mapping") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Update Mapping", description = "Update existing mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", description = "Succeeded")) Response updateMappingRequestOld(
            InputStream mapping,
            @Context UriInfo uriInfo); @POST @Path("/mapping/{mappingDefinitionId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Update Mapping", description = "Update existing mapping file on the server") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", description = "Succeeded")) Response updateMappingRequest(
            InputStream mapping,
            @Parameter(description = "Mapping Definition ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId,
            @Context UriInfo uriInfo); @Deprecated @PUT @Path("/mapping/validate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Validate Mapping", description = "Validate mapping file") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Validations.class)), description = "Return a validation result")) Response validateMappingRequestOld(InputStream mapping,
                                           @Context UriInfo uriInfo); @PUT @Path("/mapping/validate/{mappingDefinitionId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Validate Mapping", description = "Validate mapping file") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Validations.class)), description = "Return a validation result")) Response validateMappingRequest(InputStream mapping,
                                           @Parameter(description = "Mapping ID") @PathParam("mappingDefinitionId") Integer mappingDefinitionId,
                                           @Context UriInfo uriInfo); @PUT @Path("/mapping/process") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Process Mapping", description = "Process Mapping by feeding input data") @RequestBody(description = "Mapping file content", content = @Content(schema = @Schema(implementation = AtlasMapping.class))) @ApiResponses({ @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessMappingResponse.class)), description = "Return a mapping result"), @ApiResponse(responseCode = "204", description = "Skipped empty mapping execution") }) Response processMappingRequest(InputStream request, @Context UriInfo uriInfo); @GET @Path("/ping") @Operation(summary = "Ping", description = "Simple liveness check method used in liveness checks. Must not be protected via authetication.") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(type = "string")), description = "Return 'pong'")) Response ping(); @GET @Path("/library/list") @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "List Library Classes", description = "Retrieves a list of available Java library class names from uploaded JARs.") @ApiResponses(@ApiResponse( responseCode = "200", content = @Content(schema = @Schema(type = "ArrayList<String>")), description = "Return a list of loadable class names")) Response listLibraryClasses(@Context UriInfo uriInfo); @PUT @Path("/library") @Operation(summary = "Upload Library", description = "Upload a Java library archive file") @Consumes({MediaType.APPLICATION_OCTET_STREAM}) @ApiResponses(@ApiResponse( responseCode = "200", description = "Library upload successful.")) Response uploadLibrary(InputStream requestIn); AtlasLibraryLoader getLibraryLoader();  }