sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1495611 [3/3] - in /sis/trunk: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ c...
Date Fri, 21 Jun 2013 22:02:34 GMT
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1495611&r1=1495610&r2=1495611&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Fri Jun 21
22:02:32 2013
@@ -16,7 +16,10 @@
  */
 package org.apache.sis.xml;
 
+import java.util.Map;
 import java.util.Locale;
+import java.util.TimeZone;
+import java.util.logging.LogRecord; // For javadoc
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -26,6 +29,8 @@ import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.Version;
+import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.internal.jaxb.TypeRegistration;
@@ -36,15 +41,18 @@ import org.apache.sis.internal.jaxb.Type
  * This class defines also some property keys that can be given to the {@link Marshaller}
  * and {@link Unmarshaller} instances created by {@link PooledMarshaller}:
  *
- * <ul>
- *   <li>{@link #LOCALE} for specifying the locale to use for international strings
and code lists.</li>
- *   <li>{@link #TIMEZONE} for specifying the timezone to use for dates and times.</li>
- *   <li>{@link #SCHEMAS} for specifying the root URL of metadata schemas to use.</li>
- *   <li>{@link #DEFAULT_NAMESPACE} for specifying the default namespace of the XML
document to write.</li>
- *   <li>{@link #RESOLVER} for replacing {@code xlink} or {@code uuidref} attributes
by the actual object to use.</li>
- *   <li>{@link #CONVERTER} for controlling the conversion of URL, UUID, Units or similar
objects.</li>
- *   <li>{@link #STRING_SUBSTITUTES} for specifying which code lists to replace by
simpler {@code <gco:CharacterString>} elements.</li>
- * </ul>
+ * <table class="sis">
+ *   <tr><th>Key</th>                         <th>Value type</th>
               <th>Purpose</th></tr>
+ *   <tr><td>{@link #LOCALE}</td>             <td>{@link Locale}</td>
           <td>for specifying the locale to use for international strings and code lists.</td></tr>
+ *   <tr><td>{@link #TIMEZONE}</td>           <td>{@link TimeZone}</td>
         <td>for specifying the timezone to use for dates and times.</td></tr>
+ *   <tr><td>{@link #SCHEMAS}</td>            <td>{@link Map}</td>
              <td>for specifying the root URL of metadata schemas to use.</td></tr>
+ *   <tr><td>{@link #DEFAULT_NAMESPACE}</td>  <td>{@link String}</td>
           <td>for specifying the default namespace of the XML document to write.</td></tr>
+ *   <tr><td>{@link #GML_VERSION}</td>        <td>{@link Version}</td>
          <td>for specifying the GML version to the document be (un)marshalled.</td></tr>
+ *   <tr><td>{@link #RESOLVER}</td>           <td>{@link ReferenceResolver}</td>
<td>for replacing {@code xlink} or {@code uuidref} attributes by the actual object to
use.</td></tr>
+ *   <tr><td>{@link #CONVERTER}</td>          <td>{@link ValueConverter}</td>
   <td>for controlling the conversion of URL, UUID, Units or similar objects.</td></tr>
+ *   <tr><td>{@link #STRING_SUBSTITUTES}</td> <td>{@code String[]}</td>
         <td>for specifying which code lists to replace by simpler {@code <gco:CharacterString>}
elements.</td></tr>
+ *   <tr><td>{@link #WARNING_LISTENER}</td>   <td>{@link WarningListener}</td>
  <td>for being notified about non-fatal warnings.</td></tr>
+ * </table>
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -88,13 +96,13 @@ public final class XML extends Static {
      *
      * {@section Default behavior}
      * If this property is never set, then (un)marshalling will use the
-     * {@linkplain java.util.TimeZone#getDefault() default timezone}.
+     * {@linkplain TimeZone#getDefault() default timezone}.
      */
     public static final String TIMEZONE = "org.apache.sis.xml.timezone";
 
     /**
      * Specifies the root URL of schemas. The value for this property shall
-     * be an instance of {@link java.util.Map Map&lt;String,String&gt;}.
+     * be an instance of {@link Map Map&lt;String,String&gt;}.
      * This property controls the URL to be used when marshalling the following elements:
      *
      * <ul>
@@ -133,12 +141,13 @@ public final class XML extends Static {
     public static final String DEFAULT_NAMESPACE = "org.apache.sis.xml.defaultNamespace";
 
     /**
-     * Specifies the GML version to be marshalled or unmarshalled. The GML version may affect
the
-     * set of XML elements to be marshalled. Newer versions typically have more elements,
but not
-     * always. For example in {@code gml:VerticalDatum}, the {@code gml:verticalDatumType}
property
+     * Specifies the GML version of the document to be marshalled or unmarshalled.
+     * The GML version may affect the set of XML elements to be marshalled.
+     * Newer versions typically have more elements, but not always.
+     * For example in {@code gml:VerticalDatum}, the {@code gml:verticalDatumType} property
      * presents in GML 3.0 and 3.1 has been removed in GML 3.2.
      *
-     * <p>The value can be {@link String} or {@link org.apache.sis.util.Version} objects.
+     * <p>The value can be {@link String} or {@link Version} objects.
      * If no version is specified, then the most recent GML version is assumed.</p>
      */
     public static final String GML_VERSION = "org.apache.sis.gml.version";
@@ -219,9 +228,13 @@ public final class XML extends Static {
     public static final String CONVERTER = "org.apache.sis.xml.converter";
 
     /**
-     * Allows marshallers to substitute some code lists by the simpler {@code <gco:CharacterString>}
-     * element. The value for this property shall be a coma-separated list of any of the
following
-     * values: "{@code language}", "{@code country}".
+     * Allows marshallers to substitute some code lists by the simpler {@code <gco:CharacterString>}
element.
+     * The value for this property shall be a {@code String[]} array of any of the following
values:
+     *
+     * <ul>
+     *   <li>"{@code language}"</li>
+     *   <li>"{@code country}"</li>
+     * </ul>
      *
      * {@section Example}
      * INSPIRE compliant language code shall be formatted like below (formatting may vary):
@@ -247,6 +260,18 @@ public final class XML extends Static {
     public static final String STRING_SUBSTITUTES = "org.apache.sis.xml.stringSubstitutes";
 
     /**
+     * Specifies a listener to be notified when a non-fatal error occurred during the (un)marshalling.
+     * The value for this property shall be an instance of {@code WarningListener<Object>}.
+     *
+     * <p>By default, warnings that occur during the (un)marshalling process are logged.
However if a
+     * property is set for this key, then the {@link WarningListener#warningOccured(Object,
LogRecord)}
+     * method will be invoked and the warning will <em>not</em> be logged by
the (un)marshaller.</p>
+     *
+     * @see WarningListener
+     */
+    public static final String WARNING_LISTENER = "org.apache.sis.xml.warningListener";
+
+    /**
      * The pool of marshallers and unmarshallers used by this class.
      * The field name uses the uppercase convention because this field is almost constant:
      * this field is initially null, then created by {@link #getPool()} when first needed.

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1495611&r1=1495610&r2=1495611&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] Fri Jun 21 22:02:32 2013
@@ -51,6 +51,7 @@ import org.junit.BeforeClass;
     org.apache.sis.util.logging.PerformanceLevelTest.class,
     org.apache.sis.util.logging.WarningListenersTest.class,
     org.apache.sis.util.logging.MonolineFormatterTest.class,
+    org.apache.sis.util.logging.LoggerAdapterTest.class,
     org.apache.sis.math.MathFunctionsTest.class,
     org.apache.sis.math.StatisticsTest.class,
     org.apache.sis.math.StatisticsFormatTest.class,
@@ -112,8 +113,12 @@ import org.junit.BeforeClass;
     org.apache.sis.xml.NilReasonTest.class,
     org.apache.sis.xml.OGCNamespacePrefixMapperTest.class,
     org.apache.sis.xml.MarshallerPoolTest.class,
+    org.apache.sis.internal.jaxb.XmlUtilitiesTest.class,
     org.apache.sis.internal.jaxb.IdentifierMapAdapterTest.class,
-    org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCasesTest.class
+    org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCasesTest.class,
+    org.apache.sis.internal.jaxb.gco.StringAdapterTest.class,
+    org.apache.sis.internal.jaxb.gco.MeasureTest.class,
+    org.apache.sis.internal.jaxb.gco.PropertyTypeTest.class
 })
 public final strictfp class UtilityTestSuite extends TestSuite {
     /**

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=1495611&r1=1495610&r2=1495611&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] Fri Jun 21 22:02:32 2013
@@ -30,6 +30,11 @@ import org.apache.sis.util.resources.Err
  * component where the real {@link WarningListeners} instance is not yet available.</p>
  *
  * @param <S> If the listener list had a source, that would be type type of the source.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
  */
 public final strictfp class EmptyWarningListeners<S> extends WarningListeners<S>
{
     /**

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java?rev=1495611&r1=1495610&r2=1495611&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java
[UTF-8] Fri Jun 21 22:02:32 2013
@@ -53,6 +53,14 @@ public final strictfp class WarningListe
     }
 
     /**
+     * Returns the type warning sources.
+     */
+    @Override
+    public Class<String> getSourceClass() {
+        return String.class;
+    }
+
+    /**
      * Invoked when a warning occurred. The implementation in this test verifies that the
{@code source} argument has
      * the expected values, then stores the log record in the {@link #warning} field for
inspection by the test method.
      */

Modified: sis/trunk/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/nbproject/project.properties?rev=1495611&r1=1495610&r2=1495611&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/trunk/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Fri Jun 21 22:02:32
2013
@@ -52,7 +52,8 @@ jsr275.version       = 0.9.3
 vecmath.version      = 1.5.2
 georss.version       = 0.9.8
 rome.version         = 0.9
-jdom.version         = 1.0
+jdom1.version        = 1.0
+jdom2.version        = 2.0.4
 jee.version          = 6.0
 osgi.version         = 5.0.0
 netcdf.version       = 4.3.17
@@ -74,7 +75,7 @@ javac.classpath=\
     ${maven.repository}/java3d/vecmath/${vecmath.version}/vecmath-${vecmath.version}.jar:\
     ${maven.repository}/org/geonames/georss-rome/${georss.version}/georss-rome-${georss.version}.jar:\
     ${maven.repository}/rome/rome/${rome.version}/rome-${rome.version}.jar:\
-    ${maven.repository}/jdom/jdom/${jdom.version}/jdom-${jdom.version}.jar:\
+    ${maven.repository}/jdom/jdom/${jdom1.version}/jdom-${jdom1.version}.jar:\
     ${maven.repository}/javax/javaee-api/${jee.version}/javaee-api-${jee.version}.jar:\
     ${maven.repository}/edu/ucar/netcdf/${netcdf.version}/netcdf-${netcdf.version}.jar:\
     ${maven.repository}/org/osgi/org.osgi.core/${osgi.version}/org.osgi.core-${osgi.version}.jar
@@ -93,6 +94,7 @@ run.classpath=\
 run.test.classpath=\
     ${javac.test.classpath}:\
     ${build.test.classes.dir}:\
+    ${maven.repository}/org/jdom/jdom2/${jdom2.version}/jdom2-${jdom2.version}.jar:\
     ${maven.repository}/edu/ucar/udunits/${netcdf.version}/udunits-${netcdf.version}.jar:\
     ${maven.repository}/joda-time/joda-time/${joda-time.version}/joda-time-${joda-time.version}.jar:\
     ${maven.repository}/commons-httpclient/commons-httpclient/${httpclient.version}/commons-httpclient-${httpclient.version}.jar:\

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java?rev=1495611&r1=1495610&r2=1495611&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
[UTF-8] Fri Jun 21 22:02:32 2013
@@ -170,13 +170,13 @@ public final strictfp class ChannelDataI
         final Random random = TestUtilities.createRandomNumberGenerator("testSeekOnForwardOnlyChannel");
         int length = random.nextInt(2048) + 1024;
         final byte[] array = createRandomArray(length, random);
-        length -= (Long.SIZE / Byte.SIZE) - 1; // Safety against buffer underflow.
+        length -= (Long.SIZE / Byte.SIZE); // Safety against buffer underflow.
         final ByteBuffer buffer = ByteBuffer.wrap(array);
         final ChannelDataInput input = new ChannelDataInput("testSeekOnForwardOnlyChannel",
                 Channels.newChannel(new ByteArrayInputStream(array)),
                 ByteBuffer.allocate(random.nextInt(64) + 16), false);
         int position = 0;
-        while (position <= length) {
+        while (position < length) {
             input.seek(position);
             assertEquals("getStreamPosition()", position, input.getStreamPosition());
             assertEquals(buffer.getLong(position), input.readLong());



Mime
View raw message