sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1626345 [4/14] - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/ core/sis-metadat...
Date Fri, 19 Sep 2014 21:46:44 GMT
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -1,4 +1,4 @@
-/*
+ /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -16,22 +16,50 @@
  */
 package org.apache.sis.metadata.iso.citation;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
 import org.opengis.metadata.citation.Telephone;
+import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.metadata.iso.ISOMetadata;
 
 
 /**
  * Telephone numbers for contacting the responsible individual or organization.
  *
+ * {@section Differences between versions 2003 and 2014 of ISO 19115}
+ * For any contact having more than one telephone number, the way to organize the information
+ * changed significantly between the two versions of ISO standard:
+ *
+ * <ul>
+ *   <li>In ISO 19115:2003, each {@code Contact} had only one {@code Telephone} instance, but that instance
+ *       could have an arbitrary amount of "voice" and "facsimile" numbers. The methods (now deprecated) were
+ *       {@link DefaultContact#getPhone()}, {@link #getVoices()} and {@link #getFacsimiles()}.</li>
+ *   <li>In ISO 19115:2014, each {@code Contact} has an arbitrary amount of {@code Telephone} instances, and
+ *       each telephone has exactly one number. The new methods are {@link DefaultContact#getPhones()},
+ *       {@link #getNumber()} and {@link #getNumberType()}.</li>
+ * </ul>
+ *
+ * {@section Limitations}
+ * <ul>
+ *   <li>Instances of this class are not synchronized for multi-threading.
+ *       Synchronization, if needed, is caller's responsibility.</li>
+ *   <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ *       Serialization support is appropriate for short term storage or RMI between applications running the
+ *       same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Cédric Briançon (Geomatys)
- * @since   0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @author  Rémi Maréchal (Geomatys)
+ * @since   0.5 (derived from geotk-2.1)
+ * @version 0.5
  * @module
+ *
+ * @see DefaultContact#getPhones()
  */
 @XmlType(name = "CI_Telephone_Type", propOrder = {
     "voices",
@@ -42,17 +70,17 @@ public class DefaultTelephone extends IS
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -1920621361930970869L;
+    private static final long serialVersionUID = 5156405432420742237L;
 
     /**
-     * Telephone numbers by which individuals can speak to the responsible organization or individual.
+     * Telephone number by which individuals can contact responsible organization or individual.
      */
-    private Collection<String> voices;
+    private String number;
 
     /**
-     * Telephone numbers of a facsimile machine for the responsible organization or individual.
+     * Type of telephone number.
      */
-    private Collection<String> facsimiles;
+    TelephoneType numberType;
 
     /**
      * Constructs a default telephone.
@@ -61,6 +89,19 @@ public class DefaultTelephone extends IS
     }
 
     /**
+     * Constructs a telephone with the given number and type.
+     *
+     * @param number     The telephone number, or {@code null}.
+     * @param numberType The type of telephone number, or {@code null}.
+     *
+     * @since 0.5
+     */
+    DefaultTelephone(final String number, final TelephoneType numberType) {
+        this.number     = number;
+        this.numberType = numberType;
+    }
+
+    /**
      * Constructs a new instance initialized with the values from the specified metadata object.
      * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the
      * given object are not recursively copied.
@@ -72,8 +113,13 @@ public class DefaultTelephone extends IS
     public DefaultTelephone(final Telephone object) {
         super(object);
         if (object != null) {
-            voices     = copyCollection(object.getVoices(), String.class);
-            facsimiles = copyCollection(object.getFacsimiles(), String.class);
+            if (object instanceof DefaultTelephone) {
+                number     = ((DefaultTelephone) object).getNumber();
+                numberType = ((DefaultTelephone) object).numberType;
+            } else {
+                setVoices(object.getVoices());
+                setFacsimiles(object.getFacsimiles());
+            }
         }
     }
 
@@ -103,42 +149,181 @@ public class DefaultTelephone extends IS
     }
 
     /**
+     * Returns the telephone number by which individuals can contact responsible organization or individual.
+     *
+     * @return Telephone number by which individuals can contact responsible organization or individual.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "number", required = true)
+    public String getNumber() {
+        return number;
+    }
+
+    /**
+     * Sets the telephone number by which individuals can contact responsible organization or individual.
+     *
+     * @param newValue The new telephone number by which individuals can contact responsible organization or individual.
+     *
+     * @since 0.5
+     */
+    public void setNumber(final String newValue) {
+        checkWritePermission();
+        number = newValue;
+    }
+
+    /**
+     * Returns the type of telephone number, or {@code null} if none.
+     * If non-null, the type can be {@code "VOICE"}, {@code "FACSIMILE"} or {@code "SMS"}.
+     *
+     * <div class="warning"><b>Upcoming API change — specialization</b><br>
+     * The return type will be changed to the {@code TelephoneType} code list
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @return Type of telephone number, or {@code null} if none.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "numberType")
+    public Object getNumberType() {
+        return (numberType != null) ? numberType.name() : null;
+    }
+
+    /**
+     * Set the type of telephone number.
+     * If non-null, the type can only be {@code "VOICE"}, {@code "FACSIMILE"} or {@code "SMS"}.
+     *
+     * <div class="warning"><b>Upcoming API change — specialization</b><br>
+     * The argument type will be changed to the {@code TelephoneType} code list
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @param newValue The new type of telephone number.
+     *
+     * @since 0.5
+     */
+    public void setNumberType(final Object newValue) {
+        checkWritePermission();
+        numberType = (newValue != null) ? TelephoneType.valueOf(newValue.toString()) : null;
+    }
+
+    /**
+     * For implementation of {@link #getVoices()} and {@link #getFacsimiles()} deprecated methods.
+     * Shall be the telephones list of the enclosing {@link DefaultContact} object.
+     *
+     * <p>This field references the same collection than {@link DefaultContact#phones} when possible.
+     * Note that the link between this collection and {@code DefaultContact.phones} is broken when
+     * {@link DefaultContact#freeze()} is invoked, since the {@code Cloner.clone(Object)} method
+     * creates a new (unmodifiable) collection.</p>
+     *
+     * @deprecated This field will be removed after we removed the deprecated public methods.
+     */
+    @Deprecated
+    private Collection<Telephone> owner;
+
+    /**
+     * Specifies the collection which contains this telephone number.
+     * This method is invoked by {@link DefaultContact#setPhones(Collection)}
+     * when the contact "takes possession" of a {@code DefaultTelephone}.
+     *
+     * <p>This method will be removed after we removed the deprecated public methods.</p>
+     *
+     * @param  phones The collection which should contains this telephone number.
+     * @return {@code this}, or a copy of this instance if we conservatively choose to not modify this instance.
+     */
+    final DefaultTelephone setOwner(final Collection<Telephone> phones) {
+        if (owner != phones) {
+            if (owner != null && !CollectionsExt.identityEquals(owner.iterator(), phones.iterator())) {
+                final DefaultTelephone copy = new DefaultTelephone(this);
+                copy.owner = phones;
+                return copy;
+            }
+            owner = phones;
+        }
+        return this;
+    }
+
+    /**
+     * Returns the collection that own this telephone number, or create a new collection.
+     * Creating a new collection is needed when this phone number has not yet been given
+     * to a {@link DefaultContact}.
+     *
+     * <p>This method will be removed after we removed the deprecated public methods.</p>
+     */
+    final Collection<Telephone> getOwner() {
+       if (owner == null) {
+           if (isModifiable()) {
+               owner = new ArrayList<Telephone>(4);
+               owner.add(this);
+           } else {
+               owner = Collections.<Telephone>singletonList(this);
+           }
+       }
+       return owner;
+    }
+
+    /**
      * Returns the telephone numbers by which individuals can speak to the responsible organization or individual.
+     * This method searches in the {@linkplain DefaultContact#getPhones() contact phones}, if the contact that own
+     * this phone is known.
      *
      * @return Telephone numbers by which individuals can speak to the responsible organization or individual.
+     *
+     * @deprecated As of ISO 19115:2014, replaced by a {@linkplain #getNumber() number}
+     *             with {@link TelephoneType#VOICE}.
      */
     @Override
+    @Deprecated
     @XmlElement(name = "voice")
-    public Collection<String> getVoices() {
-        return voices = nonNullCollection(voices, String.class);
+    public final Collection<String> getVoices() {
+        return new LegacyTelephones(getOwner(), TelephoneType.VOICE);
     }
 
     /**
      * Sets the telephone numbers by which individuals can speak to the responsible organization or individual.
+     * This method writes in the {@linkplain DefaultContact#getPhones() contact phones}, if the contact that own
+     * this phone is known.
      *
      * @param newValues The new telephone numbers, or {@code null} if none.
+     *
+     * @deprecated As of ISO 19115:2014, replaced by a {@linkplain #setNumber(String) number}
+     *             with {@link TelephoneType#VOICE}.
      */
-    public void setVoices(final Collection<? extends String> newValues) {
-        voices = writeCollection(newValues, voices, String.class);
+    @Deprecated
+    public final void setVoices(final Collection<? extends String> newValues) {
+        ((LegacyTelephones) getVoices()).setValues(newValues);
     }
 
     /**
      * Returns the telephone numbers of a facsimile machine for the responsible organization or individual.
+     * This method searches in the {@linkplain DefaultContact#getPhones() contact phones}, if the contact
+     * that own this phone is known.
      *
      * @return Telephone numbers of a facsimile machine for the responsible organization or individual.
+     *
+     * @deprecated As of ISO 19115:2014, replaced by a {@linkplain #getNumber() number}
+     *             with {@link TelephoneType#FACSIMILE}.
      */
     @Override
+    @Deprecated
     @XmlElement(name = "facsimile")
-    public Collection<String> getFacsimiles() {
-        return facsimiles = nonNullCollection(facsimiles, String.class);
+    public final Collection<String> getFacsimiles() {
+        return new LegacyTelephones(getOwner(), TelephoneType.FACSIMILE);
     }
 
     /**
      * Sets the telephone number of a facsimile machine for the responsible organization or individual.
+     * This method writes in the {@linkplain DefaultContact#getPhones() contact phones}, if the contact
+     * that own this phone is known.
      *
      * @param newValues The new telephone number, or {@code null} if none.
+     *
+     * @deprecated As of ISO 19115:2014, replaced by a {@linkplain #setNumber(String) number}
+     *             with {@link TelephoneType#FACSIMILE}.
      */
-    public void setFacsimiles(final Collection<? extends String> newValues) {
-        facsimiles = writeCollection(newValues, facsimiles, String.class);
+    @Deprecated
+    public final void setFacsimiles(final Collection<? extends String> newValues) {
+        ((LegacyTelephones) getFacsimiles()).setValues(newValues);
     }
 }

Copied: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java (from r1625241, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java?p2=sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java&p1=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java&r1=1625241&r2=1626345&rev=1626345&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -19,7 +19,6 @@ package org.apache.sis.metadata.iso.cita
 import java.util.Collection;
 import java.util.Iterator;
 import org.opengis.metadata.citation.Telephone;
-import org.opengis.metadata.citation.TelephoneType;
 import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 
 
@@ -53,10 +52,7 @@ final class LegacyTelephones extends Leg
      */
     @Override
     protected Telephone wrap(final String value) {
-        final DefaultTelephone telephone = new DefaultTelephone();
-        telephone.setNumber(value);
-        telephone.setNumberType(type);
-        return telephone;
+        return new DefaultTelephone(value, type);
     }
 
     /**
@@ -64,8 +60,8 @@ final class LegacyTelephones extends Leg
      */
     @Override
     protected String unwrap(final Telephone container) {
-        if (container != null && type.equals(container.getNumberType())) {
-            return container.getNumber();
+        if (container instanceof DefaultTelephone && type.equals(((DefaultTelephone) container).numberType)) {
+            return ((DefaultTelephone) container).getNumber();
         }
         return null;
     }
@@ -76,10 +72,10 @@ final class LegacyTelephones extends Leg
     @Override
     protected boolean update(final Telephone container, final String value) {
         if (container instanceof DefaultTelephone) {
-            final TelephoneType ct = container.getNumberType();
+            final TelephoneType ct = ((DefaultTelephone) container).numberType;
             if (ct == null || ct.equals(type)) {
                 if (ct == null) {
-                    ((DefaultTelephone) container).setNumberType(type);
+                    ((DefaultTelephone) container).numberType = type;
                 }
                 ((DefaultTelephone) container).setNumber(value);
                 return true;

Added: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java?rev=1626345&view=auto
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java (added)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 desruisseaux.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.metadata.iso.citation;
+
+
+/**
+ * Placeholder for {@code org.opengis.metadata.citation.TelephoneType}
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.5
+ * @version 0.5
+ * @module
+ */
+enum TelephoneType {
+    VOICE, FACSIMILE, SMS
+}

Propchange: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -32,7 +32,10 @@
  * {@linkplain org.apache.sis.metadata.iso.ISOMetadata ISO-19115 metadata}<br>
  * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitation         Citation}<br>
  * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitationDate     Citation date}<br>
- * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultResponsibleParty Responsible party}<br>
+ * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultResponsibility   Responsibility}<br>
+ * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.AbstractParty           Party}<br>
+ * {@code  │   ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultIndividual   Individual}<br>
+ * {@code  │   └─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultOrganisation Organisation}<br>
  * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultContact          Contact}<br>
  * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultTelephone        Telephone}<br>
  * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultAddress          Address}<br>
@@ -47,12 +50,13 @@
  *                         {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitation         Citation}<br>
  * {@code  ├─}             {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitationDate     Citation date}<br>
  * {@code  │   └─}         {@linkplain org.opengis.metadata.citation.DateType                       Date type} «code list»<br>
- * {@code  ├─}             {@linkplain org.apache.sis.metadata.iso.citation.DefaultResponsibleParty Responsible party}<br>
- * {@code  │   ├─}         {@linkplain org.apache.sis.metadata.iso.citation.DefaultContact          Contact}<br>
- * {@code  │   │   ├─}     {@linkplain org.apache.sis.metadata.iso.citation.DefaultTelephone        Telephone}<br>
- * {@code  │   │   ├─}     {@linkplain org.apache.sis.metadata.iso.citation.DefaultAddress          Address}<br>
- * {@code  │   │   └─}     {@linkplain org.apache.sis.metadata.iso.citation.DefaultOnlineResource   Online resource}<br>
- * {@code  │   │       └─} {@linkplain org.opengis.metadata.citation.OnLineFunction                 Online function} «code list»<br>
+ * {@code  ├─}             {@linkplain org.apache.sis.metadata.iso.citation.DefaultResponsibility   Responsibility}<br>
+ * {@code  │   ├─}         {@linkplain org.apache.sis.metadata.iso.citation.AbstractParty           Party}<br>
+ * {@code  │   │   └─}     {@linkplain org.apache.sis.metadata.iso.citation.DefaultContact          Contact}<br>
+ * {@code  │   │       ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultTelephone        Telephone}<br>
+ * {@code  │   │       ├─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultAddress          Address}<br>
+ * {@code  │   │       └─} {@linkplain org.apache.sis.metadata.iso.citation.DefaultOnlineResource   Online resource}<br>
+ * {@code  │   │           └─} {@linkplain org.opengis.metadata.citation.OnLineFunction             Online function} «code list»<br>
  * {@code  │   └─}         {@linkplain org.opengis.metadata.citation.Role                           Role} «code list»<br>
  * {@code  ├─}             {@linkplain org.opengis.metadata.citation.PresentationForm               Presentation form} «code list»<br>
  * {@code  └─}             {@linkplain org.apache.sis.metadata.iso.citation.DefaultSeries           Series}<br>
@@ -66,7 +70,7 @@
  * See {@link org.apache.sis.xml.IdentifierMap} for more information.
  *
  * {@section Null values, nil objects and collections}
- * All constructors (except the <cite>copy constructors</cite>) and setter methods accept {@code null} arguments.
+ * All constructors and setter methods accept {@code null} arguments.
  * A null argument value means that the metadata element can not be provided, and the reason for that is unspecified.
  * Alternatively, users can specify why a metadata element is missing by providing a value created by
  * {@link org.apache.sis.xml.NilReason#createNilObject NilReason.createNilObject(Class)}.
@@ -99,11 +103,14 @@
     @XmlJavaTypeAdapter(CI_DateTypeCode.class),
     @XmlJavaTypeAdapter(CI_OnLineFunctionCode.class),
     @XmlJavaTypeAdapter(CI_OnlineResource.class),
+    @XmlJavaTypeAdapter(CI_Party.class),
     @XmlJavaTypeAdapter(CI_PresentationFormCode.class),
+    @XmlJavaTypeAdapter(CI_Responsibility.class),
     @XmlJavaTypeAdapter(CI_ResponsibleParty.class),
     @XmlJavaTypeAdapter(CI_RoleCode.class),
     @XmlJavaTypeAdapter(CI_Series.class),
     @XmlJavaTypeAdapter(CI_Telephone.class),
+    @XmlJavaTypeAdapter(EX_Extent.class),
     @XmlJavaTypeAdapter(MD_Identifier.class),
 
     // Java types, primitive types and basic OGC types handling

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -22,9 +22,13 @@ import javax.xml.bind.annotation.XmlSeeA
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.util.InternationalString;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.identification.BrowseGraphic;
 import org.opengis.metadata.constraint.Constraints;
 import org.opengis.metadata.constraint.LegalConstraints;
 import org.opengis.metadata.constraint.SecurityConstraints;
+import org.opengis.metadata.quality.Scope;
+import org.apache.sis.metadata.iso.citation.DefaultResponsibility;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.util.iso.Types;
 
@@ -32,14 +36,31 @@ import org.apache.sis.util.iso.Types;
 /**
  * Restrictions on the access and use of a resource or metadata.
  *
+ * <p><b>Limitations:</b></p>
+ * <ul>
+ *   <li>Instances of this class are not synchronized for multi-threading.
+ *       Synchronization, if needed, is caller's responsibility.</li>
+ *   <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ *       Serialization support is appropriate for short term storage or RMI between applications running the
+ *       same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
+ * @author  Rémi Maréchal (Geomatys)
  * @since   0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
  * @module
  */
-@XmlType(name = "MD_Constraints_Type")
+@XmlType(name = "MD_Constraints_Type" /*, propOrder = {
+    "useLimitation",
+    "constraintApplicationScope",
+    "graphic",
+    "reference",
+    "releasability",
+    "responsibleParty"
+} */)
 @XmlRootElement(name = "MD_Constraints")
 @XmlSeeAlso({
     DefaultLegalConstraints.class,
@@ -58,6 +79,31 @@ public class DefaultConstraints extends 
     private Collection<InternationalString> useLimitations;
 
     /**
+     * Spatial and / or temporal extent and or level of the application of the constraints restrictions.
+     */
+    private Scope constraintApplicationScope;
+
+    /**
+     * Graphic / symbol indicating the constraint.
+     */
+    private Collection<BrowseGraphic> graphics;
+
+    /**
+     * Citation for the limitation of constraint.
+     */
+    private Collection<Citation> references;
+
+    /**
+     * Citation for the limitation of constraint.
+     */
+    private DefaultReleasability releasability;
+
+    /**
+     * Party responsible for the resource constraints.
+     */
+    private Collection<DefaultResponsibility> responsibleParties;
+
+    /**
      * Constructs an initially empty constraints.
      */
     public DefaultConstraints() {
@@ -84,7 +130,15 @@ public class DefaultConstraints extends 
     public DefaultConstraints(final Constraints object) {
         super(object);
         if (object != null) {
-            useLimitations = copyCollection(object.getUseLimitations(), InternationalString.class);
+            useLimitations             = copyCollection(object.getUseLimitations(), InternationalString.class);
+            if (object instanceof DefaultConstraints) {
+                final DefaultConstraints c = (DefaultConstraints) object;
+                constraintApplicationScope = c.getConstraintApplicationScope();
+                graphics                   = copyCollection(c.getGraphics(), BrowseGraphic.class);
+                references                 = copyCollection(c.getReferences(), Citation.class);
+                releasability              = c.getReleasability();
+                responsibleParties         = copyCollection(c.getResponsibleParties(), DefaultResponsibility.class);
+            }
         }
     }
 
@@ -94,7 +148,7 @@ public class DefaultConstraints extends 
      *
      * <ul>
      *   <li>If the given object is {@code null}, then this method returns {@code null}.</li>
-     *   <li>Otherwise if the given object is is an instance of {@link LegalConstraints} or
+     *   <li>Otherwise if the given object is an instance of {@link LegalConstraints} or
      *       {@link SecurityConstraints}, then this method delegates to the {@code castOrCopy(…)}
      *       method of the corresponding SIS subclass. Note that if the given object implements
      *       more than one of the above-cited interfaces, then the {@code castOrCopy(…)} method
@@ -143,7 +197,146 @@ public class DefaultConstraints extends 
      *
      * @param newValues The new use limitations.
      */
-    public void setUseLimitations(final Collection<? extends InternationalString> newValues) {
+    public void setUseLimitations(final Collection< ? extends InternationalString> newValues) {
         useLimitations = writeCollection(newValues, useLimitations, InternationalString.class);
     }
+
+    /**
+     * Returns the spatial and / or temporal extents and or levels of the application
+     * of the constraints restrictions.
+     *
+     * @return Spatial and / or temporal extents.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "constraintApplicationScope")
+    public Scope getConstraintApplicationScope() {
+        return constraintApplicationScope;
+    }
+
+    /**
+     * Sets the spatial and / or temporal extents and or levels of the application of the constraints restrictions.
+     *
+     * @param newValue The new spatial and / or temporal extents.
+     *
+     * @since 0.5
+     */
+    public void setConstraintApplicationScope(final Scope newValue) {
+        checkWritePermission();
+        constraintApplicationScope = newValue;
+    }
+
+    /**
+     * Returns the graphics / symbols indicating the constraint.
+     *
+     * @return The graphics / symbols indicating the constraint.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "graphic")
+    public Collection<BrowseGraphic> getGraphics() {
+        return graphics = nonNullCollection(graphics, BrowseGraphic.class);
+    }
+
+    /**
+     * Sets the new graphics / symbols indicating the constraint.
+     *
+     * @param newValues the new graphics / symbols indicating the constraint.
+     *
+     * @since 0.5
+     */
+    public void setGraphics(final Collection<? extends BrowseGraphic> newValues) {
+        graphics = writeCollection(newValues, graphics, BrowseGraphic.class);
+    }
+
+    /**
+     * Returns citations for the limitation of constraint.
+     * Example: "copyright statement, license agreement, etc."
+     *
+     * @return Citations for the limitation of constraint.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "reference")
+    public Collection<Citation> getReferences() {
+        return references = nonNullCollection(references, Citation.class);
+    }
+
+    /**
+     * Sets the citations for the limitation of constraint.
+     *
+     * @param newValues The new citation for the limitation of constraint.
+     *
+     * @since 0.5
+     */
+    public void setReferences(Collection<? extends Citation> newValues) {
+        references = writeCollection(newValues, references, Citation.class);
+    }
+
+    /**
+     * Returns information concerning the parties to whom the resource can or cannot be released.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The return type will be changed to the {@code Releasability} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @return Information concerning the parties to whom the resource, or {@code null} if none.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "releasability")
+    public DefaultReleasability getReleasability() {
+        return releasability;
+    }
+
+    /**
+     * Sets the information concerning the parties to whom the resource.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The argument type will be changed to the {@code Releasability} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @param newValue The new information concerning the parties to whom the resource.
+     *
+     * @since 0.5
+     */
+    public void setReleasability(final DefaultReleasability newValue) {
+        checkWritePermission();
+        releasability = newValue;
+    }
+
+    /**
+     * Returns the parties responsible for the resource constraints.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The element type will be changed to the {@code Responsibility} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @return Parties responsible for the resource constraints.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "responsibleParty")
+    public Collection<DefaultResponsibility> getResponsibleParties() {
+        return responsibleParties = nonNullCollection(responsibleParties, DefaultResponsibility.class);
+    }
+
+    /**
+     * Sets the parties responsible for the resource constraints.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The element type will be changed to the {@code Responsibility} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @param newValues The new parties responsible for the resource constraints.
+     *
+     * @since 0.5
+     */
+    public void setResponsibleParties(final Collection<? extends DefaultResponsibility> newValues) {
+        responsibleParties = writeCollection(newValues, responsibleParties, DefaultResponsibility.class);
+    }
 }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -27,10 +27,21 @@ import org.opengis.metadata.constraint.L
 
 /**
  * Restrictions and legal prerequisites for accessing and using the resource.
- * The {@linkplain #getOtherConstraints() other constraint} element shall be non-empty only if
+ *
+ * {@section Relationship between properties}
+ * The {@linkplain #getOtherConstraints() other constraints} collection shall be non-empty if
  * {@linkplain #getAccessConstraints() access constraints} and/or {@linkplain #getUseConstraints()
  * use constraints} elements have a value of {@link Restriction#OTHER_RESTRICTIONS}.
  *
+ * {@section Limitations}
+ * <ul>
+ *   <li>Instances of this class are not synchronized for multi-threading.
+ *       Synchronization, if needed, is caller's responsibility.</li>
+ *   <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ *       Serialization support is appropriate for short term storage or RMI between applications running the
+ *       same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)

Copied: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java (from r1625241, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java?p2=sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java&p1=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java&r1=1625241&r2=1626345&rev=1626345&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -21,15 +21,28 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.util.InternationalString;
-import org.opengis.metadata.citation.Responsibility;
-import org.opengis.metadata.constraint.Releasability;
 import org.opengis.metadata.constraint.Restriction;
 import org.apache.sis.metadata.iso.ISOMetadata;
+import org.apache.sis.metadata.iso.citation.DefaultResponsibility;
+
+// Branch-specific imports
+import org.opengis.annotation.UML;
+import static org.opengis.annotation.Obligation.OPTIONAL;
+import static org.opengis.annotation.Obligation.MANDATORY;
+import static org.opengis.annotation.Specification.ISO_19115;
 
 
 /**
  * Information about resource release constraints.
  *
+ * <div class="warning"><b>Note on International Standard versions</b><br>
+ * This class is derived from a new type defined in the ISO 19115 international standard published in 2014,
+ * while GeoAPI 3.0 is based on the version published in 2003. Consequently this implementation class does
+ * not yet implement a GeoAPI interface, but is expected to do so after the next GeoAPI releases.
+ * When the interface will become available, all references to this implementation class in Apache SIS will
+ * be replaced be references to the corresponding interface.
+ * </div>
+ *
  * <p><b>Limitations:</b></p>
  * <ul>
  *   <li>Instances of this class are not synchronized for multi-threading.
@@ -50,7 +63,8 @@ import org.apache.sis.metadata.iso.ISOMe
     "disseminationConstraints"
 })
 @XmlRootElement(name = "MD_Releasability")
-public class DefaultReleasability extends ISOMetadata implements Releasability {
+@UML(identifier="MD_Releasability", specification=ISO_19115)
+public class DefaultReleasability extends ISOMetadata {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -59,7 +73,7 @@ public class DefaultReleasability extend
     /**
      * Party to which the release statement applies.
      */
-    private Collection<Responsibility> addressees;
+    private Collection<DefaultResponsibility> addressees;
 
     /**
      * Release statement.
@@ -86,58 +100,43 @@ public class DefaultReleasability extend
      *
      * @see #castOrCopy(SecurityConstraints)
      */
-    public DefaultReleasability(final Releasability object) {
+    public DefaultReleasability(final DefaultReleasability object) {
         super(object);
         if (object != null) {
-            addressees                = copyCollection(object.getAddressees(), Responsibility.class);
+            addressees                = copyCollection(object.getAddressees(), DefaultResponsibility.class);
             statement                 = object.getStatement();
             disseminationConstraints  = copyCollection(object.getDisseminationConstraints(), Restriction.class);
         }
     }
 
     /**
-     * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
-     * This method performs the first applicable action in the following choices:
-     *
-     * <ul>
-     *   <li>If the given object is {@code null}, then this method returns {@code null}.</li>
-     *   <li>Otherwise if the given object is already an instance of
-     *       {@code DefaultReleasability}, then it is returned unchanged.</li>
-     *   <li>Otherwise a new {@code DefaultReleasability} instance is created using the
-     *       {@linkplain #DefaultReleasability(Releasability) copy constructor} and returned.
-     *       Note that this is a <cite>shallow</cite> copy operation, since the other
-     *       metadata contained in the given object are not recursively copied.</li>
-     * </ul>
-     *
-     * @param  object The object to get as a SIS implementation, or {@code null} if none.
-     * @return A SIS implementation containing the values of the given object (may be the
-     *         given object itself), or {@code null} if the argument was null.
-     */
-    public static DefaultReleasability castOrCopy(final Releasability object) {
-        if (object == null || object instanceof DefaultReleasability) {
-            return (DefaultReleasability) object;
-        }
-        return new DefaultReleasability(object);
-    }
-
-    /**
      * Returns the parties to which the release statement applies.
      *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The element type will be changed to the {@code Responsibility} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
      * @return Parties to which the release statement applies.
      */
-    @Override
     @XmlElement(name = "addressee")
-    public Collection<Responsibility> getAddressees() {
-        return addressees = nonNullCollection(addressees, Responsibility.class);
+    @UML(identifier="addressee", obligation=OPTIONAL, specification=ISO_19115)
+    public Collection<DefaultResponsibility> getAddressees() {
+        return addressees = nonNullCollection(addressees, DefaultResponsibility.class);
     }
 
     /**
      * Sets the parties to which the release statement applies.
      *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The element type will be changed to the {@code Responsibility} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
      * @param newValues The new parties.
      */
-    public void getAddressees(final Collection<? extends Responsibility> newValues) {
-        addressees = writeCollection(newValues, addressees, Responsibility.class);
+    public void getAddressees(final Collection<? extends DefaultResponsibility> newValues) {
+        addressees = writeCollection(newValues, addressees, DefaultResponsibility.class);
     }
 
     /**
@@ -145,8 +144,8 @@ public class DefaultReleasability extend
      *
      * @return Release statement, or {@code null} if none.
      */
-    @Override
     @XmlElement(name = "statement")
+    @UML(identifier="statement", obligation=OPTIONAL, specification=ISO_19115)
     public InternationalString getStatement() {
         return statement;
     }
@@ -166,8 +165,8 @@ public class DefaultReleasability extend
      *
      * @return Components in determining releasability.
      */
-    @Override
     @XmlElement(name = "disseminationConstraints")
+    @UML(identifier="disseminationConstraints", obligation=OPTIONAL, specification=ISO_19115)
     public Collection<Restriction> getDisseminationConstraints() {
         return disseminationConstraints = nonNullCollection(disseminationConstraints, Restriction.class);
     }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -27,6 +27,15 @@ import org.opengis.metadata.constraint.S
 /**
  * Handling restrictions imposed on the resource for national security or similar security concerns.
  *
+ * <p><b>Limitations:</b></p>
+ * <ul>
+ *   <li>Instances of this class are not synchronized for multi-threading.
+ *       Synchronization, if needed, is caller's responsibility.</li>
+ *   <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ *       Serialization support is appropriate for short term storage or RMI between applications running the
+ *       same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
@@ -45,7 +54,7 @@ public class DefaultSecurityConstraints 
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = 621767670847345848L;;
+    private static final long serialVersionUID = 621767670847345848L;
 
     /**
      * Name of the handling restrictions on the resource.

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -30,14 +30,16 @@
  *   <th class="sep">Aggregation hierarchy</th>
  * </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.constraint.DefaultConstraints         Constraints}<br>
- * {@code      ├─} {@linkplain org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints    Legal constraints}<br>
- * {@code      └─} {@linkplain org.apache.sis.metadata.iso.constraint.DefaultSecurityConstraints Security constraints}<br>
+ * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.constraint.DefaultConstraints         Constraints}<br>
+ * {@code  │   ├─} {@linkplain org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints    Legal constraints}<br>
+ * {@code  │   └─} {@linkplain org.apache.sis.metadata.iso.constraint.DefaultSecurityConstraints Security constraints}<br>
+ * {@code  └─}     {@linkplain org.apache.sis.metadata.iso.constraint.DefaultReleasability       Releasability}<br>
  * {@linkplain org.opengis.util.CodeList Code list}<br>
  * {@code  ├─} {@linkplain org.opengis.metadata.constraint.Restriction    Restriction}<br>
  * {@code  └─} {@linkplain org.opengis.metadata.constraint.Classification Classification}<br>
  * </td><td class="sep" style="width: 50%; white-space: nowrap">
  *             {@linkplain org.apache.sis.metadata.iso.constraint.DefaultConstraints         Constraints}<br>
+ * {@code  └─} {@linkplain org.apache.sis.metadata.iso.constraint.DefaultReleasability       Releasability}<br>
  *             {@linkplain org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints    Legal constraints}<br>
  * {@code  └─} {@linkplain org.opengis.metadata.constraint.Restriction                       Restriction} «code list»<br>
  *             {@linkplain org.apache.sis.metadata.iso.constraint.DefaultSecurityConstraints Security constraints}<br>
@@ -45,7 +47,7 @@
  * </td></tr></table>
  *
  * {@section Null values, nil objects and collections}
- * All constructors (except the <cite>copy constructors</cite>) and setter methods accept {@code null} arguments.
+ * All constructors and setter methods accept {@code null} arguments.
  * A null argument value means that the metadata element can not be provided, and the reason for that is unspecified.
  * Alternatively, users can specify why a metadata element is missing by providing a value created by
  * {@link org.apache.sis.xml.NilReason#createNilObject NilReason.createNilObject(Class)}.

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -26,7 +26,16 @@ import org.apache.sis.metadata.iso.ISOMe
 
 
 /**
- * Description of the content of a dataset.
+ * Description of the content of a resource.
+ *
+ * <p><b>Limitations:</b></p>
+ * <ul>
+ *   <li>Instances of this class are not synchronized for multi-threading.
+ *       Synchronization, if needed, is caller's responsibility.</li>
+ *   <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ *       Serialization support is appropriate for short term storage or RMI between applications running the
+ *       same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
@@ -72,7 +81,7 @@ public class AbstractContentInformation 
      *
      * <ul>
      *   <li>If the given object is {@code null}, then this method returns {@code null}.</li>
-     *   <li>Otherwise if the given object is is an instance of {@link FeatureCatalogueDescription}
+     *   <li>Otherwise if the given object is an instance of {@link FeatureCatalogueDescription}
      *       or {@link CoverageDescription}, then this method delegates to the {@code castOrCopy(…)}
      *       method of the corresponding SIS subclass. Note that if the given object implements
      *       more than one of the above-cited interfaces, then the {@code castOrCopy(…)} method

Copied: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java (from r1625241, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java?p2=sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java&p1=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java&r1=1625241&r2=1626345&rev=1626345&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -20,16 +20,29 @@ import java.util.Collection;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-import org.opengis.metadata.content.AttributeGroup;
 import org.opengis.metadata.content.CoverageContentType;
 import org.opengis.metadata.content.RangeDimension;
 import org.apache.sis.metadata.iso.ISOMetadata;
 
+// Branch-specific imports
+import org.opengis.annotation.UML;
+import static org.opengis.annotation.Obligation.OPTIONAL;
+import static org.opengis.annotation.Obligation.MANDATORY;
+import static org.opengis.annotation.Specification.ISO_19115;
+
 
 /**
  * Information about content type for groups of attributes for a specific
  * {@linkplain DefaultRangeDimension range dimension}.
  *
+ * <div class="warning"><b>Note on International Standard versions</b><br>
+ * This class is derived from a new type defined in the ISO 19115 international standard published in 2014,
+ * while GeoAPI 3.0 is based on the version published in 2003. Consequently this implementation class does
+ * not yet implement a GeoAPI interface, but is expected to do so after the next GeoAPI releases.
+ * When the interface will become available, all references to this implementation class in Apache SIS will
+ * be replaced be references to the corresponding interface.
+ * </div>
+ *
  * <p><b>Limitations:</b></p>
  * <ul>
  *   <li>Instances of this class are not synchronized for multi-threading.
@@ -50,7 +63,8 @@ import org.apache.sis.metadata.iso.ISOMe
     "attribute"
 })
 @XmlRootElement(name = "MD_AttributeGroup")
-public class DefaultAttributeGroup extends ISOMetadata implements AttributeGroup {
+@UML(identifier="MD_AttributeGroup", specification=ISO_19115)
+public class DefaultAttributeGroup extends ISOMetadata {
     /**
      * Serial number for compatibility with different versions.
      */
@@ -92,7 +106,7 @@ public class DefaultAttributeGroup exten
      *
      * @see #castOrCopy(AttributeGroup)
      */
-    public DefaultAttributeGroup(final AttributeGroup object) {
+    public DefaultAttributeGroup(final DefaultAttributeGroup object) {
         super(object);
         if (object != null) {
             contentTypes = copyCollection(object.getContentTypes(), CoverageContentType.class);
@@ -101,37 +115,12 @@ public class DefaultAttributeGroup exten
     }
 
     /**
-     * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
-     * This method performs the first applicable action in the following choices:
-     *
-     * <ul>
-     *   <li>If the given object is {@code null}, then this method returns {@code null}.</li>
-     *   <li>Otherwise if the given object is already an instance of
-     *       {@code DefaultAttributeGroup}, then it is returned unchanged.</li>
-     *   <li>Otherwise a new {@code DefaultAttributeGroup} instance is created using the
-     *       {@linkplain #DefaultAttributeGroup(AttributeGroup) copy constructor}
-     *       and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
-     *       metadata contained in the given object are not recursively copied.</li>
-     * </ul>
-     *
-     * @param  object The object to get as a SIS implementation, or {@code null} if none.
-     * @return A SIS implementation containing the values of the given object (may be the
-     *         given object itself), or {@code null} if the argument was null.
-     */
-    public static DefaultAttributeGroup castOrCopy(final AttributeGroup object) {
-        if (object == null || object instanceof DefaultAttributeGroup) {
-            return (DefaultAttributeGroup) object;
-        }
-        return new DefaultAttributeGroup(object);
-    }
-
-    /**
      * Returns the types of information represented by the value(s).
      *
      * @return The types of information represented by the value(s).
      */
-    @Override
     @XmlElement(name = "contentType", required = true)
+    @UML(identifier="contentType", obligation=MANDATORY, specification=ISO_19115)
     public Collection<CoverageContentType> getContentTypes() {
         return contentTypes = nonNullCollection(contentTypes, CoverageContentType.class);
     }
@@ -150,8 +139,8 @@ public class DefaultAttributeGroup exten
      *
      * @return Information on an attribute of the resource.
      */
-    @Override
     @XmlElement(name = "attribute")
+    @UML(identifier="attribute", obligation=OPTIONAL, specification=ISO_19115)
     public Collection<RangeDimension> getAttributes() {
         return attributes = nonNullCollection(attributes, RangeDimension.class);
     }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -33,23 +33,24 @@ import org.apache.sis.measure.ValueRange
 /**
  * Range of wavelengths in the electromagnetic spectrum.
  *
- * {@section SIS extension}
- * The {@link Band} interface defined by ISO 19115-2 is specific to measurements in
- * electromagnetic spectrum. For the needs of Image I/O, an additional interface -
- * {@link org.apache.sis.image.io.metadata.SampleDimension} - has been defined with
- * a subset of the {@code Band} API but without the restriction to wavelengths.
+ * <p><b>Limitations:</b></p>
+ * <ul>
+ *   <li>Instances of this class are not synchronized for multi-threading.
+ *       Synchronization, if needed, is caller's responsibility.</li>
+ *   <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ *       Serialization support is appropriate for short term storage or RMI between applications running the
+ *       same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
+ * @author  Rémi Maréchal (Geomatys)
  * @since   0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 @XmlType(name = "MD_Band_Type", propOrder = {
-    "maxValue",
-    "minValue",
-    "units",
     "peakResponse",
     "bitsPerValue",
     "toneGradation",
@@ -63,28 +64,26 @@ import org.apache.sis.measure.ValueRange
 })
 @XmlRootElement(name = "MD_Band")
 @XmlSeeAlso(org.apache.sis.internal.jaxb.gmi.MI_Band.class)
-public class DefaultBand extends DefaultRangeDimension implements Band {
+public class DefaultBand extends DefaultSampleDimension implements Band {
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = 6969884732125615287L;
+    private static final long serialVersionUID = -2474871120376144737L;
 
     /**
-     * Longest wavelength that the sensor is capable of collecting within a designated band.
+     * Shortest wavelength that the sensor is capable of collecting within a designated band.
      */
-    private Double maxValue;
+    private Double boundMin;
 
     /**
-     * Shortest wavelength that the sensor is capable of collecting within a designated band.
+     * Longest wavelength that the sensor is capable of collecting within a designated band.
      */
-    private Double minValue;
+    private Double boundMax;
 
     /**
-     * Units in which sensor wavelengths are expressed. Should be non-null if
-     * {@linkplain #getMinValue() min value} or {@linkplain #getMaxValue() max value}
-     * are provided.
+     * Units in which sensor wavelengths are expressed.
      */
-    private Unit<Length> units;
+    private Unit<Length> boundUnits;
 
     /**
      * Wavelength at which the response is the highest.
@@ -92,27 +91,11 @@ public class DefaultBand extends Default
     private Double peakResponse;
 
     /**
-     * Maximum number of significant bits in the uncompressed representation for the value
-     * in each band of each pixel.
-     */
-    private Integer bitsPerValue;
-
-    /**
      * Number of discrete numerical values in the grid data.
      */
     private Integer toneGradation;
 
     /**
-     * Scale factor which has been applied to the cell value.
-     */
-    private Double scaleFactor;
-
-    /**
-     * The physical value corresponding to a cell value of zero.
-     */
-    private Double offset;
-
-    /**
      * Designation of criterion for defining maximum and minimum wavelengths for a spectral band.
      */
     private BandDefinition bandBoundaryDefinition;
@@ -156,14 +139,14 @@ public class DefaultBand extends Default
     public DefaultBand(final Band object) {
         super(object);
         if (object != null) {
-            maxValue                 = object.getMaxValue();
-            minValue                 = object.getMinValue();
-            units                    = object.getUnits();
+            if (object instanceof DefaultBand) {
+                final DefaultBand c = (DefaultBand) object;
+                boundMin   = c.getBoundMin();
+                boundMax   = c.getBoundMax();
+                boundUnits = c.getBoundUnits();
+            }
             peakResponse             = object.getPeakResponse();
-            bitsPerValue             = object.getBitsPerValue();
             toneGradation            = object.getToneGradation();
-            scaleFactor              = object.getScaleFactor();
-            offset                   = object.getOffset();
             bandBoundaryDefinition   = object.getBandBoundaryDefinition();
             nominalSpatialResolution = object.getNominalSpatialResolution();
             transferFunctionType     = object.getTransferFunctionType();
@@ -203,69 +186,107 @@ public class DefaultBand extends Default
      *
      * @return Longest wavelength that the sensor is capable of collecting within a designated band,
      *         or {@code null} if unspecified.
+     *
+     * @since 0.5
      */
-    @Override
-    @XmlElement(name = "maxValue")
-    public Double getMaxValue() {
-        return maxValue;
+    @ValueRange(minimum = 0)
+/// @XmlElement(name = "boundMax")
+    public Double getBoundMax() {
+        return boundMax;
     }
 
     /**
      * Sets the longest wavelength that the sensor is capable of collecting within a designated band.
      *
      * @param newValue The new longest wavelength.
+     *
+     * @since 0.5
      */
-    public void setMaxValue(final Double newValue) {
+    public void setBoundMax(final Double newValue) {
         checkWritePermission();
-        maxValue = newValue;
+        boundMax = newValue;
     }
 
     /**
      * Returns the shortest wavelength that the sensor is capable of collecting within a designated band.
-     * The units of measurement is given by {@link #getUnits()}.
+     * The units of measurement is given by {@link #getBoundUnit()}.
      *
      * @return Shortest wavelength that the sensor is capable of collecting within a designated band,
      *         or {@code null} if unspecified.
+     *
+     * @since 0.5
      */
-    @Override
-    @XmlElement(name = "minValue")
-    public Double getMinValue() {
-        return minValue;
+    @ValueRange(minimum = 0)
+/// @XmlElement(name = "boundMin")
+    public Double getBoundMin() {
+        return boundMin;
     }
 
     /**
      * Sets the shortest wavelength that the sensor is capable of collecting within a designated band.
      *
      * @param newValue The new shortest wavelength.
+     *
+     * @since 0.5
      */
-    public void setMinValue(final Double newValue) {
+    public void setBoundMin(final Double newValue) {
         checkWritePermission();
-        minValue = newValue;
+        boundMin = newValue;
     }
 
     /**
-     * Returns the units in which sensor wavelengths are expressed. Shall be non-null
-     * if {@linkplain #getMinValue() min value} or {@linkplain #getMaxValue() max value}
-     * are provided.
+     * Returns units in which sensor wavelengths are expressed.
      *
-     * @return Units in which sensor wavelengths are expressed, or {@code null}.
+     * @return Units in which sensor wavelengths are expressed.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "boundUnits")
+    public Unit<Length> getBoundUnits() {
+        return boundUnits;
+    }
+
+    /**
+     * Set a new units in which sensor wavelengths are expressed.
+     *
+     * @param newValue the new unit.
+     *
+     * @since 0.5
+     */
+    public void setBoundUnits(final Unit<Length> newValue) {
+        checkWritePermission();
+        boundUnits = newValue;
+    }
+
+    /**
+     * Returns the units of data as a unit of length.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * As of ISO 19115:2014, the units of wavelength is rather {@code boundUnits}.
+     * The restriction for units of length in this {@code units} property may be relaxed in GeoAPI 4.0.
+     * </div>
+     *
+     * @return The units of data.
      */
     @Override
-    @XmlElement(name = "units")
     public Unit<Length> getUnits() {
-        return units;
+        final Unit<?> units = super.getUnits();
+        return (units != null) ? units.asType(Length.class) : null;
     }
 
     /**
-     * Sets the units in which sensor wavelengths are expressed. Shall be non-null if
-     * {@linkplain #getMinValue() min value} or {@linkplain #getMaxValue() max value}
-     * are provided.
+     * Sets the units of data as a unit of length.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * As of ISO 19115:2014, the units of wavelength is rather {@code boundUnits}.
+     * The restriction for units of length in this {@code units} property may be relaxed in GeoAPI 4.0.
+     * </div>
      *
-     * @param newValue The new units.
+     * @param newValue The new units of data as an instance of {@code Unit<Length>}.
      */
-    public void setUnits(final Unit<Length> newValue) {
-        checkWritePermission();
-        units = newValue;
+    @Override
+    public void setUnits(final Unit<?> newValue) {
+        super.setUnits(newValue.asType(Length.class));
     }
 
     /**
@@ -275,6 +296,7 @@ public class DefaultBand extends Default
      * @return Wavelength at which the response is the highest, or {@code null} if unspecified.
      */
     @Override
+    @ValueRange(minimum = 0)
     @XmlElement(name = "peakResponse")
     public Double getPeakResponse() {
         return peakResponse;
@@ -291,36 +313,30 @@ public class DefaultBand extends Default
     }
 
     /**
-     * Returns the maximum number of significant bits in the uncompressed
-     * representation for the value in each band of each pixel.
-     *
-     * @return Maximum number of significant bits in the uncompressed representation, or {@code null}.
+     * {@inheritDoc}
      */
     @Override
-    @ValueRange(minimum=1)
+    @ValueRange(minimum = 1)
     @XmlElement(name = "bitsPerValue")
     public Integer getBitsPerValue() {
-        return bitsPerValue;
+        return super.getBitsPerValue();
     }
 
     /**
-     * Sets the maximum number of significant bits in the uncompressed representation
-     * for the value in each band of each pixel.
-     *
-     * @param newValue The new number of bits per value.
+     * {@inheritDoc}
      */
+    @Override
     public void setBitsPerValue(final Integer newValue) {
-        checkWritePermission();
-        bitsPerValue = newValue;
+        super.setBitsPerValue(newValue);
     }
 
     /**
      * Returns the number of discrete numerical values in the grid data.
      *
-     * @return Number of discrete numerical values in the grid data, or {@code null}.
+     * @return Number of discrete numerical values in the grid data, or {@code null} if none.
      */
     @Override
-    @ValueRange(minimum=0)
+    @ValueRange(minimum = 0)
     @XmlElement(name = "toneGradation")
     public Integer getToneGradation() {
         return toneGradation;
@@ -337,45 +353,37 @@ public class DefaultBand extends Default
     }
 
     /**
-     * Returns the scale factor which has been applied to the cell value.
-     *
-     * @return Scale factor which has been applied to the cell value, or {@code null}.
+     * {@inheritDoc}
      */
     @Override
     @XmlElement(name = "scaleFactor")
     public Double getScaleFactor() {
-        return scaleFactor;
+        return super.getScaleFactor();
     }
 
     /**
-     * Sets the scale factor which has been applied to the cell value.
-     *
-     * @param newValue The new scale factor.
+     * {@inheritDoc}
      */
+    @Override
     public void setScaleFactor(final Double newValue) {
-        checkWritePermission();
-        scaleFactor = newValue;
+        super.setScaleFactor(newValue);
     }
 
     /**
-     * Returns the physical value corresponding to a cell value of zero.
-     *
-     * @return The physical value corresponding to a cell value of zero, or {@code null}.
+     * {@inheritDoc}
      */
     @Override
     @XmlElement(name = "offset")
     public Double getOffset() {
-        return offset;
+        return super.getOffset();
     }
 
     /**
-     * Sets the physical value corresponding to a cell value of zero.
-     *
-     * @param newValue The new offset.
+     * {@inheritDoc}
      */
+    @Override
     public void setOffset(final Double newValue) {
-        checkWritePermission();
-        offset = newValue;
+        super.setOffset(newValue);
     }
 
     /**
@@ -406,7 +414,7 @@ public class DefaultBand extends Default
      * @return Smallest distance between which separate points can be distinguished, or {@code null}.
      */
     @Override
-    @ValueRange(minimum=0, isMinIncluded=false)
+    @ValueRange(minimum = 0, isMinIncluded = false)
     @XmlElement(name = "nominalSpatialResolution", namespace = Namespaces.GMI)
     public Double getNominalSpatialResolution() {
         return nominalSpatialResolution;
@@ -445,7 +453,7 @@ public class DefaultBand extends Default
     }
 
     /**
-     * Polarization of the radiation transmitted.
+     * Returns the polarization of the radiation transmitted.
      *
      * @return Polarization of the radiation transmitted, or {@code null}.
      */
@@ -466,7 +474,7 @@ public class DefaultBand extends Default
     }
 
     /**
-     * Polarization of the radiation detected.
+     * Returns polarization of the radiation detected.
      *
      * @return Polarization of the radiation detected, or {@code null}.
      */

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.metadata.Identifier;
 import org.opengis.metadata.content.CoverageContentType;
 import org.opengis.metadata.content.CoverageDescription;
 import org.opengis.metadata.content.ImageDescription;
@@ -28,16 +29,26 @@ import org.opengis.metadata.content.Rang
 import org.opengis.metadata.content.RangeElementDescription;
 import org.opengis.util.RecordType;
 import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 
 
 /**
  * Information about the content of a grid data cell.
  *
+ * <p><b>Limitations:</b></p>
+ * <ul>
+ *   <li>Instances of this class are not synchronized for multi-threading.
+ *       Synchronization, if needed, is caller's responsibility.</li>
+ *   <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ *       Serialization support is appropriate for short term storage or RMI between applications running the
+ *       same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @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_CoverageDescription_Type", propOrder = {
@@ -55,7 +66,7 @@ public class DefaultCoverageDescription 
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -3314118785767660332L;
+    private static final long serialVersionUID = 2161065580202989466L;
 
     /**
      * Description of the attribute described by the measurement value.
@@ -63,14 +74,14 @@ public class DefaultCoverageDescription 
     private RecordType attributeDescription;
 
     /**
-     * Type of information represented by the cell value.
+     * Identifier for the level of processing that has been applied to the resource.
      */
-    private CoverageContentType contentType;
+    private Identifier processingLevelCode;
 
     /**
-     * Information on the dimensions of the cell measurement value.
+     * Information on attribute groups of the resource.
      */
-    private Collection<RangeDimension> dimensions;
+    private Collection<DefaultAttributeGroup> attributeGroups;
 
     /**
      * Provides the description of the specific range elements of a coverage.
@@ -96,9 +107,11 @@ public class DefaultCoverageDescription 
         super(object);
         if (object != null) {
             attributeDescription     = object.getAttributeDescription();
-            contentType              = object.getContentType();
-            dimensions               = copyCollection(object.getDimensions(), RangeDimension.class);
             rangeElementDescriptions = copyCollection(object.getRangeElementDescriptions(), RangeElementDescription.class);
+            if (object instanceof DefaultCoverageDescription) {
+                processingLevelCode  = ((DefaultCoverageDescription) object).getProcessingLevelCode();
+                attributeGroups      = copyCollection(((DefaultCoverageDescription) object).getAttributeGroups(), DefaultAttributeGroup.class);
+            }
         }
     }
 
@@ -108,7 +121,7 @@ public class DefaultCoverageDescription 
      *
      * <ul>
      *   <li>If the given object is {@code null}, then this method returns {@code null}.</li>
-     *   <li>Otherwise if the given object is is an instance of {@link ImageDescription}, then this
+     *   <li>Otherwise if the given object is an instance of {@link ImageDescription}, then this
      *       method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.</li>
      *   <li>Otherwise if the given object is already an instance of
      *       {@code DefaultCoverageDescription}, then it is returned unchanged.</li>
@@ -136,7 +149,7 @@ public class DefaultCoverageDescription 
     /**
      * Returns the description of the attribute described by the measurement value.
      *
-     * @return Description of the attribute, or {@code null}.
+     * @return Description of the attribute.
      */
     @Override
     @XmlElement(name = "attributeDescription", required = true)
@@ -155,44 +168,167 @@ public class DefaultCoverageDescription 
     }
 
     /**
+     * Returns an identifier for the level of processing that has been applied to the resource, or {@code null} if none.
+     *
+     * @return Identifier for the level of processing that has been applied to the resource, or {@code null} if none.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "processingLevelCode")
+    public Identifier getProcessingLevelCode() {
+        return processingLevelCode;
+    }
+
+    /**
+     * Sets the identifier for the level of processing that has been applied to the resource.
+     *
+     * @param newValue The new identifier for the level of processing.
+     *
+     * @since 0.5
+     */
+    public void setProcessingLevelCode(final Identifier newValue) {
+        checkWritePermission();
+        processingLevelCode = newValue;
+    }
+
+    /**
+     * Returns information on attribute groups of the resource.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The element type will be changed to the {@code AttributeGroup} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @return Information on attribute groups of the resource.
+     *
+     * @since 0.5
+     */
+/// @XmlElement(name = "attributeGroup")
+    public Collection<DefaultAttributeGroup> getAttributeGroups() {
+        return attributeGroups = nonNullCollection(attributeGroups, DefaultAttributeGroup.class);
+    }
+
+    /**
+     * Sets information on attribute groups of the resource.
+     *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * The element type will be changed to the {@code AttributeGroup} interface
+     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * </div>
+     *
+     * @param newValues The new information on attribute groups of the resource.
+     *
+     * @since 0.5
+     */
+    public void setAttributeGroups(final Collection<? extends DefaultAttributeGroup> newValues) {
+        attributeGroups = writeCollection(newValues, attributeGroups, DefaultAttributeGroup.class);
+    }
+
+    /**
      * Returns the type of information represented by the cell value.
+     * This method fetches the value from the {@linkplain #getAttributeGroups() attribute groups}.
      *
      * @return Type of information represented by the cell value, or {@code null}.
+     *
+     * @deprecated As of ISO 19115:2014, moved to {@link DefaultAttributeGroup#getContentTypes()}.
      */
     @Override
+    @Deprecated
     @XmlElement(name = "contentType", required = true)
-    public CoverageContentType getContentType() {
-        return contentType;
+    public final CoverageContentType getContentType() {
+        CoverageContentType type = null;
+        if (attributeGroups != null) {
+            for (final DefaultAttributeGroup g : attributeGroups) {
+                final Collection<? extends CoverageContentType> contentTypes = g.getContentTypes();
+                if (contentTypes != null) { // May be null on marshalling.
+                    for (final CoverageContentType t : contentTypes) {
+                        if (type == null) {
+                            type = t;
+                        } else {
+                            LegacyPropertyAdapter.warnIgnoredExtraneous(CoverageContentType.class,
+                                    DefaultCoverageDescription.class, "getContentType");
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        return type;
     }
 
     /**
      * Sets the type of information represented by the cell value.
+     * This method stores the value in the {@linkplain #getAttributeGroups() attribute groups}.
      *
      * @param newValue The new content type.
+     *
+     * @deprecated As of ISO 19115:2014, moved to {@link DefaultAttributeGroup#setContentTypes(Collection)}.
      */
-    public void setContentType(final CoverageContentType newValue) {
+    @Deprecated
+    public final void setContentType(final CoverageContentType newValue) {
         checkWritePermission();
-        contentType = newValue;
+        final Collection<CoverageContentType> newValues = LegacyPropertyAdapter.asCollection(newValue);
+        final Collection<DefaultAttributeGroup> groups = getAttributeGroups();
+        for (final DefaultAttributeGroup group : groups) {
+            if (group instanceof DefaultAttributeGroup) {
+                group.setContentTypes(newValues);
+                return;
+            }
+        }
+        final DefaultAttributeGroup group = new DefaultAttributeGroup();
+        group.setContentTypes(newValues);
+        groups.add(group);
     }
 
     /**
      * Returns the information on the dimensions of the cell measurement value.
+     * This method fetches the values from the {@linkplain #getAttributeGroups() attribute groups}.
      *
      * @return Dimensions of the cell measurement value.
+     *
+     * @deprecated As of ISO 19115:2014, moved to {@link DefaultAttributeGroup#getGroupAttributes()}.
      */
     @Override
+    @Deprecated
     @XmlElement(name = "dimension")
-    public Collection<RangeDimension> getDimensions() {
-        return dimensions = nonNullCollection(dimensions, RangeDimension.class);
+    public final Collection<RangeDimension> getDimensions() {
+        return new LegacyPropertyAdapter<RangeDimension,DefaultAttributeGroup>(getAttributeGroups()) {
+            /** Stores a legacy value into the new kind of value. */
+            @Override protected DefaultAttributeGroup wrap(final RangeDimension value) {
+                final DefaultAttributeGroup container = new DefaultAttributeGroup();
+                container.setAttributes(asCollection(value));
+                return container;
+            }
+
+            /** Extracts the legacy value from the new kind of value. */
+            @Override protected RangeDimension unwrap(final DefaultAttributeGroup container) {
+                return getSingleton(container.getAttributes(), RangeDimension.class,
+                        this, DefaultCoverageDescription.class, "getDimensions");
+            }
+
+            /** Updates the legacy value in an existing instance of the new kind of value. */
+            @Override protected boolean update(final DefaultAttributeGroup container, final RangeDimension value) {
+                if (container instanceof DefaultAttributeGroup) {
+                    container.setAttributes(asCollection(value));
+                    return true;
+                }
+                return false;
+            }
+        }.validOrNull();
     }
 
     /**
      * Sets the information on the dimensions of the cell measurement value.
+     * This method stores the values in the {@linkplain #getAttributeGroups() attribute groups}.
      *
      * @param newValues The new dimensions.
+     *
+     * @deprecated As of ISO 19115:2014, moved to {@link DefaultAttributeGroup#setGroupAttributes(Collection)}.
      */
-    public void setDimensions(final Collection<? extends RangeDimension> newValues) {
-        dimensions = writeCollection(newValues, dimensions, RangeDimension.class);
+    @Deprecated
+    public final void setDimensions(final Collection<? extends RangeDimension> newValues) {
+        checkWritePermission();
+        ((LegacyPropertyAdapter<RangeDimension,?>) getDimensions()).setValues(newValues);
     }
 
     /**



Mime
View raw message