sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1796414 - in /sis/trunk/core: sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/ sis-metadata/src/main/java/org/apache/sis/metadata/sql/ sis-metadata/src/test/java/org/apache/sis/metadata/sql/ sis-utility/src/main/java/org/ap...
Date Sat, 27 May 2017 15:18:49 GMT
Author: desruisseaux
Date: Sat May 27 15:18:49 2017
New Revision: 1796414

URL: http://svn.apache.org/viewvc?rev=1796414&view=rev
Log:
Allow SIS to know that "UnsupportedCodeList" stands for "TelephoneType" until a future GeoAPI
version provides that CodeList.

Added:
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java
  (with props)
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/InterimType.java
  (with props)
Modified:
    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/sql/MetadataSource.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/package-info.java
    sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/util/iso/class-index.properties

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=1796414&r1=1796413&r2=1796414&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] Sat May 27 15:18:49 2017
@@ -26,7 +26,6 @@ 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 org.apache.sis.internal.metadata.Dependencies;
 
@@ -34,6 +33,10 @@ import static org.opengis.annotation.Obl
 import static org.opengis.annotation.Obligation.MANDATORY;
 import static org.opengis.annotation.Specification.ISO_19115;
 
+// Branch-specific imports
+import org.apache.sis.internal.geoapi.evolution.InterimType;
+import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList;
+
 
 /**
  * Telephone numbers for contacting the responsible individual or organization.
@@ -198,6 +201,7 @@ public class DefaultTelephone extends IS
      */
 /// @XmlElement(name = "numberType")
     @UML(identifier="numberType", obligation=OPTIONAL, specification=ISO_19115)
+    @InterimType(UnsupportedCodeList.class)
     public CodeList<?> getNumberType() {
         return numberType;
     }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1796414&r1=1796413&r2=1796414&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
[UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
[UTF-8] Sat May 27 15:18:49 2017
@@ -72,6 +72,7 @@ import org.apache.sis.util.iso.Types;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk8.JDK8;
+import org.apache.sis.internal.geoapi.evolution.Interim;
 
 
 /**
@@ -896,7 +897,7 @@ public class MetadataSource implements A
          * the name between bracket is a subtype of the given 'type' argument.
          */
         final Class<?> type           = subType(info.getMetadataType(), toSearch.identifier);
-        final Class<?> returnType     = method.getReturnType();
+        final Class<?> returnType     = Interim.getReturnType(method);
         final boolean  wantCollection = Collection.class.isAssignableFrom(returnType);
         final Class<?> elementType    = wantCollection ? Classes.boundOfParameterizedProperty(method)
: returnType;
         final boolean  isMetadata     = standard.isMetadata(elementType);

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java?rev=1796414&r1=1796413&r2=1796414&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java
[UTF-8] Sat May 27 15:18:49 2017
@@ -201,8 +201,6 @@ public final strictfp class MetadataWrit
      */
     @SuppressWarnings("deprecation")
     private void readWriteDeprecated() throws MetadataStoreException {
-        org.junit.Assume.assumeTrue("TODO: needs to investigate why information are lost.",
false);
-
         final DefaultTelephone tel = new DefaultTelephone();
         tel.setVoices(Collections.singleton("01.02.03.04"));
         assertEquals("01.02.03.04", source.add(tel));

Added: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java?rev=1796414&view=auto
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java
(added)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/Interim.java
[UTF-8] Sat May 27 15:18:49 2017
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * The ASF licenses this file to You 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.internal.geoapi.evolution;
+
+import java.lang.reflect.Method;
+import org.apache.sis.util.Static;
+
+
+/**
+ * Temporary methods used until a new major GeoAPI release provides the missing functionalities.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ * @module
+ */
+public final class Interim extends Static {
+    /**
+     * Do not allow instantiation of this class.
+     */
+    private Interim() {
+    }
+
+    /**
+     * Returns the return type of the given method, or the interim type if the method is
annotated
+     * with {@link InterimType}.
+     *
+     * @param  method  the method from which to get the return type.
+     * @return the return type or the interim type.
+     */
+    public static Class<?> getReturnType(final Method method) {
+        final InterimType an = method.getAnnotation(InterimType.class);
+        return (an != null) ? an.value() : method.getReturnType();
+    }
+}

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

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

Added: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/InterimType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/InterimType.java?rev=1796414&view=auto
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/InterimType.java
(added)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/InterimType.java
[UTF-8] Sat May 27 15:18:49 2017
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ * The ASF licenses this file to You 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.internal.geoapi.evolution;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Method;
+
+
+/**
+ * Identifies an interim class to use until an official GeoAPI class or interface is released.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ * @module
+ *
+ * @see Interim#getReturnType(Method)
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface InterimType {
+    /**
+     * The interim Apache SIS class to use until the GeoAPI class or interface is released.
+     *
+     * @return Apache SIS class to use in the interim.
+     */
+    Class<?> value();
+}

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

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

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java?rev=1796414&r1=1796413&r2=1796414&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java
[UTF-8] Sat May 27 15:18:49 2017
@@ -17,18 +17,25 @@ package org.apache.sis.internal.geoapi.e
 
 import java.util.List;
 import java.util.ArrayList;
+import org.opengis.annotation.UML;
 import org.opengis.util.CodeList;
 
+import static org.opengis.annotation.Obligation.CONDITIONAL;
+import static org.opengis.annotation.Specification.ISO_19115;
+
 
 /**
  * Placeholder for code list not yet available in GeoAPI.
- * Example: {@code org.opengis.metadata.citation.TelephoneType}.
+ * Currently only for {@code org.opengis.metadata.citation.TelephoneType}, but we use the
+ * {@code UnsupportedCodeList} class name for making clear that this class will disappear
+ * in a future Apache SIS version.
  *
  * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
  * @since   0.5
- * @version 0.5
  * @module
  */
+@UML(identifier="CI_TelephoneTypeCode", specification=ISO_19115)
 public final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> {
     /**
      * For cross-version compatibility.
@@ -38,16 +45,18 @@ public final class UnsupportedCodeList e
     /**
      * The list of constants defined in this code list.
      */
-    private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>();
+    private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>(3);
 
     /**
      * A frequently used code list element.
      */
+    @UML(identifier="voice", obligation=CONDITIONAL, specification=ISO_19115)
     public static final CodeList<?> VOICE = new UnsupportedCodeList("VOICE");
 
     /**
      * A frequently used code list element.
      */
+    @UML(identifier="facsimile", obligation=CONDITIONAL, specification=ISO_19115)
     public static final CodeList<?> FACSIMILE = new UnsupportedCodeList("FACSIMILE");
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java?rev=1796414&r1=1796413&r2=1796414&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java
[UTF-8] Sat May 27 15:18:49 2017
@@ -31,8 +31,8 @@ import org.apache.sis.internal.jaxb.gmd.
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.5
  * @version 0.5
+ * @since   0.5
  * @module
  */
 public abstract class UnsupportedCodeListAdapter<ValueType extends UnsupportedCodeListAdapter<ValueType>>

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/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?rev=1796414&r1=1796413&r2=1796414&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/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] Sat May 27 15:18:49 2017
@@ -29,8 +29,8 @@
  * may change in incompatible ways in any future version without notice.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.5
  * @version 0.5
+ * @since   0.5
  * @module
  */
 package org.apache.sis.internal.geoapi.evolution;

Modified: sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/util/iso/class-index.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/util/iso/class-index.properties?rev=1796414&r1=1796413&r2=1796414&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/util/iso/class-index.properties
(original)
+++ sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/util/iso/class-index.properties
Sat May 27 15:18:49 2017
@@ -217,6 +217,7 @@ CI_Party=org.apache.sis.metadata.iso.cit
 CI_Individual=org.apache.sis.metadata.iso.citation.DefaultIndividual
 CI_Organisation=org.apache.sis.metadata.iso.citation.DefaultOrganisation
 CI_Responsibility=org.apache.sis.metadata.iso.citation.DefaultResponsibility
+CI_TelephoneTypeCode=org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList
 MD_AssociatedResource=org.apache.sis.metadata.iso.identification.DefaultAssociatedResource
 MD_AttributeGroup=org.apache.sis.metadata.iso.content.DefaultAttributeGroup
 MD_FeatureTypeInfo=org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo



Mime
View raw message