sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1797115 - in /sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf: AttributeNames.java MetadataReader.java
Date Wed, 31 May 2017 21:27:24 GMT
Author: desruisseaux
Date: Wed May 31 21:27:24 2017
New Revision: 1797115

URL: http://svn.apache.org/viewvc?rev=1797115&view=rev
Log:
Fix a type in a NetCDF attribute name, and prepare for more development.

Modified:
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/AttributeNames.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/AttributeNames.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/AttributeNames.java?rev=1797115&r1=1797114&r2=1797115&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/AttributeNames.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/AttributeNames.java
[UTF-8] Wed May 31 21:27:24 2017
@@ -616,6 +616,13 @@ public class AttributeNames {
      * {@link DataIdentification#getCredits() credit}</li></ul>
      *
      * @see <a href="http://www.unidata.ucar.edu/software/netcdf-java/formats/DataDiscoveryAttConvention.html#acknowledgement_Attribute">UCAR
reference</a>
+     *
+     * @since 0.8
+     */
+    public static final String ACKNOWLEDGEMENT = ACDD.acknowledgement;
+
+    /**
+     * @deprecated Renamed {@link #ACKNOWLEDGEMENT}.
      */
     public static final String ACKNOWLEDGMENT = "acknowledgment";
 

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1797115&r1=1797114&r2=1797115&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] Wed May 31 21:27:24 2017
@@ -66,6 +66,7 @@ import org.apache.sis.internal.netcdf.Va
 import org.apache.sis.internal.netcdf.GridGeometry;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.CharSequences;
 import org.apache.sis.measure.Units;
 
 // The following dependency is used only for static final String constants.
@@ -104,7 +105,7 @@ import static org.apache.sis.internal.ut
  * </ul>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 0.8
  * @since   0.3
  * @module
  */
@@ -205,6 +206,13 @@ final class MetadataReader {
     }
 
     /**
+     * Splits comma-separated values. Leading and trailing spaces are removed.
+     */
+    private static String[] split(final String value) {
+        return (String[]) CharSequences.split(value, ',');
+    }
+
+    /**
      * Reads the attribute value for the given name, then trims the leading and trailing
spaces.
      * If the value is null, empty or contains only spaces, then this method returns {@code
null}.
      */
@@ -535,7 +543,7 @@ final class MetadataReader {
             final Keywords keywords = createKeywords(KeywordType.THEME, false);
             final String   topic    = stringValue(TOPIC_CATEGORY);
             final String   type     = stringValue(DATA_TYPE);
-            final String   credits  = stringValue(ACKNOWLEDGMENT);
+            final String   credits  = stringValue(ACKNOWLEDGEMENT);
             final String   license  = stringValue(LICENSE);
             final String   access   = stringValue(ACCESS_CONSTRAINT);
             final Extent   extent   = hasExtent ? null : createExtent();
@@ -550,8 +558,7 @@ final class MetadataReader {
                 if (credits  != null) addIfAbsent(identification.getCredits(), new SimpleInternationalString(credits));
                 if (license  != null) addIfAbsent(identification.getResourceConstraints(),
constraints = new DefaultLegalConstraints(license));
                 if (access   != null) {
-                    for (String keyword : access.split(KEYWORD_SEPARATOR)) {
-                        keyword = keyword.trim();
+                    for (final String keyword : split(access)) {
                         if (!keyword.isEmpty()) {
                             if (constraints == null) {
                                 identification.getResourceConstraints().add(constraints =
new DefaultLegalConstraints());
@@ -618,8 +625,7 @@ final class MetadataReader {
         DefaultKeywords keywords = null;
         if (list != null) {
             final Set<InternationalString> words = new LinkedHashSet<>();
-            for (String keyword : list.split(KEYWORD_SEPARATOR)) {
-                keyword = keyword.trim();
+            for (final String keyword : split(list)) {
                 if (!keyword.isEmpty()) {
                     words.add(new SimpleInternationalString(keyword));
                 }



Mime
View raw message