Class TLcdModelMetadata.Builder

java.lang.Object
com.luciad.model.TLcdModelMetadata.Builder
Enclosing class:
TLcdModelMetadata

public static class TLcdModelMetadata.Builder extends Object
Builder for creating a model metadata object.
Since:
2018.0
  • Method Details

    • resourceMetadata

      public TLcdModelMetadata.Builder resourceMetadata(ILcdResourceMetadata aResourceMetadata)
      Sets the resource metadata to use and attempts to extract the following information from it:
      • title
      • format
      • entry point - including associated mime type, if defined
      • supporting sources - including associated mime types, if defined
      • model reference
      • bounds
      • dimensional information - specifically temporal and vertical axis
      • data category - ISO 19115 defines a similar concept with its "spatial representation type". Only the values GRID and VECTOR can be mapped to a corresponding DataCategory (RASTER and VECTOR respectively); other values will be mapped to UNKNOWN
      All values that are successfully extracted from the resource metadata will override corresponding values that were previously set in this builder. Any previously set resource metadata instance will also be overridden.

      Note: this resource metadata might be altered by any subsequent calls to builder methods. Calling format(java.lang.String) on this builder, for example, will also set the format in the resource metadata instance.
      Parameters:
      aResourceMetadata - the new resource metadata, never null. This should be an instance of TLcdISO19115Metadata, otherwise the builder will fail to build.
      Returns:
      this builder
    • format

      public TLcdModelMetadata.Builder format(String aFormat)
      Sets the data format to use.
      Parameters:
      aFormat - the format of the model, never null.
      Returns:
      this builder
    • title

      public TLcdModelMetadata.Builder title(String aTitle)
      Sets the title to use.
      Parameters:
      aTitle - the title of the model, never null.
      Returns:
      this builder
    • modelReference

      public TLcdModelMetadata.Builder modelReference(ILcdModelReference aModelReference)
      Sets the model reference to use.
      Parameters:
      aModelReference - the model reference, or null if the model is not georeferenced
      Returns:
      this builder
    • bounds

      public TLcdModelMetadata.Builder bounds(ILcdBounded aBounds)
      Sets the bounds to use. Next to a bounds object, a bounded object (such as the model itself) can be passed.
      Parameters:
      aBounds - the bounds of the model or the object that has the bounds (e.g. the model itself), expressed in the model reference
      Returns:
      this builder
    • dimensions

      public TLcdModelMetadata.Builder dimensions(List<? extends ILcdDimension<?>> aDimensions)
      Sets the dimensions to use. If not set, an empty list is used or it will be derived from the resource metadata.
      Parameters:
      aDimensions - the dimensions of the model. Can be empty, but never null.
      Returns:
      this builder
      See Also:
    • unitsOfMeasure

      public TLcdModelMetadata.Builder unitsOfMeasure(Set<ILcdISO19103UnitOfMeasure> aUnitsOfMeasure)
      Sets the units of measure of the model.
      Parameters:
      aUnitsOfMeasure - the units of measure of the data the model contains
      Returns:
      this builder
      Since:
      2023.1
    • addUnitOfMeasure

      public TLcdModelMetadata.Builder addUnitOfMeasure(ILcdISO19103UnitOfMeasure aUnitOfMeasure)
      Adds a unit of measure to the set of units of measure contained in the model.
      Parameters:
      aUnitOfMeasure - the unit of measure of the data the model contains, never null
      Returns:
      this builder
      Since:
      2023.1
    • dataSource

      public TLcdModelMetadata.Builder dataSource(ILcdDataSource aDataSource)
      Sets the data source to use. If the given data source is an instance of TLcdDataSource and no entry point is set when the model metadata are being built (using entryPoint(TLcdModelMetadata.Source)), the entry point will be set to TLcdDataSource.getSourceName() from the given data source. The corresponding mime type will be determined as "application/xml" if the source name has a .xml extension, "application/json" if the source name has a .json extension, or "application/octet-stream" in any other case. This method overrides any previously set data source.
      Parameters:
      aDataSource - the data source of the model, or null if the source is unknown.
      Returns:
      this builder
    • entryPoint

      public TLcdModelMetadata.Builder entryPoint(TLcdModelMetadata.Source aEntryPoint)
      Sets the entry point to the given TLcdModelMetadata.Source. This represents the main source, usually a file, which can be decoded by its corresponding model decoder. If no ILcdDataSource is set when the model metadata are being built (using dataSource(ILcdDataSource)), the data source will be set to a newly created TLcdDataSource, based on the entry point's source name. This method overrides any previously set entry point.
      Parameters:
      aEntryPoint - the entry point of the model, or null if the entry point is unknown or undefined.
      Returns:
      this builder
    • supportingSources

      public TLcdModelMetadata.Builder supportingSources(List<TLcdModelMetadata.Source> aSources)
      Sets the list of supporting sources to use. These point to resources that do not represent a model on their own, but rather provide supporting information about a model (for example, a .prj file next to the entry point, which defines the coordinate reference system of the model). If not set, an empty list is used.

      It is recommended to use absolute paths whenever possible.

      Parameters:
      aSources - The list of supporting sources. Can be empty, but never null.
      Returns:
      this builder
    • addSupportingSource

      public TLcdModelMetadata.Builder addSupportingSource(TLcdModelMetadata.Source aSource)
      Adds the given source to the list of supporting sources to use. These point to resources that do not represent a model on their own, but rather provide supporting information about a model (for example, a .prj file next to the entry point, which defines the coordinate reference system of the model).

      If a supporting sources callable was previously set with supportingSources(Callable), this method will wrap that callable in a new callable which appends the given supporting source to the result.

      Parameters:
      aSource - The supporting source. Never null. It is recommended to use absolute paths whenever possible.
      Returns:
      this builder
    • supportingSources

      public TLcdModelMetadata.Builder supportingSources(Callable<List<TLcdModelMetadata.Source>> aSourcesCallable)
      Sets the callable for discovering supporting sources of the model. These point to resources that do not represent a model on their own, but rather provide supporting information about a model (for example, a .prj file next to the entry point, which defines the coordinate reference system of the model). If not set, an empty list is used.

      It is recommended to use absolute paths whenever possible.

      Parameters:
      aSourcesCallable - A callable that should return a list containing the metadata of all supporting sources of the model. Can return an empty list or throw exceptions, but should never return null. This callable will be called lazily, the first time when the sources are queried. It will only be called once, as its result will then be cached and returned for every subsequent query.
      Returns:
      this builder
    • addDataCategory

      public TLcdModelMetadata.Builder addDataCategory(TLcdModelMetadata.DataCategory aDataCategory)
      Adds a data category of to the set of data categories contained in the model. If not set, Collections.emptySet() is used.
      Parameters:
      aDataCategory - the kind of data the model contains, never null
      Returns:
      this builder
    • dataCategories

      public TLcdModelMetadata.Builder dataCategories(Set<TLcdModelMetadata.DataCategory> aDataCategories)
      Sets the data category set of the model. If not set, Collections.emptySet() is used.
      Parameters:
      aDataCategories - the kind of data the model contains
      Returns:
      this builder
    • dataSeries

      public TLcdModelMetadata.Builder dataSeries(List<TLcdModelMetadata> aDataSeries)
      Sets the data series children of the model. If not set, an empty list is used.
      Parameters:
      aDataSeries - a list containing the metadata of all child models in the comprised data series. Can be empty, but never null.
      Returns:
      this builder
    • dataSeries

      public TLcdModelMetadata.Builder dataSeries(Callable<List<TLcdModelMetadata>> aDataSeries)
      Sets the callable for discovering data series children of the model. If not set, an empty list is used as data series.
      Parameters:
      aDataSeries - A callable that should return a list containing the metadata of all child models in the comprised data series. Can return an empty list or throw exceptions, but should never return null. This callable will be called lazily, the first time when the data series are queried. It will only be called once, as its result will then be cached and returned for every subsequent query.
      Returns:
      this builder
    • fromModel

      public TLcdModelMetadata.Builder fromModel(ILcdModel aModel)
      Attempts to extract the following metadata properties from the given model: Any values that are found on the model will override any previously set values in this builder.
      Parameters:
      aModel - The model from which the metadata will be extracted.
      Returns:
      this builder
    • build

      public TLcdModelMetadata build()
      Creates a new model metadata object. Requires at least the following properties to be set:
      Returns:
      a new model metadata object
      Throws:
      IllegalStateException - If any of the mandatory properties has not been set.