The TLcyDataFormatManager offers API for data loading:

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

String path = "/path/to/file/to/open";

TLcyDataFormatManager dataFormatManager = lucy.getDataFormatManager();
dataFormatManager.handleDataSources(new String[]{path}, map, null, 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.

The code in Program: Opening data through the TLcyDataFormatManager works well for files for which just one model decoder or data source handler is available. If multiple instances are available to handle the input string, the TLcyDataFormatManager will use the ALcyHandlerChooser to select a handler for the input string, as described in Loading data in Lucy.

The default ALcyHandlerChooser implementation delegates the decision to the users, and shows them selection UI. This might be unwanted behavior if you are running an automated test, for example. To change the behavior, you can use the overloaded version of the handleDataSources method. It allows you to specify which model decoders and data source handlers the TLcyDataFormatManager can consider. By only passing in a single model decoder or data source handler instance, which you can retrieve from ILcyLucyEnv.getServices, you can prevent that any UI is shown to the user.

There are convenience configuration options available for loading data sets on the map shown at start-up. This is explained in How to add data to your Lightspeed map at Lucy start-up.