Class TLcyFormatTool

java.lang.Object
com.luciad.lucy.util.ALcyTool
com.luciad.lucy.format.TLcyFormatTool
All Implemented Interfaces:
ILcdPropertyChangeSource

public class TLcyFormatTool extends ALcyTool

Support class to plug the format-related objects created by an ALcyFormat (e.g. ILcdGXYLayerFactory) into the ILcyLucyEnv. Call the plugInto(ILcyLucyEnv) method to plug all the format-related objects of the given ALcyFormat into the Lucy back-end.

Using this TLcyFormatTool to plug in an ALcyFormat will register most objects as service to the Lucy back-end. As a consequence, everything that is plugged in using this TLcyFormatTool should be unplugged using a TLcyFormatTool as well.

See Also:
  • Constructor Details

    • TLcyFormatTool

      public TLcyFormatTool(ALcyFormat aFormat)

      Creates a TLcyFormatTool for the given ALcyFormat.

      Parameters:
      aFormat - The ALcyFormat whose contents needs to be plugged into the Lucy backend. Must not be null.
  • Method Details

    • getFormat

      public ALcyFormat getFormat()

      Returns the ALcyFormat for which this tool was created.

      Returns:
      The ALcyFormat for which this tool was created. Never null.
    • plugInto

      public void plugInto(ILcyLucyEnv aLucyEnv)

      Plugs this tool. This method is usually called from ALcyAddOn#plugInto.

      Lets the format create all the format-related objects and plugs them into the given Lucy backend.

      Overrides:
      plugInto in class ALcyTool
      Parameters:
      aLucyEnv - The environment to plug into.
    • unplugFrom

      public void unplugFrom(ILcyLucyEnv aLucyEnv)
      Description copied from class: ALcyTool

      Unplugs this tool. This method is usually called from ALcyAddOn#unplugFrom.

      Overrides:
      unplugFrom in class ALcyTool
      Parameters:
      aLucyEnv - The environment to unplug from, must be identical to the environment given to plugInto.
    • findFormat

      public static <T extends ALcyFormat> T findFormat(ALcyFormat aFormat, Class<T> aFormatClass)

      Utility method to find an ALcyFormat (or ALcyFormatWrapper) of the given class. This can be useful to, in a chain of wrapped formats, retrieve a format of the given class.

      To do so, it assumes every format wrapper extends from ALcyFormatWrapper.

      Consider for example this chain of formats:

      
       ALcyFormat format =
         new TLcyAsynchronousFormatWrapper( new TLcySafeGuardFormatWrapper( new MyFormat() ) )
       
      A call to
      
       findFormat(format, TLcySafeGuardFormatWrapper.class)
       
      will return the TLcySafeGuardFormatWrapper instance. A call to
      
       findFormat(format, TLcyMutableFileFormatWrapper.class)
       
      will return null.

      Parameters:
      aFormat - The format to start looking from.
      aFormatClass - The class to find.
      Returns:
      null if no such format was found, or an instance of (a subclass of) the given aFormatClass.
    • findBaseFormat

      public static ALcyFormat findBaseFormat(ALcyFormat aFormat)

      Utility method to, in a chain of wrapped formats, find the deepest format.

      To do so, it assumes every format wrapper extends from ALcyFormatWrapper.

      Consider for example this chain of formats:

      
       ALcyFormat format =
         new TLcyAsynchronousFormatWrapper( new TLcySafeGuardFormatWrapper( new MyFormat() ) )
       
      A call to
      
       findBaseFormat(format)
       
      will return the MyFormat instance.

      Parameters:
      aFormat - The format to find the base format of.
      Returns:
      The base format of the given aFormat.