You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/04/19 00:33:26 UTC

svn commit: r1469607 - in /sis/trunk: ./ sis-metadata/src/main/java/org/apache/sis/metadata/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/ sis-metadata/src/test/java/org/apache/sis/metadata/ sis-metadata/src/test/java/org/apach...

Author: desruisseaux
Date: Thu Apr 18 22:33:25 2013
New Revision: 1469607

URL: http://svn.apache.org/r1469607
Log:
Merge from the JDK6 branch.

Added:
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/DomainRange.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/DomainRange.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/InformationMap.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/InformationMap.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/NameMap.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/NameMap.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyMap.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyMap.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/TypeMap.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/TypeMap.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ValueMap.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/ValueMap.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/package-info.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/package-info.java
    sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
      - copied unchanged from r1469604, sis/branches/JDK6/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
Removed:
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataMap.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyDescriptor.java
    sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyDescriptorTest.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/TypeValuePolicy.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
    sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
    sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
    sis/trunk/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK7:r1468922-1469596
  Merged /sis/branches/JDK6:r1468940-1469604

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -121,7 +121,7 @@ public abstract class AbstractMetadata i
      *   <li>An empty {@linkplain CharSequence character sequences}.</li>
      *   <li>An {@linkplain java.util.Collection#isEmpty() empty collection} or an empty array.</li>
      *   <li>A collection or array containing only {@code null} or empty elements.</li>
-     *   <li>An other metadata object containing only {@code null} or empty attributes.</li>
+     *   <li>An other metadata object containing only {@code null} or empty properties.</li>
      * </ul>
      *
      * Note that empty properties can be removed by calling the {@link ModifiableMetadata#prune()}
@@ -129,7 +129,7 @@ public abstract class AbstractMetadata i
      *
      * {@section Note for implementors}
      * The default implementation uses Java reflection indirectly, by iterating over all entries
-     * returned by {@link MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)}.
+     * returned by {@link MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)}.
      * Subclasses that override this method should usually not invoke {@code super.isEmpty()},
      * because the Java reflection will discover and process the properties defined in the
      * subclasses - which is usually not the intend when overriding a method.
@@ -187,16 +187,16 @@ public abstract class AbstractMetadata i
      *
      * <p>The default implementation is equivalent to the following method call:</p>
      * {@preformat java
-     *   return getStandard().asMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
+     *   return getStandard().asValueMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
      * }
      *
      * @return A view of this metadata object as a map.
      *
-     * @see MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)
+     * @see MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)
      */
     public synchronized Map<String,Object> asMap() {
         if (asMap == null) {
-            asMap = getStandard().asMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
+            asMap = getStandard().asValueMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
         }
         return asMap;
     }

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -35,7 +35,7 @@ import org.opengis.annotation.UML;
  * @version 0.3
  * @module
  *
- * @see MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)
+ * @see MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)
  */
 public enum KeyNamePolicy {
     /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -24,10 +24,13 @@ import java.util.Collection;
 import java.util.Iterator;
 import net.jcip.annotations.ThreadSafe;
 import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.ExtendedElementInformation;
+import org.opengis.referencing.ReferenceIdentifier;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.TreeTable;
+import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.internal.util.SystemListener;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -43,15 +46,14 @@ import static org.apache.sis.util.Argume
  * {@linkplain java.lang.reflect Java reflection}. The following rules are assumed:</p>
  *
  * <ul>
- *   <li>Properties (or metadata attributes) are defined by the collection of
- *       following getter methods found <strong>in the interface</strong>
- *       (methods declared only in the implementation are ignored):
+ *   <li>Metadata properties are defined by the collection of following getter methods found
+ *       <strong>in the interface</strong>, ignoring implementation methods:
  *       <ul>
  *         <li>{@code get*()} methods with arbitrary return type;</li>
  *         <li>or {@code is*()} methods with boolean return type.</li>
  *       </ul></li>
- *   <li>Every properties are <cite>readable</cite>.
- *       But a property is also <cite>writable</cite> if a {@code set*(…)} method is defined
+ *   <li>All properties are <cite>readable</cite>.</li>
+ *   <li>A property is also <cite>writable</cite> if a {@code set*(…)} method is defined
  *       <strong>in the implementation class</strong> for the corresponding getter method.
  *       The setter method doesn't need to be defined in the interface.</li>
  * </ul>
@@ -66,7 +68,7 @@ import static org.apache.sis.util.Argume
  *
  * <ul>
  *   <li>For <em>read-only</em> metadata, {@code MetadataStandard} can be instantiated directly.
- *       only getter methods will be used and all operations that modify the metadata properties
+ *       Only getter methods will be used and all operations that modify the metadata properties
  *       will throw an {@link UnmodifiableMetadataException}.</li>
  *   <li>For <em>read/write</em> metadata, the {@link #getImplementation(Class)}
  *       method must be overridden in a {@code MetadataStandard} subclass.</li>
@@ -154,9 +156,10 @@ public class MetadataStandard {
     private final Map<Class<?>, Object> accessors;
 
     /**
-     * Creates a new instance working on implementation of interfaces defined
-     * in the specified package. For the ISO 19115 standard reflected by GeoAPI
-     * interfaces, it should be the {@link org.opengis.metadata} package.
+     * Creates a new instance working on implementation of interfaces defined in the specified package.
+     *
+     * <p><b>Example:</b>: For the ISO 19115 standard reflected by GeoAPI interfaces,
+     * {@code interfacePackage} shall be the {@link org.opengis.metadata} package.</p>
      *
      * @param citation         Bibliographical reference to the international standard.
      * @param interfacePackage The root package for metadata interfaces.
@@ -420,6 +423,133 @@ public class MetadataStandard {
     }
 
     /**
+     * Returns the names of all properties defined in the given metadata type.
+     * The property names appears both as keys and as values, but may be written differently.
+     * The names may be {@linkplain KeyNamePolicy#UML_IDENTIFIER standard identifiers} (e.g.
+     * as defined by ISO 19115), {@linkplain KeyNamePolicy#JAVABEANS_PROPERTY JavaBeans names},
+     * {@linkplain KeyNamePolicy#METHOD_NAME method names} or {@linkplain KeyNamePolicy#SENTENCE
+     * sentences} (usually in English).
+     *
+     * <p><b>Example:</b> The {@code value} in the following code is
+     * <code>"alternateTitle<u>s</u>"</code> (note the plural):</p>
+     *
+     * {@preformat java
+     *   MetadataStandard standard = MetadataStandard.ISO_19115;
+     *   Map<String, String> names = standard.asNameMap(Citation.class, UML_IDENTIFIER, JAVABEANS_PROPERTY);
+     *   String value = names.get("alternateTitle");  // alternateTitles
+     * }
+     *
+     * The {@code keyPolicy} argument specify only the string representation of keys returned by the iterators.
+     * No matter the key name policy, the {@code key} argument given to any {@link Map} method can be any of the
+     * above-cited forms of property names.
+     *
+     * @param  type        The interface or implementation class of a metadata.
+     * @param  keyPolicy   Determines the string representation of map keys.
+     * @param  valuePolicy Determines the string representation of map values.
+     * @return The names of all properties defined by the given metadata type.
+     * @throws ClassCastException if the specified interface or implementation class does
+     *         not extend or implement a metadata interface of the expected package.
+     */
+    public Map<String,String> asNameMap(Class<?> type, final KeyNamePolicy keyPolicy,
+            final KeyNamePolicy valuePolicy) throws ClassCastException
+    {
+        ensureNonNull("type",        type);
+        ensureNonNull("keyPolicy",   keyPolicy);
+        ensureNonNull("valuePolicy", valuePolicy);
+        final Class<?> implementation = getImplementation(type);
+        if (implementation != null) {
+            type = implementation;
+        }
+        return new NameMap(getAccessor(type, true), keyPolicy, valuePolicy);
+    }
+
+    /**
+     * Returns the type of all properties, or their declaring type, defined in the given
+     * metadata type. The keys in the returned map are the same than the keys in the above
+     * {@linkplain #asNameMap name map}. The values are determined by the {@code valuePolicy}
+     * argument, which can be {@linkplain TypeValuePolicy#ELEMENT_TYPE element type} or the
+     * {@linkplain TypeValuePolicy#DECLARING_INTERFACE declaring interface} among others.
+     *
+     * <p><b>Example:</b> The {@code value} in the following code is {@code InternationalString.class}:</p>
+     *
+     * {@preformat java
+     *   MetadataStandard  standard = MetadataStandard.ISO_19115;
+     *   Map<String,Class<?>> types = standard.asTypeMap(Citation.class, UML_IDENTIFIER, ELEMENT_TYPE);
+     *   Class<?> value = names.get("alternateTitle");  // InternationalString.class
+     * }
+     *
+     * @param  type        The interface or implementation class of a metadata.
+     * @param  keyPolicy   Determines the string representation of map keys.
+     * @param  valuePolicy Whether the values shall be property types, the element types
+     *         (same as property types except for collections) or the declaring interface or class.
+     * @return The types or declaring type of all properties defined in the given metadata type.
+     * @throws ClassCastException if the specified interface or implementation class does
+     *         not extend or implement a metadata interface of the expected package.
+     */
+    public Map<String,Class<?>> asTypeMap(Class<?> type, final KeyNamePolicy keyPolicy,
+            final TypeValuePolicy valuePolicy) throws ClassCastException
+    {
+        ensureNonNull("type",        type);
+        ensureNonNull("keyPolicy",   keyPolicy);
+        ensureNonNull("valuePolicy", valuePolicy);
+        final Class<?> implementation = getImplementation(type);
+        if (implementation != null) {
+            type = implementation;
+        }
+        return new TypeMap(getAccessor(type, true), keyPolicy, valuePolicy);
+    }
+
+    /**
+     * Returns information about all properties defined in the given metadata type.
+     * The keys in the returned map are the same than the keys in the above
+     * {@linkplain #asNameMap name map}. The values contain information inferred from
+     * the ISO names, the {@link org.opengis.annotation.Obligation} enumeration and the
+     * {@link org.apache.sis.measure.ValueRange} annotations.
+     *
+     * <p>In the particular case of Apache SIS implementation, all values in the information map
+     * additionally implement the following interfaces:</p>
+     * <ul>
+     *   <li>{@link ReferenceIdentifier} with the following properties:
+     *     <ul>
+     *       <li>The {@linkplain ReferenceIdentifier#getAuthority() authority} is this metadata standard {@linkplain #getCitation() citation}.</li>
+     *       <li>The {@linkplain ReferenceIdentifier#getCodeSpace() codespace} is the standard name of the interface that contain the property.</li>
+     *       <li>The {@linkplain ReferenceIdentifier#getCode() code} is the standard name of the property.</li>
+     *     </ul>
+     *   </li>
+     *   <li>{@link CheckedContainer} with the following properties:
+     *     <ul>
+     *       <li>The {@linkplain CheckedContainer#getElementType() element type} is the type of property values
+     *           as defined by {@link TypeValuePolicy#ELEMENT_TYPE}.</li>
+     *     </ul>
+     *   </li>
+     * </ul>
+     *
+     * In addition, for each map entry the value returned by {@link ExtendedElementInformation#getDomainValue()}
+     * may optionally be an instance of any of the following classes:
+     *
+     * <ul>
+     *   <li>{@link org.apache.sis.measure.NumberRange} if the valid values are constrained to some specific range.</li>
+     * </ul>
+     *
+     * @param  type      The metadata interface or implementation class.
+     * @param  keyPolicy Determines the string representation of map keys.
+     * @return Information about all properties defined in the given metadata type.
+     * @throws ClassCastException if the given type doesn't implement a metadata
+     *         interface of the expected package.
+     */
+    public Map<String,ExtendedElementInformation> asInformationMap(Class<?> type,
+            final KeyNamePolicy keyPolicy) throws ClassCastException
+    {
+        ensureNonNull("type",     type);
+        ensureNonNull("keyNames", keyPolicy);
+        final Class<?> implementation = getImplementation(type);
+        if (implementation != null) {
+            type = implementation;
+        }
+        return new InformationMap(getAccessor(type, true), keyPolicy);
+    }
+
+    /**
      * Returns a view of the specified metadata object as a {@link Map}.
      * The map is backed by the metadata object using Java reflection, so changes in the
      * underlying metadata object are immediately reflected in the map and conversely.
@@ -444,13 +574,13 @@ public class MetadataStandard {
      *
      * @see AbstractMetadata#asMap()
      */
-    public Map<String,Object> asMap(final Object metadata, final KeyNamePolicy keyPolicy,
+    public Map<String,Object> asValueMap(final Object metadata, final KeyNamePolicy keyPolicy,
             final ValueExistencePolicy valuePolicy) throws ClassCastException
     {
         ensureNonNull("metadata",    metadata);
         ensureNonNull("keyPolicy",   keyPolicy);
         ensureNonNull("valuePolicy", valuePolicy);
-        return new PropertyMap(metadata, getAccessor(metadata.getClass(), true), keyPolicy, valuePolicy);
+        return new ValueMap(metadata, getAccessor(metadata.getClass(), true), keyPolicy, valuePolicy);
     }
 
     /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -30,7 +30,7 @@ import java.lang.reflect.InvocationTarge
 import net.jcip.annotations.ThreadSafe;
 import org.opengis.annotation.UML;
 import org.opengis.metadata.citation.Citation;
-import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.metadata.ExtendedElementInformation;
 import org.apache.sis.measure.ValueRange;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.Numbers;
@@ -201,13 +201,13 @@ final class PropertyAccessor {
     private transient volatile ObjectConverter<?,?> converter;
 
     /**
-     * The property descriptions, including the name and restrictions on valid values.
+     * The property information, including the name and restrictions on valid values.
      * The array will be created when first needed. A {@code null} element means that
-     * the descriptor at that index has not yet been computed.
+     * the information at that index has not yet been computed.
      *
-     * @see #descriptor(int)
+     * @see #information(int)
      */
-    private transient ParameterDescriptor<?>[] descriptors;
+    private transient ExtendedElementInformation[] informations;
 
     /**
      * Creates a new property accessor for the specified metadata implementation.
@@ -538,26 +538,27 @@ final class PropertyAccessor {
     }
 
     /**
-     * Returns the descriptor for the property at the given index.
-     * The descriptor are created when first needed.
+     * Returns the information for the property at the given index.
+     * The information are created when first needed.
      *
-     * @param  index The index of the property for which to get the descriptor.
-     * @return The descriptor for the property at the given index,
+     * @param  index The index of the property for which to get the information.
+     * @return The information for the property at the given index,
      *         or {@code null} if the index is out of bounds.
+     *
+     * @see PropertyInformation
      */
     @SuppressWarnings({"unchecked","rawtypes"})
-    final synchronized ParameterDescriptor<?> descriptor(final int index) {
-        ParameterDescriptor[] descriptors = this.descriptors;
-        if (descriptors == null) {
-            this.descriptors = descriptors = new PropertyDescriptor<?>[standardCount];
+    final synchronized ExtendedElementInformation information(final int index) {
+        ExtendedElementInformation[] informations = this.informations;
+        if (informations == null) {
+            this.informations = informations = new PropertyInformation<?>[standardCount];
         }
-        if (index < 0 || index >= descriptors.length) {
+        if (index < 0 || index >= informations.length) {
             return null;
         }
-        ParameterDescriptor<?> descriptor = descriptors[index];
-        if (descriptor == null) {
+        ExtendedElementInformation information = informations[index];
+        if (information == null) {
             final Class<?> elementType = elementTypes[index];
-            final Citation standard    = this.standard;
             final String   name        = name(index, KeyNamePolicy.UML_IDENTIFIER);
             final Method   getter      = getters[index];
             ValueRange range = null;
@@ -572,14 +573,10 @@ final class PropertyAccessor {
                     throw new AssertionError(error);
                 }
             }
-            if (range != null) {
-                descriptor = new PropertyDescriptor.Bounded(elementType, standard, name, getter, range);
-            } else {
-                descriptor = new PropertyDescriptor(elementType, standard, name, getter);
-            }
-            descriptors[index] = descriptor;
+            information = new PropertyInformation(standard, name, getter, elementType, range);
+            informations[index] = information;
         }
-        return descriptor;
+        return information;
     }
 
     /**
@@ -635,7 +632,7 @@ final class PropertyAccessor {
      * copy the new collection in their existing instance.
      *
      * <p>If the given index is out of bounds, then this method does nothing and return {@code null}.
-     * We do that because the {@link PropertyMap#remove(Object)} method may invoke this method with
+     * We do that because the {@link ValueMap#remove(Object)} method may invoke this method with
      * an index of -1 if the {@link #indexOf(String, boolean)} method didn't found the property name.
      * However the given value will be silently discarded, so index out-of-bounds shall be used only
      * in the context of {@code remove} operations (this is not verified).</p>

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -59,7 +59,7 @@ final class Pruner extends ThreadLocal<M
      * include empty (but non-null) values in order to allow us to set them to {@code null}.
      */
     private static Map<String, Object> asMap(final MetadataStandard standard, final Object metadata, final boolean prune) {
-        return standard.asMap(metadata, KeyNamePolicy.JAVABEANS_PROPERTY, prune ?
+        return standard.asValueMap(metadata, KeyNamePolicy.JAVABEANS_PROPERTY, prune ?
                 ValueExistencePolicy.NON_NULL : ValueExistencePolicy.NON_EMPTY);
     }
 
@@ -67,8 +67,8 @@ final class Pruner extends ThreadLocal<M
      * Returns {@code true} if the value for the given entry is a primitive type.
      */
     private static boolean isPrimitive(final Map.Entry<String,Object> entry) {
-        return (entry instanceof PropertyMap.Property) &&
-                ((PropertyMap.Property) entry).getValueType().isPrimitive();
+        return (entry instanceof ValueMap.Property) &&
+                ((ValueMap.Property) entry).getValueType().isPrimitive();
     }
 
     /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/TypeValuePolicy.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/TypeValuePolicy.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/TypeValuePolicy.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/TypeValuePolicy.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -53,16 +53,16 @@ public enum TypeValuePolicy {
     ELEMENT_TYPE,
 
     /**
-     * The type of the class that declares the method. A metadata implementation may have
-     * different declaring classes for its properties if some of them are declared in parent
-     * classes.
+     * The type of the interface that declares the method. For any metadata object, different
+     * properties may have different declaring interfaces if some properties were inherited
+     * from parent interfaces.
      */
-    DECLARING_CLASS,
+    DECLARING_INTERFACE,
 
     /**
-     * The type of the interface that declares the method. This is the same than
-     * {@link #DECLARING_CLASS}, except that the interface from the metadata standard
-     * is returned instead than the implementation class.
+     * The type of the class that declares the method. This is similar to
+     * {@link #DECLARING_INTERFACE}, except that the implementation class
+     * from the metadata standard is returned instead than the interface.
      */
-    DECLARING_INTERFACE
+    DECLARING_CLASS
 }

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -18,8 +18,8 @@ package org.apache.sis.metadata;
 
 
 /**
- * Whatever {@link MetadataStandard#asMap MetadataStandard.asMap(…)} shall contain entries
- * for null values or empty collections. By default the map does not provide
+ * Whatever {@link MetadataStandard#asValueMap MetadataStandard.asValueMap(…)} shall contain
+ * entries for null values or empty collections. By default the map does not provide
  * {@linkplain java.util.Map.Entry entries} for {@code null} metadata properties or
  * {@linkplain java.util.Collection#isEmpty() empty} collections.
  * This enumeration allows control on this behavior.
@@ -29,7 +29,7 @@ package org.apache.sis.metadata;
  * @version 0.3
  * @module
  *
- * @see MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)
+ * @see MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)
  */
 public enum ValueExistencePolicy {
     /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -19,6 +19,7 @@ package org.apache.sis.metadata.iso.iden
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.metadata.identification.ServiceIdentification;
+import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -33,7 +34,7 @@ import org.opengis.metadata.identificati
  * @module
  */
 @XmlType(name = "MD_ServiceIdentification_Type")
-@XmlRootElement(name = "SV_ServiceIdentification") // Prefix is really SV_ according ISO 19115 corrigendum.
+@XmlRootElement(name = "SV_ServiceIdentification", namespace = Namespaces.SRV) // Prefix is really SV_ according ISO 19115 corrigendum.
 public class DefaultServiceIdentification extends AbstractIdentification implements ServiceIdentification {
     /**
      * Serial number for compatibility with different versions.

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -91,6 +91,7 @@
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GMD, xmlns = {
     @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD),
     @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO),
+    @XmlNs(prefix = "srv", namespaceURI = Namespaces.SRV),
     @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI)
 })
 @XmlAccessorType(XmlAccessType.NONE)

Modified: sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -20,8 +20,16 @@ import java.util.Set;
 import java.util.Map;
 import java.util.HashSet;
 import java.util.Collection;
+import java.util.Date;
+import org.opengis.util.InternationalString;
+import org.opengis.metadata.Identifier;
+import org.opengis.metadata.citation.Series;
 import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.citation.CitationDate;
+import org.opengis.metadata.citation.ResponsibleParty;
+import org.opengis.metadata.citation.PresentationForm;
 import org.opengis.metadata.quality.Completeness;
+import org.opengis.metadata.ExtendedElementInformation;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.metadata.iso.quality.AbstractCompleteness;
@@ -33,6 +41,7 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.opengis.test.Assert.*;
+import static java.util.AbstractMap.SimpleEntry;
 
 
 /**
@@ -44,7 +53,7 @@ import static org.opengis.test.Assert.*;
  * @version 0.3
  * @module
  */
-@DependsOn(PropertyAccessorTest.class)
+@DependsOn({PropertyAccessorTest.class, PropertyInformationTest.class})
 public final strictfp class MetadataStandardTest extends TestCase {
     /**
      * Tests {@link MetadataStandard#getInterface(Class)}.
@@ -115,19 +124,92 @@ public final strictfp class MetadataStan
     }
 
     /**
-     * Tests the {@link MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)} implementation.
-     * Note: this test duplicates {@link PropertyMapTest}, but is done here again because other tests in this
-     * class depend on it.
+     * Tests the {@link MetadataStandard#asName(Class, KeyNamePolicy, KeyNamePolicy)} implementation.
+     * The properties used in this test are listed in {@link PropertyAccessorTest#testConstructor()}.
+     *
+     * @see PropertyAccessorTest#testConstructor()
+     */
+    @Test
+    public void testNameMap() {
+        final Map<String,String> map = MetadataStandard.ISO_19115.asNameMap(
+                Citation.class, KeyNamePolicy.UML_IDENTIFIER, KeyNamePolicy.JAVABEANS_PROPERTY);
+        assertArrayEquals(new Object[] {
+            new SimpleEntry<String,String>("title",                 "title"),
+            new SimpleEntry<String,String>("alternateTitle",        "alternateTitles"),
+            new SimpleEntry<String,String>("date",                  "dates"),
+            new SimpleEntry<String,String>("edition",               "edition"),
+            new SimpleEntry<String,String>("editionDate",           "editionDate"),
+            new SimpleEntry<String,String>("identifier",            "identifiers"),
+            new SimpleEntry<String,String>("citedResponsibleParty", "citedResponsibleParties"),
+            new SimpleEntry<String,String>("presentationForm",      "presentationForms"),
+            new SimpleEntry<String,String>("series",                "series"),
+            new SimpleEntry<String,String>("otherCitationDetails",  "otherCitationDetails"),
+            new SimpleEntry<String,String>("collectiveTitle",       "collectiveTitle"),
+            new SimpleEntry<String,String>("ISBN",                  "ISBN"),
+            new SimpleEntry<String,String>("ISSN",                  "ISSN")
+        }, map.entrySet().toArray());
+
+        assertEquals("alternateTitles", map.get("alternateTitle"));
+        assertNull("Shall not exists.", map.get("dummy"));
+    }
+
+    /**
+     * Tests the {@link MetadataStandard#asType(Class, KeyNamePolicy, TypeValuePolicy)} implementation.
+     * The properties used in this test are listed in {@link PropertyAccessorTest#testConstructor()}.
+     *
+     * @see PropertyAccessorTest#testConstructor()
+     */
+    @Test
+    public void testTypeMap() {
+        final Map<String,Class<?>> map = MetadataStandard.ISO_19115.asTypeMap(
+                Citation.class, KeyNamePolicy.UML_IDENTIFIER, TypeValuePolicy.ELEMENT_TYPE);
+        assertArrayEquals(new Object[] {
+            new SimpleEntry<String,Class<?>>("title",                 InternationalString.class),
+            new SimpleEntry<String,Class<?>>("alternateTitle",        InternationalString.class),
+            new SimpleEntry<String,Class<?>>("date",                  CitationDate.class),
+            new SimpleEntry<String,Class<?>>("edition",               InternationalString.class),
+            new SimpleEntry<String,Class<?>>("editionDate",           Date.class),
+            new SimpleEntry<String,Class<?>>("identifier",            Identifier.class),
+            new SimpleEntry<String,Class<?>>("citedResponsibleParty", ResponsibleParty.class),
+            new SimpleEntry<String,Class<?>>("presentationForm",      PresentationForm.class),
+            new SimpleEntry<String,Class<?>>("series",                Series.class),
+            new SimpleEntry<String,Class<?>>("otherCitationDetails",  InternationalString.class),
+            new SimpleEntry<String,Class<?>>("collectiveTitle",       InternationalString.class),
+            new SimpleEntry<String,Class<?>>("ISBN",                  String.class),
+            new SimpleEntry<String,Class<?>>("ISSN",                  String.class)
+        }, map.entrySet().toArray());
+
+        assertEquals(InternationalString.class, map.get("alternateTitle"));
+        assertNull("Shall not exists.", map.get("dummy"));
+    }
+
+    /**
+     * Tests the {@link MetadataStandard#asInformationMap(Class, KeyNamePolicy)} implementation.
+     * Note: this test duplicates {@link PropertyInformationTest}, but is done here again as an
+     * integration test.
+     */
+    @Test
+    public void testInformationMap() {
+        final Map<String,ExtendedElementInformation> map = MetadataStandard.ISO_19115.asInformationMap(
+                Citation.class, KeyNamePolicy.JAVABEANS_PROPERTY);
+        PropertyInformationTest.validateTitle(map.get("title"));
+        PropertyInformationTest.validatePresentationForm(map.get("presentationForms"));
+        assertNull("Shall not exists.", map.get("dummy"));
+    }
+
+    /**
+     * Tests the {@link MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)} implementation.
+     * Note: this test duplicates {@link ValueMapTest}, but is done here again as an integration test.
      */
     @Test
-    public void testMap() {
+    public void testValueMap() {
         final DefaultCitation instance = new DefaultCitation(HardCodedCitations.EPSG);
-        final Map<String,Object> map = MetadataStandard.ISO_19115.asMap(instance,
+        final Map<String,Object> map = MetadataStandard.ISO_19115.asValueMap(instance,
                 KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
         assertFalse("The properties map shall not be empty.", map.isEmpty());
         assertEquals("Unexpected number of properties.", 4, map.size());
         /*
-         * Verify the set of keys in the PropertyMap.
+         * Verify the set of keys in the ValueMap.
          *
          * Note: the iterator order (and consequently, the order of elements in the following
          * string representation) is determined by the @XmlType(…) annotation and verified by
@@ -158,13 +240,13 @@ public final strictfp class MetadataStan
      * hash code values of all non-empty properties, plus the hash code of the interface.
      */
     @Test
-    @DependsOnMethod("testMap")
+    @DependsOnMethod("testValueMap")
     public void testHashCode() {
         final MetadataStandard std = MetadataStandard.ISO_19115;
         final DefaultCitation instance = HardCodedCitations.EPSG;
-        final Map<String,Object> map = std.asMap(instance,
+        final Map<String,Object> map = std.asValueMap(instance,
                 KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
-        assertFalse(map.isEmpty()); // Actually 'testMap()' job, but verified for safety.
+        assertFalse(map.isEmpty()); // Actually 'testValueMap()' job, but verified for safety.
         assertEquals("hashCode()", new HashSet<Object>(map.values()).hashCode() + Citation.class.hashCode(),
                 std.hashCode(instance));
     }

Modified: sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -69,7 +69,7 @@ import static org.apache.sis.test.TestUt
  * @version 0.3
  * @module
  */
-@DependsOn(PropertyDescriptorTest.class)
+@DependsOn(PropertyInformationTest.class)
 public final strictfp class PropertyAccessorTest extends TestCase {
     /**
      * Creates a new property accessor for the {@link DefaultCitation} class.
@@ -143,6 +143,11 @@ public final strictfp class PropertyAcce
      * Tests the constructor with the {@link DefaultCitation} implementation.
      * The order of properties shall be the order declared in the {@code XmlType.propOrder} annotation.
      * This test may need to be updated if a future GeoAPI release modifies the {@link Citation} interface.
+     * Other tests that depends on {@link Citation} property order are {@link MetadataStandardTest#testNameMap()}
+     * and {@link MetadataStandardTest#testTypeMap()}</p>
+     *
+     * @see MetadataStandardTest#testNameMap()
+     * @see MetadataStandardTest#testTypeMap()
      */
     @Test
     public void testConstructor() {
@@ -191,10 +196,10 @@ public final strictfp class PropertyAcce
      */
     @Test
     @DependsOnMethod("testConstructor")
-    public void testDescriptor() {
+    public void testInformation() {
         final PropertyAccessor accessor = createPropertyAccessor();
-        PropertyDescriptorTest.validateTitle           (accessor.descriptor(accessor.indexOf("title",            true)));
-        PropertyDescriptorTest.validatePresentationForm(accessor.descriptor(accessor.indexOf("presentationForm", true)));
+        PropertyInformationTest.validateTitle           (accessor.information(accessor.indexOf("title",            true)));
+        PropertyInformationTest.validatePresentationForm(accessor.information(accessor.indexOf("presentationForm", true)));
     }
 
     /**

Modified: sis/trunk/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -30,7 +30,7 @@ import org.junit.runners.Suite;
  */
 @Suite.SuiteClasses({
     org.apache.sis.internal.metadata.MetadataUtilitiesTest.class,
-    org.apache.sis.metadata.PropertyDescriptorTest.class,
+    org.apache.sis.metadata.PropertyInformationTest.class,
     org.apache.sis.metadata.PropertyAccessorTest.class,
     org.apache.sis.metadata.MetadataStandardTest.class
 })

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -175,10 +175,21 @@ public class SimpleReferenceIdentifier i
         if (open) {
             buffer.append('”');
         }
+        appendToString(buffer);
         return buffer.append(']').toString();
     }
 
     /**
+     * Invoked by {@link #toString()} in order to allow subclasses to add additional information.
+     * This method is invoked just before the final {@code ']'} is appended to the buffer.
+     *
+     * @param buffer A buffer filled with the {@link #toString()} characters,
+     *               that subclasses can update.
+     */
+    protected void appendToString(final StringBuilder buffer) {
+    }
+
+    /**
      * Returns a pseudo Well Known Text for this identifier.
      * While this method is not defined in the {@link ReferenceIdentifier} interface, it is often
      * defined in related interfaces like {@link org.opengis.referencing.IdentifiedObject}.

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1469607&r1=1469606&r2=1469607&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] Thu Apr 18 22:33:25 2013
@@ -75,6 +75,14 @@ public final class Namespaces extends St
 
     /**
      * The <code>{@value}</code> URL.
+     * The usual prefix for this namespace is {@code "srv"}.
+     *
+     * @category ISO
+     */
+    public static final String SRV = "http://www.isotc211.org/2005/srv";
+
+    /**
+     * The <code>{@value}</code> URL.
      * The usual prefix for this namespace is {@code "gts"}.
      *
      * @category ISO