Class ALfnCoverageMetadata.Builder<B extends ALfnCoverageMetadata.Builder<B>>

java.lang.Object
com.luciad.fusion.tilestore.metadata.ALfnResourceMetadata.Builder<B>
com.luciad.fusion.tilestore.metadata.ALfnCoverageMetadata.Builder<B>
Type Parameters:
B - the builder type
Direct Known Subclasses:
TLfnCoverageMetadata.Builder, TLfnRasterCoverageMetadata.Builder, TLfnVectorCoverageMetadata.Builder
Enclosing class:
ALfnCoverageMetadata

public abstract static class ALfnCoverageMetadata.Builder<B extends ALfnCoverageMetadata.Builder<B>> extends ALfnResourceMetadata.Builder<B>
Abstract builder for coverage metadata.

Auto-defaults

Properties that are not explicitly set on the builder will have smart auto-defaults. These auto-defaults are computed from the asset metadata. In order to access to the asset metadata, this builder either needs a ILfnResourceMetadataResolver, which can be passed using ALfnCoverageMetadata.asBuilder(ILfnResourceMetadataResolver) or one of the static family of methods such as TLfnRasterCoverageMetadata.newBuilder(ILfnResourceMetadataResolver), or it needs the asset metadata to be passed directly to the builder using addAssetInfo(ALfnAssetMetadata, String).

You can typically reset individual properties to their defaults by setting an invalid value such as null or -1. For example boundingBox(null) will reset the bounding box to its default value. The details are documented on this builder's individual setters.

When no asset infos have been set, or when at least one asset metadata could not be resolved, the defaults fall back to constant defaults. This is documented on this builder's individual setters.

The resolver and asset metadata are not persisted once the coverage metadata has been built using build(). A coverage metadata only contains links to the assets (the ALfnCoverageMetadata.AssetInfos). When you create a builder again from a coverage metadata, and if you want to use the auto-default mechanism again, you need to give a resolver to the builder again to make sure it can resolve the links.

Resolver

You need a resolver if you need the builder to resolve asset metadata from the asset infos. For example:
  • If you are creating a new coverage and you want the coverage to automatically match all its assets' properties as closely as possible.
  • If you want to set any properties to their defaults when adding an asset to a coverage that already has multiple assets.
You do not always need a resolver on the builder. For example:
  • If you are creating a new coverage and you are setting all properties explicitly.
  • If you are creating a new coverage and the constant defaults are good enough (EPSG:4326, world bounding box, ...).
  • If you are working on an existing coverage and you just want to add some assets without changing any of the coverage's properties.
  • If you add all asset infos by passing the asset metadata explicitly, using addAssetInfo(ALfnAssetMetadata, String).
Since:
11.0
See Also:
  • Method Details

    • type

      public B type(ELfnDataType aType)
      Sets the required type of the coverage. If not set, or if set to null, the default type will be used.

      For vector coverages, the default type is VECTOR.

      For raster coverages, the default type depends on the asset metadatas.

      • If no asset metadatas have been set, the default type is IMAGE.
      • If the asset metadatas have a common type, then this will be the default.
      • If the asset metadatas have a mixture of types, the default will be IMAGE since it is the greatest common denominator.
      As a consequence of this method, the default tile size will be adjusted, and possibly also the default bounding box, aiming for square pixels.

      For non-tiled coverages, the type is always null.

      Parameters:
      aType - a type, or null to indicate the default type
      Returns:
      this builder
      Since:
      2013.0
    • setType

      public final B setType(ELfnDataType aType)
    • assetSourcesInTileStore

      public final B assetSourcesInTileStore(boolean aOn)
      Sets whether or not the asset sources should be in the Tile Store.
      Parameters:
      aOn - true if the asset sources should be in the Tile Store
      Returns:
      this builder
      Since:
      2013.1
    • featureTypeStyles

      public final B featureTypeStyles(List<TLcdSLDFeatureTypeStyle> aFeatureTypeStyles)
      Sets the SLD feature type styles to be used for the visualization of the coverage. If not set or if set to null, the default SLD feature type styles will be used, which is a collection of styles defined by SLD files next to the asset part's sources, or otherwise an empty list.

      SLD feature type styles allow to define visibility of features using rules with min. and max. scale denominators.

      Setting the feature type styles may cause changes to the default max. level.

      Warning: for TLfnVectorCoverageMetadata instances, the OGC filters and SLD feature type styles are mutually exclusive. Setting them both will throw an exception when trying to build the vector coverage metadata.

      Parameters:
      aFeatureTypeStyles - the SLD feature type styles to be used for the visualization of the coverage, or null to reset to default
      Returns:
      this builder
      Since:
      2013.1
      See Also:
    • featureTypeStyles

      public final B featureTypeStyles(TLcdSLDFeatureTypeStyle... aFeatureTypeStyles)
      Sets the SLD feature type styles to be used for the visualization of the coverage. If not set or if set to null, the default SLD feature type styles will be used, which is an empty list.

      SLD feature type styles allow to define visibility of features using rules with min. and max. scale denominators. If SLD feature type styles are set, they take precedence over any OGC filters that may have been set.

      Setting the feature type styles may cause changes to the default max. level.

      Parameters:
      aFeatureTypeStyles - the SLD feature type styles to be used for the visualization of the coverage, or null to reset to default
      Returns:
      this builder
      Since:
      2013.1
    • level0RowCount

      public final B level0RowCount(long aLevel0RowCount)
      Sets the required level 0 row count. Sane values are in the range [1..15]. If not set, or if set to a negative value, the default level-0 row count will be used. The default depends on the bounding box and, in case of raster coverages, on the tile size, and aims for square tiles. 'Square' is relative to the geographic reference.

      This method may cause adjustments to the default level-0 column count, aiming for square tiles. For raster coverages, this may cause additional adjustments of tile size and bounding box, aiming for square pixels.

      When the row count is not in range, this method will throw an IllegalArgumentException.

      Parameters:
      aLevel0RowCount - a row count in the range [0, 15], or negative to reset to default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - when the row count is out of range
      Since:
      2013.0
      See Also:
    • setLevel0RowCount

      public final B setLevel0RowCount(long aRowCount)
      Deprecated.
    • level0ColumnCount

      public final B level0ColumnCount(long aLevel0ColumnCount)
      Sets the required level 0 column count. Sane values are in the range [1..15]. If not set, or if set to a negative value, the default level-0 column count will be used. The default depends on the bounding box and, in case of raster coverages, on the tile size, and aims for square tiles. 'Square' is relative to the geographic reference.

      This method may cause adjustments to the default level-0 row count, aiming for square tiles. For raster coverages, this may cause additional adjustments of tile size and bounding box, aiming for square pixels.

      When the column count is not in range, this method will throw an IllegalArgumentException.

      Parameters:
      aLevel0ColumnCount - a column count in the range [0, 15], or negative to reset to default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - when the row count is out of range
      Since:
      2013.0
      See Also:
    • setLevel0ColumnCount

      public final B setLevel0ColumnCount(long aColumnCount)
      Deprecated.
    • layout

      public final B layout(long aCoverageWidth, long aCoverageHeight)
      A convenience method for setting both the width and height of a coverage in terms of tiles.

      Beware that the order of the arguments is different from the row- and column arguments. The width corresponds to the level-0 column count, while the height corresponds to the level-0 row count.

      Parameters:
      aCoverageWidth - the coverage width in tiles, which is the amount of tiles at level 0 in the longitudinal direction. This corresponds to the level-0 column count. Use a negative value to reset to default.
      aCoverageHeight - the coverage height in tiles, which is the amount of tiles at level 0 in the latitudinal direction. This corresponds to the level-0 row count. Use a negative value to reset to default.
      Returns:
      this builder
      Since:
      2013.0
      See Also:
    • setCoverageLayout

      public final B setCoverageLayout(long aCoverageWidth, long aCoverageHeight)
      Deprecated.
      use layout(long, long) instead
    • boundingBox

      public final B boundingBox(ILcdBounds aBoundingBox)
      Sets the required 2D bounding box of the coverage, possibly converting the given bounding box to a consistent 2D bounding box. If not set or if set to null, the default 2D bounding box will be used. The default 2D bounding box will be computed as the union of the bounding boxes of the asset parts, transformed to the geographic reference of the coverage. If there are no asset parts, the default 2D bounding box will be the world bounds.

      If the given bounding box is a 3D bounding box, it will be converted to a 2D bounding box. For example a TLcdLonLatHeightBounds instance will be converted to a TLcdLonLatBounds instance.

      If the given bounding box is of a type which is inconsistent with the coverage's geographic reference, the bounding box may be converted. For example a TLcdXYBounds instance will be converted to a TLcdLonLatBounds instance if the geographic reference is geodetic.

      If you set the geographic reference after the bounding box, the bounding box may need to be transformed. Transformation ensures a valid bounding box, but it is a lossy operation in the sense that bounding boxes can only 'grow'. You will end up with a valid bounding box, but possibly a larger one than you intended. To avoid this, it is recommended to set the geographic reference before setting the bounding box.

      This method may cause adjustments to the layout and, for raster coverages, the tile size, aiming for square tiles and square pixels.

      Parameters:
      aBoundingBox - a bounding box, or null to reset to default
      Returns:
      this builder
      Since:
      2013.0
    • setBoundingBox

      public final B setBoundingBox(ILcdBounds aBoundingBox)
      Deprecated.
    • geoReference

      public final B geoReference(ILcdGeoReference aGeoReference)
      Sets the required geographic reference of the coverage's bounding box. If not set or if set to null, the default geographic reference will be used. If no asset metadatas have been set, or if they have a mixture of geographic references, the default geodetic reference "EPSG:4326" will be used. If asset metadatas have been set and they have a common geographic reference, that will be the default.

      This method may cause adjustments to the bounding box, layout and, for raster coverages, the tile size.

      Parameters:
      aGeoReference - a geographic reference, or null to reset to default
      Returns:
      this builder
      Since:
      2013.0
    • setGeoReference

      public final B setGeoReference(ILcdGeoReference aGeoReference)
    • format

      public final B format(String aMimeType)
      Sets the required tile format (MIME type) of the coverage. If not set or if set to null, the default will be used which depends on the coverage type and asset types:
      • IMAGE coverage without VECTOR assets: "image/jpeg"
      • IMAGE coverage with at least one VECTOR asset: "image/png"
      • ELEVATION coverage: "image/tiff" (since 2014.0)
      • VECTOR coverage: "application/vnd.luciad.vector.gzip", version "1.0"

      The tile format "image/tiff" for ELEVATION is not compatible with clients prior to V2014.0. For backwards compatibility, you need to set the tile format explicitly to "image/png" for those coverages.

      The MIME type should correspond to one of the codecs registered on ALfnEnvironment. See ALfnEnvironment.getTileDataCodecs(com.luciad.fusion.tilestore.ELfnDataType) for a list of the defaults. Because this builder does not have access to the environment, it assumes the default codecs exist. If you've modified the codecs of the environment, in particular if you've replaced default codecs with your own, you need to set the format explicitly.

      This method may cause adjustments to the format version.

      Parameters:
      aMimeType - a tile format as a MIME type, or null to reset to default
      Returns:
      this builder
      Since:
      2013.0
      See Also:
    • formatVersion

      public final B formatVersion(String aVersion)
      Sets the optional tile format version of the coverage. The default depends on the coverage type and the default format:
      • VECTOR coverages with the default format: "1.0"
      • any other coverages: null
      Parameters:
      aVersion - a tile format version, or null to reset to default (the default may be null itself)
      Returns:
      this builder
      Since:
      2013.0
    • tileFormat

      public final B tileFormat(String aMimeType, String aVersion)
      Sets the required tile format (MIME type) of the coverage, with a given version.
      Parameters:
      aMimeType - a tile format, or null to reset to default
      aVersion - a version, or null to reset to default (the default may itself be null)
      Returns:
      this builder
      Since:
      2013.0
    • setFormat

      public final B setFormat(String aMimeType)
      Deprecated.
    • setFormatVersion

      public final B setFormatVersion(String aVersion)
    • assetInfos

      public final B assetInfos(List<ALfnCoverageMetadata.AssetInfo> aAssetInfos)
      Sets the optional assets contributing to the coverage. It defaults to an empty list if unspecified.

      If this builder was created with an ILfnResourceMetadataResolver, and if all asset metadatas can be found, this method may cause defaults to be adjusted.

      Parameters:
      aAssetInfos - a list of asset infos, must not be null
      Returns:
      this builder
      Since:
      2013.0
      See Also:
    • setAssetInfos

      public final B setAssetInfos(List<ALfnCoverageMetadata.AssetInfo> aAssetInfos)
      Deprecated.
    • assetInfos

      public final B assetInfos(ALfnCoverageMetadata.AssetInfo... aAssetInfos)
      Sets the optional assets contributing to the coverage. It defaults to an empty list if unspecified.

      If this builder was created with an ILfnResourceMetadataResolver, and if all asset metadatas can be found, this method may cause defaults to be adjusted.

      Parameters:
      aAssetInfos - an array of asset infos, must not be null
      Returns:
      this builder
      Since:
      2013.0
      See Also:
    • setAssetInfos

      public final B setAssetInfos(ALfnCoverageMetadata.AssetInfo... aAssetInfos)
      Deprecated.
    • scaleDenominators

      public final B scaleDenominators(List<Integer> aScaleDenominators)
      Sets the optional scale denominators of the coverage. It defaults to an empty list if unspecified.
      Parameters:
      aScaleDenominators - the scale denominators, must not be null
      Returns:
      this builder
      Since:
      2013.0
      See Also:
    • setScaleDenominators

      public final B setScaleDenominators(List<Integer> aScaleDenominators)
      Deprecated.
      Since:
      11.0
    • scaleDenominators

      public final B scaleDenominators(int... aScaleDenominators)
      Sets the optional scale denominators of the coverage. It defaults to an empty list if unspecified.
      Parameters:
      aScaleDenominators - the scale denominators, must not be null
      Returns:
      this builder
      Since:
      2013.0
      See Also:
    • setScaleDenominators

      public final B setScaleDenominators(int... aScaleDenominators)
      Deprecated.
      Since:
      11.0
    • dataDensity

      public final B dataDensity(ELfnDataDensity aDataDensity)
      Sets the data density of this coverage. The default is ELfnDataDensity.OVERVIEW.

      Can be used by rendering engines as a hint on how to render the coverage data. See ELfnDataDensity for more information on the different data density types.

      Parameters:
      aDataDensity - a data density, or null to clear it
      Since:
      2013.0
    • setDataDensity

      public final B setDataDensity(ELfnDataDensity aDataDensity)
      Deprecated.
      Since:
      2012.0
    • messageDigestAlgorithm

      public final B messageDigestAlgorithm(String aMessageDigestAlgorithm)
      Sets a message digest algorithm on the coverage, to be used for corruption checking on the server.
      Parameters:
      aMessageDigestAlgorithm - the message digest algorithm, may be null
      Since:
      2013.0
    • setMessageDigestAlgorithm

      public final B setMessageDigestAlgorithm(String aMessageDigestAlgorithm)
      Deprecated.
      Since:
      2012.0
    • ignoreNonFatalFailures

      public final B ignoreNonFatalFailures(boolean aIgnoreNonFatalFailures)
      Indicates whether non-fatal failures can be ignored during the fusion process.

      See ALfnCoverageMetadata.isIgnoreNonFatalFailures() for more details.

      By default, this is false.

      Returns:
      this builder
      Since:
      2013.0
    • ignoreNonFatalFailures

      public final B ignoreNonFatalFailures()
      Indicates that non-fatal failures can be ignored during the fusion process.

      See ALfnCoverageMetadata.isIgnoreNonFatalFailures() for more details.

      By default, this is false.

      Returns:
      this builder
      Since:
      2013.0
    • build

      public abstract ALfnCoverageMetadata build()
      Builds a coverage metadata, using default values if none provided.
      Specified by:
      build in class ALfnResourceMetadata.Builder<B extends ALfnCoverageMetadata.Builder<B>>
      Returns:
      a coverage metadata, never null
    • getType

      public final ELfnDataType getType()
      Gets this builder's current type, possibly null.
      Returns:
      this builder's current type
      Since:
      2012.0
    • isAssetSourcesInTileStore

      public final boolean isAssetSourcesInTileStore()
      Tells if the asset sources should be in the Tile Store. When true, fusion will copy the asset sources to the Tile Store.

      A use case for this is to support WMS GetFeatureInfo requests for rasterized vector data. The WMS GetMap requests use the rasterized tiles for performance. The WMS GetFeatureInfo requests use the asset data. Such a coverage has this flag enabled and has a type. When fusing such a coverage, fusion will first copy the asset data to the Tile Store and then create the tiles.

      Another use case is pixel-perfect WMS for vector data. Both the WMS GetMap and GetFeatureInfo requests use the asset sources, and tiles are entirely absent. Such a coverage does not have a type (untyped), parameters such as format are irrelevant (may be present or absent).

      Note that this feature was introduced for S-57. Other formats may or may not support being copied to the Tile Store.

      Returns:
      if the asset sources should be in the Tile Store
      Since:
      2013.1
    • getFeatureTypeStyles

      public List<TLcdSLDFeatureTypeStyle> getFeatureTypeStyles()
      Gets this builder's current style, possibly null.
      Returns:
      this builder's current style
      Since:
      2013.1
    • getLevel0RowCount

      public final long getLevel0RowCount()
      Gets this builder's current level-0 row count, possibly -1.
      Returns:
      this builder's current level-0 row count
      Since:
      2012.0
    • getLevel0ColumnCount

      public final long getLevel0ColumnCount()
      Gets this builder's current level-0 column count, possibly -1.
      Returns:
      this builder's current level-0 column count
      Since:
      2012.0
    • getBoundingBox

      public final ILcdBounds getBoundingBox()
      Gets this builder's current 2D bounding box.
      Returns:
      this builder's current 2D bounding box, never null
      Since:
      2012.0
    • getFormat

      public final String getFormat()
      Gets this builder's current format.
      Returns:
      this builder's current format, possibly null
    • getFormatVersion

      public final String getFormatVersion()
      Gets this builder's current format version.
      Returns:
      this builder's current format version, possibly null
      Since:
      2012.0
    • getGeoReference

      public final ILcdGeoReference getGeoReference()
      Gets this builder's current geographic reference.
      Returns:
      this builder's current geographic reference, never null
      Since:
      2012.0
    • getAssetInfos

      public final List<ALfnCoverageMetadata.AssetInfo> getAssetInfos()
      Gets this builder's current asset infos (unmodifiable).
      Returns:
      this builder's current asset infos, possibly null
      Since:
      2012.0
    • getScaleDenominators

      public final List<Integer> getScaleDenominators()
      Gets this builder's current scale denominators (unmodifiable).
      Returns:
      this builder's current scale denominators, possibly null
      Since:
      2012.0
    • getDataDensity

      public final ELfnDataDensity getDataDensity()
      Gets this builder's current data density.
      Returns:
      this builder's current data density, possibly null
      Since:
      2012.1
    • getMessageDigestAlgorithm

      public final String getMessageDigestAlgorithm()
      Gets this builder's current message digest algorithm.
      Returns:
      this builder's current message digest algorithm, possibly null
      Since:
      2012.0
    • isIgnoreNonFatalFailures

      public final boolean isIgnoreNonFatalFailures()
      Indicates whether non-fatal failures can be ignored during the fusion process.

      See ALfnCoverageMetadata.isIgnoreNonFatalFailures() for more details.

      By default, this is false.

      Returns:
      true if non-fatal failures may be ignored, false if the fusion process should fail
      Since:
      2013.0
    • addAssetInfo

      public final B addAssetInfo(ALfnCoverageMetadata.AssetInfo aAssetInfo)
      Adds an asset info. As a consequence of this method, the defaults for several properties may be updated.
      1. The default type will be adjusted to match the asset metadatas.
      2. The default geographic reference will be adjusted to match the asset metadatas.
      3. The default bounding box will be adjusted to span all the asset's bounding boxes.
      4. The default layout (level-0 row and column count) will be adjusted to match the bounding box as well as possible, aiming for square tiles. 'Square' is relative to the geographic reference.
      For raster coverage metadata specifically:
      • The default tile size will be adjusted to match the bounding box and layout as well as possible, aiming for square pixels. Square pixels are a requirement for WMTS compliancy. 'Square' is relative to the geographic reference.
      • The default bounding box will be adjusted one final time to match the tile size and layout, aiming for WMTS compliancy. This means that, by default, raster coverages will strive to be WMTS compliant.
      Parameters:
      aAssetInfo - the asset info to add, must not be null
      Returns:
      this builder
      Since:
      2014.0
    • addAssetInfo

      public final B addAssetInfo(ALfnAssetMetadata aAssetMetadata, String aStatus)

      Adds an asset info from a given asset metadata with a given status ALfnCoverageMetadata.AssetInfo.STATUS_INCOMPLETE or ALfnCoverageMetadata.AssetInfo.STATUS_COMPLETE. When adding a new asset, the status should be STATUS_INCOMPLETE.

      This method is a convenience method for creating a builder with a resolver and adding an asset info without actually having to create a resolver. In other words, the code block:

      
       ALfnAssetMetadata assetMetadata;
       ALCoverageMetadata coverageMetadata = TLfnRasterCoverageMetadata
           .newBuilder()
           .addAssetInfo(assetMetadata, AssetInfo.STATUS_INCOMPLETE)
           .build();
       

      is equivalent to:

      
       ALfnAssetMetadata assetMetadata;
       List<ALfnAssetMetadata> assetMetadatas = Collections.singletonList(assetMetadata);
       ILfnResourceMetadataResolver resolver = new TLfnCollectionResourceMetadataResolver(assetMetadatas);
       ALfnCoverageMetadata coverageMetadata = TLfnRasterCoverageMetadata
           .newBuilder(resolver)
           .addAssetInfo(assetMetadata.getId(), AssetInfo.STATUS_INCOMPLETE)
           .build();
       
      Parameters:
      aAssetMetadata - the asset metadata to be added, must not be null
      aStatus - the status of the asset info, one of STATUS_INCOMPLETE or STATUS_COMPLETE, must not be null
      Returns:
      this builder
      Since:
      2014.0
      See Also: