Package com.luciad.model
Class TLcdModelMetadata.Builder
java.lang.Object
com.luciad.model.TLcdModelMetadata.Builder
- Enclosing class:
TLcdModelMetadata
Builder for creating a model metadata object.
- Since:
- 2018.0
-
Method Summary
Modifier and TypeMethodDescriptionaddDataCategory
(TLcdModelMetadata.DataCategory aDataCategory) Adds a data category of to the set of data categories contained in the model.Adds the given source to the list of supporting sources to use.addUnitOfMeasure
(ILcdISO19103UnitOfMeasure aUnitOfMeasure) Adds a unit of measure to the set of units of measure contained in the model.bounds
(ILcdBounded aBounds) Sets the bounds to use.build()
Creates a new model metadata object.dataCategories
(Set<TLcdModelMetadata.DataCategory> aDataCategories) Sets the data category set of the model.dataSeries
(Callable<List<TLcdModelMetadata>> aDataSeries) Sets the callable for discoveringdata series
children of the model.dataSeries
(List<TLcdModelMetadata> aDataSeries) Sets thedata series
children of the model.dataSource
(ILcdDataSource aDataSource) Sets the data source to use.dimensions
(List<? extends ILcdDimension<?>> aDimensions) Sets the dimensions to use.entryPoint
(TLcdModelMetadata.Source aEntryPoint) Sets the entry point to the givenTLcdModelMetadata.Source
.Sets the data format to use.Attempts to extract the following metadata properties from the given model: Title - Extracted from the model's descriptor withILcdModelDescriptor.getDisplayName()
. Format - Extracted from the model's descriptor withILcdModelDescriptor.getTypeName()
. Entry point - Extracted from the model's descriptor withILcdModelDescriptor.getSourceName()
.modelReference
(ILcdModelReference aModelReference) Sets the model reference to use.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"
.supportingSources
(Callable<List<TLcdModelMetadata.Source>> aSourcesCallable) Sets the callable for discovering supporting sources of the model.supportingSources
(List<TLcdModelMetadata.Source> aSources) Sets the list of supporting sources to use.Sets the title to use.unitsOfMeasure
(Set<ILcdISO19103UnitOfMeasure> aUnitsOfMeasure) Sets the units of measure of the model.
-
Method Details
-
resourceMetadata
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 valuesGRID
andVECTOR
can be mapped to a correspondingDataCategory
(RASTER
andVECTOR
respectively); other values will be mapped toUNKNOWN
Note: this resource metadata might be altered by any subsequent calls to builder methods. Callingformat(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 ofTLcdISO19115Metadata
, otherwise the builder will fail to build.- Returns:
- this builder
-
format
Sets the data format to use.- Parameters:
aFormat
- the format of the model, never null.- Returns:
- this builder
-
title
Sets the title to use.- Parameters:
aTitle
- the title of the model, never null.- Returns:
- this builder
-
modelReference
Sets the model reference to use.- Parameters:
aModelReference
- the model reference, or null if the model is not georeferenced- Returns:
- this builder
-
bounds
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 themodel reference
- Returns:
- this builder
-
dimensions
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
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
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
Sets the data source to use. If the given data source is an instance ofTLcdDataSource
and no entry point is set when the model metadata are being built (usingentryPoint(TLcdModelMetadata.Source)
), the entry point will be set toTLcdDataSource.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
Sets the entry point to the givenTLcdModelMetadata.Source
. This represents the main source, usually a file, which can be decoded by its corresponding model decoder. If noILcdDataSource
is set when the model metadata are being built (usingdataSource(ILcdDataSource)
), the data source will be set to a newly createdTLcdDataSource
, 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
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
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 returnnull
. 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
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
Sets thedata 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
Sets the callable for discoveringdata 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 returnnull
. 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
Attempts to extract the following metadata properties from the given model:- Title - Extracted from the model's descriptor with
ILcdModelDescriptor.getDisplayName()
. - Format - Extracted from the model's descriptor with
ILcdModelDescriptor.getTypeName()
. - Entry point - Extracted from the model's descriptor with
ILcdModelDescriptor.getSourceName()
. The mime type will be set to"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. - Data source - Extracted from the model's descriptor with
ILcdDataSourceModelDescriptor.getDataSource()
, if that descriptor is an instance ofILcdDataSourceModelDescriptor
. - Model reference - Extracted from the model with
ILcdModel.getModelReference()
. - Bounds - Calculated based on the model, its submodels and/or elements (if any), or simply extracted
from the model if it is an instance of
ILcdBounded
. - Dimensions - Extracted from the model with
ILcdMultiDimensional.getDimensions()
, if the model is an instance ofILcdMultiDimensional
. - Data category - If the model's descriptor is an instance of
ILcdImageModelDescriptor
, data categoryRASTER
will be added to this builder. If the model is an instance ofILcdModelContainer
, the datacategories of all submodels will be added to this builder, as retrieved via their respectiveILcdModel.getModelMetadata()
. In any other case this method will not make any assumptions about the data category.
- Parameters:
aModel
- The model from which the metadata will be extracted.- Returns:
- this builder
- Title - Extracted from the model's descriptor with
-
build
Creates a new model metadata object. Requires at least the following properties to be set:- The title - with
title(String)
- The data format - with
format(String)
- Returns:
- a new model metadata object
- Throws:
IllegalStateException
- If any of the mandatory properties has not been set.
- The title - with
-