Some data sources cannot be represented by a single string. For example, if you want to connect to a WMS server, and load a single layer from the server, you need at least the URL of the server and the name of the layer to load.

In the LuciadLightspeed API, such a source is represented by an ILcdDataSource implementation. In the case of the WMS server, this is a TLcdWMSDataSource. Once you have constructed such an ILcdDataSource, you can use the TLcyDataFormatManager API in a way similar to the demonstration in How to open data using the API.

Program: Loading WMS data through the TLcyDataFormatManager
ILcyLucyEnv lucy = ... ;
ILcyGenericMapComponent map = ...;

//Construct an ILcdDataSource to indicate which data you want to load
String serverURL = ...;
String wmsLayerName = ...;
TLcdWMSDataSource dataSource =
  TLcdWMSDataSource.newBuilder()
                   .uri(serverURL)
                   .addLayer(wmsLayerName)
                   .build();

TLcyDataFormatManager dataFormatManager = lucy.getDataFormatManager();
dataFormatManager.handleDataSources(new ILcdDataSource[]{dataSource}, map, map.getComponent());

The API methods of the TLcyDataFormatManager load data on the calling thread. Because data loading is a potentially demanding operation, you need to call these methods on a background thread to prevent a blocked UI.