Class TLfnTileStoreProvider

java.lang.Object
com.luciad.fusion.tilestore.ALfnTileStoreProvider
com.luciad.fusion.tilestore.TLfnTileStoreProvider

public class TLfnTileStoreProvider extends ALfnTileStoreProvider
A Tile Store factory that can handle
  • file URIs: local tile stores accessible through files
  • http and https 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 Details

    • TLfnTileStoreProvider

      public TLfnTileStoreProvider(TLfnClientFactory aClientFactory, ALfnEnvironment aEnvironment)

      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

      public ALfnTileStore getTileStore(URI aURI) throws IOException, TLfnServiceException
      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 class ALfnTileStoreProvider
      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 reasons
      TLfnServiceException - if the Tile Store cannot be opened because of unexpected reasons
    • createLTSClient

      protected TLfnLTSClient createLTSClient(URI aUri) throws IOException, TLfnServiceException
      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 return null 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 reasons
      TLfnServiceException - if the Tile Store cannot be opened because of unexpected reasons
    • createFileSystemTileStore

      protected ALfnTileStore createFileSystemTileStore(File aHome) throws IOException
      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

      protected final TLfnClientFactory getClientFactory()
      Gets the client factory of this Tile Store provider.

      Extensions that override createLTSClient(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

      protected final ALfnEnvironment getEnvironment()
      Gets the environment of this Tile Store provider.

      Extensions that override createFileSystemTileStore(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