Package io.atlasmap.core
Class ADMArchiveHandler
- java.lang.Object
-
- io.atlasmap.core.ADMArchiveHandler
-
public class ADMArchiveHandler extends Object
The API for handling ADM archive. It encapsulates ADM archive structure and format and isolate file/stream I/O from other part. ADM archive is a zipped archive file or its exploded directory which contains- Mapping Definition file (atlasmapping-UI.n.json)
- Gzipped digest file which contains all non-Java document metadata and mapping definition in a single JSON file (adm-catalog-files-n.gz)
- Java libraries (jar files in lib/ directory)
load(Path)export(OutputStream)This handler follows lazy loading strategy as much as possible, i.e. defer to serialize/deserialize until it is really required. Also note that at this moment Java library directory is not managed by this class. Only when it imports/exports ADM archive file, library jars are extracted/bundled ifisIgnoreLibrary()is set tofalse.TODO https://github.com/atlasmap/atlasmap/issues/1476 A gzipped digest file have to be splitted into individual schemas and a catalog file.
-
-
Constructor Summary
Constructors Constructor Description ADMArchiveHandler()ADMArchiveHandler(ClassLoader loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()io.atlasmap.v2.AtlasMappingcloneMappingDefinition()voidexport(OutputStream out)Export into an ADM archive.io.atlasmap.v2.DataSourceMetadatagetDataSourceMetadata(boolean isSource, String documentId)io.atlasmap.v2.DataSourceMetadatagetDataSourceMetadata(io.atlasmap.v2.DataSourceKey key)Map<io.atlasmap.v2.DataSourceKey,io.atlasmap.v2.DataSourceMetadata>getDataSourceMetadataMap()byte[]getGzippedADMDigestBytes()StringgetGzippedADMDigestFileName()io.atlasmap.v2.AtlasMappinggetMappingDefinition()byte[]getMappingDefinitionBytes()StringgetMappingDefinitionFileName()booleanisIgnoreLibrary()voidload(io.atlasmap.api.AtlasContextFactory.Format format, InputStream in)Load an ADM archive or mapping definition from stream.voidload(InputStream in)Load an ADM archive from stream.voidload(Path path)Load an ADM archive file, an exploded directory or mapping definition JSON file.voidpersist()Persist ADM archive into a directory.voidsetGzippedADMDigest(InputStream is)voidsetIgnoreLibrary(boolean ignoreLib)voidsetLibraryDirectory(Path dir)voidsetMappingDefinition(io.atlasmap.v2.AtlasMapping mapping)voidsetMappingDefinitionBytes(InputStream is)voidsetMappingDefinitionId(String id)voidsetPersistDirectory(Path dir)
-
-
-
Constructor Detail
-
ADMArchiveHandler
public ADMArchiveHandler()
-
ADMArchiveHandler
public ADMArchiveHandler(ClassLoader loader)
-
-
Method Detail
-
load
public void load(Path path) throws io.atlasmap.api.AtlasException
Load an ADM archive file, an exploded directory or mapping definition JSON file.- Parameters:
path-java.nio.file.Pathof the ADM archive file or an exploded directory- Throws:
io.atlasmap.api.AtlasException- If it fails to load
-
load
public void load(InputStream in) throws io.atlasmap.api.AtlasException
Load an ADM archive from stream.- Parameters:
in- InputStream to read an ADM Archive- Throws:
io.atlasmap.api.AtlasException- If it fails to load
-
load
public void load(io.atlasmap.api.AtlasContextFactory.Format format, InputStream in) throws io.atlasmap.api.AtlasExceptionLoad an ADM archive or mapping definition from stream.- Parameters:
format-AtlasContextFactory.Formatto indicate stream formatin- InputStream to read an ADM Archive- Throws:
io.atlasmap.api.AtlasException- If it fails to load
-
export
public void export(OutputStream out) throws io.atlasmap.api.AtlasException
Export into an ADM archive.- Parameters:
out- OutputStream to write an ADM archive- Throws:
io.atlasmap.api.AtlasException- If it fails to export
-
persist
public void persist() throws io.atlasmap.api.AtlasExceptionPersist ADM archive into a directory.- Throws:
io.atlasmap.api.AtlasException- If it fails to persist
-
getMappingDefinition
public io.atlasmap.v2.AtlasMapping getMappingDefinition()
-
setMappingDefinition
public void setMappingDefinition(io.atlasmap.v2.AtlasMapping mapping)
-
setMappingDefinitionBytes
public void setMappingDefinitionBytes(InputStream is) throws io.atlasmap.api.AtlasException
- Throws:
io.atlasmap.api.AtlasException
-
getMappingDefinitionBytes
public byte[] getMappingDefinitionBytes() throws io.atlasmap.api.AtlasException- Throws:
io.atlasmap.api.AtlasException
-
setGzippedADMDigest
public void setGzippedADMDigest(InputStream is) throws io.atlasmap.api.AtlasException
- Throws:
io.atlasmap.api.AtlasException
-
getGzippedADMDigestBytes
public byte[] getGzippedADMDigestBytes()
-
getDataSourceMetadata
public io.atlasmap.v2.DataSourceMetadata getDataSourceMetadata(boolean isSource, String documentId) throws io.atlasmap.api.AtlasException- Throws:
io.atlasmap.api.AtlasException
-
getDataSourceMetadata
public io.atlasmap.v2.DataSourceMetadata getDataSourceMetadata(io.atlasmap.v2.DataSourceKey key) throws io.atlasmap.api.AtlasException- Throws:
io.atlasmap.api.AtlasException
-
getDataSourceMetadataMap
public Map<io.atlasmap.v2.DataSourceKey,io.atlasmap.v2.DataSourceMetadata> getDataSourceMetadataMap() throws io.atlasmap.api.AtlasException
- Throws:
io.atlasmap.api.AtlasException
-
cloneMappingDefinition
public io.atlasmap.v2.AtlasMapping cloneMappingDefinition() throws io.atlasmap.api.AtlasException- Throws:
io.atlasmap.api.AtlasException
-
clear
public void clear()
-
setIgnoreLibrary
public void setIgnoreLibrary(boolean ignoreLib)
-
isIgnoreLibrary
public boolean isIgnoreLibrary()
-
setPersistDirectory
public void setPersistDirectory(Path dir) throws io.atlasmap.api.AtlasException
- Throws:
io.atlasmap.api.AtlasException
-
setLibraryDirectory
public void setLibraryDirectory(Path dir) throws io.atlasmap.api.AtlasException
- Throws:
io.atlasmap.api.AtlasException
-
setMappingDefinitionId
public void setMappingDefinitionId(String id)
-
getGzippedADMDigestFileName
public String getGzippedADMDigestFileName()
-
getMappingDefinitionFileName
public String getMappingDefinitionFileName()
-
-