Class AbstractFileAtlasProvider
- java.lang.Object
-
- org.openstreetmap.atlas.mutator.configuration.parsing.provider.file.AbstractFileAtlasProvider
-
- All Implemented Interfaces:
java.io.Serializable,java.util.function.BiFunction<java.lang.String,org.openstreetmap.atlas.geography.sharding.Shard,java.util.Optional<org.openstreetmap.atlas.geography.atlas.Atlas>>,AtlasProvider
- Direct Known Subclasses:
AtlasFileAtlasProvider,PbfRawAtlasProvider
public abstract class AbstractFileAtlasProvider extends java.lang.Object implements AtlasProvider
Abstract AtlasProvider that focuses on accessing Atlas data from files/resources usingResourceCaches.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openstreetmap.atlas.mutator.configuration.parsing.provider.AtlasProvider
AtlasProvider.AtlasProviderConstants
-
-
Constructor Summary
Constructors Constructor Description AbstractFileAtlasProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.Optional<org.openstreetmap.atlas.geography.atlas.Atlas>apply(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)protected java.lang.StringgetAtlasPath()protected abstract java.util.Optional<org.openstreetmap.atlas.streaming.resource.Resource>getResourceFromCache(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)Use aConcurrentResourceCacheto get a remote resource from the country and shard.protected java.util.Map<java.lang.String,java.lang.String>getSparkConfiguration()protected abstract voidinvalidateCache(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)Invalidate the cache for a specific country and shard, allowing for a retry.protected abstract java.util.Optional<org.openstreetmap.atlas.geography.atlas.Atlas>resourceToAtlas(org.openstreetmap.atlas.streaming.resource.Resource resource, java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)The core of theAbstractFileAtlasProvider, in which a provided file becomes a resource which is then translated into an Atlas.voidsetAtlasProviderContext(java.util.Map<java.lang.String,java.lang.Object> context)Provide more generic runtime context to the AtlasProvider, this method to be used right before running the dependent mutation.
-
-
-
Method Detail
-
apply
public java.util.Optional<org.openstreetmap.atlas.geography.atlas.Atlas> apply(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)- Specified by:
applyin interfacejava.util.function.BiFunction<java.lang.String,org.openstreetmap.atlas.geography.sharding.Shard,java.util.Optional<org.openstreetmap.atlas.geography.atlas.Atlas>>
-
setAtlasProviderContext
public void setAtlasProviderContext(java.util.Map<java.lang.String,java.lang.Object> context)
Description copied from interface:AtlasProviderProvide more generic runtime context to the AtlasProvider, this method to be used right before running the dependent mutation.- Specified by:
setAtlasProviderContextin interfaceAtlasProvider- Parameters:
context- Generic context that is needed by the provider
-
getAtlasPath
protected java.lang.String getAtlasPath()
-
getResourceFromCache
protected abstract java.util.Optional<org.openstreetmap.atlas.streaming.resource.Resource> getResourceFromCache(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)Use aConcurrentResourceCacheto get a remote resource from the country and shard.- Parameters:
country- The country codeshard- The provided shard- Returns:
- If it exists, the resource associated with the country and shard.
-
getSparkConfiguration
protected java.util.Map<java.lang.String,java.lang.String> getSparkConfiguration()
-
invalidateCache
protected abstract void invalidateCache(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)Invalidate the cache for a specific country and shard, allowing for a retry.- Parameters:
country- The country codeshard- The provided shard
-
resourceToAtlas
protected abstract java.util.Optional<org.openstreetmap.atlas.geography.atlas.Atlas> resourceToAtlas(org.openstreetmap.atlas.streaming.resource.Resource resource, java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)The core of theAbstractFileAtlasProvider, in which a provided file becomes a resource which is then translated into an Atlas.- Parameters:
resource- The resource to translatecountry- The country codeshard- The provided shard- Returns:
- The resulting Atlas.
-
-