001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2004-2024 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.metadata.distribution;
019
020import java.util.Collection;
021import java.util.Collections;
022import javax.measure.Unit;
023import org.opengis.annotation.UML;
024import org.opengis.annotation.Classifier;
025import org.opengis.annotation.Stereotype;
026import org.opengis.metadata.Identifier;
027import org.opengis.util.InternationalString;
028
029import static org.opengis.annotation.Obligation.*;
030import static org.opengis.annotation.Specification.*;
031
032
033/**
034 * Information about the media on which the resource can be stored or distributed.
035 *
036 * @author  Martin Desruisseaux (IRD)
037 * @version 3.1
038 * @since   2.0
039 */
040@Classifier(Stereotype.DATATYPE)
041@UML(identifier="MD_Medium", specification=ISO_19115)
042public interface Medium {
043    /**
044     * Name of the medium on which the resource can be stored or distributed.
045     *
046     * <div class="warning"><b>Upcoming API change — generalization</b><br>
047     * As of ISO 19115:2014, {@code MediumName} is replaced by {@link org.opengis.metadata.citation.Citation}.
048     * This change may be applied in GeoAPI 4.0.
049     * See <a href="https://github.com/opengeospatial/geoapi/issues/14">issue #14</a>.</div>
050     *
051     * @return name of the medium, or {@code null}.
052     */
053    @UML(identifier="name", obligation=OPTIONAL, specification=ISO_19115)
054    default MediumName getName() {
055        return null;
056    }
057
058    /**
059     * Density at which the data is recorded.
060     * The numbers shall be greater than zero.
061     *
062     * @return density at which the data is recorded, or {@code null}.
063     *
064     * @since 3.1
065     */
066    @UML(identifier="density", obligation=OPTIONAL, specification=ISO_19115)
067    default Double getDensity() {
068        return null;
069    }
070
071    /**
072     * @deprecated As of ISO 19115:2014, replaced by {@link #getDensity()}.
073     *
074     * @return density at which the data is recorded.
075     */
076    @Deprecated(since="3.1")
077    default Collection<Double> getDensities() {
078        Double density = getDensity();
079        return (density != null) ? Collections.singleton(density) : Collections.emptySet();
080    }
081
082    /**
083     * Units of measure for the recording density.
084     *
085     * @return units of measure for the recording density, or {@code null}.
086     *
087     * @condition The {@linkplain #getDensity() density} must be provided.
088     */
089    @UML(identifier="densityUnits", obligation=CONDITIONAL, specification=ISO_19115)
090    default Unit<?> getDensityUnits() {
091        return null;
092    }
093
094    /**
095     * Number of items in the media identified.
096     * Returns {@code null} if unknown.
097     *
098     * @return number of items in the media identified, or {@code null}.
099     */
100    @UML(identifier="volumes", obligation=OPTIONAL, specification=ISO_19115)
101    default Integer getVolumes() {
102        return null;
103    }
104
105    /**
106     * Method used to write to the medium.
107     *
108     * @return method used to write to the medium, or {@code null}.
109     */
110    @UML(identifier="mediumFormat", obligation=OPTIONAL, specification=ISO_19115)
111    default Collection<MediumFormat> getMediumFormats() {
112        return Collections.emptySet();          // Use Set instead of List for hash-safe final classes.
113    }
114
115    /**
116     * Description of other limitations or requirements for using the medium.
117     *
118     * @return description of other limitations for using the medium, or {@code null}.
119     */
120    @UML(identifier="mediumNote", obligation=OPTIONAL, specification=ISO_19115)
121    default InternationalString getMediumNote() {
122        return null;
123    }
124
125    /**
126     * Unique identifier for an instance of the medium.
127     *
128     * @return unique identifier, or {@code null} if none.
129     *
130     * @since 3.1
131     */
132    @UML(identifier="identifier", obligation=OPTIONAL, specification=ISO_19115)
133    default Identifier getIdentifier() {
134        return null;
135    }
136}