sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1635469 - in /sis/trunk/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/ sis-metadat...
Date Thu, 30 Oct 2014 12:06:23 GMT
Author: desruisseaux
Date: Thu Oct 30 12:06:22 2014
New Revision: 1635469

URL: http://svn.apache.org/r1635469
Log:
Replaced 'Object' property type by 'CodeList<?>' property type for code list that are not yet in GeoAPI 3.0.
This allow us to enable some tests that we had disabled on trunk (those tests were enabled on branches).

Added:
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java
      - copied, changed from r1635203, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java
      - copied, changed from r1635203, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java
      - copied, changed from r1635203, sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java
      - copied, changed from r1635203, sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/package-info.java
      - copied, changed from r1635203, sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/warning-templates.txt   (with props)
Removed:
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java
Modified:
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/LegacyTelephones.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.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/citation/DefaultContactTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
    sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java

Copied: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java (from r1635203, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java?p2=sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java&p1=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java&r1=1635203&r2=1635469&rev=1635469&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -17,10 +17,9 @@
 package org.apache.sis.internal.jaxb.code;
 
 import javax.xml.bind.annotation.XmlElement;
-import org.opengis.metadata.identification.DistributedComputingPlatform;
-import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
-import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
 import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeListAdapter;
 
 
 /**
@@ -33,7 +32,7 @@ import org.apache.sis.xml.Namespaces;
  * @version 0.5
  * @module
  */
-public final class DCPList extends CodeListAdapter<DCPList, DistributedComputingPlatform> {
+public final class DCPList extends UnsupportedCodeListAdapter<DCPList> {
     /**
      * Empty constructor for JAXB only.
      */
@@ -60,11 +59,32 @@ public final class DCPList extends CodeL
     /**
      * {@inheritDoc}
      *
-     * @return The code list class.
+     * @return The code list class name.
+     */
+    @Override
+    protected String getCodeListName() {
+        return "DCPList";
+    }
+
+    /**
+     * Converts the given Java constant name to something hopefully close to the UML identifier,
+     * or close to the textual value to put in the XML.
+     *
+     * @param  name    The Java constant name (e.g. {@code WEB_SERVICES}).
+     * @param  buffer  An initially empty buffer to use for creating the identifier.
+     * @param  isValue {@code false} for the {@code codeListValue} attribute, or {@code true} for the XML value.
+     * @return The identifier (e.g. {@code "WebServices"} or {@code "Web services"}).
      */
     @Override
-    protected Class<DistributedComputingPlatform> getCodeListClass() {
-        return DistributedComputingPlatform.class;
+    protected String toIdentifier(final String name, final StringBuilder buffer, final boolean isValue) {
+        if (name.startsWith("WEB_")) {
+            super.toIdentifier(name, buffer, isValue);
+            buffer.setCharAt(0, 'W');
+            return buffer.toString();
+        } else {
+            // Other names are abbreviations (e.g. XML, SQL, FTP, etc.), so return unchanged.
+            return name;
+        }
     }
 
     /**

Copied: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java (from r1635203, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java?p2=sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java&p1=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java&r1=1635203&r2=1635469&rev=1635469&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -17,8 +17,7 @@
 package org.apache.sis.internal.jaxb.code;
 
 import javax.xml.bind.annotation.XmlElement;
-import org.opengis.metadata.identification.CouplingType;
-import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeListAdapter;
 import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
 import org.apache.sis.xml.Namespaces;
 
@@ -33,7 +32,7 @@ import org.apache.sis.xml.Namespaces;
  * @version 0.5
  * @module
  */
-public final class SV_CouplingType extends CodeListAdapter<SV_CouplingType, CouplingType> {
+public final class SV_CouplingType extends UnsupportedCodeListAdapter<SV_CouplingType> {
     /**
      * Empty constructor for JAXB only.
      */
@@ -60,11 +59,11 @@ public final class SV_CouplingType exten
     /**
      * {@inheritDoc}
      *
-     * @return The code list class.
+     * @return The code list class name.
      */
     @Override
-    protected Class<CouplingType> getCodeListClass() {
-        return CouplingType.class;
+    protected String getCodeListName() {
+        return "SV_CouplingType";
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import org.opengis.annotation.UML;
+import org.opengis.util.CodeList;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.Address;
 import org.opengis.metadata.citation.Contact;
@@ -32,6 +33,7 @@ import org.apache.sis.metadata.iso.ISOMe
 import org.apache.sis.util.resources.Messages;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList;
 
 import static org.opengis.annotation.Obligation.OPTIONAL;
 import static org.opengis.annotation.Specification.ISO_19115;
@@ -230,11 +232,12 @@ public class DefaultContact extends ISOM
         Telephone phone = null;
         final Collection<Telephone> phones = getPhones();
         if (phones != null) { // May be null on marshalling.
-            TelephoneType ignored = null;
+            CodeList<?> ignored = null;
             for (final Telephone c : phones) {
                 if (c instanceof DefaultTelephone) {
-                    final TelephoneType type = ((DefaultTelephone) c).numberType;
-                    if (TelephoneType.VOICE.equals(type) || TelephoneType.FACSIMILE.equals(type)) {
+                    String name;
+                    final CodeList<?> type = ((DefaultTelephone) c).numberType;
+                    if (type != null && ("VOICE".equals(name = type.name()) || "FACSIMILE".equals(name))) {
                         if (phone == null) {
                             phone = c;
                         }
@@ -245,7 +248,7 @@ public class DefaultContact extends ISOM
             }
             if (ignored != null) {
                 Context.warningOccured(Context.current(), DefaultContact.class, "getPhone",
-                        Messages.class, Messages.Keys.IgnoredPropertyAssociatedTo_1, ignored.toString());
+                        Messages.class, Messages.Keys.IgnoredPropertyAssociatedTo_1, ignored);
             }
         }
         return phone;
@@ -268,10 +271,10 @@ public class DefaultContact extends ISOM
             } else {
                 newValues = new ArrayList<Telephone>(4);
                 for (String number : newValue.getVoices()) {
-                    newValues.add(new DefaultTelephone(number, TelephoneType.VOICE));
+                    newValues.add(new DefaultTelephone(number, UnsupportedCodeList.VOICE));
                 }
                 for (String number : newValue.getFacsimiles()) {
-                    newValues.add(new DefaultTelephone(number, TelephoneType.FACSIMILE));
+                    newValues.add(new DefaultTelephone(number, UnsupportedCodeList.FACSIMILE));
                 }
             }
         }

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=1635469&r1=1635468&r2=1635469&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] Thu Oct 30 12:06:22 2014
@@ -22,9 +22,11 @@ import java.util.Collections;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.util.CodeList;
 import org.opengis.annotation.UML;
 import org.opengis.metadata.citation.Telephone;
 import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList;
 import org.apache.sis.metadata.iso.ISOMetadata;
 
 import static org.opengis.annotation.Obligation.OPTIONAL;
@@ -85,7 +87,7 @@ public class DefaultTelephone extends IS
     /**
      * Type of telephone number.
      */
-    TelephoneType numberType;
+    CodeList<?> numberType;
 
     /**
      * Constructs a default telephone.
@@ -101,7 +103,7 @@ public class DefaultTelephone extends IS
      *
      * @since 0.5
      */
-    DefaultTelephone(final String number, final TelephoneType numberType) {
+    DefaultTelephone(final String number, final CodeList<?> numberType) {
         this.number     = number;
         this.numberType = numberType;
     }
@@ -193,8 +195,8 @@ public class DefaultTelephone extends IS
      */
 /// @XmlElement(name = "numberType")
     @UML(identifier="numberType", obligation=OPTIONAL, specification=ISO_19115)
-    public Object getNumberType() {
-        return (numberType != null) ? numberType.name() : null;
+    public CodeList<?> getNumberType() {
+        return numberType;
     }
 
     /**
@@ -202,17 +204,41 @@ public class DefaultTelephone extends IS
      * 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).
+     * The argument type will be changed to the {@code TelephoneType} code list when GeoAPI will provide it
+     * (tentatively in GeoAPI 3.1). In the meantime, users can define their own code list class as below:
+     *
+     * {@preformat java
+     *   final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
+     *       private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();
+     *
+     *       // Need to declare at least one code list element.
+     *       public static final UnsupportedCodeList MY_CODE_LIST = new UnsupportedCodeList("MY_CODE_LIST");
+     *
+     *       private UnsupportedCodeList(String name) {
+     *           super(name, VALUES);
+     *       }
+     *
+     *       public static UnsupportedCodeList valueOf(String code) {
+     *           return valueOf(UnsupportedCodeList.class, code);
+     *       }
+     *
+     *       &#64;Override
+     *       public UnsupportedCodeList[] family() {
+     *           synchronized (VALUES) {
+     *               return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]);
+     *           }
+     *       }
+     *   }
+     * }
      * </div>
      *
      * @param newValue The new type of telephone number.
      *
      * @since 0.5
      */
-    public void setNumberType(final Object newValue) {
+    public void setNumberType(final CodeList<?> newValue) {
         checkWritePermission();
-        numberType = (newValue != null) ? TelephoneType.valueOf(newValue.toString()) : null;
+        numberType = newValue;
     }
 
     /**
@@ -284,7 +310,7 @@ public class DefaultTelephone extends IS
     @Deprecated
     @XmlElement(name = "voice")
     public final Collection<String> getVoices() {
-        return new LegacyTelephones(getOwner(), TelephoneType.VOICE);
+        return new LegacyTelephones(getOwner(), UnsupportedCodeList.VOICE);
     }
 
     /**
@@ -316,7 +342,7 @@ public class DefaultTelephone extends IS
     @Deprecated
     @XmlElement(name = "facsimile")
     public final Collection<String> getFacsimiles() {
-        return new LegacyTelephones(getOwner(), TelephoneType.FACSIMILE);
+        return new LegacyTelephones(getOwner(), UnsupportedCodeList.FACSIMILE);
     }
 
     /**

Modified: sis/trunk/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?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/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] Thu Oct 30 12:06:22 2014
@@ -18,6 +18,7 @@ package org.apache.sis.metadata.iso.cita
 
 import java.util.Collection;
 import java.util.Iterator;
+import org.opengis.util.CodeList;
 import org.opengis.metadata.citation.Telephone;
 import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 
@@ -35,14 +36,14 @@ import org.apache.sis.internal.metadata.
 final class LegacyTelephones extends LegacyPropertyAdapter<String,Telephone> {
     /**
      * The type of telephone number.
-     * Either {@link TelephoneType#VOICE} or {@link TelephoneType#FACSIMILE}.
+     * Either {@link UnsupportedCodeList#VOICE} or {@link UnsupportedCodeList#FACSIMILE}.
      */
-    private final TelephoneType type;
+    private final CodeList<?> type;
 
     /**
      * Wraps the given telephone list for the given type.
      */
-    LegacyTelephones(final Collection<Telephone> telephones, final TelephoneType type) {
+    LegacyTelephones(final Collection<Telephone> telephones, final CodeList<?> type) {
         super(telephones);
         this.type = type;
     }
@@ -60,8 +61,13 @@ final class LegacyTelephones extends Leg
      */
     @Override
     protected String unwrap(final Telephone container) {
-        if (container instanceof DefaultTelephone && type.equals(((DefaultTelephone) container).numberType)) {
-            return ((DefaultTelephone) container).getNumber();
+        if (container instanceof DefaultTelephone) {
+            final CodeList<?> ct = ((DefaultTelephone) container).numberType;
+            if (ct != null) {
+                if (type.name().equals(ct.name())) {
+                    return ((DefaultTelephone) container).getNumber();
+                }
+            }
         }
         return null;
     }
@@ -72,8 +78,8 @@ final class LegacyTelephones extends Leg
     @Override
     protected boolean update(final Telephone container, final String value) {
         if (container instanceof DefaultTelephone) {
-            final TelephoneType ct = ((DefaultTelephone) container).numberType;
-            if (ct == null || ct.equals(type)) {
+            final CodeList<?> ct = ((DefaultTelephone) container).numberType;
+            if (ct == null || type.name().equals(ct.name())) {
                 if (ct == null) {
                     ((DefaultTelephone) container).numberType = type;
                 }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -20,6 +20,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.util.CodeList;
 import org.opengis.annotation.UML;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.Citation;
@@ -82,7 +83,7 @@ public class DefaultKeywords extends ISO
      * User-defined categorization of groups of keywords that extend or are orthogonal
      * to the standardized {@linkplain #getType() keyword type} codes.
      */
-    private Object keywordClass;
+    private CodeList<?> keywordClass;
 
     /**
      * Constructs an initially empty keywords.
@@ -229,7 +230,7 @@ public class DefaultKeywords extends ISO
      * @since 0.5
      */
     @UML(identifier="keywordClass", obligation=OPTIONAL, specification=ISO_19115)
-    public Object getKeywordClass() {
+    public CodeList<?> getKeywordClass() {
         return keywordClass;
     }
 
@@ -237,15 +238,39 @@ public class DefaultKeywords extends ISO
      * Sets the user-defined categorization of groups of keywords.
      *
      * <div class="warning"><b>Upcoming API change — specialization</b><br>
-     * The element type will be changed to the {@code KeywordClass} code list
-     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * The argument type will be changed to the {@code KeywordClass} code list when GeoAPI will provide it
+     * (tentatively in GeoAPI 3.1). In the meantime, users can define their own code list class as below:
+     *
+     * {@preformat java
+     *   final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
+     *       private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();
+     *
+     *       // Need to declare at least one code list element.
+     *       public static final UnsupportedCodeList MY_CODE_LIST = new UnsupportedCodeList("MY_CODE_LIST");
+     *
+     *       private UnsupportedCodeList(String name) {
+     *           super(name, VALUES);
+     *       }
+     *
+     *       public static UnsupportedCodeList valueOf(String code) {
+     *           return valueOf(UnsupportedCodeList.class, code);
+     *       }
+     *
+     *       &#64;Override
+     *       public UnsupportedCodeList[] family() {
+     *           synchronized (VALUES) {
+     *               return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]);
+     *           }
+     *       }
+     *   }
+     * }
      * </div>
      *
      * @param newValue New user-defined categorization of groups of keywords.
      *
      * @since 0.5
      */
-    public void setKeywordClass(final Object newValue) {
+    public void setKeywordClass(final CodeList<?> newValue) {
         checkWritePermission();
         keywordClass = newValue;
     }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] Thu Oct 30 12:06:22 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 javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.util.InternationalString;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.opengis.metadata.citation.OnlineResource;
@@ -28,7 +29,9 @@ import org.opengis.parameter.ParameterDe
 import org.apache.sis.xml.Namespaces;
 
 // Branch-specific imports
+import org.opengis.util.CodeList;
 import org.opengis.annotation.UML;
+import org.apache.sis.internal.jaxb.code.DCPList;
 import static org.opengis.annotation.Obligation.OPTIONAL;
 import static org.opengis.annotation.Obligation.MANDATORY;
 import static org.opengis.annotation.Specification.ISO_19115;
@@ -85,7 +88,7 @@ public class DefaultOperationMetadata ex
     /**
      * Distributed computing platforms on which the operation has been implemented.
      */
-    private Collection<Object> distributedComputingPlatforms;
+    private Collection<CodeList<?>> distributedComputingPlatforms;
 
     /**
      * Free text description of the intent of the operation and the results of the operation.
@@ -132,7 +135,7 @@ public class DefaultOperationMetadata ex
         super(object);
         if (object != null) {
             this.operationName                 = object.getOperationName();
-            this.distributedComputingPlatforms = copyCollection(object.getDistributedComputingPlatforms(), Object.class);
+            this.distributedComputingPlatforms = copyCollection(object.getDistributedComputingPlatforms(), (Class) CodeList.class);
             this.operationDescription          = object.getOperationDescription();
             this.invocationName                = object.getInvocationName();
             this.connectPoints                 = copyCollection(object.getConnectPoints(), OnlineResource.class);
@@ -172,19 +175,49 @@ public class DefaultOperationMetadata ex
      *
      * @return Distributed computing platforms on which the operation has been implemented.
      */
+    @XmlJavaTypeAdapter(DCPList.class)
     @XmlElement(name = "DCP", namespace = Namespaces.SRV, required = true)
     @UML(identifier="distributedComputingPlatform", obligation=MANDATORY, specification=ISO_19115)
-    public Collection<Object> getDistributedComputingPlatforms() {
-        return distributedComputingPlatforms = nonNullCollection(distributedComputingPlatforms, Object.class);
+    public Collection<CodeList<?>> getDistributedComputingPlatforms() {
+        return distributedComputingPlatforms = nonNullCollection(distributedComputingPlatforms, (Class) CodeList.class);
     }
 
     /**
      * Sets the distributed computing platforms on which the operation has been implemented.
      *
+     * <div class="warning"><b>Upcoming API change — specialization</b><br>
+     * The element type will be changed to the {@code DistributedComputingPlatform} code list when GeoAPI will provide
+     * it (tentatively in GeoAPI 3.1). In the meantime, users can define their own code list class as below:
+     *
+     * {@preformat java
+     *   final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
+     *       private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();
+     *
+     *       // Need to declare at least one code list element.
+     *       public static final UnsupportedCodeList MY_CODE_LIST = new UnsupportedCodeList("MY_CODE_LIST");
+     *
+     *       private UnsupportedCodeList(String name) {
+     *           super(name, VALUES);
+     *       }
+     *
+     *       public static UnsupportedCodeList valueOf(String code) {
+     *           return valueOf(UnsupportedCodeList.class, code);
+     *       }
+     *
+     *       &#64;Override
+     *       public UnsupportedCodeList[] family() {
+     *           synchronized (VALUES) {
+     *               return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]);
+     *           }
+     *       }
+     *   }
+     * }
+     * </div>
+     *
      * @param newValues The new distributed computing platforms on which the operation has been implemented.
      */
-    public void setDistributedComputingPlatforms(final Collection<?> newValues) {
-        distributedComputingPlatforms = writeCollection(newValues, distributedComputingPlatforms, Object.class);
+    public void setDistributedComputingPlatforms(final Collection<? extends CodeList<?>> newValues) {
+        distributedComputingPlatforms = writeCollection(newValues, distributedComputingPlatforms, (Class) CodeList.class);
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -21,12 +21,15 @@ import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.annotation.UML;
+import org.opengis.util.CodeList;
 import org.opengis.util.GenericName;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.identification.DataIdentification;
 import org.opengis.metadata.distribution.StandardOrderProcess;
 import org.opengis.metadata.identification.ServiceIdentification;
+import org.apache.sis.internal.jaxb.code.SV_CouplingType;
 import org.apache.sis.xml.Namespaces;
 
 import static org.opengis.annotation.Obligation.OPTIONAL;
@@ -94,7 +97,7 @@ public class DefaultServiceIdentificatio
     /**
      * Type of coupling between service and associated data (if exist).
      */
-    private Object couplingType;
+    private CodeList<?> couplingType;
 
     /**
      * Further description of the data coupling in the case of tightly coupled services.
@@ -283,9 +286,10 @@ public class DefaultServiceIdentificatio
      *
      * @return Type of coupling between service and associated data, or {@code null} if none.
      */
+    @XmlJavaTypeAdapter(SV_CouplingType.class)
     @XmlElement(name = "couplingType", namespace = Namespaces.SRV)
     @UML(identifier="couplingType", obligation=CONDITIONAL, specification=ISO_19115)
-    public Object getCouplingType() {
+    public CodeList<?> getCouplingType() {
         return couplingType;
     }
 
@@ -293,13 +297,37 @@ public class DefaultServiceIdentificatio
      * Sets the type of coupling between service and associated data.
      *
      * <div class="warning"><b>Upcoming API change — specialization</b><br>
-     * The argument type will be changed to the {@code CouplingType} code list
-     * when GeoAPI will provide it (tentatively in GeoAPI 3.1).
+     * The argument type will be changed to the {@code CouplingType} code list when GeoAPI will provide it
+     * (tentatively in GeoAPI 3.1). In the meantime, users can define their own code list class as below:
+     *
+     * {@preformat java
+     *   final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
+     *       private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();
+     *
+     *       // Need to declare at least one code list element.
+     *       public static final UnsupportedCodeList MY_CODE_LIST = new UnsupportedCodeList("MY_CODE_LIST");
+     *
+     *       private UnsupportedCodeList(String name) {
+     *           super(name, VALUES);
+     *       }
+     *
+     *       public static UnsupportedCodeList valueOf(String code) {
+     *           return valueOf(UnsupportedCodeList.class, code);
+     *       }
+     *
+     *       &#64;Override
+     *       public UnsupportedCodeList[] family() {
+     *           synchronized (VALUES) {
+     *               return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]);
+     *           }
+     *       }
+     *   }
+     * }
      * </div>
      *
      * @param newValue The new type of coupling between service and associated data.
      */
-    public void setCouplingType(final Object newValue) {
+    public void setCouplingType(final CodeList<?> newValue) {
         checkWritePermission();
         couplingType = newValue;
     }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTestCase.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -134,6 +134,9 @@ public abstract strictfp class MetadataT
                 // but not all character sets are supported.
                 return CharacterSet.ISO_8859_1;
             }
+            if (type == CodeList.class) {
+                return null;
+            }
             final CodeList<?>[] codes = (CodeList<?>[]) type.getMethod("values", (Class[]) null).invoke(null, (Object[]) null);
             return codes[random.nextInt(codes.length)];
         } catch (Exception e) { // (ReflectiveOperationException) on JDK7 branch.

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.logging.LogRecord;
 import org.opengis.metadata.citation.Telephone;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList;
 import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.XMLTestCase;
@@ -91,10 +92,10 @@ public final strictfp class DefaultConta
     @SuppressWarnings("deprecation")
     public void testSetPhones() {
         init();
-        final DefaultTelephone   tel1 = new DefaultTelephone("00.01", TelephoneType.SMS);
-        final DefaultTelephone   tel2 = new DefaultTelephone("00.02", TelephoneType.VOICE);
-        final DefaultTelephone   tel3 = new DefaultTelephone("00.03", TelephoneType.FACSIMILE);
-        final DefaultTelephone   tel4 = new DefaultTelephone("00.04", TelephoneType.VOICE);
+        final DefaultTelephone   tel1 = new DefaultTelephone("00.01", UnsupportedCodeList.valueOf("SMS"));
+        final DefaultTelephone   tel2 = new DefaultTelephone("00.02", UnsupportedCodeList.VOICE);
+        final DefaultTelephone   tel3 = new DefaultTelephone("00.03", UnsupportedCodeList.FACSIMILE);
+        final DefaultTelephone   tel4 = new DefaultTelephone("00.04", UnsupportedCodeList.VOICE);
         final DefaultTelephone[] tels = new DefaultTelephone[] {tel1, tel2, tel3, tel4};
         final DefaultContact  contact = new DefaultContact();
         contact.setPhones(Arrays.asList(tel1, tel2, tel3, tel4));
@@ -134,7 +135,6 @@ public final strictfp class DefaultConta
      */
     @Test
     @DependsOnMethod("testSetPhones")
-    @org.junit.Ignore("Pending completion of ISO 19115:2014 upgrade.")
     public void testSetPhone() {
         testSetPhone(false);
     }
@@ -145,7 +145,6 @@ public final strictfp class DefaultConta
      */
     @Test
     @DependsOnMethod("testSetPhones")
-    @org.junit.Ignore("Pending completion of ISO 19115:2014 upgrade.")
     public void testSetNonSISPhone() {
         testSetPhone(true);
     }
@@ -179,9 +178,9 @@ public final strictfp class DefaultConta
         contact.setPhone(view);
         verifyLegacyLists(view);
         assertArrayEquals("getPhones", new DefaultTelephone[] {
-                new DefaultTelephone("00.02", TelephoneType.VOICE),
-                new DefaultTelephone("00.04", TelephoneType.VOICE),
-                new DefaultTelephone("00.03", TelephoneType.FACSIMILE)
+                new DefaultTelephone("00.02", UnsupportedCodeList.VOICE),
+                new DefaultTelephone("00.04", UnsupportedCodeList.VOICE),
+                new DefaultTelephone("00.03", UnsupportedCodeList.FACSIMILE)
             }, contact.getPhones().toArray());
     }
 }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -41,7 +41,6 @@ public final strictfp class DefaultRespo
      * @throws JAXBException if an error occurred during the marshalling.
      */
     @Test
-    @org.junit.Ignore("Need investigation")
     public void testLegacyMarshalling() throws JAXBException {
         final DefaultIndividual  party = new DefaultIndividual("An author", null, null);
         final DefaultResponsibleParty r = new DefaultResponsibleParty(Role.AUTHOR);
@@ -57,7 +56,7 @@ public final strictfp class DefaultRespo
                 "        <gco:CharacterString>An author</gco:CharacterString>\n" +
                 "      </gmd:individualName>\n" +
                 "      <gmd:role>\n" +
-                "        <gmd:CI_RoleCode codeList=\"http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_RoleCode\" codeListValue=\"author\" codeSpace=\"eng\">Author</gmd:CI_RoleCode>\n" +
+                "        <gmd:CI_RoleCode codeList=\"http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_RoleCode\" codeListValue=\"author\">Author</gmd:CI_RoleCode>\n" +
                 "      </gmd:role>\n" +
                 "    </gmd:CI_ResponsibleParty>\n" +
                 "  </gmd:citedResponsibleParty>\n" +

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -19,6 +19,7 @@ package org.apache.sis.metadata.iso.iden
 import org.opengis.util.ScopedName;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.metadata.citation.OnlineResource;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList;
 import org.apache.sis.internal.jaxb.metadata.replace.ServiceParameterTest;
 import org.apache.sis.xml.NilReason;
 import org.apache.sis.test.DependsOn;
@@ -46,7 +47,7 @@ public final strictfp class DefaultCoupl
     static DefaultCoupledResource create() {
         final DefaultOperationMetadata operation = new DefaultOperationMetadata();
         operation.setOperationName("Get Map");
-        operation.setDistributedComputingPlatforms(singleton("WEB_SERVICES"));
+        operation.setDistributedComputingPlatforms(singleton(UnsupportedCodeList.valueOf("WEB_SERVICES")));
         operation.setParameters(singleton((ParameterDescriptor<?>) ServiceParameterTest.create()));
         operation.setConnectPoints(singleton(NilReason.MISSING.createNilObject(OnlineResource.class)));
 

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -18,6 +18,7 @@ package org.apache.sis.metadata.iso.iden
 
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.citation.Citation;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.xml.NilReason;
 import org.apache.sis.test.DependsOn;
@@ -58,7 +59,7 @@ public final strictfp class DefaultServi
                 "A dummy service for testing purpose.");                // abstract
         id.setServiceTypeVersions(singleton("1.0"));
         id.setCoupledResources(singleton(resource));
-        id.setCouplingType("LOOSE");
+        id.setCouplingType(UnsupportedCodeList.valueOf("LOOSE"));
         id.setContainsOperations(singleton(resource.getOperation()));
         return id;
     }
@@ -69,7 +70,6 @@ public final strictfp class DefaultServi
      * @throws JAXBException If an error occurred during the during marshalling process.
      */
     @Test
-    @org.junit.Ignore("Pending completion of ISO 19115:2014 upgrade.")
     public void testMarshal() throws JAXBException {
         assertMarshalEqualsFile(XML_FILE, create(), "xlmns:*", "xsi:schemaLocation");
     }
@@ -83,7 +83,6 @@ public final strictfp class DefaultServi
      * @throws JAXBException If an error occurred during the during unmarshalling process.
      */
     @Test
-    @org.junit.Ignore("Pending completion of ISO 19115:2014 upgrade.")
     public void testUnmarshal() throws JAXBException {
         assertTrue(create().equals(unmarshalFile(DefaultServiceIdentification.class, XML_FILE), ComparisonMode.DEBUG));
     }

Modified: sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml (original)
+++ sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml Thu Oct 30 12:06:22 2014
@@ -76,9 +76,6 @@
               </gco:TypeName>
             </gco:attributeType>
           </srv:name>
-          <srv:direction>
-            <srv:SV_ParameterDirection>in</srv:SV_ParameterDirection>
-          </srv:direction>
           <srv:optionality>
             <gco:CharacterString>Optional</gco:CharacterString>
           </srv:optionality>

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java?rev=1635469&r1=1635468&r2=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -66,6 +66,7 @@ import static java.util.Collections.sing
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.StandardCharsets;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList;
 
 
 /**
@@ -105,7 +106,7 @@ public strictfp class DefaultMetadataTes
     private static DefaultTelephone telephone(final String number, final String type) {
         final DefaultTelephone tel = new DefaultTelephone();
         tel.setNumber(number);
-        tel.setNumberType(type);
+        tel.setNumberType(UnsupportedCodeList.valueOf(type));
         return tel;
     }
 

Copied: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java (from r1635203, 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-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java?p2=sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java&p1=sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java&r1=1635203&r2=1635469&rev=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/TelephoneType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -13,17 +13,71 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.metadata.iso.citation;
+package org.apache.sis.internal.geoapi.evolution;
+
+import java.util.List;
+import java.util.ArrayList;
+import org.opengis.util.CodeList;
 
 
 /**
- * Placeholder for {@code org.opengis.metadata.citation.TelephoneType}
+ * Placeholder for code list not yet available in GeoAPI.
+ * Example: {@code org.opengis.metadata.citation.TelephoneType}.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
  * @version 0.5
  * @module
  */
-enum TelephoneType {
-    VOICE, FACSIMILE, SMS
+public final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = 7205015191869240829L;
+
+    /**
+     * The list of constants defined in this code list.
+     */
+    private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();
+
+    /**
+     * A frequently used code list element.
+     */
+    public static final CodeList<?> VOICE = new UnsupportedCodeList("VOICE");
+
+    /**
+     * A frequently used code list element.
+     */
+    public static final CodeList<?> FACSIMILE = new UnsupportedCodeList("FACSIMILE");
+
+    /**
+     * Constructor for new code list element.
+     *
+     * @param name The code list name.
+     */
+    private UnsupportedCodeList(String name) {
+        super(name, VALUES);
+    }
+
+    /**
+     * Returns the list of codes of the same kind than this code list element.
+     *
+     * @return All code values for this code list.
+     */
+    @Override
+    public UnsupportedCodeList[] family() {
+        synchronized (VALUES) {
+            return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]);
+        }
+    }
+
+    /**
+     * Returns the telephone type that matches the given string, or returns a new one if none match it.
+     *
+     * @param code The name of the code to fetch or to create.
+     * @return A code matching the given name.
+     */
+    public static UnsupportedCodeList valueOf(String code) {
+        return valueOf(UnsupportedCodeList.class, code);
+    }
 }

Copied: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java (from r1635203, sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java?p2=sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java&p1=sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java&r1=1635203&r2=1635469&rev=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -14,41 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.internal.jaxb.gmd;
+package org.apache.sis.internal.geoapi.evolution;
 
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.CodeList;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
 
 
 /**
- * An adapter for {@link CodeList}, in order to implement the ISO-19139 standard. This object
- * wraps a {@link CodeListProxy}, which contain {@link CodeListProxy#codeList codeList} and
- * {@link CodeListProxy#codeListValue codeListValue} attributes. The result looks like below:
- *
- * {@preformat xml
- *   <dateType>
- *     <CI_DateTypeCode codeList="../Codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision" codeSpace="fra">
- *       révision
- *     </CI_DateTypeCode>
- *   </dateType>
- * }
- *
- * A subclass must exist for each code list, with a {@link #getElement()} method having a
- * {@code @XmlElement} annotation.
+ * An adapter for {@link UnsupportedCodeList}, in order to implement the ISO-19139 standard.
+ * See {@link org.apache.sis.internal.jaxb.gmd.CodeListAdapter} for more information.
  *
  * @param <ValueType> The subclass implementing this adapter.
- * @param <BoundType> The code list being adapted.
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @since   0.5
+ * @version 0.5
  * @module
  */
-public abstract class CodeListAdapter<ValueType extends CodeListAdapter<ValueType,BoundType>,
-        BoundType extends CodeList<BoundType>> extends XmlAdapter<ValueType,BoundType>
+public abstract class UnsupportedCodeListAdapter<ValueType extends UnsupportedCodeListAdapter<ValueType>>
+        extends XmlAdapter<ValueType,CodeList<?>>
 {
     /**
      * A proxy form of the {@link CodeList}.
@@ -58,7 +46,7 @@ public abstract class CodeListAdapter<Va
     /**
      * Empty constructor for subclasses only.
      */
-    protected CodeListAdapter() {
+    protected UnsupportedCodeListAdapter() {
     }
 
     /**
@@ -66,7 +54,7 @@ public abstract class CodeListAdapter<Va
      *
      * @param proxy The proxy version of {@link CodeList} to be marshalled.
      */
-    protected CodeListAdapter(final CodeListProxy proxy) {
+    protected UnsupportedCodeListAdapter(final CodeListProxy proxy) {
         this.proxy = proxy;
     }
 
@@ -78,21 +66,17 @@ public abstract class CodeListAdapter<Va
      *     return new ValueType(proxy);
      * }
      *
-     * However is some cases, the {@code proxy} argument may be inspected.
-     * For example {@link org.apache.sis.internal.jaxb.code.MD_RestrictionCode}
-     * replaces {@code "licence"} by {@code "license"} for ISO 19115:2003 compatibility.
-     *
      * @param proxy The proxy version of {@link CodeList}, to be marshalled.
      * @return The wrapper for the code list value.
      */
     protected abstract ValueType wrap(final CodeListProxy proxy);
 
     /**
-     * Returns the class of code list wrapped by this adapter.
+     * Returns the name of the code list class.
      *
-     * @return The code list class.
+     * @return The code list class name.
      */
-    protected abstract Class<BoundType> getCodeListClass();
+    protected abstract String getCodeListName();
 
     /**
      * Substitutes the adapter value read from an XML stream by the object which will
@@ -102,49 +86,68 @@ public abstract class CodeListAdapter<Va
      * @return A code list which represents the metadata value.
      */
     @Override
-    public final BoundType unmarshal(final ValueType adapter) {
+    public final CodeList<?> unmarshal(final ValueType adapter) {
         if (adapter == null) {
             return null;
         }
-        return Types.forCodeName(getCodeListClass(), adapter.proxy.identifier(), true);
+        return Types.forCodeName(UnsupportedCodeList.class, adapter.proxy.identifier(), true);
     }
 
     /**
-     * Substitutes the code list by the adapter to be marshalled into an XML file
-     * or stream. JAXB calls automatically this method at marshalling time.
+     * Substitutes the code list by the adapter to be marshalled into an XML file or stream.
+     * JAXB calls automatically this method at marshalling time.
      *
      * @param  value The code list value.
      * @return The adapter for the given code list.
      */
     @Override
-    public final ValueType marshal(final BoundType value) {
+    public final ValueType marshal(final CodeList<?> value) {
         if (value == null) {
             return null;
         }
-        final CodeListProxy p;
-        if (isEnum()) {
-            // To be removed after GEO-199 resolution.
-            p = new CodeListProxy();
-            p.value = Types.getCodeName(value);
-        } else {
-            p = new CodeListProxy(Context.current(), value);
-        }
-        return wrap(p);
+        final String name = value.name();
+        final int length = name.length();
+        final StringBuilder buffer = new StringBuilder(length);
+        final String codeListValue = toIdentifier(name, buffer, false);
+        buffer.setLength(0);
+        return wrap(new CodeListProxy(Context.current(), getCodeListName(), codeListValue,
+                null, toIdentifier(name, buffer, true)));
     }
 
     /**
-     * Returns {@code true} if this code list is actually an enum. The default implementation
-     * returns {@code false} in every cases, since there is very few enums in ISO 19115.
-     *
-     * @return {@code true} if this code list is actually an enum.
-     *
-     * @todo Remove this method after we refactored enum wrappers as {@link EnumAdapter} subclasses
-     *       instead of {@code CodeListAdapter}. This requires the resolution of GEO-199 first.
-     *
-     * @see <a href="http://jira.codehaus.org/browse/GEO-199">GEO-199</a>
-     */
-    protected boolean isEnum() {
-        return false;
+     * Converts the given Java constant name to something hopefully close to the UML identifier,
+     * or close to the textual value to put in the XML. This method convert the Java constant name
+     * to camel case if {@code isValue} is {@code true}, or to lower cases with word separated by
+     * spaces if {@code isValue} is {@code true}.
+     *
+     * @param  name    The Java constant name (e.g. {@code WEB_SERVICES}).
+     * @param  buffer  An initially empty buffer to use for creating the identifier.
+     * @param  isValue {@code false} for the {@code codeListValue} attribute, or {@code true} for the XML value.
+     * @return The identifier (e.g. {@code "webServices"} or {@code "Web services"}).
+     */
+    protected String toIdentifier(final String name, final StringBuilder buffer, final boolean isValue) {
+        final int length = name.length();
+        boolean toUpper = isValue;
+        for (int i=0; i<length;) {
+            int c = name.codePointAt(i);
+            i += Character.charCount(c);
+            if (c == '_') {
+                if (isValue) {
+                    c = ' ';
+                } else {
+                    toUpper = true;
+                    continue;
+                }
+            }
+            if (toUpper) {
+                c = Character.toUpperCase(c);
+                toUpper = false;
+            } else {
+                c = Character.toLowerCase(c);
+            }
+            buffer.appendCodePoint(c);
+        }
+        return buffer.toString();
     }
 
     /**
@@ -157,7 +160,6 @@ public abstract class CodeListAdapter<Va
 
     /*
      * We do not define setter method (even abstract) since it seems to confuse JAXB.
-     * It is subclasses responsibility to define the setter method. The existence of
-     * this setter will be tested by MetadataAnnotationsTest.
+     * It is subclasses responsibility to define the setter method.
      */
 }

Copied: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/package-info.java (from r1635203, sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/package-info.java?p2=sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/package-info.java&p1=sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java&r1=1635203&r2=1635469&rev=1635469&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/package-info.java [UTF-8] Thu Oct 30 12:06:22 2014
@@ -16,16 +16,21 @@
  */
 
 /**
- * Placeholder for GeoAPI interfaces not present in GeoAPI 3.0.0.
+ * Provides a transition path for new GeoAPI elements not yet published in a formal release.
+ * We try to avoid putting a copy of those new elements in Apache SIS, since it would break
+ * compatibility when they would be removed in favor of GeoAPI elements. The approach taken
+ * is rather to use in the new API the most immediate parent available in a GeoAPI release.
+ * For example for new code list classes, this is {@code CodeList<?>}. The Javadoc for such
+ * API shall contain a warning. See {@code warning-templates.txt} for some proposals.
  *
- * <STRONG>Do not use!</STRONG>
+ * <p><STRONG>Do not use!</STRONG></p>
  *
  * This package is for internal use by SIS only. Classes in this package
  * may change in incompatible ways in any future version without notice.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.3
- * @version 0.3
+ * @since   0.5
+ * @version 0.5
  * @module
  */
-package org.apache.sis.internal.geoapi.temporal;
+package org.apache.sis.internal.geoapi.evolution;

Added: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/warning-templates.txt
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/warning-templates.txt?rev=1635469&view=auto
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/warning-templates.txt (added)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/warning-templates.txt [UTF-8] Thu Oct 30 12:06:22 2014
@@ -0,0 +1,33 @@
+Suggestions for the Javadoc of methods having a CodeList<?> return type
+(replace "NewCodeList" and "3.1" by appropriate values):
+
+     *
+     * <div class="warning"><b>Upcoming API change — specialization</b><br>
+     * The argument type will be changed to the {@code NewCodeList} code list when GeoAPI will provide it
+     * (tentatively in GeoAPI 3.1). In the meantime, users can define their own code list class as below:
+     *
+     * {@preformat java
+     *   final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
+     *       private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();
+     *
+     *       // Need to declare at least one code list element.
+     *       public static final UnsupportedCodeList MY_CODE_LIST = new UnsupportedCodeList("MY_CODE_LIST");
+     *
+     *       private UnsupportedCodeList(String name) {
+     *           super(name, VALUES);
+     *       }
+     *
+     *       public static UnsupportedCodeList valueOf(String code) {
+     *           return valueOf(UnsupportedCodeList.class, code);
+     *       }
+     *
+     *       &#64;Override
+     *       public UnsupportedCodeList[] family() {
+     *           synchronized (VALUES) {
+     *               return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]);
+     *           }
+     *       }
+     *   }
+     * }
+     * </div>
+     *

Propchange: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/warning-templates.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/warning-templates.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8



Mime
View raw message