Class TLfnClientFactory

java.lang.Object
com.luciad.fusion.client.TLfnClientFactory

public class TLfnClientFactory extends Object
A factory for LuciadFusion client components. It provides creation of Luciad Tile Service clients and transport implementations.
Since:
10.0
  • Field Details

    • TRANSPORT_TYPE_DEFAULT

      public static final String TRANSPORT_TYPE_DEFAULT
      Default transport type, based upon Apache HttpClient 4.5.2.
      See Also:
  • Constructor Details

    • TLfnClientFactory

      public TLfnClientFactory(ALfnClientEnvironment aClientEnvironment)
      Creates a client factory based on a client environment.
      Parameters:
      aClientEnvironment - client environment
  • Method Details

    • createLTSClient

      public TLfnLTSClient createLTSClient(URI aUri, ILcdTransport aTransport) throws IOException, TLfnServiceException
      Creates a client for a Luciad Tile Service, with a specific transport.

      The client implements the Luciad Tile Service (LTS) protocol, for communicating with a remote LuciadFusion TileStore.

      The LuciadFusion protocol is HTTP based:
      • Read-only requests that do not change the server state use the HTTP GET method, with the request parameters encoded in the URL. In case the URL becomes too long, a HTTP POST may be used, with the request encoded in the request body using form-URL-encoding (KVP).
      • Requests that change the server state must use the HTTP POST method, with the data encoded in the request body using XML, form-URL-encoding (KVP) or a custom binary protocol.
      The client is thread-safe.
      Parameters:
      aUri - the URI of the LuciadFusion service
      aTransport - the transport to use for communicating with the LuciadFusion service
      Returns:
      the client
      Throws:
      IOException - when client cannot connect to the LuciadFusion service
      TLfnServiceException - when the LuciadFusion service failed to connect to the client
      IllegalArgumentException - when the URI is not valid
    • createLTSClient

      public TLfnLTSClient createLTSClient(URI aUri, ILcdTransport aTransport, boolean aOwnsTransport) throws IOException, TLfnServiceException
      Creates a client for a Luciad Tile Service, with a specific transport.

      The client implements the Luciad Tile Service (LTS) protocol, for communicating with a remote LuciadFusion TileStore.

      The LuciadFusion protocol is HTTP based:
      • Read-only requests that do not change the server state use the HTTP GET method, with the request parameters encoded in the URL. In case the URL becomes too long, a HTTP POST may be used, with the request encoded in the request body using form-URL-encoding (KVP).
      • Requests that change the server state must use the HTTP POST method, with the data encoded in the request body using XML, form-URL-encoding (KVP) or a custom binary protocol.
      The client is thread-safe.

      When the given transport is owned by the client, and if it is ILcdDisposable, it will be closed when the Tile Store corresponding to the client is closed.

      Parameters:
      aUri - the URI of the LuciadFusion service
      aTransport - the transport to use for communicating with the LuciadFusion service
      aOwnsTransport - When true, and if the given transport also implements ILcdDisposable, it will be disposed when the Tile Store corresponding to the client is closed. If you want to share a transport across multiple LTS clients, you should pass false here and you're responsible for disposing the transport yourself.
      Returns:
      the client
      Throws:
      IOException - when client cannot connect to the LuciadFusion service
      TLfnServiceException - when the LuciadFusion service failed to connect to the client
      IllegalArgumentException - when the URI is not valid
    • createLTSClient

      public TLfnLTSClient createLTSClient(URI aUri) throws IOException, TLfnServiceException
      Creates a client for a Luciad Tile Service, with the default transport.

      The client implements the Luciad Tile Service (LTS) protocol, for communicating with a remote LuciadFusion TileStore.

      The LuciadFusion protocol is HTTP based:
      • Read-only requests that do not change the server state use the HTTP GET method, with the request parameters encoded in the URL. In case the URL becomes too long, a HTTP POST may be used, with the request encoded in the request body using XML or form-URL-encoding (KVP).
      • Requests that change the server state must use the HTTP POST method, with the data encoded in the request body using XML, form-URL-encoding (KVP) or a custom binary protocol.
      The client is thread-safe.
      Parameters:
      aUri - the URI of the LuciadFusion service
      Returns:
      the client
      Throws:
      IOException - when client cannot connect to the LuciadFusion service
      TLfnServiceException - when the LuciadFusion service failed to connect to the client
      IllegalArgumentException - when the URI is not valid
      See Also:
    • createModelDecoder

      public TLfnTileStoreModelDecoder createModelDecoder()
      Creates a model decoder for Tile Stores.
      Returns:
      a model decoder
    • createTransport

      public ILcdTransport createTransport()
      Creates a default transport to be used by a client.

      The transport supports the HTTP and HTTPS protocols. Request performed on the transport with other protocols will result in an IOException.

      The transport returned by this method implements ILcdDisposable. When combined with the 'owns transport' flag of createLTSClient(java.net.URI, com.luciad.io.transport.ILcdTransport, boolean), it will be disposed when the corresponding Tile Store is closed.

      Returns:
      a transport.
    • createTransport

      public ILcdTransport createTransport(String aTransportType, Object aParameter)
      Creates a transport to be used by a client. This method supports the creation of different types of transports and allows users to configure it to their needs.

      The currently supported transport is based upon Apache HttpClient 4.1.1. Use TRANSPORT_TYPE_DEFAULT for the aTransportType parameter to create this transport. The aParameter parameter should be a fully configured org.apache.commons.httpclient.HttpClient. To create a valid HttpClient, you can use the createTransportConfiguration(String) method.

      The transport supports the HTTP and HTTPS protocols. Request performed on the transport with other protocols will result in an IOException.

      The transport returned by this method implements ILcdDisposable. When combined with the 'owns transport' flag of createLTSClient(java.net.URI, com.luciad.io.transport.ILcdTransport, boolean), it will be disposed when the corresponding Tile Store is closed.

      Parameters:
      aTransportType - The type of transport to create, this should be one of the constants that are available in this class.
      aParameter - A parameter that can be used to initialize the transport, the required type depends on aTransportType.
      Returns:
      a transport of the requested type.
      Throws:
      IllegalArgumentException - in case the requested type is not supported.
    • createTransportConfiguration

      public Object createTransportConfiguration(String aTransportType)
      Creates a valid configuration parameter that can be used to create the corresponding transport. This method will ensure that the transport will be configured optimally by default.

      To create a transport with a custom configuration, call this method with the constant corresponding to the desired type of transport. The returned Object can then be casted to the type listed below and modified as desired.

      The available transport types and their corresponding return types:

      Parameters:
      aTransportType - The type of transport for which a configuration parameter needs to be created.
      Returns:
      A valid transport configuration.
      See Also:
    • setTransportFactory

      public void setTransportFactory(ILcdTransportFactory aTransportFactory)
      Sets the transport factory that will construct the ILcdTransport used for communicating with Luciad tile server.

      The default transport factory creates ILcdTransports based on the Apache HttpClient library. This factory uses the proxy configuration from the system-wide proxy selector

      The transports created by the factory should implement ILcdDisposable if they hold any resources (ex. network connections).

      This setter does not affect already decoded models.

      Parameters:
      aTransportFactory - the transport factory, must not be null
      Since:
      2017.0
    • getTransportFactory

      public ILcdTransportFactory getTransportFactory()
      Returns the transport factory that will construct the ILcdTransport used for communicating with Luciad tile server.
      Returns:
      the transport.
      Since:
      2017.0
      See Also: