public class TLfnTileStoreProvider extends ALfnTileStoreProvider
file
URIs: local tile stores accessible through fileshttp
and https
URIs: remote tile stores accessible through the LTS protocolThis 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.
Constructor and Description |
---|
TLfnTileStoreProvider(TLfnClientFactory aClientFactory,
ALfnEnvironment aEnvironment)
Constructs a Tile Store provider using a given client factory and environment.
|
Modifier and Type | Method and Description |
---|---|
protected 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 TLfnClientFactory |
getClientFactory()
Gets the client factory of this Tile Store provider.
|
protected ALfnEnvironment |
getEnvironment()
Gets the environment of this Tile Store provider.
|
ALfnTileStore |
getTileStore(URI aURI)
Returns a Tile Store for the given URI.
|
public TLfnTileStoreProvider(TLfnClientFactory aClientFactory, ALfnEnvironment aEnvironment)
Constructs a Tile Store provider using a given client factory and environment.
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.public ALfnTileStore getTileStore(URI aURI) throws IOException, TLfnServiceException
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.
getTileStore
in class ALfnTileStoreProvider
aURI
- The URI to create the Tile Store forIOException
- if the Tile Store cannot be opened because of unexpected IO reasonsTLfnServiceException
- if the Tile Store cannot be opened because of unexpected reasonsprotected TLfnLTSClient createLTSClient(URI aUri) throws IOException, TLfnServiceException
null
to indicate that it was impossible to create an LTS client for the given URI.aUri
- a URI to create the LTS client fornull
to indicate that it was impossible to create an LTS client for the given URIIOException
- if the Tile Store cannot be opened because of unexpected IO reasonsTLfnServiceException
- if the Tile Store cannot be opened because of unexpected reasonsprotected ALfnTileStore createFileSystemTileStore(File aHome) throws IOException
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.
aHome
- The Tile Store root directoryIOException
protected final TLfnClientFactory getClientFactory()
createLTSClient(java.net.URI)
to customize the transport can use this method to gain access to
the client factory.null
protected final ALfnEnvironment getEnvironment()
createFileSystemTileStore(java.io.File)
to customize the file system Tile Store can use this
method to gain access to the environment.null