Class MetadataBuilder

java.lang.Object
org.apache.sis.internal.storage.MetadataBuilder
Direct Known Subclasses:
FeatureCatalogBuilder, ImageMetadataBuilder, MetadataReader

public class MetadataBuilder extends Object
Helper methods for the metadata created by DataStore implementations. This is not a general-purpose builder suitable for public API, since the methods provided in this class are tailored for Apache SIS data store needs. API of this class may change in any future SIS versions.
Since:
0.8
Version:
1.3
  • Field Details

  • Constructor Details

    • MetadataBuilder

      public MetadataBuilder()
      Creates a new metadata builder.
  • Method Details

    • metadata

      private DefaultMetadata metadata()
      Creates the metadata object if it does not already exists, then returns it.
      Returns:
      the metadata (never null).
      See Also:
    • identification

      private DefaultDataIdentification identification()
      Creates the identification information object if it does not already exists, then returns it.
      Returns:
      the identification information (never null).
      See Also:
    • citation

      private DefaultCitation citation()
      Creates the citation object if it does not already exists, then returns it.
      Returns:
      the citation information (never null).
    • series

      private DefaultSeries series()
      Returns the information about the series, or aggregate dataset, of which the dataset is a part.
    • responsibility

      private DefaultResponsibleParty responsibility()
      Creates the responsibility object if it does not already exists, then returns it.
      Returns:
      the responsibility party (never null).
    • party

      private AbstractParty party()
      Creates the individual or organization information object if it does not already exists, then returns it.

      Limitations

      If the party type is unknown, then this method creates an AbstractParty instead of one of the subtypes. This is not valid, but we currently have no way to guess if a party is an individual or an organization. For now we prefer to let users know that the type is unknown rather than to pick a potentially wrong type.
      Returns:
      the individual or organization information (never null).
      See Also:
    • constraints

      private DefaultLegalConstraints constraints()
      Creates the constraints information object if it does not already exists, then returns it.
      Returns:
      the constraints information (never null).
    • extent

      private DefaultExtent extent()
      Creates the extent information object if it does not already exists, then returns it.
      Returns:
      the extent information (never null).
    • acquisition

      private DefaultAcquisitionInformation acquisition()
      Creates the acquisition information object if it does not already exists, then returns it.
      Returns:
      the acquisition information (never null).
      See Also:
    • platform

      private DefaultPlatform platform()
      Creates a platform object if it does not already exists, then returns it.
      Returns:
      the platform information (never null).
    • featureDescription

      private DefaultFeatureCatalogueDescription featureDescription()
      Creates the feature descriptions object if it does not already exists, then returns it. This method sets the includedWithDataset property to true because the metadata built by this helper class are typically encoded together with the data.
      Returns:
      the feature descriptions (never null).
      See Also:
    • coverageDescription

      private DefaultCoverageDescription coverageDescription()
      Creates the coverage description object if it does not already exists, then returns it.
      Returns:
      the coverage description (never null).
      See Also:
    • attributeGroup

      private DefaultAttributeGroup attributeGroup()
      Creates the attribute group object if it does not already exists, then returns it.
      Returns:
      the attribute group (never null).
    • sampleDimension

      private DefaultSampleDimension sampleDimension()
      Creates the sample dimension object if it does not already exists, then returns it.
      Returns:
      the sample dimension (never null).
      See Also:
    • gridRepresentation

      private DefaultGridSpatialRepresentation gridRepresentation()
      Creates a grid representation object if it does not already exists, then returns it.
      Returns:
      the grid representation object (never null).
      See Also:
    • groundControlPoints

      private DefaultGCPCollection groundControlPoints()
      Creates the collection of ground control points if it does not already exists, then returns it.
      Returns:
      the ground control points (never null).
    • distribution

      private DefaultDistribution distribution()
      Creates the distribution information object if it does not already exists, then returns it.
      Returns:
      the distribution information (never null).
      See Also:
    • format

      private DefaultFormat format()
      Creates the distribution format object if it does not already exists, then returns it.
      Returns:
      the distribution format (never null).
    • lineage

      private DefaultLineage lineage()
      Creates the lineage object if it does not already exists, then returns it.
      Returns:
      the lineage (never null).
      See Also:
    • processStep

      private DefaultProcessStep processStep()
      Creates the process step object if it does not already exists, then returns it.
      Returns:
      the process step (never null).
    • processing

      private DefaultProcessing processing()
      Creates the processing object if it does not already exists, then returns it.
      Returns:
      the processing (never null).
    • addIfNotPresent

      private static <E> void addIfNotPresent(Collection<E> collection, E element)
      Adds the given element in the given collection if not already present. This method is used only for properties that are usually stored in List rather than Set and for which we do not keep a reference in this MetadataBuilder after the element has been added. This method is intended for adding elements that despite being modifiable, are not going to be modified by this MetadataBuilder class. Performance should not be a concern since the given list is usually very short (0 or 1 element).

      The given element should be non-null. The check for null value should be done by the caller instead than by this method in order to avoid unneeded creation of collections. Such creation are implicitly done by calls to metadata.getFoos() methods.

    • newParty

      public final void newParty(MetadataBuilder.PartyType type)
      Commits all pending information under the "responsible party" node (author, address, etc). If there is no pending party information, then invoking this method has no effect except setting the type flag. If new party information are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "responsible party" node, separated from the previous one, is desired.

      Parameters:
      type - whether the party to create is an individual or an organization.
    • newIdentification

      public final void newIdentification()
      Commits all pending information under the metadata "identification info" node (author, bounding box, etc). If there is no pending identification information, then invoking this method has no effect. If new identification info are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "identification info" node, separated from the previous one, is desired.

    • newAcquisition

      public final void newAcquisition()
      Commits all pending information under the metadata "acquisition" node (station, sensors, etc). If there is no pending acquisition information, then invoking this method has no effect. If new acquisition info are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "acquisition info" node, separated from the previous one, is desired.

    • newDistribution

      public final void newDistribution()
      Commits all pending information under metadata "distribution" node. If there is no pending distribution information, then invoking this method has no effect. If new distribution info are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "distribution info" node, separated from the previous one, is desired.

    • newFeatureTypes

      public final void newFeatureTypes()
      Commits all pending information under the metadata "feature catalog" node. If there is no pending feature description, then invoking this method has no effect. If new feature descriptions are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "feature catalog description" node is desired.

    • newCoverage

      public final void newCoverage(boolean electromagnetic)
      Commits all pending information under the metadata "content info" node (bands, etc). If there is no pending coverage description, then invoking this method has no effect except setting the electromagnetic flag. If new coverage descriptions are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "coverage description" node is desired, or the electromagnetic flag needs to be set to true.

      Parameters:
      electromagnetic - true if the next CoverageDescription to create will be a description of measurements in the electromagnetic spectrum.
    • newSampleDimension

      public final void newSampleDimension()
      Commits all pending information under the coverage "attribute group" node. If there is no pending sample dimension description, then invoking this method has no effect. If new sample dimensions are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "sample dimension" node is desired.

    • newGridRepresentation

      public final void newGridRepresentation(MetadataBuilder.GridType type)
      Commits all pending information under the metadata "spatial representation" node (dimensions, etc). If there is no pending spatial representation information, then invoking this method has no effect. If new spatial representation info are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "spatial representation info" node, separated from the previous one, is desired.

      Parameters:
      type - whether the next grid should be an instance of DefaultGeorectified or DefaultGeoreferenceable.
    • newLineage

      public final void newLineage()
      Commits all pending information under the metadata "lineage" node (process steps, etc). If there is no pending lineage information, then invoking this method has no effect. If new lineage information are added after this method call, they will be stored in a new element.

      This method does not need to be invoked unless a new "lineage" node, separated from the previous one, is desired.

    • addDefaultMetadata

      public final void addDefaultMetadata(AbstractResource resource, StoreListeners listeners) throws DataStoreException
      Adds default metadata for the specified resource. This is used for default implementation of AbstractResource.createMetadata().
      Parameters:
      resource - the resource for which to add metadata.
      listeners - the listeners to notify in case of warning.
      Throws:
      DataStoreException - if an error occurred while reading metadata from the data store.
    • addDefaultMetadata

      public final void addDefaultMetadata(AbstractFeatureSet resource, StoreListeners listeners) throws DataStoreException
      Adds default metadata for the specified resource. This is used for default implementation of AbstractFeatureSet.createMetadata().
      Parameters:
      resource - the resource for which to add metadata.
      listeners - the listeners to notify in case of warning.
      Throws:
      DataStoreException - if an error occurred while reading metadata from the data store.
    • addDefaultMetadata

      public final void addDefaultMetadata(AbstractGridCoverageResource resource, StoreListeners listeners) throws DataStoreException
      Adds default metadata for the specified resource. This is used for default implementation of AbstractGridCoverageResource.createMetadata().
      Parameters:
      resource - the resource for which to add metadata.
      listeners - the listeners to notify in case of warning.
      Throws:
      DataStoreException - if an error occurred while reading metadata from the data store.
    • sharedCitation

      private org.opengis.metadata.citation.Citation sharedCitation(org.opengis.util.InternationalString title)
      Creates or fetches a citation for the given title. The same citation may be shared by many metadata objects, for example identifiers or groups of keywords. Current implementation creates a DefaultCitation for the given title and caches the result. Future implementations may return predefined citation constants from the SQL database when applicable.
      Parameters:
      title - the citation title, or null if none.
      Returns:
      a (potentially shared) citation for the given title, or null if the given title was null.
    • sharedIdentifier

      private org.opengis.metadata.Identifier sharedIdentifier(CharSequence authority, String code)
      Creates or fetches an identifier for the given authority and code. This method may query the metadata database for fetching a more complete Citation for the given authority. This method may return a shared Identifier instance.
      Parameters:
      authority - the authority tile, or null if none.
      code - the identifier code (mandatory).
    • addIdentifier

      public final void addIdentifier(org.opengis.metadata.Identifier id, MetadataBuilder.Scope scope)
      Adds a data and/or metadata identifier. This method performs the same work than addIdentifier(CharSequence, String, Scope) for situations where the identifier instance is already available.
      Parameters:
      id - the identifier, or null if none.
      scope - whether the date applies to data, to metadata or to both.
      See Also:
    • addIdentifier

      public final void addIdentifier(CharSequence authority, String code, MetadataBuilder.Scope scope)
      Adds a resource (data) identifier, a metadata identifier, or both as they are often the same. The identifier is added only if code is non-null, regardless other argument values. Empty strings (ignoring spaces) are considered as null. The identifier is not added if already presents. Storage locations are:
      • Metadata: metadata/metadataIdentifier
      • Resource: metadata/identificationInfo/citation/identifier
      Parameters:
      authority - the the person or party responsible for maintenance of the namespace, or null if none.
      code - the identifier code, or null for no-operation.
      scope - whether the date applies to data, to metadata or to both.
      See Also:
    • setPredefinedFormat

      public final void setPredefinedFormat(String abbreviation) throws MetadataStoreException
      Sets the file format. The given name should be a short name like "GeoTIFF". The long name will be inferred from the given short name, if possible. Storage location is:
      • metadata/identificationInfo/resourceFormat
      This method should be invoked before any other method writing in the identificationInfo/resourceFormat node. If this exception throws an exception, than that exception should be reported as a warning. Example:
      Parameters:
      abbreviation - the format short name or abbreviation, or null for no-operation.
      Throws:
      MetadataStoreException - if this method cannot connect to the jdbc/SpatialMetadata database. Callers should generally handle this exception as a recoverable one (i.e. log a warning and continue).
      See Also:
    • addLanguage

      public final void addLanguage(Locale language, MetadataBuilder.Scope scope)
      Adds a language used for documenting data and/or metadata. Storage locations are:
      • Metadata: metadata/language
      • Resource: metadata/identificationInfo/language
      Parameters:
      language - a language used for documenting data and/or metadata, or null for no-operation.
      scope - whether the language applies to data, to metadata or to both.
      See Also:
    • addEncoding

      public final void addEncoding(Charset encoding, MetadataBuilder.Scope scope)
      Adds a character set used for encoding the data and/or metadata. Storage locations are:
      • Metadata: metadata/characterSet
      • Resource: metadata/identificationInfo/characterSet
      Parameters:
      encoding - the character set used for encoding data and/or metadata, or null for no-operation.
      scope - whether the encoding applies to data, to metadata or to both.
      See Also:
    • addResourceScope

      public final void addResourceScope(org.opengis.metadata.maintenance.ScopeCode scope, CharSequence name)
      Adds information about the scope of the resource. The scope is typically (but not restricted to)
      invalid reference
      ScopeCode#COVERAGE
      , ScopeCode.FEATURE or the more generic ScopeCode.DATASET. Storage locations are:
      • metadata/metadataScope/resourceScope
      • metadata/metadataScope/name
      Parameters:
      scope - the scope of the resource, or null if none.
      name - description of the scope, or null if none.
    • addCitationDate

      public final void addCitationDate(Date date, org.opengis.metadata.citation.DateType type, MetadataBuilder.Scope scope)
      Adds a date of the given type. This is not the data acquisition time, but rather the metadata creation or last update time. With MetadataBuilder.Scope.METADATA, this is the creation of the metadata file as a whole. With MetadataBuilder.Scope.RESOURCE, this is the creation of the metadata for a particular "identification info". They are often the same, since there is typically only one "identification info" per file. Storage locations are:
      • Metadata: metadata/dateInfo/*
      • Resource: metadata/identificationInfo/citation/date/*
      If a date already exists for the given type, then the earliest date is retained (oldest date are discarded) except for DateType.LAST_REVISION, DateType.LAST_UPDATE LAST_UPDATE or any other date type prefixed by "LATE_", where only the latest date is kept.
      Parameters:
      date - the date to add, or null for no-operation..
      type - the type of the date to add, or null if none (not legal but tolerated).
      scope - whether the date applies to data, to metadata or to both.
      See Also:
    • addEarliest

      private static void addEarliest(Collection<org.opengis.metadata.citation.CitationDate> dates, org.opengis.metadata.citation.CitationDate cd, org.opengis.metadata.citation.DateType type)
      Adds a date in the given collection, making sure that there is no two dates of the same type. If two dates are of the same type, retains the latest one if the type name starts with "LATE_" or retains the earliest date otherwise.
    • trim

      private static org.opengis.util.InternationalString trim(CharSequence value)
      Returns the given character sequence as a non-empty character string with leading and trailing spaces removed. If the given character sequence is null, empty or blank, then this method returns null.
    • append

      private static org.opengis.util.InternationalString append(org.opengis.util.InternationalString previous, org.opengis.util.InternationalString toAdd)
      Returns the concatenation of the given strings. The previous string may be null. This method does nothing if the previous string already contains the one to append.
    • equals

      private static boolean equals(CharSequence s1, CharSequence s2)
      Returns true if the given character sequences have equal content.
    • addTitle

      public final void addTitle(CharSequence title)
      Adds a title or alternate title of the resource, if not already present. This operation does nothing if the title is already defined and the given title is already used as an identifier (this policy is a complement of the addTitleOrIdentifier(String, Scope) behavior). Storage locations are:
      • metadata/identificationInfo/citation/title if not yet used
      • metadata/identificationInfo/citation/alternateTitle otherwise
      Parameters:
      title - the resource title or alternate title, or null for no-operation.
      See Also:
    • addTitleOrIdentifier

      public final void addTitleOrIdentifier(String code, MetadataBuilder.Scope scope)
      Adds the given code as a title if the current citation has no title, or as an identifier otherwise. This method is invoked when adding an identifier to a metadata that may have no title. Because the title is mandatory, adding only an identifier would make an invalid metadata.
      Parameters:
      code - the identifier code, or null for no-operation.
      scope - whether the date applies to data, to metadata or to both.
      See Also:
    • addEdition

      public final void addEdition(CharSequence version)
      Adds a version of the resource. If a version already exists, the new one will be appended after a new line. Storage location is:
      • metadata/identificationInfo/citation/edition
      Parameters:
      version - the version of resource(s), or null for no-operation.
    • addSeries

      public final void addSeries(CharSequence name)
      Adds the name of the series, or aggregate dataset, of which the dataset is a part. Storage location is:
      • metadata/identificationInfo/citation/series/name
      Parameters:
      name - name of the series, or null for no-operation.
    • addPage

      public final void addPage(CharSequence page)
      Adds details on which pages of the publication the article was published. Storage location is:
      • metadata/identificationInfo/citation/series/page
      Parameters:
      page - the page, or null for no-operation.
    • addPage

      public final void addPage(int page, int total)
      Adds details on which pages of the publication the article was published. Storage location is:
      • metadata/identificationInfo/citation/series/page
      Parameters:
      page - the page number, or 0 or negative for no-operation.
      total - the total number of pages, or 0 or negative if unknown.
    • addAbstract

      public final void addAbstract(CharSequence description)
      Adds a brief narrative summary of the resource(s). If a summary already exists, the new one will be appended after a new line. Storage location is:
      • metadata/identificationInfo/abstract
      Parameters:
      description - the summary of resource(s), or null for no-operation.
      See Also:
    • addPurpose

      public final void addPurpose(CharSequence intention)
      Adds a summary of the intentions with which the resource(s) was developed. If a purpose already exists, the new one will be appended after a new line. Storage location is:
      • metadata/identificationInfo/purpose
      Parameters:
      intention - the summary of intention(s), or null for no-operation.
      See Also:
    • addOtherCitationDetails

      public final void addOtherCitationDetails(CharSequence details)
      Adds other information required to complete the citation that is not recorded elsewhere. Storage location is:
      • metadata/identificationInfo/citation/otherCitationDetails
      Parameters:
      details - other details, or null for no-operation.
    • addSupplementalInformation

      public final void addSupplementalInformation(CharSequence info)
      Adds any other descriptive information about the resource. If information already exists, the new one will be appended after a new line. Storage location is:
      • metadata/identificationInfo/supplementalInformation
      Parameters:
      info - any other descriptive information about the resource, or null for no-operation.
    • addTopicCategory

      public final void addTopicCategory(org.opengis.metadata.identification.TopicCategory topic)
      Adds a main theme of the resource. Storage location is:
      • metadata/identificationInfo/topicCategory
      Parameters:
      topic - main theme of the resource, or null for no-operation.
    • addKeywords

      public final void addKeywords(Iterable<? extends CharSequence> keywords, org.opengis.metadata.identification.KeywordType type, CharSequence thesaurusName)
      Adds keywords if at least one non-empty element exists in the keywords array. Other arguments have no impact on whether keywords are added or not because only the MD_Keywords.keyword property is mandatory. Storage locations are:
      • metadata/identificationInfo/descriptiveKeywords
      • metadata/identificationInfo/thesaurusName/title
      • metadata/identificationInfo/type
      Parameters:
      keywords - word(s) used to describe the subject, or null for no-operation.
      type - subject matter used to group similar keywords, or null if none.
      thesaurusName - name of the formally registered thesaurus, or null if none.
    • addAuthor

      public final void addAuthor(CharSequence name)
      Adds an author name. If an author was already defined with a different name, then a new party instance is created. Storage location is:
      • metadata/identificationInfo/citation/party/name
      Parameters:
      name - the name of the author or publisher, or null for no-operation.
    • addCitedResponsibleParty

      public final void addCitedResponsibleParty(org.opengis.metadata.citation.ResponsibleParty party, org.opengis.metadata.citation.Role role)
      Adds role, name, contact and position information for an individual or organization that is responsible for the resource. This method can be used as an alternative to addAuthor(CharSequence) when the caller needs to create the responsibly party itself.

      If the given role is non-null, then this method will ensure that the added party has the given role. A copy of the given party will be created if needed (the given party will never be modified).

      Storage locations are:
      • metadata/identificationInfo/citation/citedResponsibleParty
      • metadata/identificationInfo/citation/citedResponsibleParty/role
      Parameters:
      party - the individual or organization that is responsible, or null for no-operation.
      role - the role to set, or null for leaving it unchanged.
    • addPointOfContact

      public final void addPointOfContact(org.opengis.metadata.citation.ResponsibleParty contact, MetadataBuilder.Scope scope)
      Adds a means of communication with person(s) and organizations(s) associated with the resource(s). This is often the same party than the above cited responsibly party, with only the role changed. Storage locations are:
      • Metadata metadata/contact
      • Resource metadata/identificationInfo/pointOfContact
      Parameters:
      contact - means of communication with party associated with the resource, or null for no-operation.
      scope - whether the contact applies to data, to metadata or to both.
    • addDistributor

      public final void addDistributor(org.opengis.metadata.citation.ResponsibleParty distributor)
      Adds a distributor. This is often the same than the above responsible party. Storage location is:
      • metadata/distributionInfo/distributor/distributorContact
      Parameters:
      distributor - the distributor, or null for no-operation.
    • addCredits

      public final void addCredits(CharSequence credit)
      Adds recognition of those who contributed to the resource(s). Storage location is:
      • metadata/identificationInfo/credit
      Parameters:
      credit - recognition of those who contributed to the resource, or null for no-operation.
    • parseLegalNotice

      public final void parseLegalNotice(String notice)
      Parses the legal notice. The method expects a string of the form “Copyright, John Smith, 1992. All rights reserved.” The result of above example will be: Storage location is:
      • metadata/identificationInfo/resourceConstraint
      Parameters:
      notice - the legal notice, or null for no-operation.
    • addAccessConstraint

      public final void addAccessConstraint(org.opengis.metadata.constraint.Restriction restriction)
      Adds an access constraint applied to assure the protection of privacy or intellectual property, and any special restrictions or limitations on obtaining the resource. Storage location is:
      • metadata/identificationInfo/resourceConstraint/accessConstraints
      Parameters:
      restriction - access constraints applied, or null for no-operation.
    • addUseLimitation

      public final void addUseLimitation(CharSequence limitation)
      Adds a limitation affecting the fitness for use of the resource. Storage location is:
      • metadata/identificationInfo/resourceConstraint/useLimitation
      Parameters:
      limitation - limitation affecting the fitness for use, or null for no-operation.
    • addReferenceSystem

      public final void addReferenceSystem(org.opengis.referencing.ReferenceSystem crs)
      Adds the given coordinate reference system to metadata, if it does not already exists. This method ensures that there is no duplicated values. Storage location is:
      • metadata/referenceSystemInfo
      Parameters:
      crs - the coordinate reference system to add to the metadata, or null for no-operation.
    • addBoundingPolygon

      public final void addBoundingPolygon(org.opengis.geometry.Geometry bounds)
      Adds the given geometry as a bounding polygon. Storage locations is:
      • metadata/identificationInfo/extent/geographicElement/polygon
      Parameters:
      bounds - the bounding polygon, or null if none.
    • addExtent

      public final void addExtent(CharSequence identifier)
      Adds a geographic extent described by an identifier. The given identifier is stored as-is as the natural language description, and possibly in a modified form as the geographic identifier. See DefaultGeographicDescription(CharSequence) for details. Storage locations are:
      • metadata/identificationInfo/extent/geographicElement/description
      • metadata/identificationInfo/extent/geographicElement/identifier
      Parameters:
      identifier - identifier or description of spatial and temporal extent, or null for no-operation.
    • addExtent

      public final void addExtent(org.opengis.geometry.Envelope envelope) throws org.opengis.referencing.operation.TransformException
      Adds the given envelope, including its CRS, to the metadata. If the metadata already contains a geographic bounding box, then a new bounding box is added; this method does not compute the union of the two boxes. Storage location is:
      • metadata/identificationInfo/extent/geographicElement
      Parameters:
      envelope - the extent to add in the metadata, or null for no-operation.
      Throws:
      org.opengis.referencing.operation.TransformException - if an error occurred while converting the given envelope to extents.
    • addExtent

      public final void addExtent(double[] coordinates, int index)
      Adds a geographic bounding box initialized to the values in the given array. The array must contains at least 4 values starting at the given index in this exact order:
      • westBoundLongitude (the minimal λ value), or NaN
      • eastBoundLongitude (the maximal λ value), or NaN
      • southBoundLatitude (the minimal φ value), or NaN
      • northBoundLatitude (the maximal φ value), or NaN
      Storage location is:
      • metadata/identificationInfo/extent/geographicElement
      Parameters:
      coordinates - the geographic coordinates, or null for no-operation.
      index - index of the first value to use in the given array.
    • addVerticalExtent

      public final void addVerticalExtent(double minimumValue, double maximumValue, org.opengis.referencing.crs.VerticalCRS verticalCRS)
      Adds a vertical extent covered by the data. Storage location is:
      • metadata/identificationInfo/extent/verticalElement
      Parameters:
      minimumValue - the lowest vertical extent contained in the dataset, or Double.NaN if none.
      maximumValue - the highest vertical extent contained in the dataset, or Double.NaN if none.
      verticalCRS - the information about the vertical coordinate reference system, or null.
    • addTemporalExtent

      public final void addTemporalExtent(Date startTime, Date endTime)
      Adds a temporal extent covered by the data. Storage location is:
      • metadata/identificationInfo/extent/temporalElement
      Parameters:
      startTime - when the data begins, or null if unbounded.
      endTime - when the data ends, or null if unbounded.
      See Also:
    • addFeatureType

      public final org.opengis.util.GenericName addFeatureType(DefaultFeatureType type, long occurrences)
      Adds descriptions for the given feature. Storage locations are:
      • metadata/contentInfo/featureTypes/featureTypeName
      • metadata/contentInfo/featureTypes/featureInstanceCount
      This method returns the feature name for more convenient chaining with FeatureNaming.add(…). Note that the FeatureCatalogBuilder subclasses can also be used for that chaining.
      Parameters:
      type - the feature type to add, or null for no-operation.
      occurrences - number of instances of the given feature type, or a negative value if unknown. Note that ISO-19115 considers 0 as an invalid value. Consequently, if 0, the feature is not added.
      Returns:
      the name of the added feature (even if not added to the metadata), or null if none.
      See Also:
    • addFeatureType

      public final void addFeatureType(org.opengis.util.GenericName name, long occurrences)
      Adds descriptions for a feature of the given name. Storage locations are:
      • metadata/contentInfo/featureTypes/featureTypeName
      • metadata/contentInfo/featureTypes/featureInstanceCount
      Parameters:
      name - name of the feature type to add, or null for no-operation.
      occurrences - number of instances of the given feature type, or a negative value if unknown. Note that ISO-19115 considers 0 as an invalid value. Consequently, if 0, the feature is not added.
    • addSpatialRepresentation

      public final void addSpatialRepresentation(org.opengis.metadata.spatial.SpatialRepresentationType type)
      Adds a method used to spatially represent geographic information. Storage location is:
      • metadata/identificationInfo/spatialRepresentationType
      Parameters:
      type - method used to spatially represent geographic information, or null for no-operation.
    • addSpatialRepresentation

      public final boolean addSpatialRepresentation(String description, GridGeometry grid, boolean addResolution)
      Adds and populates a "spatial representation info" node using the given grid geometry. This method invokes implicitly newGridRepresentation(GridType), unless this method returns false in which case nothing has been done. Storage locations are:
      • metadata/spatialRepresentationInfo/transformationDimensionDescription
      • metadata/spatialRepresentationInfo/transformationParameterAvailability
      • metadata/spatialRepresentationInfo/axisDimensionProperties/dimensionName
      • metadata/spatialRepresentationInfo/axisDimensionProperties/dimensionSize
      • metadata/spatialRepresentationInfo/axisDimensionProperties/resolution
      • metadata/identificationInfo/spatialRepresentationType
      • metadata/referenceSystemInfo
      This method does not add the envelope provided by GridGeometry.getEnvelope(). That envelope appears in a separated node, which can be added by addExtent(Envelope). This separation is required by AbstractGridCoverageResource for instance.
      Parameters:
      description - a general description of the "grid to CRS" transformation, or null if none. Can also be specified later by a call to setGridToCRS(CharSequence).
      grid - the grid extent, "grid to CRS" transform and target CRS, or null if none.
      addResolution - whether to declare the resolutions. Callers should set this argument to false if they intend to provide the resolution themselves, or if grid axes are not in the same order than CRS axes.
      Returns:
      whether a "spatial representation info" node has been added.
    • addResolution

      public final void addResolution(double distance)
      Adds a linear resolution in metres. Storage location is:
      • metadata/identificationInfo/spatialResolution/distance
      Parameters:
      distance - the resolution in metres, or NaN for no-operation.
    • setCellGeometry

      public final void setCellGeometry(org.opengis.metadata.spatial.CellGeometry value)
      Sets identification of grid data as point or cell. Storage location is:
      • metadata/spatialRepresentationInfo/cellGeometry
      Parameters:
      value - whether the data represent point or area, or null for no-operation.
    • setPointInPixel

      public final void setPointInPixel(org.opengis.metadata.spatial.PixelOrientation value)
      Sets the point in a pixel corresponding to the Earth location of the pixel. Storage location is:
      • metadata/spatialRepresentationInfo/pointInPixel
      Parameters:
      value - whether the data represent point or area, or null for no-operation.
    • setGeoreferencingAvailability

      public final void setGeoreferencingAvailability(boolean transformationParameterAvailability, boolean controlPointAvailability, boolean orientationParameterAvailability)
      Sets whether parameters for transformation, control/check point(s) or orientation parameters are available. Storage locations are:
      • If georeferenceable:
        • metadata/spatialRepresentationInfo/transformationParameterAvailability
        • metadata/spatialRepresentationInfo/controlPointAvailability
        • metadata/spatialRepresentationInfo/orientationParameterAvailability
      • If georeferenced:
        • metadata/spatialRepresentationInfo/transformationParameterAvailability
        • metadata/spatialRepresentationInfo/checkPointAvailability
      Parameters:
      transformationParameterAvailability - indication of whether or not parameters for transformation exists.
      controlPointAvailability - indication of whether or not control or check point(s) exists.
      orientationParameterAvailability - indication of whether or not orientation parameters are available.
    • addGeolocation

      public final void addGeolocation(org.opengis.metadata.spatial.GeolocationInformation info)
      Adds information about the geolocation of an image. Storage location is:
      • metadata/spatialRepresentationInfo/geolocationInformation
      Parameters:
      info - the geolocation information to add, or null if none.
    • addControlPoints

      public final void addControlPoints(org.opengis.geometry.DirectPosition geographicCoordinates, org.opengis.metadata.quality.Element accuracyReport)
      Adds check points (if georectified) or ground control points (if georeferenceable). Ground control points (GCP) are large marked targets on the ground. GCP should not be used for storing the localization grid (e.g. "model tie points" in a GeoTIFF file). Storage locations are:
      • metadata/spatialRepresentationInfo/checkPoint/geographicCoordinates if georectified
      • metadata/spatialRepresentationInfo/geolocationInformation/gcp/geographicCoordinates if georeferenceable
      Parameters:
      geographicCoordinates - the geographic or map position of the control point, in either two or three dimensions.
      accuracyReport - the accuracy of a ground control point, or null if none. Ignored if geographicCoordinates is null.
    • setGridToCRS

      public final void setGridToCRS(CharSequence value)
      Sets a general description of the transformation from grid coordinates to "real world" coordinates. Storage location is:
      • metadata/spatialRepresentationInfo/transformationDimensionDescription
      Parameters:
      value - a general description of the "grid to CRS" transformation, or null for no-operation.
    • axis

      private DefaultDimension axis(int index)
      Returns the axis at the given dimension index. All previous dimensions are created if needed.
      Parameters:
      index - index of the desired dimension.
      Returns:
      dimension at the given index.
    • setAxisName

      public final void setAxisName(int dimension, org.opengis.metadata.spatial.DimensionNameType name)
      Sets the number of cells along the given dimension. Storage location is:
      • metadata/spatialRepresentationInfo/axisDimensionProperties/dimensionName
      Parameters:
      dimension - the axis dimension.
      name - the name to set for the given dimension.
    • setAxisSize

      public final void setAxisSize(int dimension, long length)
      Sets the number of cells along the given dimension. Storage location is:
      • metadata/spatialRepresentationInfo/axisDimensionProperties/dimensionSize
      Parameters:
      dimension - the axis dimension.
      length - number of cell values along the given dimension.
    • setAxisResolution

      public final void setAxisResolution(int dimension, double resolution, javax.measure.Unit<?> unit)
      Sets the degree of detail in the given dimension. This method does nothing if the given resolution if NaN or infinite. Storage location is:
      • metadata/spatialRepresentationInfo/axisDimensionProperties/resolution
      Parameters:
      dimension - the axis dimension.
      resolution - the degree of detail in the grid dataset, or NaN for no-operation.
      unit - the resolution unit, of null if unknown.
    • addContentType

      public final void addContentType(org.opengis.metadata.content.CoverageContentType type)
      Adds type of information represented in the cell. Storage location is:
      • metadata/contentInfo/attributeGroup/contentType
      Parameters:
      type - type of information represented in the cell, or null for no-operation.
    • addNewBand

      public final void addNewBand(SampleDimension band)
      Sets the sequence identifier, sample value ranges, transfer function and units of measurement from the given sample dimension. This method dispatch its work to other methods in this class. Before to set any value, this method starts a new band by calling newSampleDimension(). Storage locations are:
      • metadata/contentInfo/attributeGroup/attribute/sequenceIdentifier
      • metadata/contentInfo/attributeGroup/attribute/minValue
      • metadata/contentInfo/attributeGroup/attribute/maxValue
      • metadata/contentInfo/attributeGroup/attribute/scale
      • metadata/contentInfo/attributeGroup/attribute/offset
      • metadata/contentInfo/attributeGroup/attribute/transferFunctionType
      • metadata/contentInfo/attributeGroup/attribute/unit
      Parameters:
      band - the sample dimension to describe in metadata, or null if none.
    • setBandIdentifier

      public final void setBandIdentifier(org.opengis.util.GenericName sequenceIdentifier)
      Sets the name or number that uniquely identifies instances of bands of wavelengths on which a sensor operates. If a coverage contains more than one band, additional bands can be created by calling newSampleDimension() before to call this method. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/sequenceIdentifier
      Parameters:
      sequenceIdentifier - the band name or number, or null for no-operation.
    • setBandIdentifier

      public final void setBandIdentifier(int sequenceIdentifier)
      Sets the number that uniquely identifies instances of bands of wavelengths on which a sensor operates. This is a convenience method for setBandIdentifier(MemberName) when the band is specified only by a number. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/sequenceIdentifier
      Parameters:
      sequenceIdentifier - the band number, or 0 or negative if none.
    • addBandName

      public final void addBandName(CharSequence authority, String name)
      Adds an identifier for the current band. These identifiers can be used to provide names for the attribute from a standard set of names. If a coverage contains more than one band, additional bands can be created by calling newSampleDimension() before to call this method. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/name
      Parameters:
      authority - identifies which controlled list of name is used, or null if none.
      name - the band name, or null for no-operation.
    • addBandDescription

      public final void addBandDescription(CharSequence description)
      Adds a description of the current band. If a coverage contains more than one band, additional bands can be created by calling newSampleDimension() before to call this method. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/description
      Parameters:
      description - the band description, or null for no-operation.
    • addSampleValueDescription

      public void addSampleValueDescription(CharSequence name, CharSequence definition)
      Adds a description of a particular sample value. Storage location is:
      • metadata/contentInfo/rangeElementDescription
      Note: ISO 19115 range elements are approximately equivalent to org.apache.sis.coverage.Category in the sis-coverage module.
      Parameters:
      name - designation associated with a set of range elements, or null if none.
      definition - description of a set of specific range elements, or null if none.
    • addMinimumSampleValue

      public final void addMinimumSampleValue(double value)
      Adds a minimal value for the current sample dimension. The value should be in the unit of measurement specified by setSampleUnits(Unit). If a minimal value was already defined, then the new value will be set only if it is smaller than the existing one. NaN values are ignored. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/minValue
      If a coverage contains more than one band, additional bands can be created by calling newSampleDimension() before to call this method.
      Parameters:
      value - the minimal value to add to the existing range of sample values, or NaN for no-operation.
    • addMaximumSampleValue

      public final void addMaximumSampleValue(double value)
      Adds a maximal value for the current sample dimension. The value should be in the unit of measurement specified by setSampleUnits(Unit). If a maximal value was already defined, then the new value will be set only if it is greater than the existing one. NaN values are ignored. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/maxValue
      If a coverage contains more than one band, additional bands can be created by calling newSampleDimension() before to call this method.
      Parameters:
      value - the maximal value to add to the existing range of sample values, or NaN for no-operation.
    • hasSampleValueRange

      public final boolean hasSampleValueRange()
      Returns true if current band has the minimum or maximum value defined.
      Returns:
      whether minimum or maximum value is defined for current band.
    • setSampleUnits

      public final void setSampleUnits(javax.measure.Unit<?> unit)
      Sets the units of data in the current band. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/unit
      If a coverage contains more than one band, additional bands can be created by calling newSampleDimension() before to call this method.
      Parameters:
      unit - units of measurement of sample values.
    • setTransferFunction

      public final void setTransferFunction(double scale, double offset)
      Sets the scale factor and offset which have been applied to the cell value. The transfer function type is declared linear Storage locations are:
      • metadata/contentInfo/attributeGroup/attribute/scale
      • metadata/contentInfo/attributeGroup/attribute/offset
      • metadata/contentInfo/attributeGroup/attribute/transferFunctionType
      If a coverage contains more than one band, additional bands can be created by calling newSampleDimension() before to call this method.
      Parameters:
      scale - the scale factor which has been applied to the cell value.
      offset - the physical value corresponding to a cell value of zero.
    • setBitPerSample

      public final void setBitPerSample(int bits)
      Sets the maximum number of significant bits in the uncompressed representation for the value in current band. Storage location is:
      • metadata/contentInfo/attributeGroup/attribute/bitsPerValue
      Parameters:
      bits - the new maximum number of significant bits.
      Throws:
      IllegalArgumentException - if the given value is zero or negative.
    • setProcessingLevelCode

      public final void setProcessingLevelCode(CharSequence authority, String processingLevel)
      Sets an identifier for the level of processing that has been applied to the coverage. For image descriptions, this is the image distributor's code that identifies the level of radiometric and geometric processing that has been applied. Storage location is:
      • metadata/contentInfo/processingLevelCode
      Note that another storage location exists at metadata/identificationInfo/processingLevel but is currently not used.
      Parameters:
      authority - identifies which controlled list of code is used, or null if none.
      processingLevel - identifier for the level of processing that has been applied to the resource, or null for no-operation.
    • setCloudCoverPercentage

      public final void setCloudCoverPercentage(double value)
      Sets the area of the dataset obscured by clouds, expressed as a percentage of the spatial extent. This method does nothing if the given value is Double.NaN.

      This method is available only if newCoverage(boolean) has been invoked with the electromagnetic parameter set to true. Storage location is:

      • metadata/contentInfo/cloudCoverPercentage
      Parameters:
      value - the new cloud percentage, or NaN for no-operation.
      Throws:
      IllegalArgumentException - if the given value is out of range.
    • setIlluminationAzimuthAngle

      public final void setIlluminationAzimuthAngle(double value)
      Sets the illumination azimuth measured in degrees clockwise from true north at the time the image is taken. For images from a scanning device, refer to the centre pixel of the image. This method does nothing if the given value is Double.NaN.

      This method is available only if newCoverage(boolean) has been invoked with the electromagnetic parameter set to true. Storage location is:

      • metadata/contentInfo/illuminationAzimuthAngle
      Parameters:
      value - the new illumination azimuth angle, or NaN for no-operation.
      Throws:
      IllegalArgumentException - if the given value is out of range.
    • setIlluminationElevationAngle

      public final void setIlluminationElevationAngle(double value)
      Sets the illumination elevation measured in degrees clockwise from the target plane at intersection of the optical line of sight with the Earth's surface. For images from a canning device, refer to the centre pixel of the image. This method does nothing if the given value is Double.NaN.

      This method is available only if newCoverage(boolean) has been invoked with the electromagnetic parameter set to true. Storage location is:

      • metadata/contentInfo/illuminationElevationAngle
      Parameters:
      value - the new illumination azimuth angle, or NaN for no-operation.
      Throws:
      IllegalArgumentException - if the given value is out of range.
    • addPlatform

      public final void addPlatform(CharSequence authority, String identifier)
      Adds a platform on which instrument are installed. If a platform was already defined with a different identifier, then a new platform instance will be created. Storage location is:
      • metadata/acquisitionInformation/platform/identifier
      Parameters:
      authority - identifiers the authority that define platform codes, or null if none.
      identifier - identifier of the platform to add, or null for no-operation.
    • addInstrument

      public final void addInstrument(CharSequence authority, String identifier)
      Adds an instrument or sensor on the platform. Storage location is:
      • metadata/acquisitionInformation/platform/instrument/identifier
      Parameters:
      authority - identifiers the authority that define instrument codes, or null if none.
      identifier - identifier of the sensor to add, or null for no-operation.
    • addAcquisitionTime

      public final void addAcquisitionTime(Date time)
      Adds an event that describe the time at which data were acquired. Storage location is:
      • metadata/acquisitionInformation/operation/significantEvent/time
      Parameters:
      time - the acquisition time, or null for no-operation.
      See Also:
    • addAcquisitionTime

      public final void addAcquisitionTime(Instant startTime, Instant endTime)
      Adds an event that describe the range of time at which data were acquired. Current implementation computes the average of given instants. Storage location is:
      • metadata/acquisitionInformation/operation/significantEvent/time
      Parameters:
      startTime - start time, or null if unknown.
      endTime - end time, or null if unknown.
    • addAcquisitionOperation

      public final void addAcquisitionOperation(CharSequence program, String identifier)
      Adds the identifier of the operation used to acquire the dataset. Examples: "GHRSST", "NOAA CDR", "NASA EOS", "JPSS", "GOES-R". Storage location is:
      • metadata/acquisitionInformation/operation/identifier
      Parameters:
      program - identification of the mission, or null if none.
      identifier - unique identification of the operation, or null for no-operation.
    • addAcquisitionRequirement

      public final void addAcquisitionRequirement(CharSequence authority, String identifier)
      Adds the identifier of the requirement to be satisfied by data acquisition. Storage location is:
      • metadata/acquisitionInformation/acquisitionRequirement/identifier
      Parameters:
      authority - specifies the authority that define requirement codes, or null if none.
      identifier - unique name or code for the requirement, or null for no-operation.
    • addLineage

      public final void addLineage(CharSequence statement)
      Adds a general explanation of the data producer's knowledge about the lineage of a dataset. If a statement already exists, the new one will be appended after a new line. Storage location is:
      • metadata/resourceLineage/statement
      Parameters:
      statement - explanation of the data producer's knowledge about the lineage, or null for no-operation.
      See Also:
    • addSource

      public final void addSource(org.opengis.metadata.Metadata source)
      Adds a source described by the given metadata. Storage locations are:
      • metadata/resourceLineage/source/description
      • metadata/resourceLineage/source/citation
      • metadata/resourceLineage/source/scope/level
      • metadata/resourceLineage/source/scope/extent
      • metadata/resourceLineage/source/sourceReferenceSystem
      • metadata/resourceLineage/source/sourceSpatialResolution
      Parameters:
      source - metadata about a source of the resource for which to describe the lineage.
      See Also:
    • addSource

      public final void addSource(CharSequence description, org.opengis.metadata.maintenance.ScopeCode level, CharSequence feature)
      Adds information about a source of data used for producing the resource. Storage locations are:
      • metadata/resourceLineage/source/description
      • metadata/resourceLineage/source/scope/level
      • metadata/resourceLineage/source/scope/levelDescription/features
      Example: if a Landsat image uses the "GTOPO30" digital elevation model, then it can declare the source with "GTOPO30" description, ScopeCode.MODEL and feature "Digital Elevation Model".
      Parameters:
      description - a detailed description of the level of the source data, or null if none.
      level - hierarchical level of the source (e.g. model), or null if unspecified.
      feature - more detailed name for level, or null if none.
      See Also:
    • addSource

      public final void addSource(org.opengis.metadata.Metadata metadata, org.opengis.metadata.maintenance.ScopeCode level, CharSequence... features)
      Adds information about a source of data used for producing the resource. Storage locations are:
      • metadata/resourceLineage/source/scope/level
      • metadata/resourceLineage/source/scope/extent
      • metadata/resourceLineage/source/scope/levelDescription/*
      • metadata/resourceLineage/source/citation
      • metadata/resourceLineage/source/sourceReferenceSystem
      • metadata/resourceLineage/source/sourceSpatialResolution
      Example: if a FeatureSet is the aggregation of two other FeatureSet resources, then this method can be invoked twice with the metadata of each source FeatureSet. If the aggregated data are features, then level should be ScopeCode.FEATURE.
      Parameters:
      metadata - the metadata of the source, or null if none.
      level - hierarchical level of the source (e.g. feature). Should not be null.
      features - names of dataset, features or attributes used in the source.
      See Also:
    • addProcessing

      public final void addProcessing(CharSequence authority, String identifier)
      Adds information about the procedure, process and algorithm applied in a process step. If a processing was already defined with a different identifier, then a new processing instance will be created. Storage location is:
      • metadata/resourceLineage/processStep/processingInformation/identifier
      Parameters:
      authority - identifies the authority that defines processing code, or null if none.
      identifier - processing package that produced the data, or null for no-operation.
      See Also:
    • addSoftwareReference

      public final void addSoftwareReference(CharSequence title)
      Adds a reference to document describing processing software. This is added to the processing identified by last call to addProcessing(CharSequence, String). Storage location is:
      • metadata/resourceLineage/processStep/processingInformation/softwareReference/title
      Parameters:
      title - title of the document that describe the software, or null for no-operation.
      See Also:
    • addHostComputer

      public final void addHostComputer(CharSequence platform)
      Adds information about the computer and/or operating system in use at the processing time. This is added to the processing identified by last call to addProcessing(CharSequence, String). Storage location is:
      • metadata/resourceLineage/processStep/processingInformation/procedureDescription
      Parameters:
      platform - name of the system on which the processing has been executed, or null for no-operation.
      See Also:
    • addProcessDescription

      public final void addProcessDescription(CharSequence description)
      Adds additional details about the process step. If a description already exists, the new one will be added on a new line. Storage location is:
      • metadata/resourceLineage/processStep/description
      Parameters:
      description - additional details about the process step, or null for no-operation.
      See Also:
    • addFormatName

      public final void addFormatName(CharSequence value)
      Adds a name to the resource format. Note that this method does not add a new format, but only an alternative name to current format. Storage location is:
      • metadata/identificationInfo/resourceFormat/formatSpecificationCitation/alternateTitle
      If this method is used together with setPredefinedFormat(String), then setPredefinedFormat(…) should be invoked before this method.
      Parameters:
      value - the format name, or null for no-operation.
      See Also:
    • setFormatEdition

      public final void setFormatEdition(CharSequence value)
      Sets a version number for the resource format. Storage location is:
      • metadata/identificationInfo/resourceFormat/formatSpecificationCitation/edition
      If this method is used together with setPredefinedFormat(String), then setPredefinedFormat(…) should be invoked before this method.
      Parameters:
      value - the format edition, or null for no-operation.
      See Also:
    • addCompression

      public final void addCompression(CharSequence value)
      Adds a compression name. Storage location is:
      • metadata/identificationInfo/resourceFormat/fileDecompressionTechnique
      If this method is used together with setPredefinedFormat(String), then setPredefinedFormat(…) should be invoked before this method.
      Parameters:
      value - the compression name, or null for no-operation.
      See Also:
    • addCompleteMetadata

      public final void addCompleteMetadata(URI link)
      Adds a URL to a more complete description of the metadata. Storage location is:
      • metadata/metadataLinkage/linkage with function set to OnLineFunction.COMPLETE_METADATA
      Parameters:
      link - URL to a more complete description of the metadata, or null.
    • setISOStandards

      public final void setISOStandards(boolean part2)
      Sets the metadata standards to ISO 19115-1, and optionally to ISO 19115-2 too. Those metadata citations are added only if the metadata object is otherwise non-empty. Storage location is:
      • metadata/metadataStandards
      Parameters:
      part2 - whether to set ISO 19115-2 in addition to ISO 19115-1.
    • addFromComponent

      public final void addFromComponent(org.opengis.metadata.Metadata component)
      Appends information from the metadata of a component. This is an helper method for building the metadata of an aggregate. Aggregate metadata should be set before to invoke this method, in particular:
      • The aggregated resource title.
      • The format (may not be the same than component format).
      This method applies the following heuristic rules (may change in any future version). Those rules assume that the component metadata was built with MetadataBuilder (this assumption determines which metadata elements are inspected).
      • Content information is added verbatim. There is usually one instance per component.
      • Extents are added as one Extent per component, but without duplicated values.
      • All Coordinate Reference System information are added without duplicated values.
      • Some citation information are merged in a single citation. The following information are ignored because considered too specific to the component:
        • titles
        • identifiers
        • series (includes page numbers).
      • Compression are added (without duplicated value) but not the other format information (because the aggregate is assumed to have its own format name).
      • Distributor names, but not the other distribution information because the aggregated resource may not be distributed in the same way then the components.
      Parameters:
      component - the component from which to append metadata.
    • mergeMetadata

      public boolean mergeMetadata(Object source, Locale locale)
      Merge the given metadata into the metadata created by this builder. The given source should be an instance of Metadata, but some types of metadata components are accepted as well.

      This method should be invoked last, just before the call to build(). Any identification information, responsible party, extent, coverage description, etc. added after this method call will be stored in new metadata object (not merged).

      Parameters:
      source - the source metadata to merge. Will never be modified.
      locale - the locale to use for error message in exceptions, or null for the default locale.
      Returns:
      true if the given source has been merged, or false if its type is not managed by this builder.
      Throws:
      RuntimeException - if the merge failed (may be IllegalArgumentException, ClassCastException, InvalidMetadataException…)
      See Also:
    • flush

      private void flush()
      Writes all pending metadata objects into the DefaultMetadata root class. Then all identification, gridRepresentation, etc. fields except metadata are set to null.
    • build

      public final DefaultMetadata build()
      Returns the metadata as a modifiable object.
      Returns:
      the metadata (never null).
    • buildAndFreeze

      public final DefaultMetadata buildAndFreeze()
      Returns the metadata as an unmodifiable object.
      Returns:
      the metadata (never null).
    • shared

      private <T> T shared(Class<T> type, T value)
      Returns a shared instance of the given object if it already exists. If the given object is new, then it is added to the cache and returned.

      It is caller's responsibility to ensure that the type given in argument does not conflict with one of the type documented in sharedValues.

    • shared

      protected final Double shared(double value)
      Returns a shared instance of the given value. This is a helper method for callers who want to set themselves some additional metadata values on the instance returned by build().
      Parameters:
      value - a double value.
      Returns:
      the given value, but as an existing instance if possible.
    • shared

      protected final Integer shared(int value)
      Returns a shared instance of the given value. This is a helper method for callers who want to set themselves some additional metadata values on the instance returned by build().
      Parameters:
      value - an integer value.
      Returns:
      the same value, but as an existing instance if possible.