sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1495607 [1/2] - in /sis/branches/JDK6: ./ 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/met...
Date Fri, 21 Jun 2013 21:39:38 GMT
Author: desruisseaux
Date: Fri Jun 21 21:39:36 2013
New Revision: 1495607

URL: http://svn.apache.org/r1495607
Log:
Merge from the JDK7 branch.

Added:
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
      - copied, changed from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/direct/
      - copied from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/direct/
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java
      - copied, changed from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java
      - copied, changed from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/AbstractMetadataTest.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/AbstractMetadataTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/XmlUtilities.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/XmlUtilities.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/DateAsLongAdapter.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/DateAsLongAdapter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Distance.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Distance.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/GO_URL.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/GO_URL.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/XmlUtilitiesTest.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/XmlUtilitiesTest.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/
      - copied from r1495602, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/logging/DummyLogger.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/logging/DummyLogger.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/logging/LoggerAdapterTest.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/logging/LoggerAdapterTest.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/xml/ReferenceResolverMock.java
      - copied unchanged from r1495602, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ReferenceResolverMock.java
Modified:
    sis/branches/JDK6/   (props changed)
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatform.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatformPass.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultRequirement.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringConverter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/io/IO.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeMock.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java
    sis/branches/JDK6/ide-project/NetBeans/nbproject/project.properties
    sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java

Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK7:r1493761-1495602

Copied: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java (from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java?p2=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java&p1=sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java&r1=1495602&r2=1495607&rev=1495607&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -132,7 +132,7 @@ public final class PT_Locale extends Xml
             final String encoding;
             try {
                 encoding = (String) marshaller.getProperty(Marshaller.JAXB_ENCODING);
-            } catch (PropertyException | ClassCastException e) {
+            } catch (Exception e) { // (PropertyException | ClassCastException) on the JDK7 branch.
                 // Should never happen. But if it happen anyway, just let the
                 // characterEncoding unitialized: it will not be marshalled.
                 Context.warningOccured(Context.current(), marshaller, PT_Locale.class, "beforeMarshal", e, true);

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -50,9 +50,11 @@ public class RS_ReferenceSystem extends 
     }
 
     /**
-     * Constructor for the {@link #wrap} method only.
+     * Wraps a Reference System value in a {@code MD_ReferenceSystem} element at marshalling-time.
+     *
+     * @param metadata The metadata value to marshal.
      */
-    RS_ReferenceSystem(final ReferenceSystem metadata) {
+    protected RS_ReferenceSystem(final ReferenceSystem metadata) {
         super(metadata);
     }
 

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -314,13 +314,15 @@ public abstract class AbstractMetadata i
 
     /**
      * Computes a hash code value for this metadata using Java reflection. The hash code
-     * is defined as the sum of hash code values of all non-empty properties. This is a
-     * similar contract than {@link java.util.Set#hashCode()} and ensures that the hash code
-     * value is insensitive to the ordering of properties.
+     * is defined as the sum of hash code values of all non-empty properties, excluding
+     * cyclic dependencies. For acyclic metadata, this method contract is compatible with
+     * the {@link java.util.Set#hashCode()} one and ensures that the hash code value is
+     * insensitive to the ordering of properties.
      *
      * {@note This method does not cache the value because current implementation has no notification
      *        mechanism for tracking changes in children properties. If this metadata is known to be
-     *        immutable, then subclasses may consider caching the hash code value at their choice.}
+     *        immutable, then subclasses may consider caching the hash code value if performance is
+     *        important.}
      *
      * @see MetadataStandard#hashCode(Object)
      */

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -434,7 +434,7 @@ public class MetadataStandard implements
      * @param  type The interface, typically from the {@code org.opengis.metadata} package.
      * @return The implementation class, or {@code null} if none.
      */
-    protected Class<?> getImplementation(final Class<?> type) {
+    public Class<?> getImplementation(final Class<?> type) {
         return null;
     }
 
@@ -746,7 +746,25 @@ public class MetadataStandard implements
         if (accessor.type != findInterface(metadata2.getClass())) {
             return false;
         }
-        return accessor.equals(metadata1, metadata2, mode);
+        /*
+         * At this point, we have to perform the actual property-by-property comparison.
+         * Cycle may exist in metadata tree, so we have to keep trace of pair in process
+         * of being compared for avoiding infinite recursivity.
+         */
+        final ObjectPair pair = new ObjectPair(metadata1, metadata2);
+        final Set<ObjectPair> inProgress = ObjectPair.CURRENT.get();
+        if (inProgress.add(pair)) try {
+            return accessor.equals(metadata1, metadata2, mode);
+        } finally {
+            inProgress.remove(pair);
+        } else {
+            /*
+             * If we get here, a cycle has been found. Returns 'true' in order to allow the caller to continue
+             * comparing other properties. It is okay because someone else is comparing those two same objects,
+             * and that later comparison will do the actual check for property values.
+             */
+            return true;
+        }
     }
 
     /**
@@ -756,14 +774,28 @@ public class MetadataStandard implements
      * and ensures that the hash code value is insensitive to the ordering of properties.
      *
      * @param  metadata The metadata object to compute hash code.
-     * @return A hash code value for the specified metadata.
+     * @return A hash code value for the specified metadata, or 0 if the given metadata is null.
      * @throws ClassCastException if the metadata object doesn't implement a metadata
      *         interface of the expected package.
      *
      * @see AbstractMetadata#hashCode()
      */
     public int hashCode(final Object metadata) throws ClassCastException {
-        return getAccessor(metadata.getClass(), true).hashCode(metadata);
+        if (metadata != null) {
+            final Map<Object,Object> inProgress = RecursivityGuard.HASH_CODES.get();
+            if (inProgress.put(metadata, Boolean.TRUE) == null) try {
+                return getAccessor(metadata.getClass(), true).hashCode(metadata);
+            } finally {
+                inProgress.remove(metadata);
+            }
+            /*
+             * If we get there, a cycle has been found. We can not compute a hash code value for that metadata.
+             * However it should not be a problem since this metadata is part of a bigger metadata object, and
+             * that enclosing object has other properties for computing its hash code. We just need the result
+             * to be consistent, we should be the case if properties ordering is always the same.
+             */
+        }
+        return 0;
     }
 
     /**

Copied: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java (from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java?p2=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java&p1=sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java&r1=1495602&r2=1495607&rev=1495607&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/ObjectPair.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -39,7 +39,7 @@ final class ObjectPair {
      */
     static final ThreadLocal<Set<ObjectPair>> CURRENT = new ThreadLocal<Set<ObjectPair>>() {
         @Override protected Set<ObjectPair> initialValue() {
-            return new HashSet<>();
+            return new HashSet<ObjectPair>();
         }
     };
 

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -19,7 +19,6 @@ package org.apache.sis.metadata;
 import java.util.Map;
 import java.util.Iterator;
 import java.util.Collection;
-import java.util.IdentityHashMap;
 import org.opengis.util.CodeList;
 import org.apache.sis.internal.util.CollectionsExt;
 
@@ -27,19 +26,25 @@ import static org.apache.sis.metadata.Va
 
 
 /**
- * Implementation of {@link AbstractMetadata#isEmpty()} and {@link ModifiableMetadata#prune()}
- * methods.
+ * Implementation of {@link AbstractMetadata#isEmpty()} and {@link ModifiableMetadata#prune()} methods.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.20)
  * @version 0.3
  * @module
  */
-final class Pruner extends ThreadLocal<Map<Object,Boolean>> {
+final class Pruner {
     /**
-     * The thread-local map of metadata object already tested.
+     * The thread-local map of metadata objects already tested. The keys are metadata instances, and values
+     * are the results of the {@code metadata.isEmpty()} operation.
+     *
+     * If the final operation requested by the user is {@code isEmpty()}, then this map will contain at most
+     * one {@code false} value since the walk in the tree will stop at the first {@code false} value found.
+     *
+     * If the final operation requested by the user is {@code prune()}, then this map will contain a mix of
+     * {@code false} and {@code true} values since the operation will unconditionally walk through the entire tree.
      */
-    private static final Pruner INSTANCE = new Pruner();
+    private static final RecursivityGuard<Boolean> MAPS = new RecursivityGuard<Boolean>();
 
     /**
      * For internal usage only.
@@ -48,15 +53,6 @@ final class Pruner extends ThreadLocal<M
     }
 
     /**
-     * Creates an initially empty hash map when the {@code isEmpty()} or {@code prune()}
-     * method is invoked, before any recursive invocation.
-     */
-    @Override
-    protected Map<Object,Boolean> initialValue() {
-        return new IdentityHashMap<Object,Boolean>();
-    }
-
-    /**
      * Returns the metadata properties. When used for pruning empty values, the map needs to
      * include empty (but non-null) values in order to allow us to set them to {@code null}.
      */
@@ -87,14 +83,19 @@ final class Pruner extends ThreadLocal<M
      */
     static boolean isEmpty(final AbstractMetadata metadata, final boolean prune) {
         final Map<String,Object> properties = asMap(metadata.getStandard(), metadata, prune);
-        final Map<Object,Boolean> tested = INSTANCE.get();
+        final Map<Object,Boolean> tested = MAPS.get();
         if (!tested.isEmpty()) {
             return isEmpty(properties, tested, prune);
         } else try {
             tested.put(metadata, Boolean.FALSE);
             return isEmpty(properties, tested, prune);
         } finally {
-            INSTANCE.remove();
+            MAPS.remove();
+            /*
+             * Note: we could invoke 'tested.clear()' instead in order to recycle the existing
+             *       IdentityHashMap instance, but we presume that usage of this class will be
+             *       rare enough for not being worth to keep those objects around.
+             */
         }
     }
 

Copied: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java (from r1495602, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java?p2=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java&p1=sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java&r1=1495602&r2=1495607&rev=1495607&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/RecursivityGuard.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -50,7 +50,7 @@ final class RecursivityGuard<V> extends 
      * The recursivity guard to use during {@code hashCode()} computations.
      * The values have no meaning for this map; only the keys matter.
      */
-    static final RecursivityGuard<Object> HASH_CODES = new RecursivityGuard<>();
+    static final RecursivityGuard<Object> HASH_CODES = new RecursivityGuard<Object>();
 
     /**
      * Creates a new thread-local map.
@@ -63,6 +63,6 @@ final class RecursivityGuard<V> extends 
      */
     @Override
     protected Map<Object,V> initialValue() {
-        return new IdentityHashMap<>();
+        return new IdentityHashMap<Object,V>();
     }
 }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -99,7 +99,7 @@ final class StandardImplementation exten
      * @return The implementation class, or {@code null} if none.
      */
     @Override
-    protected Class<?> getImplementation(final Class<?> type) {
+    public Class<?> getImplementation(final Class<?> type) {
         /*
          * We require the type to be an interface in order to exclude
          * CodeLists, Enums and Exceptions.

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeTableView.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -33,7 +33,7 @@ import org.apache.sis.internal.system.Lo
 
 /**
  * A tree table view over a metadata object.
- * The tree table is made of three columns:
+ * The tree table is made of the following columns:
  *
  * <ul>
  *   <li>{@link TableColumn#IDENTIFIER} - the property identifier as defined by the UML (if any).</li>

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -41,7 +41,7 @@ import org.opengis.metadata.maintenance.
 import org.opengis.metadata.quality.DataQuality;
 import org.opengis.metadata.spatial.SpatialRepresentation;
 import org.opengis.referencing.ReferenceSystem;
-//import org.apache.sis.internal.jaxb.gmd.PT_Locale; // TODO
+import org.apache.sis.internal.jaxb.code.PT_Locale;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.xml.Namespaces;
 
@@ -362,7 +362,7 @@ public class DefaultMetadata extends ISO
      */
     @Override
     @XmlElement(name = "locale")
-//    @XmlJavaTypeAdapter(PT_Locale.class) // TODO
+    @XmlJavaTypeAdapter(PT_Locale.class)
     public Collection<Locale> getLocales() {
         return locales = nonNullCollection(locales, Locale.class);
     }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -104,20 +104,24 @@ public class ISOMetadata extends Modifia
     /**
      * {@inheritDoc}
      *
-     * <p>The default implementation returns a wrapper around the list returned by {@link #getIdentifiers()}.
+     * <p>The default implementation returns a wrapper around the {@link #identifiers} list.
      * That map is <cite>live</cite>: changes in the identifiers list will be reflected in the map,
      * and conversely.</p>
      */
     @Override
     public IdentifierMap getIdentifierMap() {
         /*
-         * We do not cache (for now) the IdentifierMap because it is cheap to create, and if were
-         * caching it we would need anyway to check if 'identifiers' still references the same list.
+         * Do not invoke getIdentifiers(), because some subclasses like DefaultCitation and
+         * DefaultObjective override getIdentifiers() in order to return a filtered list.
          */
-        final Collection<Identifier> identifiers = getIdentifiers();
+        identifiers = nonNullCollection(identifiers, Identifier.class);
         if (identifiers == null) {
             return IdentifierMapWithSpecialCases.EMPTY;
         }
+        /*
+         * We do not cache (for now) the IdentifierMap because it is cheap to create, and if were
+         * caching it we would need anyway to check if 'identifiers' still references the same list.
+         */
         return new IdentifierMapWithSpecialCases(identifiers);
     }
 }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -115,7 +115,7 @@ public class DefaultEvent extends ISOMet
      */
     public DefaultEvent(final Event object) {
         super(object);
-        identifiers        = singleton(object.getIdentifier(), Identifier.class); // TODO
+        identifiers        = singleton(object.getIdentifier(), Identifier.class);
         trigger            = object.getTrigger();
         context            = object.getContext();
         sequence           = object.getSequence();

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -133,7 +133,7 @@ public class DefaultOperation extends IS
         super(object);
         description       = object.getDescription();
         citation          = object.getCitation();
-        identifiers       = singleton(object.getIdentifier(), Identifier.class); // TODO
+        identifiers       = singleton(object.getIdentifier(), Identifier.class);
         status            = object.getStatus();
         type              = object.getType();
         childOperations   = copyCollection(object.getChildOperations(), Operation.class);

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatform.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatform.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatform.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -91,7 +91,7 @@ public class DefaultPlatform extends ISO
     public DefaultPlatform(final Platform object) {
         super(object);
         citation    = object.getCitation();
-        identifiers = singleton(object.getIdentifier(), Identifier.class); // TODO
+        identifiers = singleton(object.getIdentifier(), Identifier.class);
         description = object.getDescription();
         sponsors    = copyCollection(object.getSponsors(), ResponsibleParty.class);
         instruments = copyCollection(object.getInstruments(), Instrument.class);

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatformPass.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatformPass.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatformPass.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultPlatformPass.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -76,7 +76,7 @@ public class DefaultPlatformPass extends
      */
     public DefaultPlatformPass(final PlatformPass object) {
         super(object);
-        identifiers   = singleton(object.getIdentifier(), Identifier.class); // TODO
+        identifiers   = singleton(object.getIdentifier(), Identifier.class);
         extent        = object.getExtent();
         relatedEvents = copyCollection(object.getRelatedEvents(), Event.class);
     }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultRequirement.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultRequirement.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultRequirement.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultRequirement.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -116,7 +116,7 @@ public class DefaultRequirement extends 
     public DefaultRequirement(final Requirement object) {
         super(object);
         citation       = object.getCitation();
-        identifiers    = singleton(object.getIdentifier(), Identifier.class); // TODO
+        identifiers    = singleton(object.getIdentifier(), Identifier.class);
         requestors     = copyCollection(object.getRequestors(), ResponsibleParty.class);
         recipients     = copyCollection(object.getRecipients(), ResponsibleParty.class);
         priority       = object.getPriority();

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -122,7 +122,7 @@
     @XmlJavaTypeAdapter(MI_TriggerCode.class),
 
     // Java types, primitive types and basic OGC types handling
-//  @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(StringAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class)
 })

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -33,6 +33,7 @@ import org.apache.sis.util.iso.SimpleInt
 import org.apache.sis.internal.jaxb.NonMarshalledAuthority;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.xml.IdentifierSpace;
+import org.apache.sis.xml.IdentifierMap;
 
 import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 import static org.apache.sis.internal.metadata.MetadataUtilities.toDate;
@@ -221,8 +222,13 @@ public class DefaultCitation extends ISO
         series                  = object.getSeries();
         otherCitationDetails    = object.getOtherCitationDetails();
         collectiveTitle         = object.getCollectiveTitle();
-// TODO ISBN                    = object.getISBN();
-// TODO ISSN                    = object.getISSN();
+        final String id1        = object.getISBN();
+        final String id2        = object.getISSN();
+        if (id1 != null || id2 != null) {
+            final IdentifierMap map = super.getIdentifierMap();
+            if (id1 != null) map.putSpecialized(ISBN, id1);
+            if (id2 != null) map.putSpecialized(ISSN, id2);
+        }
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -111,8 +111,8 @@
     @XmlJavaTypeAdapter(MD_Identifier.class),
 
     // Java types, primitive types and basic OGC types handling
-//    @XmlJavaTypeAdapter(GO_URL.class), // TODO
-//    @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(GO_URL.class),
+    @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(StringAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class)
 })

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -106,7 +106,7 @@
     @XmlJavaTypeAdapter(MI_TransferFunctionTypeCode.class),
 
     // Java types, primitive types and basic OGC types handling
-//  @XmlJavaTypeAdapter(UnitAdapter.class), // TODO
+    @XmlJavaTypeAdapter(UnitAdapter.class),
     @XmlJavaTypeAdapter(LocaleAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class),
     @XmlJavaTypeAdapter(GO_GenericName.class),

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -91,10 +91,10 @@
     @XmlJavaTypeAdapter(MD_StandardOrderProcess.class),
 
     // Java types, primitive types and basic OGC types handling
-//  @XmlJavaTypeAdapter(UnitAdapter.class), // TODO
+    @XmlJavaTypeAdapter(UnitAdapter.class),
     @XmlJavaTypeAdapter(LocalNameAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class),
-//  @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(GO_Decimal.class), @XmlJavaTypeAdapter(type=double.class, value=GO_Decimal.class),
     @XmlJavaTypeAdapter(GO_Integer.class), @XmlJavaTypeAdapter(type=int.class,    value=GO_Integer.class)
 })

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -22,11 +22,11 @@ import javax.xml.bind.annotation.XmlRoot
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.metadata.identification.RepresentativeFraction;
 import org.opengis.metadata.identification.Resolution;
-// import org.apache.sis.internal.jaxb.gco.GO_Distance; // TODO
+import org.apache.sis.internal.jaxb.gco.GO_Distance;
+import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.measure.ValueRange;
 import org.apache.sis.util.resources.Messages;
-import org.apache.sis.internal.metadata.MetadataUtilities;
 
 
 /**
@@ -46,10 +46,7 @@ import org.apache.sis.internal.metadata.
  * @version 0.3
  * @module
  */
-@XmlType(name = "MD_Resolution_Type", propOrder = {
-    "equivalentScale",
-// TODO    "distance"
-})
+@XmlType(name = "MD_Resolution_Type") // No need for propOrder since this structure is a union (see javadoc).
 @XmlRootElement(name = "MD_Resolution")
 public class DefaultResolution extends ISOMetadata implements Resolution {
     /**
@@ -169,8 +166,8 @@ public class DefaultResolution extends I
      */
     @Override
     @ValueRange(minimum=0, isMinIncluded=false)
-//    @XmlJavaTypeAdapter(GO_Distance.class) // TODO
-//    @XmlElement(name = "distance")
+    @XmlJavaTypeAdapter(GO_Distance.class)
+    @XmlElement(name = "distance")
     public Double getDistance() {
         return isDistance() ? (Double) scaleOrDistance : null;
     }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -122,7 +122,7 @@
     @XmlJavaTypeAdapter(LocaleAdapter.class),
     @XmlJavaTypeAdapter(StringAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class),
-//  @XmlJavaTypeAdapter(GO_DateTime.class), TODO
+    @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(GO_Decimal.class),        @XmlJavaTypeAdapter(type=double.class, value=GO_Decimal.class),
     @XmlJavaTypeAdapter(GO_Integer.AsLong.class), @XmlJavaTypeAdapter(type=long.class,   value=GO_Integer.AsLong.class)
 })

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -99,7 +99,7 @@ public class DefaultProcessing extends I
      */
     public DefaultProcessing(final Processing object) {
         super(object);
-        identifiers          = singleton(object.getIdentifier(), Identifier.class); // TODO
+        identifiers          = singleton(object.getIdentifier(), Identifier.class);
         softwareReferences   = copyCollection(object.getSoftwareReferences(), Citation.class);
         procedureDescription = object.getProcedureDescription();
         documentations       = copyCollection(object.getDocumentations(), Citation.class);

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -89,7 +89,7 @@
     @XmlJavaTypeAdapter(MD_RepresentativeFraction.class),
 
     // Java types, primitive types and basic OGC types handling
-//    @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class)
 })
 package org.apache.sis.metadata.iso.lineage;

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -48,7 +48,7 @@ import static org.apache.sis.internal.me
 @XmlType(name = "MD_MaintenanceInformation_Type", propOrder = {
     "maintenanceAndUpdateFrequency",
     "dateOfNextUpdate",
-// TODO    "userDefinedMaintenanceFrequency",
+    "userDefinedMaintenanceFrequency",
     "updateScopes",
     "updateScopeDescriptions",
     "maintenanceNotes",
@@ -205,11 +205,9 @@ public class DefaultMaintenanceInformati
 
     /**
      * Returns the maintenance period other than those defined.
-     *
-     * @todo needs an implementation of org.opengis.temporal modules to anntote this parameter.
      */
     @Override
-    // TODO @XmlElement(name = "userDefinedMaintenanceFrequency")
+    @XmlElement(name = "userDefinedMaintenanceFrequency")
     public PeriodDuration getUserDefinedMaintenanceFrequency() {
         return userDefinedMaintenanceFrequency;
     }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -48,10 +48,7 @@ import static org.apache.sis.util.collec
  * @version 0.3
  * @module
  */
-@XmlType(name = "MD_ScopeDescription_Type", propOrder = {
-    "dataset",
-    "other"
-})
+@XmlType(name = "MD_ScopeDescription_Type") // No need for propOrder since this structure is a union (see javadoc).
 @XmlRootElement(name = "MD_ScopeDescription")
 public class DefaultScopeDescription extends ISOMetadata implements ScopeDescription {
     /**

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -75,10 +75,10 @@
     @XmlJavaTypeAdapter(MD_MaintenanceInformation.class),
     @XmlJavaTypeAdapter(MD_ScopeCode.class),
     @XmlJavaTypeAdapter(MD_ScopeDescription.class),
-//    @XmlJavaTypeAdapter(TM_PeriodDuration.class), // TODO
+    @XmlJavaTypeAdapter(TM_PeriodDuration.class),
 
     // Java types, primitive types and basic OGC types handling
-//    @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(StringAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class)
 })
@@ -95,5 +95,5 @@ import javax.xml.bind.annotation.adapter
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.gco.*;
 import org.apache.sis.internal.jaxb.code.*;
-//import org.apache.sis.internal.jaxb.gts.TM_PeriodDuration; // TODO
+import org.apache.sis.internal.jaxb.gts.TM_PeriodDuration;
 import org.apache.sis.internal.jaxb.metadata.*;

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -118,7 +118,7 @@
     @XmlJavaTypeAdapter(LocaleAdapter.class),
     @XmlJavaTypeAdapter(StringAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class),
-//    @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(GO_Boolean.class), @XmlJavaTypeAdapter(type=boolean.class, value=GO_Boolean.class),
     @XmlJavaTypeAdapter(GO_Integer.class), @XmlJavaTypeAdapter(type=int.class,     value=GO_Integer.class)
 })

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -139,10 +139,10 @@
     @XmlJavaTypeAdapter(MX_DataFile.class),
 
     // Java types, primitive types and basic OGC types handling
-//    @XmlJavaTypeAdapter(UnitAdapter.class), // TODO
+    @XmlJavaTypeAdapter(UnitAdapter.class),
     @XmlJavaTypeAdapter(StringAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringAdapter.class),
-//    @XmlJavaTypeAdapter(GO_DateTime.class), // TODO
+    @XmlJavaTypeAdapter(GO_DateTime.class),
 //    @XmlJavaTypeAdapter(GO_RecordType.class), // TODO
     @XmlJavaTypeAdapter(GO_Boolean.class), @XmlJavaTypeAdapter(type=boolean.class, value=GO_Boolean.class)
 })

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultDimension.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -22,8 +22,8 @@ import javax.xml.bind.annotation.XmlRoot
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.metadata.spatial.Dimension;
 import org.opengis.metadata.spatial.DimensionNameType;
+import org.apache.sis.internal.jaxb.gco.GO_Measure;
 import org.apache.sis.metadata.iso.ISOMetadata;
-//import org.apache.sis.internal.jaxb.gco.GO_Measure;
 import org.apache.sis.measure.ValueRange;
 
 
@@ -166,7 +166,7 @@ public class DefaultDimension extends IS
      */
     @Override
     @ValueRange(minimum=0, isMinIncluded=false)
-//  @XmlJavaTypeAdapter(GO_Measure.class) // TODO
+    @XmlJavaTypeAdapter(GO_Measure.class)
     @XmlElement(name = "resolution")
     public Double getResolution() {
         return resolution;

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -26,6 +26,8 @@ import org.opengis.metadata.quality.Comp
 import org.opengis.coverage.grid.RectifiedGrid;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.acquisition.DefaultPlatform;
+import org.apache.sis.metadata.iso.acquisition.DefaultInstrument;
 import org.apache.sis.metadata.iso.quality.AbstractCompleteness;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.ComparisonMode;
@@ -35,6 +37,7 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
 
 
 /**
@@ -111,6 +114,36 @@ public final strictfp class MetadataStan
     }
 
     /**
+     * Creates a metadata object having a cyclic association. The cycle is between
+     * {@code platform.instrument} and {@code instrument.isMountedOn}.
+     */
+    static DefaultPlatform createCyclicMetadata() {
+        final DefaultInstrument instrument = new DefaultInstrument();
+        instrument.setType(new SimpleInternationalString("An instrument type."));
+        final DefaultPlatform platform = new DefaultPlatform();
+        platform.setDescription(new SimpleInternationalString("A platform."));
+        instrument.setMountedOn(platform);
+        platform.getInstruments().add(instrument);
+        return platform;
+    }
+
+    /**
+     * Tests the {@link MetadataStandard#equals(Object, Object, ComparisonMode)} method on an object
+     * having cyclic associations. In absence of safety guard against infinite recursivity, this test
+     * would produce {@link StackOverflowError}.
+     */
+    @Test
+    @DependsOnMethod("testEquals")
+    public void testEqualsOnCyclicMetadata() {
+        final DefaultPlatform p1 = createCyclicMetadata();
+        final DefaultPlatform p2 = createCyclicMetadata();
+        assertTrue(p1.equals(p2));
+        ((DefaultInstrument) getSingleton(p2.getInstruments()))
+                .setType(new SimpleInternationalString("An other instrument type."));
+        assertFalse(p1.equals(p2));
+    }
+
+    /**
      * Tests the {@link MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)} implementation.
      * This test duplicates {@link ValueMapTest}, but is done here again as an integration test and because many
      * {@code MetadataStandard} methods depend on it ({@code equals}, {@code hashCode}, {@code prune}, <i>etc.</i>).
@@ -166,6 +199,24 @@ public final strictfp class MetadataStan
     }
 
     /**
+     * Tests the {@link MetadataStandard#hashCode(Object)} method on an object having cyclic associations.
+     * In absence of safety guard against infinite recursivity, this test would produce {@link StackOverflowError}.
+     *
+     * @see AbstractMetadataTest#testHashCodeOnCyclicMetadata()
+     */
+    @Test
+    @DependsOnMethod("testHashCode")
+    public void testHashCodeOnCyclicMetadata() {
+        final MetadataStandard std = MetadataStandard.ISO_19115;
+        final int code = std.hashCode(createCyclicMetadata());
+        /*
+         * Following line checks that the hash code is stable, just for doing something with the code.
+         * The real test was actually to ensure that the above line didn't threw a StackOverflowError.
+         */
+        assertEquals(code, std.hashCode(createCyclicMetadata()));
+    }
+
+    /**
      * Tests the {@link MetadataStandard#ISO_19123} constant. Getters shall
      * be accessible even if there is no implementation on the classpath.
      */

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -21,6 +21,8 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.metadata.iso.extent.DefaultExtent;
 import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
 import org.apache.sis.metadata.iso.identification.DefaultDataIdentification;
+import org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation;
+import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -116,9 +118,32 @@ public final strictfp class PrunerTest e
     }
 
     /**
+     * Adds to the {@link #metadata} an object having a cyclic association.
+     * The cycle is between {@code platform.instrument} and {@code instrument.isMountedOn}.
+     */
+    private void createCyclicMetadata() {
+        final DefaultAcquisitionInformation acquisition = new DefaultAcquisitionInformation();
+        acquisition.getPlatforms().add(MetadataStandardTest.createCyclicMetadata());
+        metadata.getAcquisitionInformation().add(acquisition);
+    }
+
+    /**
+     * Tests the {@link AbstractMetadata#isEmpty()} method on a metadata object having a cycle association.
+     * In absence of safety guard against infinite recursivity, this test would produce {@link StackOverflowError}.
+     */
+    @Test
+    @DependsOnMethod("testIsEmpty")
+    public void testIsEmptyOnCyclicMetadata() {
+        assertTrue(metadata.isEmpty());
+        createCyclicMetadata();
+        assertFalse(metadata.isEmpty());
+    }
+
+    /**
      * Tests the {@link ModifiableMetadata#prune()} method.
      */
     @Test
+    @DependsOnMethod("testIsEmpty")
     public void testPrune() {
         metadata.setFileIdentifier("A file identifiers");
         identification.setCitation(new DefaultCitation("A citation title"));
@@ -149,4 +174,19 @@ public final strictfp class PrunerTest e
         assertTrue(extent.getGeographicElements().isEmpty());
         assertTrue(metadata.isEmpty());
     }
+
+    /**
+     * Tests the {@link AbstractMetadata#prune()} method on a metadata object having a cycle association.
+     * In absence of safety guard against infinite recursivity, this test would produce {@link StackOverflowError}.
+     */
+    @Test
+    @DependsOnMethod({"testPrune", "testIsEmptyOnCyclicMetadata"})
+    public void testPruneOnCyclicMetadata() {
+        createCyclicMetadata();
+        assertEquals(1, metadata.getIdentificationInfo()    .size());
+        assertEquals(1, metadata.getAcquisitionInformation().size());
+        metadata.prune();
+        assertEquals(0, metadata.getIdentificationInfo()    .size());
+        assertEquals(1, metadata.getAcquisitionInformation().size());
+    }
 }

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -74,10 +74,10 @@ public final strictfp class ValueMapTest
      *
      * {@preformat text
      *     Citation
-     *     ├───Title…………………………………………………… Undercurrent
-     *     ├───Cited Responsible Parties
-     *     │   └───Individual Name……………… Testsuya Toyoda
-     *     └───ISBN……………………………………………………… 9782505004509
+     *       ├─Title…………………………………………………… Undercurrent
+     *       ├─Cited Responsible Parties
+     *       │   └─Individual Name……………… Testsuya Toyoda
+     *       └─ISBN……………………………………………………… 9782505004509
      * }
      *
      * The citation instance is stored in the {@link #citation} field.
@@ -120,11 +120,11 @@ public final strictfp class ValueMapTest
      *
      * {@preformat text
      *     Citation
-     *     ├───Title…………………………………………………… Undercurrent
-     *     ├───Identifiers…………………………………… 9782505004509
-     *     ├───Cited Responsible Parties
-     *     │   └───Individual Name……………… Testsuya Toyoda
-     *     └───ISBN……………………………………………………… 9782505004509
+     *       ├─Title…………………………………………………… Undercurrent
+     *       ├─Identifiers…………………………………… 9782505004509
+     *       ├─Cited Responsible Parties
+     *       │   └─Individual Name……………… Testsuya Toyoda
+     *       └─ISBN……………………………………………………… 9782505004509
      * }
      *
      * Note that this test is intentionally sensitive to iteration order.
@@ -212,9 +212,9 @@ public final strictfp class ValueMapTest
          * Remove the ISBN value. Result shall be:
          *
          * Citation
-         * ├───Title…………………………………………………… Undercurrent
-         * └───Cited Responsible Parties
-         *     └───Individual Name……………… Testsuya Toyoda
+         *   ├─Title…………………………………………………… Undercurrent
+         *   └─Cited Responsible Parties
+         *       └─Individual Name……………… Testsuya Toyoda
          */
         assertEquals("9782505004509", map.remove("ISBN"));
         assertNull("ISBN shall have been removed.", citation.getISBN());
@@ -227,10 +227,10 @@ public final strictfp class ValueMapTest
          * Add a value. Result shall be:
          *
          * Citation
-         * ├───Title…………………………………………………… Undercurrent
-         * ├───Cited Responsible Parties
-         * │   └───Individual Name……………… Testsuya Toyoda
-         * └───Presentation Forms………………… document hardcopy
+         *   ├─Title…………………………………………………… Undercurrent
+         *   ├─Cited Responsible Parties
+         *   │   └─Individual Name……………… Testsuya Toyoda
+         *   └─Presentation Forms………………… document hardcopy
          */
         assertNull(map.put("presentationForm", DOCUMENT_HARDCOPY));
         assertEquals(DOCUMENT_HARDCOPY, getSingleton(citation.getPresentationForms()));
@@ -243,12 +243,12 @@ public final strictfp class ValueMapTest
          * Add back the ISBN value. Result shall be:
          *
          * Citation
-         * ├───Title…………………………………………………… Undercurrent
-         * ├───Identifiers…………………………………… 9782505004509
-         * ├───Cited Responsible Parties
-         * │   └───Individual Name……………… Testsuya Toyoda
-         * ├───Presentation Forms………………… document hardcopy
-         * └───ISBN……………………………………………………… 9782505004509
+         *   ├─Title…………………………………………………… Undercurrent
+         *   ├─Identifiers…………………………………… 9782505004509
+         *   ├─Cited Responsible Parties
+         *   │   └─Individual Name……………… Testsuya Toyoda
+         *   ├─Presentation Forms………………… document hardcopy
+         *   └─ISBN……………………………………………………… 9782505004509
          */
         assertNull(map.put("ISBN", "9782505004509"));
         assertEquals("9782505004509", citation.getISBN());

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -49,8 +49,10 @@ import org.junit.BeforeClass;
     org.apache.sis.metadata.TreeNodeChildrenTest.class,
     org.apache.sis.metadata.TreeNodeTest.class,
     org.apache.sis.metadata.TreeTableViewTest.class,
+    org.apache.sis.metadata.TreeTableFormatTest.class,
     org.apache.sis.metadata.MetadataStandardTest.class,
     org.apache.sis.metadata.PrunerTest.class,
+    org.apache.sis.metadata.AbstractMetadataTest.class,
     org.apache.sis.metadata.iso.AllMetadataTest.class
 })
 public final strictfp class MetadataTestSuite extends TestSuite {

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1495607&r1=1495606&r2=1495607&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] Fri Jun 21 21:39:36 2013
@@ -19,7 +19,12 @@ package org.apache.sis.internal.jaxb;
 import java.util.Map;
 import java.util.Locale;
 import java.util.TimeZone;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
 import org.apache.sis.util.Version;
+import org.apache.sis.util.Exceptions;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.xml.MarshalContext;
 import org.apache.sis.xml.ValueConverter;
 import org.apache.sis.xml.ReferenceResolver;
@@ -70,20 +75,20 @@ public final class Context extends Marsh
     private static final ThreadLocal<Context> CURRENT = new ThreadLocal<Context>();
 
     /**
-     * The value converter currently in use, or {@code null} for {@link ValueConverter#DEFAULT}.
+     * Various boolean attributes determines by the above static constants.
      */
-    private ValueConverter converter;
+    private int bitMasks;
 
     /**
-     * The reference resolver currently in use, or {@code null} for {@link ReferenceResolver#DEFAULT}.
+     * The locale to use for marshalling, or {@code null} if no locale were explicitly specified.
      */
-    private ReferenceResolver resolver;
+    private Locale locale;
 
     /**
-     * The GML version to be marshalled or unmarshalled, or {@code null} if unspecified.
-     * If null, than the latest version is assumed.
+     * The timezone, or {@code null} if unspecified.
+     * In the later case, an implementation-default (typically UTC) timezone is used.
      */
-    private Version versionGML;
+    private TimeZone timezone;
 
     /**
      * The base URL of ISO 19139 (or other standards) schemas. The valid values
@@ -92,20 +97,25 @@ public final class Context extends Marsh
     private Map<String,String> schemas;
 
     /**
-     * The locale to use for marshalling, or {@code null} if no locale were explicitly specified.
+     * The GML version to be marshalled or unmarshalled, or {@code null} if unspecified.
+     * If null, than the latest version is assumed.
      */
-    private Locale locale;
+    private Version versionGML;
 
     /**
-     * The timezone, or {@code null} if unspecified.
-     * In the later case, an implementation-default (typically UTC) timezone is used.
+     * The reference resolver currently in use, or {@code null} for {@link ReferenceResolver#DEFAULT}.
      */
-    private TimeZone timezone;
+    private ReferenceResolver resolver;
 
     /**
-     * Various boolean attributes determines by the above static constants.
+     * The value converter currently in use, or {@code null} for {@link ValueConverter#DEFAULT}.
      */
-    private int bitMasks;
+    private ValueConverter converter;
+
+    /**
+     * The object to inform about warnings, or {@code null} if none.
+     */
+    private WarningListener<?> warningListener;
 
     /**
      * The context which was previously used. This form a linked list allowing
@@ -127,26 +137,29 @@ public final class Context extends Marsh
      *     }
      * }
      *
-     * @param  converter  The converter in use.
-     * @param  resolver   The resolver in use.
-     * @param  versionGML The GML version, or {@code null}.
-     * @param  schemas    The schemas root URL, or {@code null} if none.
-     * @param  locale     The locale, or {@code null} if unspecified.
-     * @param  timezone   The timezone, or {@code null} if unspecified.
-     * @param  bitMasks   A combination of {@link #MARSHALLING}, {@link #SUBSTITUTE_LANGUAGE},
-     *                    {@link #SUBSTITUTE_COUNTRY} or other bit masks.
-     */
-    public Context(final ValueConverter converter, final ReferenceResolver resolver,
-            final Version versionGML, final Map<String,String> schemas,
-            final Locale locale, final TimeZone timezone, final int bitMasks)
+     * @param  bitMasks        A combination of {@link #MARSHALLING}, {@code #SUBSTITUTE_*} or other bit masks.
+     * @param  locale          The locale, or {@code null} if unspecified.
+     * @param  timezone        The timezone, or {@code null} if unspecified.
+     * @param  schemas         The schemas root URL, or {@code null} if none.
+     * @param  versionGML      The GML version, or {@code null}.
+     * @param  resolver        The resolver in use.
+     * @param  converter       The converter in use.
+     * @param  warningListener The object to inform about warnings.
+     */
+    public Context(final int                bitMasks,
+                   final Locale             locale,   final TimeZone       timezone,
+                   final Map<String,String> schemas,  final Version        versionGML,
+                   final ReferenceResolver  resolver, final ValueConverter converter,
+                   final WarningListener<?> warningListener)
     {
-        this.converter  = converter;
-        this.resolver   = resolver;
-        this.versionGML = versionGML;
-        this.schemas    = schemas; // No clone, because this class is internal.
-        this.locale     = locale;
-        this.timezone   = timezone;
-        this.bitMasks   = bitMasks;
+        this.bitMasks        = bitMasks;
+        this.locale          = locale;
+        this.timezone        = timezone;
+        this.schemas         = schemas; // No clone, because this class is internal.
+        this.versionGML      = versionGML;
+        this.resolver        = resolver;
+        this.converter       = converter;
+        this.warningListener = warningListener;
         previous = current();
         CURRENT.set(this);
     }
@@ -160,32 +173,20 @@ public final class Context extends Marsh
      */
     private Context(final Context previous) {
         if (previous != null) {
-            converter  = previous.converter;
-            resolver   = previous.resolver;
-            versionGML = previous.versionGML;
-            schemas    = previous.schemas;
-            locale     = previous.locale;
-            timezone   = previous.timezone;
-            bitMasks   = previous.bitMasks;
+            bitMasks         = previous.bitMasks;
+            locale           = previous.locale;
+            timezone         = previous.timezone;
+            schemas          = previous.schemas;
+            versionGML       = previous.versionGML;
+            resolver         = previous.resolver;
+            converter        = previous.converter;
+            warningListener  = previous.warningListener;
         }
         this.previous = previous;
         CURRENT.set(this);
     }
 
     /**
-     * Returns the schema version of the XML document being (un)marshalled.
-     * See the super-class javadoc for the list of prefix that we shall support.
-     */
-    @Override
-    public final Version getVersion(final String prefix) {
-        if (prefix.equals("gml")) {
-            return versionGML;
-        }
-        // Future SIS versions may add more cases here.
-        return null;
-    }
-
-    /**
      * Returns the locale to use for marshalling, or {@code null} if no locale were explicitly
      * specified.
      */
@@ -203,6 +204,19 @@ public final class Context extends Marsh
         return timezone;
     }
 
+    /**
+     * Returns the schema version of the XML document being (un)marshalled.
+     * See the super-class javadoc for the list of prefix that we shall support.
+     */
+    @Override
+    public final Version getVersion(final String prefix) {
+        if (prefix.equals("gml")) {
+            return versionGML;
+        }
+        // Future SIS versions may add more cases here.
+        return null;
+    }
+
     /*
      * ---- END OF PUBLIC API --------------------------------------------------------------
      *
@@ -250,22 +264,58 @@ public final class Context extends Marsh
     }
 
     /**
-     * Returns the value converter in use for the current marshalling or unmarshalling process.
-     * If no converter were explicitely set, then this method returns {@link ValueConverter#DEFAULT}.
+     * Returns the base URL of ISO 19139 (or other standards) schemas.
+     * The valid values are documented in the {@link org.apache.sis.xml.XML#SCHEMAS} property.
+     * If the returned value is not empty, then this method guarantees it ends with {@code '/'}.
      *
      * {@note This method is static for the convenience of performing the check for null context.}
      *
      * @param  context The current context, or {@code null} if none.
-     * @return The current value converter (never null).
+     * @param  key One of the value documented in the "<cite>Map key</cite>" column of
+     *         {@link org.apache.sis.xml.XML#SCHEMAS}.
+     * @param  defaultSchema The value to return if no schema is found for the given key.
+     * @return The base URL of the schema, or an empty buffer if none were specified.
      */
-    public static ValueConverter converter(final Context context) {
+    public static StringBuilder schema(final Context context, final String key, String defaultSchema) {
+        final StringBuilder buffer = new StringBuilder(128);
         if (context != null) {
-            final ValueConverter converter = context.converter;
-            if (converter != null) {
-                return converter;
+            final Map<String,String> schemas = context.schemas;
+            if (schemas != null) {
+                final String schema = schemas.get(key);
+                if (schema != null) {
+                    defaultSchema = schema;
+                }
             }
         }
-        return ValueConverter.DEFAULT;
+        buffer.append(defaultSchema);
+        final int length = buffer.length();
+        if (length != 0 && buffer.charAt(length - 1) != '/') {
+            buffer.append('/');
+        }
+        return buffer;
+    }
+
+    /**
+     * Returns {@code true} if the GML version is equals or newer than the specified version.
+     * If no GML version were specified, then this method returns {@code true}, i.e. newest
+     * version is assumed.
+     *
+     * {@note This method is static for the convenience of performing the check for null context.}
+     *
+     * @param  context The current context, or {@code null} if none.
+     * @param  version The version to compare to.
+     * @return {@code true} if the GML version is equals or newer than the specified version.
+     *
+     * @see #getVersion(String)
+     */
+    public static boolean isGMLVersion(final Context context, final Version version) {
+        if (context != null) {
+            final Version versionGML = context.versionGML;
+            if (versionGML != null) {
+                return versionGML.compareTo(version) >= 0;
+            }
+        }
+        return true;
     }
 
     /**
@@ -288,51 +338,74 @@ public final class Context extends Marsh
     }
 
     /**
-     * Returns the base URL of ISO 19139 (or other standards) schemas.
-     * The valid values are documented in the {@link org.apache.sis.xml.XML#SCHEMAS} property.
+     * Returns the value converter in use for the current marshalling or unmarshalling process.
+     * If no converter were explicitely set, then this method returns {@link ValueConverter#DEFAULT}.
      *
      * {@note This method is static for the convenience of performing the check for null context.}
      *
      * @param  context The current context, or {@code null} if none.
-     * @param  key One of the value documented in the "<cite>Map key</cite>" column of
-     *         {@link org.apache.sis.xml.XML#SCHEMAS}.
-     * @param  defaultSchema The value to return if no schema is found for the given key.
-     * @return The base URL of the schema, or {@code null} if none were specified.
+     * @return The current value converter (never null).
      */
-    public static String schema(final Context context, final String key, final String defaultSchema) {
+    public static ValueConverter converter(final Context context) {
         if (context != null) {
-            final Map<String,String> schemas = context.schemas;
-            if (schemas != null) {
-                final String schema = schemas.get(key);
-                if (schema != null) {
-                    return schema;
-                }
+            final ValueConverter converter = context.converter;
+            if (converter != null) {
+                return converter;
             }
         }
-        return defaultSchema;
+        return ValueConverter.DEFAULT;
     }
 
     /**
-     * Returns {@code true} if the GML version is equals or newer than the specified version.
-     * If no GML version were specified, then this method returns {@code true}, i.e. newest
-     * version is assumed.
-     *
-     * {@note This method is static for the convenience of performing the check for null context.}
-     *
-     * @param  context The current context, or {@code null} if none.
-     * @param  version The version to compare to.
-     * @return {@code true} if the GML version is equals or newer than the specified version.
-     *
-     * @see #getVersion(String)
-     */
-    public static boolean isGMLVersion(final Context context, final Version version) {
+     * Sends the given warning to the warning listener if there is one, or logs the warning otherwise.
+     * In the later case, this method logs to the logger specified by {@link LogRecord#getLoggerName()}
+     * if defined, or to the {@code "org.apache.sis.xml"} logger otherwise.
+     *
+     * @param context The current context, or {@code null} if none.
+     * @param source  The object that emitted a warning. Can not be null.
+     * @param warning The warning.
+     */
+    @SuppressWarnings("unchecked")
+    public static void warningOccured(final Context context, final Object source, final LogRecord warning) {
+        String logger = warning.getLoggerName();
+        if (logger == null) {
+            warning.setLoggerName(logger = "org.apache.sis.xml");
+        }
         if (context != null) {
-            final Version versionGML = context.versionGML;
-            if (versionGML != null) {
-                return versionGML.compareTo(version) >= 0;
+            final WarningListener<?> warningListener = context.warningListener;
+            if (warningListener != null && warningListener.getSourceClass().isInstance(source)) {
+                ((WarningListener) warningListener).warningOccured(source, warning);
+                return;
             }
         }
-        return true;
+        /*
+         * Log the warning without stack-trace, since this method shall be used only for non-fatal warnings
+         * and we want to avoid polluting the logs.
+         */
+        warning.setThrown(null);
+        Logging.getLogger(logger).log(warning);
+    }
+
+    /**
+     * Convenience method for sending a warning for the given exception.
+     * The logger will be {@code "org.apache.sis.xml"}.
+     *
+     * @param context The current context, or {@code null} if none.
+     * @param source  The object that emitted a warning. Can not be null.
+     * @param classe  The name of the class to declare as the warning source.
+     * @param method  The name of the method to declare as the warning source.
+     * @param cause   The exception which occurred.
+     * @param warning {@code true} for {@link Level#WARNING}, or {@code false} for {@link Level#FILE}.
+     */
+    public static void warningOccured(final Context context, final Object source, final Class<?> classe,
+            final String method, final Exception cause, final boolean warning)
+    {
+        final LogRecord record = new LogRecord(warning ? Level.WARNING : Level.FINE,
+                Exceptions.formatChainedMessages(context != null ? context.getLocale() : null, null, cause));
+        record.setSourceClassName(classe.getCanonicalName());
+        record.setSourceMethodName(method);
+        record.setThrown(cause);
+        warningOccured(context, source, record);
     }
 
     /**



Mime
View raw message