Search in sources :

Example 11 with ADMArchiveHandler

use of io.atlasmap.core.ADMArchiveHandler in project atlasmap by atlasmap.

the class AtlasService method loadExplodedMappingDirectory.

private ADMArchiveHandler loadExplodedMappingDirectory(Integer mappingDefinitionId) {
    java.nio.file.Path mappingDirPath = Paths.get(getMappingSubDirectory(mappingDefinitionId));
    File mappingDirFile = mappingDirPath.toFile();
    if (!mappingDirFile.exists()) {
        mappingDirFile.mkdirs();
    }
    ADMArchiveHandler admHandler = new ADMArchiveHandler(this.libraryLoader);
    admHandler.setIgnoreLibrary(true);
    try {
        admHandler.load(mappingDirPath);
    } catch (Exception e) {
        LOG.error("Unexpected error while loading mapping directory.\n" + e.getMessage(), e);
        throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR);
    }
    return admHandler;
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) ADMArchiveHandler(io.atlasmap.core.ADMArchiveHandler) File(java.io.File) WebApplicationException(javax.ws.rs.WebApplicationException) AtlasException(io.atlasmap.api.AtlasException) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

ADMArchiveHandler (io.atlasmap.core.ADMArchiveHandler)11 AtlasMapping (io.atlasmap.v2.AtlasMapping)6 AtlasContext (io.atlasmap.api.AtlasContext)5 AtlasSession (io.atlasmap.api.AtlasSession)5 InputStream (java.io.InputStream)5 AtlasException (io.atlasmap.api.AtlasException)4 Operation (io.swagger.v3.oas.annotations.Operation)4 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 WebApplicationException (javax.ws.rs.WebApplicationException)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 IOException (java.io.IOException)3 UriBuilder (javax.ws.rs.core.UriBuilder)3 Test (org.junit.jupiter.api.Test)3 RequestBody (io.swagger.v3.oas.annotations.parameters.RequestBody)2 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1