Class TLfnTileStoreProvider
file
URIs: local tile stores accessible through fileshttp
andhttps
URIs: remote tile stores accessible through the LTS protocol
This implementation makes sure that subsequent requests for the same URI return the same instance.
This implementation does not automatically create directories for non-existent Tile Stores.
If you want this, you need to override createFileSystemTileStore(File)
:
TLfnClientFactory clientFactory;
ALfnEnvironment environment;
TLfnTileStoreProvider tileStoreProvider = new TLfnTileStoreProvider(clientFactory, environment) {
@Override
protected ALfnTileStore createFileSystemTileStore(File aHome) throws IOException {
// Set the 'create' flag to 'true' to create the directory if it does not exist.
return new TLfnFileSystemTileStore(aHome, true, getEnvironment());
}
}
The contract of getTileStore(URI)
is that callers of this method are responsible for
closing the returned tile store instance.
- Since:
- 2013.0
-
Constructor Summary
ConstructorDescriptionTLfnTileStoreProvider
(TLfnClientFactory aClientFactory, ALfnEnvironment aEnvironment) Constructs a Tile Store provider using a given client factory and environment. -
Method Summary
Modifier and TypeMethodDescriptionprotected ALfnTileStore
createFileSystemTileStore
(File aHome) Override this method if you want to customize the creation of a file system Tile Store.protected TLfnLTSClient
createLTSClient
(URI aUri) Creates an LTS client for a given URI using the default transport.protected final TLfnClientFactory
Gets the client factory of this Tile Store provider.protected final ALfnEnvironment
Gets the environment of this Tile Store provider.getTileStore
(URI aURI) Returns a Tile Store for the given URI.
-
Constructor Details
-
TLfnTileStoreProvider
Constructs a Tile Store provider using a given client factory and environment.
- Parameters:
aClientFactory
- the client factory, necessary for remote (LTS) tile stores.null
is allowed for when you expect only file system Tile Stores.aEnvironment
- the environment, necessary for file system Tile Stores.null
is allowed for when you expect only LTS tile stores.
-
-
Method Details
-
getTileStore
Description copied from class:ALfnTileStoreProvider
Returns a Tile Store for the given URI.
Caller code must always close the returned tile store instance after using it. See class doc for more information.
- Specified by:
getTileStore
in classALfnTileStoreProvider
- Parameters:
aURI
- The URI to create the Tile Store for- Returns:
- The Tile Store
- Throws:
IOException
- if the Tile Store cannot be opened because of unexpected IO reasonsTLfnServiceException
- if the Tile Store cannot be opened because of unexpected reasons
-
createLTSClient
Creates an LTS client for a given URI using the default transport. Extensions may override this method for example to customize the transport. Extensions may returnnull
to indicate that it was impossible to create an LTS client for the given URI.- Parameters:
aUri
- a URI to create the LTS client for- Returns:
- an LTS client, or
null
to indicate that it was impossible to create an LTS client for the given URI - Throws:
IOException
- if the Tile Store cannot be opened because of unexpected IO reasonsTLfnServiceException
- if the Tile Store cannot be opened because of unexpected reasons
-
createFileSystemTileStore
Override this method if you want to customize the creation of a file system Tile Store.The default implementation returns Tile Store instances that do not automatically create the directory if it does not exist. You need to override this method to change this behavior.
- Parameters:
aHome
- The Tile Store root directory- Returns:
- A new file-system based Tile Store
- Throws:
IOException
-
getClientFactory
Gets the client factory of this Tile Store provider. Extensions that overridecreateLTSClient(java.net.URI)
to customize the transport can use this method to gain access to the client factory.- Returns:
- the client factory of this Tile Store provider, never
null
-
getEnvironment
Gets the environment of this Tile Store provider. Extensions that overridecreateFileSystemTileStore(java.io.File)
to customize the file system Tile Store can use this method to gain access to the environment.- Returns:
- the environment of this Tile Store provider, never
null
-