You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/10/13 17:50:42 UTC
svn commit: r1631443 [1/2] - in /sis/trunk: ./
core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/
core/sis-metadata/src/main/java/org/apache/sis/metadata/
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/
core/sis-metadata/src...
Author: desruisseaux
Date: Mon Oct 13 15:50:41 2014
New Revision: 1631443
URL: http://svn.apache.org/r1631443
Log:
Merge from the JDK6 branch.
Added:
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/OtherLocales.java
- copied unchanged from r1631337, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/OtherLocales.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/OtherLocalesTest.java
- copied unchanged from r1631337, sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/OtherLocalesTest.java
Modified:
sis/trunk/ (props changed)
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/PT_LocaleTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
sis/trunk/ide-project/NetBeans/nbproject/project.properties
sis/trunk/pom.xml
sis/trunk/storage/sis-netcdf/pom.xml
sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
Merged /sis/branches/JDK8:r1629470-1631330
Merged /sis/branches/JDK7:r1629471-1631332
Merged /sis/branches/JDK6:r1629497-1631337
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -21,8 +21,11 @@ import java.util.List;
import java.util.EnumSet;
import java.util.Collection;
import java.util.Collections;
+import java.util.Locale;
+import java.util.Currency;
import java.util.NoSuchElementException;
import java.lang.reflect.Modifier;
+import java.nio.charset.Charset;
import javax.xml.bind.annotation.XmlTransient;
import org.opengis.util.CodeList;
import org.apache.sis.util.logging.Logging;
@@ -632,8 +635,9 @@ public abstract class ModifiableMetadata
* versions may accept other types.
*
* <p>The default implementation returns <code>{@linkplain Set}.class</code> if the element type
- * is assignable to {@link Enum} or {@link CodeList}, and <code>{@linkplain List}.class</code>
- * otherwise. Subclasses can override this method for choosing different kind of collections.
+ * is assignable to {@link CodeList}, {@link Enum}, {@link String}, {@link Charset}, {@link Locale}
+ * or {@link Currency}, and <code>{@linkplain List}.class</code> otherwise.
+ * Subclasses can override this method for choosing different kind of collections.
* <em>Note however that {@link Set} should be used only with immutable element types</em>,
* for {@linkplain Object#hashCode() hash code} stability.</p>
*
@@ -645,7 +649,12 @@ public abstract class ModifiableMetadata
@SuppressWarnings({"rawtypes","unchecked"})
protected <E> Class<? extends Collection<E>> collectionType(final Class<E> elementType) {
return (Class) (CodeList.class.isAssignableFrom(elementType) ||
- Enum.class.isAssignableFrom(elementType) ? Set.class : List.class);
+ Enum.class.isAssignableFrom(elementType) ||
+ Charset.class.isAssignableFrom(elementType) ||
+ String.class == elementType ||
+ Locale.class == elementType ||
+ Currency.class == elementType
+ ? Set.class : List.class);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -250,10 +250,10 @@ class PropertyAccessor {
/**
* Creates a new property accessor for the specified metadata implementation.
*
- * @param standard The standard which define the {@code type} interface.
- * @param type The interface implemented by the metadata class.
+ * @param standard The standard which define the {@code type} interface.
+ * @param type The interface implemented by the metadata class.
* @param implementation The class of metadata implementations, or {@code type} if none.
- * @param onlyUML {@code true} for taking only the getter methods having a {@link UML} annotation.
+ * @param onlyUML {@code true} for taking only the getter methods having a {@link UML} annotation.
*/
PropertyAccessor(final Citation standard, final Class<?> type, final Class<?> implementation, final boolean onlyUML) {
assert type.isAssignableFrom(implementation) : implementation;
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -18,7 +18,14 @@ package org.apache.sis.metadata.iso;
import java.util.Date;
import java.util.Locale;
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
+import java.util.ConcurrentModificationException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.charset.Charset;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlType;
@@ -26,11 +33,16 @@ import javax.xml.bind.annotation.XmlSeeA
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.opengis.metadata.Identifier;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.ApplicationSchemaInformation;
import org.opengis.metadata.MetadataExtensionInformation;
import org.opengis.metadata.PortrayalCatalogueReference;
import org.opengis.metadata.acquisition.AcquisitionInformation;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.citation.CitationDate;
+import org.opengis.metadata.citation.DateType;
+import org.opengis.metadata.citation.OnlineResource;
import org.opengis.metadata.citation.ResponsibleParty;
import org.opengis.metadata.constraint.Constraints;
import org.opengis.metadata.content.ContentInformation;
@@ -39,16 +51,23 @@ import org.opengis.metadata.identificati
import org.opengis.metadata.identification.Identification;
import org.opengis.metadata.maintenance.MaintenanceInformation;
import org.opengis.metadata.maintenance.ScopeCode;
+import org.opengis.metadata.lineage.Lineage;
import org.opengis.metadata.quality.DataQuality;
import org.opengis.metadata.spatial.SpatialRepresentation;
import org.opengis.referencing.ReferenceSystem;
+import org.opengis.util.InternationalString;
+import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.citation.DefaultCitationDate;
+import org.apache.sis.metadata.iso.citation.DefaultOnlineResource;
+import org.apache.sis.metadata.iso.identification.AbstractIdentification;
+import org.apache.sis.metadata.iso.identification.DefaultDataIdentification;
+import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
+import org.apache.sis.internal.metadata.OtherLocales;
import org.apache.sis.internal.jaxb.code.PT_Locale;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.xml.Namespaces;
-import static org.apache.sis.internal.metadata.MetadataUtilities.toDate;
-import static org.apache.sis.internal.metadata.MetadataUtilities.toMilliseconds;
-
/**
* Root entity which defines metadata about a resource or resources.
@@ -74,7 +93,7 @@ import static org.apache.sis.internal.me
* @author Touraïvane (IRD)
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
* @module
*/
@XmlType(name = "MD_Metadata_Type", propOrder = {
@@ -112,66 +131,59 @@ public class DefaultMetadata extends ISO
private static final long serialVersionUID = 7337533776231004504L;
/**
- * Unique identifier for this metadata file, or {@code null} if none.
+ * Unique identifier for this metadata record, or {@code null} if none.
*/
- private String fileIdentifier;
+ private Identifier metadataIdentifier;
/**
- * Language used for documenting metadata.
+ * Language(s) used for documenting metadata.
*/
- private Locale language;
-
- /**
- * Information about an alternatively used localized character
- * strings for linguistic extensions.
- */
- private Collection<Locale> locales;
+ private Collection<Locale> languages;
/**
* Full name of the character coding standard used for the metadata set.
*/
- private CharacterSet characterSet;
+ private Collection<Charset> characterSets;
/**
- * File identifier of the metadata to which this metadata is a subset (child).
+ * Identification of the parent metadata record.
*/
- private String parentIdentifier;
+ private Citation parentMetadata;
/**
* Scope to which the metadata applies.
*/
- private Collection<ScopeCode> hierarchyLevels;
+ private Collection<DefaultMetadataScope> metadataScopes;
/**
- * Name of the hierarchy levels for which the metadata is provided.
+ * Parties responsible for the metadata information.
*/
- private Collection<String> hierarchyLevelNames;
+ private Collection<ResponsibleParty> contacts;
/**
- * Parties responsible for the metadata information.
+ * Date(s) associated with the metadata.
*/
- private Collection<ResponsibleParty> contacts;
+ private Collection<CitationDate> dates;
/**
- * Date that the metadata was created, in milliseconds elapsed since January 1st, 1970.
- * If not defined, then then value is {@link Long#MIN_VALUE}.
+ * Citation(s) for the standard(s) to which the metadata conform.
*/
- private long dateStamp = Long.MIN_VALUE;
+ private Collection<Citation> metadataStandards;
/**
- * Name of the metadata standard (including profile name) used.
+ * Citation(s) for the profile(s) of the metadata standard to which the metadata conform.
*/
- private String metadataStandardName;
+ private Collection<Citation> metadataProfiles;
/**
- * Version (profile) of the metadata standard used.
+ * Reference(s) to alternative metadata or metadata in a non-ISO standard for the same resource.
*/
- private String metadataStandardVersion;
+ private Collection<Citation> alternativeMetadataReferences;
/**
- * Uniformed Resource Identifier (URI) of the dataset to which the metadata applies.
+ * Online location(s) where the metadata is available.
*/
- private String dataSetUri;
+ private Collection<OnlineResource> metadataLinkages;
/**
* Digital representation of spatial information in the dataset.
@@ -235,6 +247,11 @@ public class DefaultMetadata extends ISO
private Collection<AcquisitionInformation> acquisitionInformation;
/**
+ * Information about the provenance, sources and/or the production processes applied to the resource.
+ */
+ private Collection<Lineage> resourceLineages;
+
+ /**
* Creates an initially empty metadata.
*/
public DefaultMetadata() {
@@ -253,8 +270,10 @@ public class DefaultMetadata extends ISO
final Identification identificationInfo)
{
this.contacts = singleton(contact, ResponsibleParty.class);
- this.dateStamp = toMilliseconds(dateStamp);
this.identificationInfo = singleton(identificationInfo, Identification.class);
+ if (dateStamp != null) {
+ dates = singleton(new DefaultCitationDate(dateStamp, DateType.CREATION), CitationDate.class);
+ }
}
/**
@@ -269,30 +288,49 @@ public class DefaultMetadata extends ISO
public DefaultMetadata(final Metadata object) {
super(object);
if (object != null) {
- fileIdentifier = object.getFileIdentifier();
- language = object.getLanguage();
- characterSet = object.getCharacterSet();
- parentIdentifier = object.getParentIdentifier();
- hierarchyLevels = copyCollection(object.getHierarchyLevels(), ScopeCode.class);
- hierarchyLevelNames = copyCollection(object.getHierarchyLevelNames(), String.class);
- contacts = copyCollection(object.getContacts(), ResponsibleParty.class);
- dateStamp = toMilliseconds(object.getDateStamp());
- metadataStandardName = object.getMetadataStandardName();
- metadataStandardVersion = object.getMetadataStandardVersion();
- dataSetUri = object.getDataSetUri();
- locales = copyCollection(object.getLocales(), Locale.class);
- spatialRepresentationInfo = copyCollection(object.getSpatialRepresentationInfo(), SpatialRepresentation.class);
- referenceSystemInfo = copyCollection(object.getReferenceSystemInfo(), ReferenceSystem.class);
- metadataExtensionInfo = copyCollection(object.getMetadataExtensionInfo(), MetadataExtensionInformation.class);
- identificationInfo = copyCollection(object.getIdentificationInfo(), Identification.class);
- contentInfo = copyCollection(object.getContentInfo(), ContentInformation.class);
- distributionInfo = object.getDistributionInfo();
- dataQualityInfo = copyCollection(object.getDataQualityInfo(), DataQuality.class);
- portrayalCatalogueInfo = copyCollection(object.getPortrayalCatalogueInfo(), PortrayalCatalogueReference.class);
- metadataConstraints = copyCollection(object.getMetadataConstraints(), Constraints.class);
- applicationSchemaInfo = copyCollection(object.getApplicationSchemaInfo(), ApplicationSchemaInformation.class);
- metadataMaintenance = object.getMetadataMaintenance();
- acquisitionInformation = copyCollection(object.getAcquisitionInformation(), AcquisitionInformation.class);
+ contacts = copyCollection(object.getContacts(), ResponsibleParty.class);
+ spatialRepresentationInfo = copyCollection(object.getSpatialRepresentationInfo(), SpatialRepresentation.class);
+ referenceSystemInfo = copyCollection(object.getReferenceSystemInfo(), ReferenceSystem.class);
+ metadataExtensionInfo = copyCollection(object.getMetadataExtensionInfo(), MetadataExtensionInformation.class);
+ identificationInfo = copyCollection(object.getIdentificationInfo(), Identification.class);
+ contentInfo = copyCollection(object.getContentInfo(), ContentInformation.class);
+ distributionInfo = object.getDistributionInfo();
+ dataQualityInfo = copyCollection(object.getDataQualityInfo(), DataQuality.class);
+ portrayalCatalogueInfo = copyCollection(object.getPortrayalCatalogueInfo(), PortrayalCatalogueReference.class);
+ metadataConstraints = copyCollection(object.getMetadataConstraints(), Constraints.class);
+ applicationSchemaInfo = copyCollection(object.getApplicationSchemaInfo(), ApplicationSchemaInformation.class);
+ metadataMaintenance = object.getMetadataMaintenance();
+ acquisitionInformation = copyCollection(object.getAcquisitionInformation(), AcquisitionInformation.class);
+ if (object instanceof DefaultMetadata) {
+ final DefaultMetadata c = (DefaultMetadata) object;
+ metadataIdentifier = c.getMetadataIdentifier();
+ parentMetadata = c.getParentMetadata();
+ languages = copyCollection(c.getLanguages(), Locale.class);
+ characterSets = copyCollection(c.getCharacterSets(), Charset.class);
+ metadataScopes = copyCollection(c.getMetadataScopes(), DefaultMetadataScope.class);
+ dates = copyCollection(c.getDates(), CitationDate.class);
+ metadataStandards = copyCollection(c.getMetadataStandards(), Citation.class);
+ metadataProfiles = copyCollection(c.getMetadataProfiles(), Citation.class);
+ alternativeMetadataReferences = copyCollection(c.getAlternativeMetadataReferences(), Citation.class);
+ metadataLinkages = copyCollection(c.getMetadataLinkages(), OnlineResource.class);
+ resourceLineages = copyCollection(c.getResourceLineages(), Lineage.class);
+ } else {
+ setFileIdentifier (object.getFileIdentifier());
+ setParentIdentifier (object.getParentIdentifier());
+ setLanguage (object.getLanguage());
+ setLocales (object.getLocales());
+ setCharacterSet (object.getCharacterSet());
+ setHierarchyLevels (object.getHierarchyLevels());
+ setHierarchyLevelNames (object.getHierarchyLevelNames());
+ setDateStamp (object.getDateStamp());
+ setMetadataStandardName (object.getMetadataStandardName());
+ setMetadataStandardVersion(object.getMetadataStandardVersion());
+ try {
+ setDataSetUri(object.getDataSetUri());
+ } catch (URISyntaxException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
}
}
@@ -322,92 +360,221 @@ public class DefaultMetadata extends ISO
}
/**
- * Returns the unique identifier for this metadata file, or {@code null} if none.
+ * Returns a unique identifier for this metadata record.
+ *
+ * @return Unique identifier for this metadata record, or {@code null}.
+ *
+ * @since 0.5
+ */
+ public Identifier getMetadataIdentifier() {
+ return metadataIdentifier;
+ }
+
+ /**
+ * Sets the unique identifier for this metadata record.
+ *
+ * @param newValue The new identifier, or {@code null} if none.
+ *
+ * @since 0.5
+ */
+ public void setMetadataIdentifier(final Identifier newValue) {
+ checkWritePermission();
+ metadataIdentifier = newValue;
+ }
+
+ /**
+ * Returns the unique identifier for this metadata file.
*
* @return Unique identifier for this metadata file, or {@code null}.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataIdentifier()}
+ * in order to include the codespace attribute.
*/
@Override
+ @Deprecated
@XmlElement(name = "fileIdentifier")
- public String getFileIdentifier() {
- return fileIdentifier;
+ public final String getFileIdentifier() {
+ final Identifier identifier = getMetadataIdentifier();
+ return (identifier != null) ? identifier.getCode() : null;
}
/**
- * Sets the unique identifier for this metadata file, or {@code null} if none.
+ * Sets the unique identifier for this metadata file.
+ *
+ * @param newValue The new identifier, or {@code null} if none.
*
- * @param newValue The new identifier.
+ * @deprecated As of ISO 19115:2014, replaced by {@link #setMetadataIdentifier(Identifier)}
*/
- public void setFileIdentifier(final String newValue) {
- checkWritePermission();
- fileIdentifier = newValue;
+ @Deprecated
+ public final void setFileIdentifier(final String newValue) {
+ DefaultIdentifier identifier = DefaultIdentifier.castOrCopy(getMetadataIdentifier());
+ if (identifier == null) {
+ identifier = new DefaultIdentifier();
+ }
+ identifier.setCode(newValue);
+ setMetadataIdentifier(identifier);
}
/**
- * Returns the language used for documenting metadata. This {@code DefaultMetadata} object and
- * its children will use that locale for marshalling {@link org.opengis.util.InternationalString}
- * and {@link org.opengis.util.CodeList} instances in ISO 19139 compliant XML documents.
+ * Returns the language(s) used for documenting metadata.
+ * The first element in iteration order is the default language.
+ * All other elements, if any, are alternate language(s) used within the resource.
+ *
+ * <p>Unless an other locale has been specified with the {@link org.apache.sis.xml.XML#LOCALE} property,
+ * this {@code DefaultMetadata} instance and its children will use the first locale returned by this method
+ * for marshalling {@link org.opengis.util.InternationalString} and {@link org.opengis.util.CodeList} instances
+ * in ISO 19115-2 compliant XML documents.
+ *
+ * @return Language(s) used for documenting metadata.
+ *
+ * @since 0.5
+ */
+ public Collection<Locale> getLanguages() {
+ return languages = nonNullCollection(languages, Locale.class);
+ }
+
+ /**
+ * Sets the language(s) used for documenting metadata.
+ * The first element in iteration order shall be the default language.
+ * All other elements, if any, are alternate language(s) used within the resource.
+ *
+ * @param newValues The new languages.
+ *
+ * @see org.apache.sis.xml.XML#LOCALE
+ *
+ * @since 0.5
+ */
+ public void setLanguages(final Collection<Locale> newValues) {
+ languages = writeCollection(newValues, languages, Locale.class);
+ // The "magik" applying this language to every children
+ // is performed by the 'beforeMarshal(Marshaller)' method.
+ }
+
+ /**
+ * Returns the default language used for documenting metadata.
*
* @return Language used for documenting metadata, or {@code null}.
+ *
+ * @deprecated As of GeoAPI 3.1, replaced by {@link #getLanguages()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "language")
- public Locale getLanguage() {
- return language;
+ public final Locale getLanguage() {
+ return OtherLocales.getFirst(languages);
+ // No warning if the collection contains more than one locale, because
+ // this is allowed by the "getLanguage() + getLocales()" contract.
}
/**
- * Sets the language used for documenting metadata. This {@code DefaultMetadata} object and its
- * children will use the given locale for marshalling {@link org.opengis.util.InternationalString}
- * and {@link org.opengis.util.CodeList} instances in ISO 19139 compliant XML documents.
+ * Sets the language used for documenting metadata.
+ * This method modifies the collection returned by {@link #getLanguages()} as below:
+ *
+ * <ul>
+ * <li>If the languages collection is empty, then this method sets the collection to the given {@code newValue}.</li>
+ * <li>Otherwise the first element in the languages collection is replaced by the given {@code newValue}.</li>
+ * </ul>
*
* @param newValue The new language.
*
- * @see org.apache.sis.xml.XML#LOCALE
+ * @deprecated As of GeoAPI 3.1, replaced by {@link #setLanguages(Collection)}.
*/
- public void setLanguage(final Locale newValue) {
+ @Deprecated
+ public final void setLanguage(final Locale newValue) {
checkWritePermission();
- language = newValue;
- // The "magik" applying this language to every children
- // is performed by the 'beforeMarshal(Marshaller)' method.
+ setLanguages(OtherLocales.setFirst(languages, newValue));
}
/**
* Provides information about an alternatively used localized character string for a linguistic extension.
*
* @return Alternatively used localized character string for a linguistic extension.
+ *
+ * @deprecated As of GeoAPI 3.1, replaced by {@link #getLanguages()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "locale")
@XmlJavaTypeAdapter(PT_Locale.class)
- public Collection<Locale> getLocales() {
- return locales = nonNullCollection(locales, Locale.class);
+ public final Collection<Locale> getLocales() {
+ return OtherLocales.filter(getLanguages());
}
/**
* Sets information about an alternatively used localized character string for a linguistic extension.
*
* @param newValues The new locales.
+ *
+ * @deprecated As of GeoAPI 3.1, replaced by {@link #setLanguages(Collection)}.
*/
- public void setLocales(final Collection<? extends Locale> newValues) {
- locales = writeCollection(newValues, locales, Locale.class);
+ @Deprecated
+ public final void setLocales(final Collection<? extends Locale> newValues) {
+ checkWritePermission();
+ setLanguages(OtherLocales.merge(getLanguage(), newValues));
}
/**
* Returns the character coding standard used for the metadata set.
+ * Instances can be obtained by a call to {@link Charset#forName(String)}.
*
- * <div class="warning"><b>Upcoming API change — JDK integration</b><br>
- * As of ISO 19115:2014, {@code CharacterSet} is replaced by a reference to the
- * <a href="http://www.iana.org/assignments/character-sets">IANA Character Set register</a>,
- * which is represented in Java by {@link Charset}.
- * This change may be applied in GeoAPI 4.0.
+ * <div class="note"><b>Examples:</b>
+ * {@code UCS-2}, {@code UCS-4}, {@code UTF-7}, {@code UTF-8}, {@code UTF-16},
+ * {@code ISO-8859-1} (a.k.a. {@code ISO-LATIN-1}), {@code ISO-8859-2}, {@code ISO-8859-3}, {@code ISO-8859-4},
+ * {@code ISO-8859-5}, {@code ISO-8859-6}, {@code ISO-8859-7}, {@code ISO-8859-8}, {@code ISO-8859-9},
+ * {@code ISO-8859-10}, {@code ISO-8859-11}, {@code ISO-8859-12}, {@code ISO-8859-13}, {@code ISO-8859-14},
+ * {@code ISO-8859-15}, {@code ISO-8859-16},
+ * {@code JIS_X0201}, {@code Shift_JIS}, {@code EUC-JP}, {@code US-ASCII}, {@code EBCDIC}, {@code EUC-KR},
+ * {@code Big5}, {@code GB2312}.
* </div>
*
+ * @return Character coding standards used for the metadata.
+ *
+ * @see #getLanguages()
+ * @see org.opengis.metadata.identification.DataIdentification#getCharacterSets()
+ * @see Charset#forName(String)
+ *
+ * @since 0.5
+ */
+ public Collection<Charset> getCharacterSets() {
+ return characterSets = nonNullCollection(characterSets, Charset.class);
+ }
+
+ /**
+ * Sets the character coding standard used for the metadata set.
+ *
+ * @param newValues The new character coding standards.
+ *
+ * @since 0.5
+ */
+ public void setCharacterSets(final Collection<Charset> newValues) {
+ characterSets = writeCollection(newValues, characterSets, Charset.class);
+ }
+
+ /**
+ * Returns the character coding standard used for the metadata set.
+ *
* @return Character coding standard used for the metadata, or {@code null}.
+ *
+ * @deprecated As of GeoAPI 3.1, replaced by {@link #getCharacterSets()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "characterSet")
- public CharacterSet getCharacterSet() {
- return characterSet;
+ public final CharacterSet getCharacterSet() {
+ final Charset cs = LegacyPropertyAdapter.getSingleton(characterSets,
+ Charset.class, null, DefaultMetadata.class, "getCharacterSet");
+ if (cs == null) {
+ return null;
+ }
+ final String name = cs.name();
+ for (final CharacterSet candidate : CharacterSet.values()) {
+ for (final String n : candidate.names()) {
+ if (name.equals(n)) {
+ return candidate;
+ }
+ }
+ }
+ return CharacterSet.valueOf(name);
}
/**
@@ -421,76 +588,241 @@ public class DefaultMetadata extends ISO
* </div>
*
* @param newValue The new character set.
+ *
+ * @deprecated As of GeoAPI 3.1, replaced by {@link #setCharacterSets(Collection)}.
*/
- public void setCharacterSet(final CharacterSet newValue) {
+ @Deprecated
+ public final void setCharacterSet(final CharacterSet newValue) {
+ setCharacterSets(LegacyPropertyAdapter.asCollection((newValue != null) ? newValue.toCharset() : null));
+ }
+
+ /**
+ * Returns an identification of the parent metadata record.
+ * This is non-null if this metadata is a subset (child) of another metadata.
+ *
+ * @return Identification of the parent metadata record, or {@code null} if none.
+ *
+ * @since 0.5
+ */
+ public Citation getParentMetadata() {
+ return parentMetadata;
+ }
+
+ /**
+ * Sets an identification of the parent metadata record.
+ *
+ * @param newValue The new identification of the parent metadata record.
+ *
+ * @since 0.5
+ */
+ public void setParentMetadata(final Citation newValue) {
checkWritePermission();
- characterSet = newValue;
+ parentMetadata = newValue;
}
/**
* Returns the file identifier of the metadata to which this metadata is a subset (child).
*
* @return Identifier of the metadata to which this metadata is a subset, or {@code null}.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getParentMetadata()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "parentIdentifier")
- public String getParentIdentifier() {
- return parentIdentifier;
+ public final String getParentIdentifier() {
+ final Citation parentMetadata = getParentMetadata();
+ if (parentMetadata != null) {
+ final InternationalString title = parentMetadata.getTitle();
+ if (title != null) {
+ return title.toString();
+ }
+ }
+ return null;
}
/**
* Sets the file identifier of the metadata to which this metadata is a subset (child).
*
* @param newValue The new parent identifier.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getParentMetadata()}.
*/
- public void setParentIdentifier(final String newValue) {
+ @Deprecated
+ public final void setParentIdentifier(final String newValue) {
checkWritePermission();
- parentIdentifier = newValue;
+ DefaultCitation parentMetadata = DefaultCitation.castOrCopy(getParentMetadata());
+ if (parentMetadata == null) {
+ parentMetadata = new DefaultCitation();
+ }
+ parentMetadata.setTitle(new SimpleInternationalString(newValue));
+ setParentMetadata(parentMetadata);
+ }
+
+ /**
+ * Returns the scope or type of resource for which metadata is provided.
+ *
+ * <div class="warning"><b>Upcoming API change — generalization</b><br>
+ * The element type will be changed to the {@code MetadataScope} interface
+ * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+ * </div>
+ *
+ * @return Scope or type of resource for which metadata is provided.
+ *
+ * @since 0.5
+ */
+ public Collection<DefaultMetadataScope> getMetadataScopes() {
+ return metadataScopes = nonNullCollection(metadataScopes, DefaultMetadataScope.class);
+ }
+
+ /**
+ * Sets the scope or type of resource for which metadata is provided.
+ *
+ * <div class="warning"><b>Upcoming API change — generalization</b><br>
+ * The element type will be changed to the {@code MetadataScope} interface
+ * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+ * </div>
+ *
+ * @param newValues The new scope or type of resource.
+ *
+ * @since 0.5
+ */
+ public void setMetadataScopes(final Collection<? extends DefaultMetadataScope> newValues) {
+ metadataScopes = writeCollection(newValues, metadataScopes, DefaultMetadataScope.class);
+ }
+
+ /**
+ * A specialization of {@link LegacyPropertyAdapter} which will try to merge the
+ * {@code "hierarchyLevel"} and {@code "hierarchyLevelName"} properties in the same
+ * {@link DefaultMetadataScope} instance.
+ */
+ private static abstract class ScopeAdapter<L> extends LegacyPropertyAdapter<L,DefaultMetadataScope> {
+ /**
+ * @param scopes Value of {@link DefaultMetadata#getMetadataScopes()}.
+ */
+ ScopeAdapter(final Collection<DefaultMetadataScope> scopes) {
+ super(scopes);
+ }
+
+ /**
+ * Invoked (indirectly) by JAXB when adding a new scope code or scope name. This implementation searches
+ * for an existing {@link MetadataScope} instance with a free slot for the new value before to create a
+ * new {@link DefaultMetadataScope} instance.
+ */
+ @Override
+ public boolean add(final L newValue) {
+ final Iterator<DefaultMetadataScope> it = elements.iterator();
+ if (it.hasNext()) {
+ DefaultMetadataScope scope = it.next();
+ if (unwrap(scope) == null) {
+ return update(scope, newValue);
+ }
+ }
+ return super.add(newValue);
+ }
}
/**
* Returns the scope to which the metadata applies.
*
* @return Scope to which the metadata applies.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataScopes()}
+ * followed by {@link DefaultMetadataScope#getResourceScope()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "hierarchyLevel")
- public Collection<ScopeCode> getHierarchyLevels() {
- return hierarchyLevels = nonNullCollection(hierarchyLevels, ScopeCode.class);
+ public final Collection<ScopeCode> getHierarchyLevels() {
+ return new ScopeAdapter<ScopeCode>(getMetadataScopes()) {
+ /** Stores a legacy value into the new kind of value. */
+ @Override protected DefaultMetadataScope wrap(final ScopeCode value) {
+ return new DefaultMetadataScope(value);
+ }
+
+ /** Extracts the legacy value from the new kind of value. */
+ @Override protected ScopeCode unwrap(final DefaultMetadataScope container) {
+ return container.getResourceScope();
+ }
+
+ /** Updates the legacy value in an existing instance of the new kind of value. */
+ @Override protected boolean update(final DefaultMetadataScope container, final ScopeCode value) {
+ container.setResourceScope(value);
+ return true;
+ }
+ }.validOrNull();
}
/**
* Sets the scope to which the metadata applies.
*
* @param newValues The new hierarchy levels.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataScopes()}
+ * followed by {@link DefaultMetadataScope#setResourceScope(ScopeCode)}.
*/
- public void setHierarchyLevels(final Collection<? extends ScopeCode> newValues) {
- hierarchyLevels = writeCollection(newValues, hierarchyLevels, ScopeCode.class);
+ @Deprecated
+ public final void setHierarchyLevels(final Collection<? extends ScopeCode> newValues) {
+ checkWritePermission();
+ ((LegacyPropertyAdapter<ScopeCode,?>) getHierarchyLevels()).setValues(newValues);
}
/**
* Returns the name of the hierarchy levels for which the metadata is provided.
*
* @return Hierarchy levels for which the metadata is provided.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataScopes()}
+ * followed by {@link DefaultMetadataScope#getName()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "hierarchyLevelName")
- public Collection<String> getHierarchyLevelNames() {
- return hierarchyLevelNames = nonNullCollection(hierarchyLevelNames, String.class);
+ public final Collection<String> getHierarchyLevelNames() {
+ return new ScopeAdapter<String>(getMetadataScopes()) {
+ /** Stores a legacy value into the new kind of value. */
+ @Override protected DefaultMetadataScope wrap(final String value) {
+ final DefaultMetadataScope scope = new DefaultMetadataScope();
+ scope.setName(new SimpleInternationalString(value));
+ return scope;
+ }
+
+ /** Extracts the legacy value from the new kind of value. */
+ @Override protected String unwrap(final DefaultMetadataScope container) {
+ final InternationalString name = container.getName();
+ return (name != null) ? name.toString() : null;
+ }
+
+ /** Updates the legacy value in an existing instance of the new kind of value. */
+ @Override protected boolean update(final DefaultMetadataScope container, final String value) {
+ container.setName(value != null ? new SimpleInternationalString(value) : null);
+ return true;
+ }
+ }.validOrNull();
}
/**
* Sets the name of the hierarchy levels for which the metadata is provided.
*
* @param newValues The new hierarchy level names.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataScopes()}
+ * followed by {@link DefaultMetadataScope#setName(InternationalString)}.
*/
- public void setHierarchyLevelNames(final Collection<? extends String> newValues) {
- hierarchyLevelNames = writeCollection(newValues, hierarchyLevelNames, String.class);
+ @Deprecated
+ public final void setHierarchyLevelNames(final Collection<? extends String> newValues) {
+ checkWritePermission();
+ ((LegacyPropertyAdapter<String,?>) getHierarchyLevelNames()).setValues(newValues);
}
/**
* Returns the parties responsible for the metadata information.
*
+ * <div class="warning"><b>Upcoming API change — generalization</b><br>
+ * As of ISO 19115:2014, {@code ResponsibleParty} is replaced by the {@link Responsibility} parent interface.
+ * This change will be tentatively applied in GeoAPI 4.0.
+ * </div>
+ *
* @return Parties responsible for the metadata information.
*/
@Override
@@ -510,87 +842,356 @@ public class DefaultMetadata extends ISO
}
/**
+ * Returns the date(s) associated with the metadata.
+ *
+ * @return Date(s) associated with the metadata.
+ *
+ * @see Citation#getDates()
+ *
+ * @since 0.5
+ */
+ public Collection<CitationDate> getDates() {
+ return dates = nonNullCollection(dates, CitationDate.class);
+ }
+
+ /**
+ * Sets the date(s) associated with the metadata.
+ * The collection should contains at least an element for {@link DateType#CREATION}.
+ *
+ * @param newValues New dates associated with the metadata.
+ *
+ * @since 0.5
+ */
+ public void setDates(final Collection<? extends CitationDate> newValues) {
+ dates = writeCollection(newValues, dates, CitationDate.class);
+ }
+
+ /**
* Returns the date that the metadata was created.
*
* @return Date that the metadata was created, or {@code null}.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getDates()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "dateStamp", required = true)
- public Date getDateStamp() {
- return toDate(dateStamp);
+ public final Date getDateStamp() {
+ final Collection<CitationDate> dates = this.dates;
+ if (dates != null) {
+ for (final CitationDate date : dates) {
+ if (DateType.CREATION.equals(date.getDateType())) {
+ return date.getDate();
+ }
+ }
+ }
+ return null;
}
/**
* Sets the date that the metadata was created.
*
* @param newValue The new date stamp.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #setDates(Collection)}.
+ */
+ @Deprecated
+ public final void setDateStamp(final Date newValue) {
+ checkWritePermission();
+ Collection<CitationDate> dates = this.dates;
+ if (dates == null) {
+ if (newValue == null) {
+ return;
+ }
+ dates = new ArrayList<CitationDate>(1);
+ } else {
+ final Iterator<CitationDate> it = dates.iterator();
+ while (it.hasNext()) {
+ final CitationDate date = it.next();
+ if (DateType.CREATION.equals(date.getDateType())) {
+ if (newValue == null) {
+ it.remove();
+ return;
+ }
+ if (date instanceof DefaultCitationDate) {
+ ((DefaultCitationDate) date).setDate(newValue);
+ return;
+ }
+ it.remove();
+ break;
+ }
+ }
+ }
+ dates.add(new DefaultCitationDate(newValue, DateType.CREATION));
+ setDates(dates);
+ }
+
+ /**
+ * Returns the citation(s) for the standard(s) to which the metadata conform.
+ *
+ * @return The standard(s) to which the metadata conform.
+ *
+ * @see #getMetadataProfiles()
+ *
+ * @since 0.5
+ */
+ public Collection<Citation> getMetadataStandards() {
+ return metadataStandards = nonNullCollection(metadataStandards, Citation.class);
+ }
+
+ /**
+ * Sets the citation(s) for the standard(s) to which the metadata conform.
+ * Metadata standard citations should include an identifier.
+ *
+ * @param newValues The new standard(s) to which the metadata conform.
+ *
+ * @since 0.5
+ */
+ public void setMetadataStandards(final Collection<? extends Citation> newValues) {
+ metadataStandards = writeCollection(newValues, metadataStandards, Citation.class);
+ }
+
+ /**
+ * Returns the citation(s) for the profile(s) of the metadata standard to which the metadata conform.
+ *
+ * @return The profile(s) to which the metadata conform.
+ *
+ * @see #getMetadataStandards()
+ * @see #getMetadataExtensionInfo()
+ *
+ * @since 0.5
*/
- public void setDateStamp(final Date newValue) {
+ public Collection<Citation> getMetadataProfiles() {
+ return metadataProfiles = nonNullCollection(metadataProfiles, Citation.class);
+ }
+
+ /**
+ * Set the citation(s) for the profile(s) of the metadata standard to which the metadata conform.
+ * Metadata profile standard citations should include an identifier.
+ *
+ * @param newValues The new profile(s) to which the metadata conform.
+ *
+ * @since 0.5
+ */
+ public void setMetadataProfiles(final Collection<? extends Citation> newValues) {
+ metadataProfiles = writeCollection(newValues, metadataProfiles, Citation.class);
+ }
+
+ /**
+ * Returns reference(s) to alternative metadata or metadata in a non-ISO standard for the same resource.
+ *
+ * @return Reference(s) to alternative metadata (e.g. Dublin core, FGDC).
+ *
+ * @since 0.5
+ */
+ public Collection<Citation> getAlternativeMetadataReferences() {
+ return alternativeMetadataReferences = nonNullCollection(alternativeMetadataReferences, Citation.class);
+ }
+
+ /**
+ * Set reference(s) to alternative metadata or metadata in a non-ISO standard for the same resource.
+ *
+ * @param newValues The new reference(s) to alternative metadata (e.g. Dublin core, FGDC).
+ *
+ * @since 0.5
+ */
+ public void setAlternativeMetadataReferences(final Collection<? extends Citation> newValues) {
+ alternativeMetadataReferences = writeCollection(newValues, alternativeMetadataReferences, Citation.class);
+ }
+
+ /**
+ * Implementation of legacy {@link #getMetadataStandardName()} and {@link #getMetadataStandardVersion()} methods.
+ */
+ private String getMetadataStandard(final boolean version) {
+ final Citation standard = LegacyPropertyAdapter.getSingleton(metadataStandards,
+ Citation.class, null, DefaultMetadata.class, version ? "getMetadataStandardName" : "getMetadataStandardVersion");
+ if (standard != null) {
+ final InternationalString title = version ? standard.getEdition() : standard.getTitle();
+ if (title != null) {
+ return title.toString();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Implementation of legacy {@link #setMetadataStandardName(String)} and
+ * {@link #setMetadataStandardVersion(String)} methods.
+ */
+ private void setMetadataStandard(final boolean version, final String newValue) {
checkWritePermission();
- dateStamp = toMilliseconds(newValue);
+ final InternationalString i18n = (newValue != null) ? new SimpleInternationalString(newValue) : null;
+ final List<Citation> newValues = (metadataStandards != null)
+ ? new ArrayList<Citation>(metadataStandards)
+ : new ArrayList<Citation>(1);
+ DefaultCitation citation = newValues.isEmpty() ? null : DefaultCitation.castOrCopy(newValues.get(0));
+ if (citation == null) {
+ citation = new DefaultCitation();
+ }
+ if (version) {
+ citation.setEdition(i18n);
+ } else {
+ citation.setTitle(i18n);
+ }
+ if (newValues.isEmpty()) {
+ newValues.add(citation);
+ } else {
+ newValues.set(0, citation);
+ }
+ setMetadataStandards(newValues);
}
/**
* Returns the name of the metadata standard (including profile name) used.
*
* @return Name of the metadata standard used, or {@code null}.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataStandards()}
+ * followed by {@link DefaultCitation#getTitle()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "metadataStandardName")
- public String getMetadataStandardName() {
- return metadataStandardName;
+ public final String getMetadataStandardName() {
+ return getMetadataStandard(false);
}
/**
* Name of the metadata standard (including profile name) used.
*
* @param newValue The new metadata standard name.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataStandards()}
+ * followed by {@link DefaultCitation#setTitle(InternationalString)}.
*/
- public void setMetadataStandardName(final String newValue) {
- checkWritePermission();
- metadataStandardName = newValue;
+ @Deprecated
+ public final void setMetadataStandardName(final String newValue) {
+ setMetadataStandard(false, newValue);
}
/**
* Returns the version (profile) of the metadata standard used.
*
* @return Version of the metadata standard used, or {@code null}.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataStandards()}
+ * followed by {@link DefaultCitation#getEdition()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "metadataStandardVersion")
- public String getMetadataStandardVersion() {
- return metadataStandardVersion;
+ public final String getMetadataStandardVersion() {
+ return getMetadataStandard(true);
}
/**
* Sets the version (profile) of the metadata standard used.
*
* @param newValue The new metadata standard version.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataStandards()}
+ * followed by {@link DefaultCitation#setEdition(InternationalString)}.
*/
- public void setMetadataStandardVersion(final String newValue) {
- checkWritePermission();
- metadataStandardVersion = newValue;
+ @Deprecated
+ public final void setMetadataStandardVersion(final String newValue) {
+ setMetadataStandard(true, newValue);
+ }
+
+ /**
+ * Returns the online location(s) where the metadata is available.
+ *
+ * @return Online location(s) where the metadata is available.
+ *
+ * @since 0.5
+ */
+ public Collection<OnlineResource> getMetadataLinkages() {
+ return metadataLinkages = nonNullCollection(metadataLinkages, OnlineResource.class);
+ }
+
+ /**
+ * Sets the online location(s) where the metadata is available.
+ *
+ * @param newValues The new online location(s).
+ *
+ * @since 0.5
+ */
+ public void setMetadataLinkages(final Collection<? extends OnlineResource> newValues) {
+ metadataLinkages = writeCollection(newValues, metadataLinkages, OnlineResource.class);
}
/**
* Provides the URI of the dataset to which the metadata applies.
*
* @return Uniformed Resource Identifier of the dataset, or {@code null}.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getIdentificationInfo()} followed by
+ * {@link DefaultDataIdentification#getCitation()} followed by {@link DefaultCitation#getOnlineResources()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "dataSetURI")
- public String getDataSetUri() {
- return dataSetUri;
+ public final String getDataSetUri() {
+ String linkage = null;
+ if (identificationInfo != null) {
+ for (final Identification identification : identificationInfo) {
+ final Citation citation = identification.getCitation();
+ if (citation instanceof DefaultCitation) {
+ final Collection<? extends OnlineResource> onlineResources = ((DefaultCitation) citation).getOnlineResources();
+ if (onlineResources != null) {
+ for (final OnlineResource link : onlineResources) {
+ final URI uri = link.getLinkage();
+ if (uri != null) {
+ if (linkage == null) {
+ linkage = uri.toString();
+ } else {
+ LegacyPropertyAdapter.warnIgnoredExtraneous(
+ OnlineResource.class, DefaultMetadata.class, "getDataSetUri");
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return linkage;
}
/**
* Sets the URI of the dataset to which the metadata applies.
+ * This method sets the linkage of the first online resource in the citation of the first identification info.
*
- * @param newValue The new data set URI.
- */
- public void setDataSetUri(final String newValue) {
+ * @param newValue The new data set URI.
+ * @throws URISyntaxException If the given value can not be parsed as a URI.
+ *
+ * @deprecated As of ISO 19115:2014, replaced by {@link #getIdentificationInfo()}
+ * followed by {@link DefaultDataIdentification#getCitation()}
+ * followed by {@link DefaultCitation#setOnlineResources(Collection)}.
+ */
+ @Deprecated
+ public final void setDataSetUri(final String newValue) throws URISyntaxException {
+ final URI uri = new URI(newValue);
checkWritePermission();
- dataSetUri = newValue;
+ Collection<Identification> identificationInfo = this.identificationInfo;
+ AbstractIdentification firstId = AbstractIdentification.castOrCopy(OtherLocales.getFirst(identificationInfo));
+ if (firstId == null) {
+ firstId = new DefaultDataIdentification();
+ }
+ DefaultCitation citation = DefaultCitation.castOrCopy(firstId.getCitation());
+ if (citation == null) {
+ citation = new DefaultCitation();
+ }
+ Collection<OnlineResource> onlineResources = citation.getOnlineResources();
+ DefaultOnlineResource firstOnline = DefaultOnlineResource.castOrCopy(OtherLocales.getFirst(onlineResources));
+ if (firstOnline == null) {
+ firstOnline = new DefaultOnlineResource();
+ }
+ firstOnline.setLinkage(uri);
+ onlineResources = OtherLocales.setFirst(onlineResources, firstOnline);
+ citation.setOnlineResources(onlineResources);
+ firstId.setCitation(citation);
+ identificationInfo = OtherLocales.setFirst(identificationInfo, firstId);
+ setIdentificationInfo(identificationInfo);
}
/**
@@ -674,7 +1275,7 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the feature catalogue and describes the coverage and
+ * Returns information about the feature catalogue and describes the coverage and
* image data characteristics.
*
* @return The feature catalogue, coverage descriptions and image data characteristics.
@@ -696,9 +1297,14 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the distributor of and options for obtaining the resource(s).
+ * Returns information about the distributor of and options for obtaining the resource(s).
+ *
+ * <div class="warning"><b>Upcoming API change — multiplicity</b><br>
+ * As of ISO 19115:2014, this singleton has been replaced by a collection.
+ * This change will tentatively be applied in GeoAPI 4.0.
+ * </div>
*
- * @return The distributor of and options for obtaining the resource(s), or {@code null}.
+ * @return The distributor of and options for obtaining the resource(s).
*/
@Override
@XmlElement(name = "distributionInfo")
@@ -707,7 +1313,12 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the distributor of and options for obtaining the resource(s).
+ * Sets information about the distributor of and options for obtaining the resource(s).
+ *
+ * <div class="warning"><b>Upcoming API change — multiplicity</b><br>
+ * As of ISO 19115:2014, this singleton has been replaced by a collection.
+ * This change will tentatively be applied in GeoAPI 4.0.
+ * </div>
*
* @param newValue The new distribution info.
*/
@@ -717,7 +1328,7 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides overall assessment of quality of a resource(s).
+ * Returns overall assessment of quality of a resource(s).
*
* @return Overall assessment of quality of a resource(s).
*/
@@ -737,7 +1348,7 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the catalogue of rules defined for the portrayal of a resource(s).
+ * Returns information about the catalogue of rules defined for the portrayal of a resource(s).
*
* @return The catalogue of rules defined for the portrayal of a resource(s).
*/
@@ -757,7 +1368,7 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides restrictions on the access and use of data.
+ * Returns restrictions on the access and use of data.
*
* @return Restrictions on the access and use of data.
*/
@@ -777,7 +1388,7 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the conceptual schema of a dataset.
+ * Returns information about the conceptual schema of a dataset.
*
* @return The conceptual schema of a dataset.
*/
@@ -788,7 +1399,7 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the conceptual schema of a dataset.
+ * Returns information about the conceptual schema of a dataset.
*
* @param newValues The new application schema info.
*/
@@ -797,7 +1408,27 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the frequency of metadata updates, and the scope of those updates.
+ * Returns information about the acquisition of the data.
+ *
+ * @return The acquisition of data.
+ */
+ @Override
+ @XmlElement(name = "acquisitionInformation", namespace = Namespaces.GMI)
+ public Collection<AcquisitionInformation> getAcquisitionInformation() {
+ return acquisitionInformation = nonNullCollection(acquisitionInformation, AcquisitionInformation.class);
+ }
+
+ /**
+ * Sets information about the acquisition of the data.
+ *
+ * @param newValues The new acquisition information.
+ */
+ public void setAcquisitionInformation(final Collection<? extends AcquisitionInformation> newValues) {
+ acquisitionInformation = writeCollection(newValues, acquisitionInformation, AcquisitionInformation.class);
+ }
+
+ /**
+ * Returns information about the frequency of metadata updates, and the scope of those updates.
*
* @return The frequency of metadata updates and their scope, or {@code null}.
*/
@@ -818,23 +1449,25 @@ public class DefaultMetadata extends ISO
}
/**
- * Provides information about the acquisition of the data.
+ * Returns information about the provenance, sources and/or the production processes applied to the resource.
*
- * @return The acquisition of data.
+ * @return Information about the provenance, sources and/or the production processes.
+ *
+ * @since 0.5
*/
- @Override
- @XmlElement(name = "acquisitionInformation", namespace = Namespaces.GMI)
- public Collection<AcquisitionInformation> getAcquisitionInformation() {
- return acquisitionInformation = nonNullCollection(acquisitionInformation, AcquisitionInformation.class);
+ public Collection<Lineage> getResourceLineages() {
+ return resourceLineages = nonNullCollection(resourceLineages, Lineage.class);
}
/**
- * Sets information about the acquisition of the data.
+ * Sets information about the provenance, sources and/or the production processes applied to the resource.
*
- * @param newValues The new acquisition information.
+ * @param newValues New information about the provenance, sources and/or the production processes.
+ *
+ * @since 0.5
*/
- public void setAcquisitionInformation(final Collection<? extends AcquisitionInformation> newValues) {
- acquisitionInformation = writeCollection(newValues, acquisitionInformation, AcquisitionInformation.class);
+ public void setResourceLineages(final Collection<? extends Lineage> newValues) {
+ resourceLineages = writeCollection(newValues, resourceLineages, Lineage.class);
}
/**
@@ -842,7 +1475,7 @@ public class DefaultMetadata extends ISO
* This method sets the locale to be used for XML marshalling to the metadata language.
*/
private void beforeMarshal(final Marshaller marshaller) {
- Context.push(language);
+ Context.push(OtherLocales.getFirst(languages));
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -207,6 +207,11 @@ public class DefaultAddress extends ISOM
/**
* Returns the address line for the location (as described in ISO 11180, Annex A).
*
+ * <div class="warning"><b>Upcoming API change — internationalization</b><br>
+ * The return type may be changed from {@code Collection<String>} to
+ * {@code Collection<? extends InternationalString>} in GeoAPI 4.0.
+ * </div>
+ *
* @return Address line for the location.
*/
@Override
@@ -218,6 +223,11 @@ public class DefaultAddress extends ISOM
/**
* Sets the address line for the location (as described in ISO 11180, Annex A).
*
+ * <div class="warning"><b>Upcoming API change — internationalization</b><br>
+ * The argument type may be changed from {@code Collection<String>} to
+ * {@code Collection<? extends InternationalString>} in GeoAPI 4.0.
+ * </div>
+ *
* @param newValues The new delivery points, or {@code null} if none.
*/
public void setDeliveryPoints(final Collection<? extends String> newValues) {
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -188,6 +188,10 @@ public class DefaultOnlineResource exten
/**
* Name of the online resource. Returns {@code null} if none.
*
+ * <div class="warning"><b>Upcoming API change — internationalization</b><br>
+ * The return type may be changed from {@code String} to {@code InternationalString} in GeoAPI 4.0.
+ * </div>
+ *
* @return Name of the online resource, or {@code null}.
*/
@Override
@@ -199,6 +203,10 @@ public class DefaultOnlineResource exten
/**
* Sets the name of the online resource.
*
+ * <div class="warning"><b>Upcoming API change — internationalization</b><br>
+ * The argument type may be changed from {@code String} to {@code InternationalString} in GeoAPI 4.0.
+ * </div>
+ *
* @param newValue The new name, or {@code null} if none.
*/
public void setName(final String newValue) {
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -194,7 +194,10 @@ public class DefaultBrowseGraphic extend
/**
* Format in which the illustration is encoded.
- * Examples: CGM, EPS, GIF, JPEG, PBM, PS, TIFF, XWD.
+ *
+ * <div class="note"><b>Example:</b>
+ * CGM, EPS, GIF, JPEG, PBM, PS, TIFF, XWD.
+ * </div>
*
* @return Format in which the illustration is encoded, or {@code null}.
*/
@@ -207,6 +210,8 @@ public class DefaultBrowseGraphic extend
/**
* Sets the format in which the illustration is encoded.
+ * Raster formats are encouraged to use one of the names returned by
+ * {@link javax.imageio.ImageIO#getReaderFormatNames()}.
*
* @param newValue The new file type.
*/
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -21,6 +21,7 @@ import java.util.Collection;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.metadata.maintenance.ScopeDescription;
import org.apache.sis.metadata.iso.ISOMetadata;
import org.apache.sis.internal.metadata.ExcludedSet;
@@ -57,7 +58,7 @@ import org.opengis.feature.type.FeatureT
* @author Touraïvane (IRD)
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
* @module
*/
@XmlType(name = "MD_ScopeDescription_Type") // No need for propOrder since this structure is a union (see javadoc).
@@ -71,18 +72,18 @@ public class DefaultScopeDescription ext
/**
* Enumeration of possible values for {@link #property}.
*/
- private static final byte ATTRIBUTES=1, FEATURES=2, FEATURE_INSTANCES=3, ATTRIBUTE_INSTANCES=4, DATASET=5, OTHER=6;
+ private static final byte DATASET=1, FEATURES=2, ATTRIBUTES=3, FEATURE_INSTANCES=4, ATTRIBUTE_INSTANCES=5, OTHER=6;
/**
* The names of the mutually exclusive properties. The index of each name shall be the
* value of the above {@code byte} constants minus one.
*/
private static final String[] NAMES = {
- "attributes",
+ "dataset",
"features",
+ "attributes",
"featureInstances",
"attributeInstances",
- "dataset",
"other"
};
@@ -90,11 +91,11 @@ public class DefaultScopeDescription ext
* The names of the setter methods, for logging purpose only.
*/
private static final String[] SETTERS = {
- "setAttributes",
+ "setDataset",
"setFeatures",
+ "setAttributes",
"setFeatureInstances",
"setAttributeInstances",
- "setDataset",
"setOther"
};
@@ -107,8 +108,8 @@ public class DefaultScopeDescription ext
* The value, as one of the following types:
*
* <ul>
- * <li>{@code Set<AttributeType>} for the {@code attributes} property</li>
* <li>{@code Set<FeatureType>} for the {@code features} property</li>
+ * <li>{@code Set<AttributeType>} for the {@code attributes} property</li>
* <li>{@code Set<FeatureType>} for the {@code featureInstances} property</li>
* <li>{@code Set<AttributeType>} for the {@code attributeInstances} property</li>
* <li>{@code String} for the {@code dataset} property</li>
@@ -129,9 +130,12 @@ public class DefaultScopeDescription ext
* given object are not recursively copied.
*
* <p>If the given object contains more than one value, then the first non-null element in the
- * following list has precedence: {@linkplain #getAttributes() attributes},
- * {@linkplain #getFeatures() features}, {@linkplain #getFeatureInstances() feature instances},
- * {@linkplain #getAttributeInstances() attribute instances}, {@linkplain #getDataset() dataset}
+ * following list has precedence (from wider scope to smaller scope):
+ * {@linkplain #getDataset() dataset},
+ * {@linkplain #getFeatures() features},
+ * {@linkplain #getAttributes() attributes},
+ * {@linkplain #getFeatureInstances() feature instances},
+ * {@linkplain #getAttributeInstances() attribute instances}
* and {@linkplain #getOther() other}.</p>
*
* @param object The metadata to copy values from, or {@code null} if none.
@@ -142,14 +146,14 @@ public class DefaultScopeDescription ext
public DefaultScopeDescription(final ScopeDescription object) {
super(object);
if (object != null) {
- for (byte i=ATTRIBUTES; i<=OTHER; i++) {
+ for (byte i=DATASET; i<=OTHER; i++) {
Object candidate;
switch (i) {
- case ATTRIBUTES: candidate = object.getAttributes(); break;
+ case DATASET: candidate = object.getDataset(); break;
case FEATURES: candidate = object.getFeatures(); break;
+ case ATTRIBUTES: candidate = object.getAttributes(); break;
case FEATURE_INSTANCES: candidate = object.getFeatureInstances(); break;
case ATTRIBUTE_INSTANCES: candidate = object.getAttributeInstances(); break;
- case DATASET: candidate = object.getDataset(); break;
case OTHER: candidate = object.getOther(); break;
default: throw new AssertionError(i);
}
@@ -264,52 +268,59 @@ public class DefaultScopeDescription ext
}
/**
- * Returns the attributes to which the information applies.
- *
- * <div class="warning"><b>Upcoming API change:</b>
- * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
- * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
+ * Returns the dataset to which the information applies.
*
- * @return Attributes to which the information applies.
+ * <div class="note"><b>Example:</b>
+ * If a geographic data provider is generating vector mapping for thee administrative areas
+ * and if the data were processed in the same way, then the provider could record the bulk
+ * of initial data at {@link ScopeCode#DATASET} level with a
+ * “<cite>Administrative area A, B & C</cite>” description.
+ * </div>
*
- * {@section Conditions}
- * This method returns a modifiable collection only if no other property is set.
- * Otherwise, this method returns an unmodifiable empty collection.
+ * @return Dataset to which the information applies, or {@code null}.
*/
@Override
- public Set<AttributeType> getAttributes() {
- return getProperty(AttributeType.class, ATTRIBUTES);
+ @XmlElement(name = "dataset")
+ public String getDataset() {
+ return (property == DATASET) ? (String) value : null;
}
/**
- * Sets the attributes to which the information applies.
+ * Sets the dataset to which the information applies.
*
* {@section Effect on other properties}
- * If and only if the {@code newValue} is non-empty, then this method automatically
+ * If and only if the {@code newValue} is non-null, then this method automatically
* discards all other properties.
*
- * <div class="warning"><b>Upcoming API change:</b>
- * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
- * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
- *
- * @param newValues The new attributes.
+ * @param newValue The new dataset.
*/
- public void setAttributes(final Set<? extends AttributeType> newValues) {
- setProperty(newValues, AttributeType.class, ATTRIBUTES);
+ public void setDataset(final String newValue) {
+ checkWritePermission();
+ if (newValue != null || property == DATASET) {
+ warningOnOverwrite(DATASET);
+ property = DATASET;
+ value = newValue;
+ }
}
/**
- * Returns the features to which the information applies.
- *
- * <div class="warning"><b>Upcoming API change:</b>
- * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
- * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
+ * Returns the feature types to which the information applies.
*
- * @return Features to which the information applies.
+ * <div class="note"><b>Example:</b>
+ * If an administrative area performs a complete re-survey of the road network,
+ * the change can be recorded at {@link ScopeCode#FEATURE_TYPE} level with a
+ * “<cite>Administrative area A — Road network</cite>” description.
+ * </div>
*
* {@section Conditions}
* This method returns a modifiable collection only if no other property is set.
* Otherwise, this method returns an unmodifiable empty collection.
+ *
+ * <div class="warning"><b>Upcoming API change:</b>
+ * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
+ * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
+ *
+ * @return Feature types to which the information applies.
*/
@Override
public Set<FeatureType> getFeatures() {
@@ -317,7 +328,7 @@ public class DefaultScopeDescription ext
}
/**
- * Sets the features to which the information applies.
+ * Sets the feature types to which the information applies.
*
* {@section Effect on other properties}
* If and only if the {@code newValue} is non-empty, then this method automatically
@@ -327,32 +338,38 @@ public class DefaultScopeDescription ext
* The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
* See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
*
- * @param newValues The new features.
+ * @param newValues The new feature types.
*/
public void setFeatures(final Set<? extends FeatureType> newValues) {
setProperty(newValues, FeatureType.class, FEATURES);
}
/**
- * Returns the feature instances to which the information applies.
- *
- * <div class="warning"><b>Upcoming API change:</b>
- * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
- * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
+ * Returns the attribute types to which the information applies.
*
- * @return Feature instances to which the information applies.
+ * <div class="note"><b>Example:</b>
+ * If an administrative area detects an anomaly in all overhead clearance of the road survey,
+ * the correction can be recorded at {@link ScopeCode#ATTRIBUTE_TYPE} level with a
+ * “<cite>Administrative area A — Overhead clearance</cite>” description.
+ * </div>
*
* {@section Conditions}
* This method returns a modifiable collection only if no other property is set.
* Otherwise, this method returns an unmodifiable empty collection.
+ *
+ * <div class="warning"><b>Upcoming API change:</b>
+ * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
+ * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
+ *
+ * @return Attribute types to which the information applies.
*/
@Override
- public Set<FeatureType> getFeatureInstances() {
- return getProperty(FeatureType.class, FEATURE_INSTANCES);
+ public Set<AttributeType> getAttributes() {
+ return getProperty(AttributeType.class, ATTRIBUTES);
}
/**
- * Sets the feature instances to which the information applies.
+ * Sets the attribute types to which the information applies.
*
* {@section Effect on other properties}
* If and only if the {@code newValue} is non-empty, then this method automatically
@@ -362,32 +379,38 @@ public class DefaultScopeDescription ext
* The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
* See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
*
- * @param newValues The new feature instances.
+ * @param newValues The new attribute types.
*/
- public void setFeatureInstances(final Set<? extends FeatureType> newValues) {
- setProperty(newValues, FeatureType.class, FEATURE_INSTANCES);
+ public void setAttributes(final Set<? extends AttributeType> newValues) {
+ setProperty(newValues, AttributeType.class, ATTRIBUTES);
}
/**
- * Returns the attribute instances to which the information applies.
- *
- * <div class="warning"><b>Upcoming API change:</b>
- * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
- * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
+ * Returns the feature instances to which the information applies.
*
- * @return Attribute instances to which the information applies.
+ * <div class="note"><b>Example:</b>
+ * If a new bridge is constructed in a road network,
+ * the change can be recorded at {@link ScopeCode#FEATURE} level with a
+ * “<cite>Administrative area A — New bridge</cite>” description.
+ * </div>
*
* {@section Conditions}
* This method returns a modifiable collection only if no other property is set.
* Otherwise, this method returns an unmodifiable empty collection.
+ *
+ * <div class="warning"><b>Upcoming API change:</b>
+ * The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
+ * See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
+ *
+ * @return Feature instances to which the information applies.
*/
@Override
- public Set<AttributeType> getAttributeInstances() {
- return getProperty(AttributeType.class, ATTRIBUTE_INSTANCES);
+ public Set<FeatureType> getFeatureInstances() {
+ return getProperty(FeatureType.class, FEATURE_INSTANCES);
}
/**
- * Sets the attribute instances to which the information applies.
+ * Sets the feature instances to which the information applies.
*
* {@section Effect on other properties}
* If and only if the {@code newValue} is non-empty, then this method automatically
@@ -397,47 +420,51 @@ public class DefaultScopeDescription ext
* The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
* See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
*
- * @param newValues The new attribute instances.
+ * @param newValues The new feature instances.
*/
- public void setAttributeInstances(final Set<? extends AttributeType> newValues) {
- setProperty(newValues, AttributeType.class, ATTRIBUTE_INSTANCES);
+ public void setFeatureInstances(final Set<? extends FeatureType> newValues) {
+ setProperty(newValues, FeatureType.class, FEATURE_INSTANCES);
}
/**
- * Returns the dataset to which the information applies.
+ * Returns the attribute instances to which the information applies.
+ *
+ * <div class="note"><b>Example:</b>
+ * If the overhead clearance of a new bridge was wrongly recorded,
+ * the correction can be recorded at {@link ScopeCode#ATTRIBUTE} level with a
+ * “<cite>Administrative area A — New bridge — Overhead clearance</cite>” description.
+ * </div>
+ *
+ * {@section Conditions}
+ * This method returns a modifiable collection only if no other property is set.
+ * Otherwise, this method returns an unmodifiable empty collection.
*
* <div class="warning"><b>Upcoming API change:</b>
* The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
* See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
*
- * @return Dataset to which the information applies, or {@code null}.
+ * @return Attribute instances to which the information applies.
*/
@Override
- @XmlElement(name = "dataset")
- public String getDataset() {
- return (property == DATASET) ? (String) value : null;
+ public Set<AttributeType> getAttributeInstances() {
+ return getProperty(AttributeType.class, ATTRIBUTE_INSTANCES);
}
/**
- * Sets the dataset to which the information applies.
+ * Sets the attribute instances to which the information applies.
*
* {@section Effect on other properties}
- * If and only if the {@code newValue} is non-null, then this method automatically
+ * If and only if the {@code newValue} is non-empty, then this method automatically
* discards all other properties.
*
* <div class="warning"><b>Upcoming API change:</b>
* The type of this property may be changed to {@code Set<CharSequence>} for ISO 19115:2014 conformance.
* See <a href="http://jira.codehaus.org/browse/GEO-238">GEO-238</a> for more information.</div>
*
- * @param newValue The new dataset.
+ * @param newValues The new attribute instances.
*/
- public void setDataset(final String newValue) {
- checkWritePermission();
- if (newValue != null || property == DATASET) {
- warningOnOverwrite(DATASET);
- property = DATASET;
- value = newValue;
- }
+ public void setAttributeInstances(final Set<? extends AttributeType> newValues) {
+ setProperty(newValues, AttributeType.class, ATTRIBUTE_INSTANCES);
}
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java?rev=1631443&r1=1631442&r2=1631443&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] Mon Oct 13 15:50:41 2014
@@ -34,6 +34,7 @@
* </tr><tr><td style="width: 50%; white-space: nowrap">
* {@linkplain org.apache.sis.metadata.iso.ISOMetadata ISO-19115 metadata}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultMetadata Metadata}<br>
+ * {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultMetadataScope Metadata scope}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultPortrayalCatalogueReference Portrayal catalogue reference}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultApplicationSchemaInformation Application schema information}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultMetadataExtensionInformation Metadata extension information}<br>
@@ -45,6 +46,7 @@
* {@code └─} {@linkplain org.opengis.metadata.Obligation Obligation}<br>
* </td><td class="sep" style="width: 50%; white-space: nowrap">
* {@linkplain org.apache.sis.metadata.iso.DefaultMetadata Metadata}<br>
+ * {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultMetadataScope Metadata scope}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultPortrayalCatalogueReference Portrayal catalogue reference}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultApplicationSchemaInformation Application schema information}<br>
* {@code ├─} {@linkplain org.apache.sis.metadata.iso.DefaultMetadataExtensionInformation Metadata extension information}<br>
@@ -82,7 +84,7 @@
* @author Touraïvane (IRD)
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
* @module
*/
@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GMD, xmlns = {