Class AtlasFileAtlasProvider
- java.lang.Object
-
- org.openstreetmap.atlas.mutator.configuration.parsing.provider.file.AbstractFileAtlasProvider
-
- org.openstreetmap.atlas.mutator.configuration.parsing.provider.file.AtlasFileAtlasProvider
-
- 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
public class AtlasFileAtlasProvider extends AbstractFileAtlasProvider
The simplest default Atlas provider which takes a repository of serialized Atlas files to provide the Atlas objects.- 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 AtlasFileAtlasProvider()AtlasFileAtlasProvider(java.lang.module.Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 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 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.-
Methods inherited from class org.openstreetmap.atlas.mutator.configuration.parsing.provider.file.AbstractFileAtlasProvider
apply, getAtlasPath, getSparkConfiguration
-
-
-
-
Method Detail
-
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- Overrides:
setAtlasProviderContextin classAbstractFileAtlasProvider- Parameters:
context- Generic context that is needed by the provider
-
getResourceFromCache
protected java.util.Optional<org.openstreetmap.atlas.streaming.resource.Resource> getResourceFromCache(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)Description copied from class:AbstractFileAtlasProviderUse aConcurrentResourceCacheto get a remote resource from the country and shard.- Specified by:
getResourceFromCachein classAbstractFileAtlasProvider- Parameters:
country- The country codeshard- The provided shard- Returns:
- If it exists, the resource associated with the country and shard.
-
invalidateCache
protected void invalidateCache(java.lang.String country, org.openstreetmap.atlas.geography.sharding.Shard shard)Description copied from class:AbstractFileAtlasProviderInvalidate the cache for a specific country and shard, allowing for a retry.- Specified by:
invalidateCachein classAbstractFileAtlasProvider- Parameters:
country- The country codeshard- The provided shard
-
resourceToAtlas
protected 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)Description copied from class:AbstractFileAtlasProviderThe core of theAbstractFileAtlasProvider, in which a provided file becomes a resource which is then translated into an Atlas.- Specified by:
resourceToAtlasin classAbstractFileAtlasProvider- Parameters:
resource- The resource to translatecountry- The country codeshard- The provided shard- Returns:
- The resulting Atlas.
-
-