sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1733385 [4/4] - in /sis/trunk: ./ application/sis-console/src/main/artifact/bin/ application/sis-console/src/main/artifact/conf/ application/sis-console/src/main/artifact/data/ application/sis-console/src/main/artifact/lib/ application/sis...
Date Wed, 02 Mar 2016 22:31:04 GMT
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Wed Mar  2 22:31:02 2016
@@ -44,6 +44,7 @@ CanNotSetParameterValue_1         = Ne p
 CanNotSetPropertyValue_1          = Ne peut pas d\u00e9finir une valeur pour la propri\u00e9t\u00e9
\u00ab\u202f{0}\u202f\u00bb.
 CanNotTransformEnvelope           = Ne peut pas transformer l\u2019enveloppe.
 CanNotTransformEnvelopeToGeodetic = Ne peut pas transformer l\u2019enveloppe vers un syst\u00e8me
g\u00e9od\u00e9sique.
+CanNotUseGeodeticParameters_2     = Ne peut pas utiliser les param\u00e8tres g\u00e9od\u00e9siques
{0}\u202f: {1}
 CircularReference                 = R\u00e9f\u00e9rence circulaire.
 ClassNotFinal_1                   = La classe \u2018{0}\u2019 n\u2019est pas finale.
 CloneNotSupported_1               = Un objet de type \u2018{0}\u2019 ne peut pas \u00eatre
clon\u00e9.
@@ -101,6 +102,7 @@ IllegalUnicodeCodePoint_2         = La v
 IllegalUnitFor_2                  = L\u2019unit\u00e9 de mesure \u00ab\u202f{1}\u202f\u00bb
n\u2019est pas valide pour les valeurs de \u00ab\u202f{0}\u202f\u00bb.
 IncompatibleCoordinateSystemTypes = Types de syst\u00e8mes de coordonn\u00e9es incompatibles.
 IncompatibleDatum_2               = Le r\u00e9f\u00e9rentiel de \u00ab\u202f{1}\u202f\u00bb
doit \u00eatre \u00ab\u202f{0}\u202f\u00bb.
+IncompatibleFormat_2              = Le format \u00ab\u202f{1}\u202f\u00bb ne s\u2019applique
pas \u00e0 \u00ab\u202f{0}\u202f\u00bb.
 IncompatiblePropertyValue_1       = La valeur de la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb
n\u2019est pas compatible.
 IncompatibleUnit_1                = L\u2019unit\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019est
pas compatible avec la valeur actuelle.
 IncompatibleUnits_2               = Les unit\u00e9s \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb
ne sont pas compatibles.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
[UTF-8] Wed Mar  2 22:31:02 2016
@@ -439,7 +439,7 @@ public class IndexedResourceBundle exten
     private static Class<?> getPublicType(Class<?> c) {
         while (!Modifier.isPublic(c.getModifiers())) {
             for (final Class<?> type : c.getInterfaces()) {
-                if (Modifier.isPublic(type.getModifiers())) {
+                if (Modifier.isPublic(type.getModifiers()) && !type.getName().startsWith("java"))
{
                     return type;
                 }
             }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] Wed Mar  2 22:31:02 2016
@@ -266,6 +266,11 @@ public final class Vocabulary extends In
         public static final short Latitude = 26;
 
         /**
+         * Legend
+         */
+        public static final short Legend = 97;
+
+        /**
          * Level
          */
         public static final short Level = 94;

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] Wed Mar  2 22:31:02 2016
@@ -57,6 +57,7 @@ JavaHome                = Java home dire
 Julian                  = Julian
 Latitude                = Latitude
 Longitude               = Longitude
+Legend                  = Legend
 Level                   = Level
 Libraries               = Libraries
 LocalConfiguration      = Local configuration

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] Wed Mar  2 22:31:02 2016
@@ -64,6 +64,7 @@ JavaHome                = R\u00e9pertoir
 Julian                  = Julien
 Latitude                = Latitude
 Longitude               = Longitude
+Legend                  = L\u00e9gende
 Level                   = Niveau
 Libraries               = Biblioth\u00e8ques
 LocalConfiguration      = Configuration locale

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Wed Mar
 2 22:31:02 2016
@@ -33,6 +33,8 @@ import org.xml.sax.SAXException;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.Exceptions;
+import org.apache.sis.util.Classes;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -100,6 +102,35 @@ public strictfp class Assert extends Geo
     }
 
     /**
+     * Asserts that the two given arrays contains objects that are equal ignoring metadata.
+     * See {@link ComparisonMode#IGNORE_METADATA} for more information.
+     *
+     * @param expected  The expected objects (array can be {@code null}).
+     * @param actual    The actual objects (array can be {@code null}).
+     *
+     * @since 0.7
+     */
+    public static void assertArrayEqualsIgnoreMetadata(final Object[] expected, final Object[]
actual) {
+        if (expected != actual) {
+            if (expected == null) {
+                assertNull("Expected null array.", actual);
+            } else {
+                assertNotNull("Expected non-null array.", actual);
+                final int length = StrictMath.min(expected.length, actual.length);
+                for (int i=0; i<length; i++) try {
+                    assertEqualsIgnoreMetadata(expected[i], actual[i]);
+                } catch (AssertionError e) {
+                    final AssertionError ne = new AssertionError(Exceptions.formatChainedMessages(null,
+                            "Comparison failure at index " + i + " (a " + Classes.getShortClassName(actual[i])
+ ").", e));
+                    ne.initCause(e);
+                    throw ne;
+                }
+                assertEquals("Unexpected array length.", expected.length, actual.length);
+            }
+        }
+    }
+
+    /**
      * Asserts that two strings are equal, ignoring the differences in EOL characters.
      * The comparisons is performed one a line-by-line basis. For each line, trailing
      * spaces (but not leading spaces) are ignored.

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
[UTF-8] Wed Mar  2 22:31:02 2016
@@ -51,21 +51,12 @@ public final strictfp class EmptyWarning
      * Creates a new instance for the given locale and logger.
      *
      * @param locale The locale to be returned by {@link #getLocale()}. Can be {@code null}.
-     * @param logger The logger to be returned by {@link #getLogger()}.
+     * @param logger The name of the logger to be returned by {@link #getLogger()}.
      */
-    public EmptyWarningListeners(final Locale locale, final Logger logger) {
+    public EmptyWarningListeners(final Locale locale, final String logger) {
         ArgumentChecks.ensureNonNull("logger", logger);
         this.locale = locale;
-        this.logger = logger;
-    }
-
-    /**
-     * Convenience constructor for an instance with null locale and the logger of the given
name.
-     *
-     * @param logger The name of the logger to be returned by {@link #getLogger()}.
-     */
-    public EmptyWarningListeners(final String logger) {
-        this(null, Logging.getLogger(logger));
+        this.logger = Logging.getLogger(logger);
     }
 
     /** Returns the value given at construction time. */ @Override public Locale getLocale()
{return locale;}

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
[UTF-8] Wed Mar  2 22:31:02 2016
@@ -45,8 +45,7 @@ public abstract strictfp class TestCase
     /**
      * A dummy list of listeners which can be given to the {@link Decoder} constructor.
      */
-    public static EmptyWarningListeners<Decoder> LISTENERS =
-            new EmptyWarningListeners<Decoder>(Modules.NETCDF);
+    public static EmptyWarningListeners<Decoder> LISTENERS = new EmptyWarningListeners<Decoder>(null,
Modules.NETCDF);
 
     /**
      * The {@code searchPath} argument value to be given to the {@link Decoder#setSearchPath(String[])}

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
[UTF-8] Wed Mar  2 22:31:02 2016
@@ -16,21 +16,27 @@
  */
 package org.apache.sis.internal.storage.wkt;
 
+import java.util.List;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
 import java.io.Reader;
 import java.io.IOException;
+import java.text.ParsePosition;
+import java.text.ParseException;
 import org.opengis.metadata.Metadata;
 import org.opengis.referencing.ReferenceSystem;
-import org.opengis.util.FactoryException;
+import org.apache.sis.io.wkt.WKTFormat;
+import org.apache.sis.io.wkt.Warnings;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.CharSequences;
 import org.apache.sis.referencing.CRS;
 
-import static java.util.Collections.singleton;
-
 
 /**
  * A data store which creates data objects from a WKT definition.
@@ -53,10 +59,10 @@ final class Store extends DataStore {
     private Reader source;
 
     /**
-     * The parsed object, initialized only when first needed.
-     * May still {@code null} if the parsing failed.
+     * The parsed objects, filled only when first needed.
+     * May still be empty if the parsing failed.
      */
-    private Object object;
+    private final List<Object> objects;
 
     /**
      * The metadata object, created when first needed.
@@ -70,8 +76,9 @@ final class Store extends DataStore {
      * @throws DataStoreException If an error occurred while opening the stream.
      */
     public Store(final StorageConnector connector) throws DataStoreException {
-        name = connector.getStorageName();
-        source = connector.getStorageAs(Reader.class);
+        objects = new ArrayList<Object>();
+        name    = connector.getStorageName();
+        source  = connector.getStorageAs(Reader.class);
         connector.closeAllExcept(source);
         if (source == null) {
             throw new DataStoreException(Errors.format(Errors.Keys.CanNotOpen_1, name));
@@ -79,44 +86,72 @@ final class Store extends DataStore {
     }
 
     /**
-     * Parses the object, if not already done. Note that {@link #object} may still be null
+     * Parses the objects, if not already done. Note that {@link #objects} may still be empty
      * if an exception has been thrown at this invocation time or in previous invocation.
      *
-     * @return The metadata associated to the parsed object, or {@code null} if none.
-     * @throws DataStoreException If an error occurred during the parsing process.
+     * @throws DataStoreException if an error occurred during the parsing process.
      */
-    @Override
-    public Metadata getMetadata() throws DataStoreException {
-        if (metadata == null) {
-            final Reader in = source;
-            source = null;                      // Cleared first in case of error.
-            if (in != null) try {
+    private void parse() throws DataStoreException {
+        final Reader in = source;
+        if (in != null) try {
+            source = null;                                                  // Cleared first
in case of error.
+            final String wkt;
+            try {
                 char[] buffer = new char[StoreProvider.READ_AHEAD_LIMIT];
                 int length = 0;
-                try {
-                    int n;
-                    while ((n = in.read(buffer, length, buffer.length - length)) >= 0)
{
-                        if ((length += n) >= buffer.length) {
-                            if (n >= Integer.MAX_VALUE / 1024) {     // Arbitrary size
limit.
-                                throw new DataStoreException(Errors.format(Errors.Keys.ExcessiveStringSize));
-                            }
-                            buffer = Arrays.copyOf(buffer, n << 1);
+                int n;
+                while ((n = in.read(buffer, length, buffer.length - length)) >= 0) {
+                    if ((length += n) >= buffer.length) {
+                        if (n >= Integer.MAX_VALUE / 1024) {     // Arbitrary size limit.
+                            throw new DataStoreException(Errors.format(Errors.Keys.ExcessiveStringSize));
                         }
+                        buffer = Arrays.copyOf(buffer, n << 1);
                     }
-                } finally {
-                    in.close();
                 }
-                object = CRS.fromWKT(String.valueOf(buffer, 0, length));
-            } catch (IOException e) {
-                throw new DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, name),
e);
-            } catch (FactoryException e) {
-                throw new DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, name),
e);
+                wkt = String.valueOf(buffer, 0, length);
+            } finally {
+                in.close();
             }
-            if (object instanceof ReferenceSystem) {
-                final DefaultMetadata d = new DefaultMetadata();
-                d.setReferenceSystemInfo(singleton((ReferenceSystem) object));
-                metadata = d;
+            final ParsePosition pos = new ParsePosition(0);
+            final WKTFormat parser = new WKTFormat(null, null);
+            do {
+                objects.add(parser.parse(wkt, pos));
+                pos.setIndex(CharSequences.skipLeadingWhitespaces(wkt, pos.getIndex(), wkt.length()));
+                final Warnings warnings = parser.getWarnings();
+                if (warnings != null) {
+                    final LogRecord record = new LogRecord(Level.WARNING, warnings.toString());
+                    record.setSourceClassName(Store.class.getName());
+                    record.setSourceMethodName("getMetadata");          // Public facade
for this method.
+                    listeners.warning(record);
+                }
+            } while (pos.getIndex() < wkt.length());
+        } catch (IOException e) {                                       // Multi-catch on
the JDK7 branch.
+            throw new DataStoreException(Errors.format(Errors.Keys.CanNotParseFile_2, "WKT",
name), e);
+        } catch (ParseException e) {
+            throw new DataStoreException(Errors.format(Errors.Keys.CanNotParseFile_2, "WKT",
name), e);
+        }
+    }
+
+    /**
+     * Returns the metadata associated to the parsed objects, or {@code null} if none.
+     * The current implementation retains only instances of {@link ReferenceSystem}
+     * and ignore other cases.
+     *
+     * @return The metadata associated to the parsed object, or {@code null} if none.
+     * @throws DataStoreException if an error occurred during the parsing process.
+     */
+    @Override
+    public Metadata getMetadata() throws DataStoreException {
+        if (metadata == null) {
+            parse();
+            DefaultMetadata d = null;
+            for (final Object object : objects) {
+                if (object instanceof ReferenceSystem) {
+                    if (d == null) d = new DefaultMetadata();
+                    d.getReferenceSystemInfo().add((ReferenceSystem) object);
+                }
             }
+            metadata = d;
         }
         return metadata;
     }
@@ -130,7 +165,7 @@ final class Store extends DataStore {
     public void close() throws DataStoreException {
         final Reader s = source;
         source = null;                  // Cleared first in case of failure.
-        object = null;
+        objects.clear();
         if (s != null) try {
             s.close();
         } catch (IOException e) {

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java?rev=1733385&r1=1733384&r2=1733385&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
[UTF-8] Wed Mar  2 22:31:02 2016
@@ -81,7 +81,7 @@ final class Store extends DataStore {
      * Creates a new XML store from the given file, URL or stream.
      *
      * @param  connector Information about the storage (URL, stream, <i>etc</i>).
-     * @throws DataStoreException If an error occurred while opening the stream.
+     * @throws DataStoreException if an error occurred while opening the stream.
      */
     public Store(final StorageConnector connector) throws DataStoreException {
         name = connector.getStorageName();
@@ -139,7 +139,7 @@ final class Store extends DataStore {
      * Unmarshal the object, if not already done. Note that {@link #object} may still be
null
      * if an exception has been thrown at this invocation time or in previous invocation.
      *
-     * @throws DataStoreException If an error occurred during the unmarshalling process.
+     * @throws DataStoreException if an error occurred during the unmarshalling process.
      */
     private void unmarshal() throws DataStoreException {
         final StreamSource s = source;
@@ -164,12 +164,14 @@ final class Store extends DataStore {
      *
      * <ul>
      *   <li>If the unmarshalled object implements the {@link Metadata} interface,
then it is returned directly.</li>
+     *   <li>Otherwise if the unmarshalled object implements {@link ReferenceSystem},
then it is wrapped in the
+     *       <cite>"reference system info"</cite> property of a new {@link DefaultMetadata}
instance.</li>
      * </ul>
      *
      * Other cases may be added in any future SIS version.
      *
      * @return The metadata associated to the unmarshalled object, or {@code null} if none.
-     * @throws DataStoreException If an error occurred during the unmarshalling process.
+     * @throws DataStoreException if an error occurred during the unmarshalling process.
      */
     @Override
     public Metadata getMetadata() throws DataStoreException {
@@ -189,7 +191,7 @@ final class Store extends DataStore {
     /**
      * Closes this data store and releases any underlying resources.
      *
-     * @throws DataStoreException If an error occurred while closing this data store.
+     * @throws DataStoreException if an error occurred while closing this data store.
      */
     @Override
     public void close() throws DataStoreException {



Mime
View raw message