Class TLcyDataFormatManager

java.lang.Object
com.luciad.lucy.TLcyDataFormatManager

public class TLcyDataFormatManager extends Object
Manager that takes care of everything related to adding new data formats.

It features collections of:

All these are extension points for addons that want to add their own type of data, layers etc.

Another important feature of this TLcyDataFormatManager is that it allows to programmatically handle data sources, for example opening data files. This can be done using handleDataSources(ILcdDataSource[], ILcyGenericMapComponent, Component).

Consult the "Loading data in Lucy" chapter in the Lucy developer guide for more information about how this class can be used for data loading, and for some examples.

  • Constructor Details

    • TLcyDataFormatManager

      public TLcyDataFormatManager(ILcyLucyEnv aLucyEnv)

      Create a new data format manager

      Note: normally this constructor should never be used. Use the TLcyDataFormatManager available on the Lucy back-end instead by calling ILcyLucyEnv#getDataFormatManager().

      Parameters:
      aLucyEnv - the Lucy backend
  • Method Details

    • handleDataSources

      public void handleDataSources(String[] aDataSources, ILcyGenericMapComponent<? extends ILcdView,? extends ILcdLayer> aMapComponent, ALcyFileTypeDescriptor aSelectedFileTypeDescriptor, Component aParentComponent)

      Opens the data represented by aDataSources on aMapComponent by using all the ILcdModelDecoders and ALcyDataSourceHandlers that are registered on the Lucy back-end.

      When data can not be opened on aMapComponent, the map component chooser will be asked for other map(s) on which the TLcyDataFormatManager re-tries opening the data.

      Parameters:
      aDataSources - The data sources to open.
      aMapComponent - The map component to which the data will be added if possible.
      aSelectedFileTypeDescriptor - The selected file type descriptor, can be used if there is ambiguity (multiple decoders can read a file). Use null for default behavior.
      aParentComponent - A parent component, used to display message dialogs.
      See Also:
    • handleDataSources

      public void handleDataSources(ILcdDataSource[] aDataSources, ILcyGenericMapComponent<? extends ILcdView,? extends ILcdLayer> aMapComponent, Component aParentComponent)

      Opens the data represented by aDataSources on aMapComponent by using all the ILcdModelDecoders that are registered on the Lucy back-end.

      When data can not be opened on aMapComponent, the map component chooser will be asked for other map(s) on which the TLcyDataFormatManager re-tries opening the data.

      Parameters:
      aDataSources - The data sources to open.
      aMapComponent - The map component to which the data will be added if possible.
      aParentComponent - A parent component, used to display message dialogs.
      See Also:
    • handleDataSources

      public void handleDataSources(String[] aDataSources, ILcyGenericMapComponent<? extends ILcdView,? extends ILcdLayer> aMapComponent, ILcdModelDecoder[] aModelDecoders, ALcyFileTypeDescriptor[] aModelDecoderFileTypeDescriptors, ALcyDataSourceHandler[] aDataSourceHandlers, ALcyFileTypeDescriptor[] aDataSourceHandlerFileTypeDescriptors, ALcyFileTypeDescriptor aSelectedFileTypeDescriptor, Component aParentComponent)

      Opens the data represented by aDataSources on aMapComponent by using the ILcdModelDecoders in aModelDecoders and the ALcyDataSourceHandlers in aDataSourceHandlers.

      Before handling starts, and after handling has finished, all ILcyDataSourceListeners are informed. Such a listener can be added using addDataSourceListener.

      Choosing which ILcdModelDecoder or ALcyDataSourceHandler to use for a particular data source and a particular map component is left to a ALcyHandlerChooser. That handler can be replaced using setHandlerChooser.

      If errors occur while handling the data sources, messages will be send to getLogListener(). It is up to that listener to inform the end user of these messages.

      When the data cannot be opened on aMapComponent it will be re-tried on other available maps. The maps on which opening the data is re-tried are determined by the ALcyMapComponentChooser. This chooser can be replaced using setMapComponentChooser.

      Note that the data sources are handled on the calling thread. As this is probably a task that may take some time, it is advised to call this method from a worker thread.

      Parameters:
      aDataSources - The data sources to open.
      aMapComponent - The map component to which the data will be added if possible.
      aModelDecoders - A list of ILcdModelDecoders to use when handling the data sources.
      aModelDecoderFileTypeDescriptors - The file type descriptors corresponding to aModelDecoders. Is null iff aModelDecoders is null. Array must have equal length as aModelDecoders. It can contain null values for those ILcdModelDecoders that don't work with files.
      aDataSourceHandlers - A list of ALcyDataSourceHandlers to use when handling the data sources.
      aDataSourceHandlerFileTypeDescriptors - The file type descriptors corresponding to aDataSourceHandlers. Is null iff aDataSourceHandlers is null. Array must have equal length as aDataSourceHandlers. It can contain null values for those ALcyDataSourceHandlers that don't work with files.
      aSelectedFileTypeDescriptor - The selected file type descriptor, can be used if there is ambiguity (multiple decoders can read a file). Use null for default behavior.
      aParentComponent - A parent component, used to display message dialogs.
    • handleDataSources

      public void handleDataSources(ILcdDataSource[] aDataSources, ILcyGenericMapComponent<? extends ILcdView,? extends ILcdLayer> aMapComponent, ILcdModelDecoder[] aModelDecoders, Component aParentComponent)

      Opens the data represented by aDataSources on aMapComponent by using all the ILcdModelDecoders in aModelDecoders.

      Before handling starts, and after handling has finished, all ILcyDataSourceListeners are informed. Such a listener can be added using addDataSourceListener(ILcyDataSourceListener).

      Choosing which ILcdModelDecoder to use for a particular data source and a particular map component is left to a ALcyHandlerChooser. That chooser can be replaced using setHandlerChooser.

      If errors occur while handling the data sources, messages will be send to getLogListener(). It is up to that listener to inform the end user of these messages.

      When the data cannot be opened on aMapComponent it will be re-tried on other available maps. The maps on which opening the data is re-tried are determined by the ALcyMapComponentChooser. This chooser can be replaced using setMapComponentChooser.

      Note that the data sources are handled on the calling thread. As this is probably a task that may take some time, it is advised to call this method from a worker thread.

      Parameters:
      aDataSources - The data sources to open.
      aMapComponent - The map component to which the data will be added if possible.
      aModelDecoders - A list of ILcdModelDecoders to use when handling the data sources.
      aParentComponent - A parent component, used to display message dialogs.
    • addDataSourceListener

      public void addDataSourceListener(ILcyDataSourceListener aDataSourceListener)
      Adds the given ILcyDataSourceListener. The listener will be notified when datasources are handled using handleDataSources(ILcdDataSource[], ILcyGenericMapComponent, Component).
      Parameters:
      aDataSourceListener - The listener to add.
      See Also:
    • removeDataSourceListener

      public void removeDataSourceListener(ILcyDataSourceListener aDataSourceListener)
      Removes the given ILcyDataSourceListener.
      Parameters:
      aDataSourceListener - The listener to remove.
      See Also:
    • getLogListener

      public ILcdLogListener getLogListener()

      Returns the one and only ILcdLogListener to which end-user messages will be passed when handling data.

      Returns:
      The log listener.
      See Also:
    • setLogListener

      public void setLogListener(ILcdLogListener aLogListener)

      Sets the one and only ILcdLogListener to which end-user messages will be passed when handling data.

      The listener could for example pop up a message dialog if a message is received, or it could collect all messages and display one dialog when handling the data sources has finished (addDataSourceListener can be useful in that context).

      Parameters:
      aLogListener - The log listener. Should not be null
      See Also:
    • getCompositeModelDecoder

      @Deprecated public TLcyCompositeModelDecoder getCompositeModelDecoder()
      Deprecated.
      Use new TLcyCompositeModelDecoder(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeModelDecoder that represents the list of associated ILcdModelDecoders. It can also be directly used as a ILcdModelDecoder itself.

      Adding ILcdModelDecoders to this list allows an add-on to provide Lucy with its own ILcdModelDecoders, offering a wider set of supported data formats.

      When a ILcdModelDecoder is registered, a matching ILcdGXYLayerFactory, ILcyModelContentTypeProvider and ILcyGXYLayerTypeProvider might need to be registered as well. Please refer to getCompositeGXYLayerFactory(), getCompositeGXYLayerTypeProvider() and getCompositeModelContentTypeProvider() for more details.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeModelDecoder.
    • getCompositeModelEncoder

      @Deprecated public TLcyCompositeModelEncoder getCompositeModelEncoder()
      Deprecated.
      Use new TLcyCompositeModelEncoder(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeModelEncoder that represents the list of associated ILcdModelEncoders. It can also be directly used as a ILcdModelEncoder itself.

      Adding ILcdModelEncoders to this list allows an add-on to provide Lucy with its own ILcdModelEncoders, allowing to export to more data formats.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeModelEncoder.
    • getCompositeDataSourceHandler

      @Deprecated public TLcyCompositeDataSourceHandler getCompositeDataSourceHandler()
      Deprecated.
      Use new TLcyCompositeDataSourceHandler(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeDataSourceHandler that represents the list of associated ALcyDataSourceHandlers. It can also be directly used as a ALcyDataSourceHandler itself.

      Adding ALcyDataSourceHandlers to this list allows an add-on to provide Lucy with its own ALcyDataSourceHandlers, offering a wider set of supported data formats.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeDataSourceHandler.
    • getCompositeGXYLayerFactory

      @Deprecated public TLcyCompositeGXYLayerFactory getCompositeGXYLayerFactory()
      Deprecated.
      Use new TLcyCompositeGXYLayerFactory(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeGXYLayerFactory that represents the list of associated ILcdGXYLayerFactorys. It can also be directly used as a ILcdGXYLayerFactory itself.

      ILcdGXYLayerFactorys that are added to this composite should only create ILcdGXYLayers for ILcdModel's they know about. It should not simply create a ILcdGXYLayer for every ILcdModel it gets passed in its createGXYLayer, but instead verify if the given ILcdModel is supported, e.g. by testing the ILcdModelDescriptor of the ILcdModel. If the ILcdModel passed in the createGXYLayer method is not supported, it should return null.

      When a ILcdGXYLayerFactory is registered, a matching ILcyGXYLayerTypeProvider might need to be registered as well. Please refer to getCompositeGXYLayerTypeProvider() for more details.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeGXYLayerFactory.
    • getCompositeGXYLayerTypeProvider

      @Deprecated public TLcyCompositeGXYLayerTypeProvider getCompositeGXYLayerTypeProvider()
      Deprecated.
      Use new TLcyCompositeGXYLayerTypeProvider(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeGXYLayerTypeProvider that represents the list of associated ILcyGXYLayerTypeProviders. It can also be directly used as a ILcyGXYLayerTypeProvider itself.

      Adding ILcyGXYLayerTypeProviders to this list allows an add-on to provide Lucy with its own layer type providers.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeGXYLayerTypeProvider.
    • getCompositeModelContentTypeProvider

      @Deprecated public TLcyCompositeModelContentTypeProvider getCompositeModelContentTypeProvider()
      Deprecated.
      Use new TLcyCompositeModelContentTypeProvider(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeModelContentTypeProvider that represents the list of associated ILcyModelContentTypeProviders. It can also be directly used as a ILcyModelContentTypeProvider itself.

      Adding ILcyModelContentTypeProviders to this list allows an add-on to provide Lucy with its own ILcyModelContentTypeProviders.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeModelContentTypeProvider.
      See Also:
    • getCompositeAsynchronousPaintHintProvider

      @Deprecated public TLcyCompositeAsynchronousPaintHintProvider getCompositeAsynchronousPaintHintProvider()
      Deprecated.
      Use new TLcyCompositeAsynchronousPaintHintProvider(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeAsynchronousPaintHintProvider that represents the list of associated ILcyAsynchronousPaintHintProviders. It can also be directly used as a ILcyAsynchronousPaintHintProvider itself.

      Adding ILcyAsynchronousPaintHintProviders to this list allows an add-on to provide Lucy with its own ILcyAsynchronousPaintHintProviders.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeAsynchronousPaintHintProvider.
    • getCompositeGXYLayerDecoder

      @Deprecated public TLcyCompositeGXYLayerDecoder getCompositeGXYLayerDecoder()
      Deprecated.
      Use new TLcyCompositeGXYLayerDecoder(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeGXYLayerDecoder that represents the list of associated ILcdGXYLayerDecoders. It can also be directly used as a ILcdGXYLayerDecoder itself.

      Adding ILcdGXYLayerDecoders to this list allows an add-on to provide Lucy with its own ILcdGXYLayerDecoders.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeGXYLayerDecoder.
    • getCompositeGXYLayerEncoder

      @Deprecated public TLcyCompositeGXYLayerEncoder getCompositeGXYLayerEncoder()
      Deprecated.
      Use new TLcyCompositeGXYLayerEncoder(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeGXYLayerEncoder that represents the list of associated ILcdGXYLayerEncoders. It can also be directly used as a ILcdGXYLayerEncoder itself.

      Adding ILcdGXYLayerEncoders to this list allows an add-on to provide Lucy with its own ILcdGXYLayerEncoders.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeGXYLayerEncoder.
    • getCompositeModelReferenceDecoder

      @Deprecated public TLcyCompositeModelReferenceDecoder getCompositeModelReferenceDecoder()
      Deprecated.
      Use new TLcyCompositeModelReferenceDecoder(aLucyEnv) instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc of ILcyLucyEnv.addService(Object, int) and the Lucy developer guide for more information.

      Returns the TLcyCompositeModelReferenceDecoder that represents the list of associated ILcdModelReferenceDecoders. It can also be directly used as a ILcdModelReferenceDecoder itself.

      Adding ILcdModelReferenceDecoders to this list allows an add-on to provide Lucy with its own ILcdModelReferenceDecoders.

      Note: the returned composite instance works on the Lucy services.

      Returns:
      The TLcyCompositeModelReferenceDecoder.
    • getCompositeFileTypeDescriptorGroup

      public TLcyCompositeFileTypeDescriptor getCompositeFileTypeDescriptorGroup()
      Returns the TLcyCompositeFileTypeDescriptor that represents the list of associated ALcyFileTypeDescriptors. It can also be directly used as a ALcyFileTypeDescriptor itself.

      Adding ALcyFileTypeDescriptors to this list allows an add-on to provide Lucy with its own ALcyFileTypeDescriptor groups. Such a group could be (though not mandatory) a TLcyCompositeFileTypeDescriptor itself. It could for example represent "All known vector files", composed of several other ALcyFileTypeDescriptors.

      Returns:
      The TLcyCompositeModelReferenceDecoder.
    • getHandlerChooser

      public TLcyDataFormatManager.ALcyHandlerChooser getHandlerChooser()
      Returns the ALcyHandlerChooser that is currently used.
      Returns:
      the ALcyHandlerChooser that is currently used.
      See Also:
    • setHandlerChooser

      public void setHandlerChooser(TLcyDataFormatManager.ALcyHandlerChooser aHandlerChooser)

      The ALcyHandlerChooser is responsible for deciding which ILcdModelDecoder or ALcyDataSourceHandler is used when a data source (a String or ILcdDataSource) is passed to this TLcyDataFormatManager.

      Parameters:
      aHandlerChooser - The handler chooser.
    • setMapComponentChooser

      public void setMapComponentChooser(TLcyDataFormatManager.ALcyMapComponentChooser aMapComponentChooser)

      The ALcyMapComponentChooser is responsible for deciding on which ILcyGenericMapComponent(s) a data source (a String or ILcdDataSource) should be opened when handling data sources.

      Parameters:
      aMapComponentChooser - The map component chooser.
    • getMapComponentChooser

      public TLcyDataFormatManager.ALcyMapComponentChooser getMapComponentChooser()
      Returns the ALcyMapComponentChooser that is currently used.
      Returns:
      the ALcyMapComponentChooser that is currently used.
      See Also: