public static class TLcdModelMetadata.Builder extends Object
Modifier and Type | Method and Description |
---|---|
TLcdModelMetadata.Builder |
addDataCategory(TLcdModelMetadata.DataCategory aDataCategory)
Adds a data category of to the set of data categories contained in the model.
|
TLcdModelMetadata.Builder |
addSupportingSource(TLcdModelMetadata.Source aSource)
Adds the given source to the list of supporting sources to use.
|
TLcdModelMetadata.Builder |
bounds(ILcdBounded aBounds)
Sets the bounds to use.
|
TLcdModelMetadata |
build()
Creates a new model metadata object.
|
TLcdModelMetadata.Builder |
dataCategories(Set<TLcdModelMetadata.DataCategory> aDataCategories)
Sets the data category set of the model.
|
TLcdModelMetadata.Builder |
dataSeries(Callable<List<TLcdModelMetadata>> aDataSeries)
Sets the callable for discovering
data series children of the model. |
TLcdModelMetadata.Builder |
dataSeries(List<TLcdModelMetadata> aDataSeries)
Sets the
data series children of the model. |
TLcdModelMetadata.Builder |
dataSource(ILcdDataSource aDataSource)
Sets the data source to use.
|
TLcdModelMetadata.Builder |
dimensions(List<? extends ILcdDimension<?>> aDimensions)
Sets the dimensions to use.
|
TLcdModelMetadata.Builder |
entryPoint(TLcdModelMetadata.Source aEntryPoint)
Sets the entry point to the given
TLcdModelMetadata.Source . |
TLcdModelMetadata.Builder |
format(String aFormat)
Sets the data format to use.
|
TLcdModelMetadata.Builder |
fromModel(ILcdModel aModel)
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() . |
TLcdModelMetadata.Builder |
modelReference(ILcdModelReference aModelReference)
Sets the model reference to use.
|
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" . |
TLcdModelMetadata.Builder |
supportingSources(Callable<List<TLcdModelMetadata.Source>> aSourcesCallable)
Sets the callable for discovering supporting sources of the model.
|
TLcdModelMetadata.Builder |
supportingSources(List<TLcdModelMetadata.Source> aSources)
Sets the list of supporting sources to use.
|
TLcdModelMetadata.Builder |
title(String aTitle)
Sets the title to use.
|
public TLcdModelMetadata.Builder resourceMetadata(ILcdResourceMetadata aResourceMetadata)
"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
format(java.lang.String)
on this builder, for example, will also set the format in the resource metadata
instance.aResourceMetadata
- the new resource metadata, never null. This should be an instance of
TLcdISO19115Metadata
, otherwise the builder will fail to build.public TLcdModelMetadata.Builder format(String aFormat)
aFormat
- the format of the model, never null.public TLcdModelMetadata.Builder title(String aTitle)
aTitle
- the title of the model, never null.public TLcdModelMetadata.Builder modelReference(ILcdModelReference aModelReference)
aModelReference
- the model reference, or null if the model is not georeferencedpublic TLcdModelMetadata.Builder bounds(ILcdBounded aBounds)
aBounds
- the bounds of the model or the object that has the bounds (e.g. the model itself), expressed in the model reference
public TLcdModelMetadata.Builder dimensions(List<? extends ILcdDimension<?>> aDimensions)
aDimensions
- the dimensions of the model. Can be empty, but never null.resourceMetadata(ILcdResourceMetadata)
public TLcdModelMetadata.Builder dataSource(ILcdDataSource aDataSource)
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.aDataSource
- the data source of the model, or null if the source is unknown.public TLcdModelMetadata.Builder entryPoint(TLcdModelMetadata.Source aEntryPoint)
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.aEntryPoint
- the entry point of the model, or null if the entry point is unknown or undefined.public TLcdModelMetadata.Builder supportingSources(List<TLcdModelMetadata.Source> aSources)
.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.
aSources
- The list of supporting sources. Can be empty, but never null.public TLcdModelMetadata.Builder addSupportingSource(TLcdModelMetadata.Source aSource)
.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.
aSource
- The supporting source. Never null. It is recommended to use absolute paths whenever possible.public TLcdModelMetadata.Builder supportingSources(Callable<List<TLcdModelMetadata.Source>> aSourcesCallable)
.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.
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.public TLcdModelMetadata.Builder addDataCategory(TLcdModelMetadata.DataCategory aDataCategory)
Collections.emptySet()
is used.aDataCategory
- the kind of data the model contains, never nullpublic TLcdModelMetadata.Builder dataCategories(Set<TLcdModelMetadata.DataCategory> aDataCategories)
Collections.emptySet()
is used.aDataCategories
- the kind of data the model containspublic TLcdModelMetadata.Builder dataSeries(List<TLcdModelMetadata> aDataSeries)
data series
children of the model.
If not set, an empty list is used.aDataSeries
- a list containing the metadata of all child models in the comprised data series.
Can be empty, but never null.public TLcdModelMetadata.Builder dataSeries(Callable<List<TLcdModelMetadata>> aDataSeries)
data series
children of the model.
If not set, an empty list is used as data series.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.public TLcdModelMetadata.Builder fromModel(ILcdModel aModel)
ILcdModelDescriptor.getDisplayName()
.ILcdModelDescriptor.getTypeName()
.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.ILcdDataSourceModelDescriptor.getDataSource()
,
if that descriptor is an instance of ILcdDataSourceModelDescriptor
.ILcdModel.getModelReference()
.ILcdBounded
.ILcdMultiDimensional.getDimensions()
,
if the model is an instance of ILcdMultiDimensional
.ILcdImageModelDescriptor
, data
category RASTER
will be added to this builder. If the model
is an instance of ILcdModelContainer
, the datacategories of all submodels
will be added to this builder, as retrieved via their respective
ILcdModel.getModelMetadata()
. In any other case this method will not make any
assumptions about the data category.aModel
- The model from which the metadata will be extracted.public TLcdModelMetadata build()
title(String)
format(String)
IllegalStateException
- If any of the mandatory properties has not been set.