sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1625169 [1/2] - in /sis/branches/JDK6: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ core/sis-metadata/src/main/java/org/apache/sis/...
Date Mon, 15 Sep 2014 21:45:27 GMT
Author: desruisseaux
Date: Mon Sep 15 21:45:25 2014
New Revision: 1625169

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

Added:
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
      - copied, changed from r1625167, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/UnknownNameException.java
      - copied unchanged from r1625167, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/UnknownNameException.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java
      - copied, changed from r1625167, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypeNamesTest.java
      - copied unchanged from r1625167, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypeNamesTest.java
Removed:
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NameToIdentifier.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/MultiOccurrenceDescriptor.java
Modified:
    sis/branches/JDK6/   (props changed)
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/SV_Parameter.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ReferenceSystemMetadata.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/UninitializedParameter.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/UnsupportedImplementationException.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordSchema.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.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/ClassesTest.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/NamesTest.java
    sis/branches/JDK6/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DirectReferenceSystem.java
    sis/branches/JDK6/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/IndirectReferenceSystem.java

Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK8:r1623887-1625166
  Merged /sis/branches/JDK7:r1623889-1625167

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/SV_Parameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/SV_Parameter.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/SV_Parameter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/SV_Parameter.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -78,7 +78,7 @@ public final class SV_Parameter extends 
      * @return The metadata to be marshalled.
      */
     @XmlElementRef
-    public ServiceParameter<?> getElement() {
+    public ServiceParameter getElement() {
         return ServiceParameter.castOrCopy(metadata);
     }
 
@@ -87,7 +87,7 @@ public final class SV_Parameter extends 
      *
      * @param metadata The unmarshalled metadata.
      */
-    public void setElement(final ServiceParameter<?> metadata) {
+    public void setElement(final ServiceParameter metadata) {
         this.metadata = metadata;
     }
 }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ReferenceSystemMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ReferenceSystemMetadata.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ReferenceSystemMetadata.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ReferenceSystemMetadata.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -23,6 +23,9 @@ import org.opengis.referencing.Reference
 import org.apache.sis.internal.simple.SimpleIdentifiedObject;
 import org.apache.sis.util.ComparisonMode;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk7.Objects;
+
 
 /**
  * An implementation of {@link ReferenceSystem} marshalled as specified in ISO 19115.
@@ -81,7 +84,7 @@ public class ReferenceSystemMetadata ext
      */
     @Override
     @XmlElement(name = "referenceSystemIdentifier")
-    public ReferenceIdentifier getName() {
+    public final ReferenceIdentifier getName() {
         return super.getName();
     }
 
@@ -90,7 +93,7 @@ public class ReferenceSystemMetadata ext
      *
      * @param name The new primary name.
      */
-    public void setName(final ReferenceIdentifier name) {
+    public final void setName(final ReferenceIdentifier name) {
         this.name = name;
     }
 
@@ -103,6 +106,14 @@ public class ReferenceSystemMetadata ext
      */
     @Override
     public boolean equals(final Object object, final ComparisonMode mode) {
-        return super.equals(object, mode) && (object instanceof ReferenceSystem);
+        if (super.equals(object, mode) && (object instanceof ReferenceSystem)) {
+            final ReferenceSystem that = (ReferenceSystem) object;
+            if (mode.ordinal() >= ComparisonMode.IGNORE_METADATA.ordinal()) {
+                // Compare the name because it was ignored by super.equals(…) in "ignore metadata" mode.
+                return Objects.equals(getName(), that.getName());
+            }
+            return that.getDomainOfValidity() == null && that.getScope() == null;
+        }
+        return false;
     }
 }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -32,11 +32,19 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.referencing.ReferenceIdentifier;
 import org.apache.sis.internal.simple.SimpleIdentifiedObject;
 import org.apache.sis.internal.jaxb.metadata.direct.GO_MemberName;
+import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.metadata.NameToIdentifier;
+import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.iso.Names;
 import org.apache.sis.xml.Namespaces;
 
+import static org.apache.sis.util.Utilities.deepEquals;
 import static org.apache.sis.internal.util.CollectionsExt.nonNull;
 import static org.apache.sis.internal.jaxb.gco.PropertyType.LEGACY_XML;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk7.Objects;
+
 
 /**
  * Parameter information conform to the ISO 19115:2014 specification.
@@ -48,7 +56,12 @@ import static org.apache.sis.internal.ja
  * parsing and formatting. For real parameter framework, consider using {@link org.apache.sis.parameter}
  * package instead.</p>
  *
- * @param <T> The type of parameter values.
+ * {@section Note about raw-type usage}
+ * We use raw type (i.e. we implement {@code ParameterDescriptor} instead of {@code ParameterDescriptor<T>})
+ * because there is no way we can know {@code <T>} for sure at unmarshalling time. This is not a recommended
+ * practice, so <strong>this class shall not be in public API</strong>.  However it should be okay to create
+ * {@code ServiceMetadata} instances in Apache SIS internal code if all methods creating such instances declare
+ * {@code ParameterDescriptor<?>} as their return type.
  *
  * @author  Rémi Maréchal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -56,8 +69,9 @@ import static org.apache.sis.internal.ja
  * @since   0.5
  * @module
  */
+@SuppressWarnings("rawtypes") // For the omission of <T> in ParameterDescriptor<T> - see javadoc.
 @XmlType(name = "SV_Parameter_Type", namespace = Namespaces.SRV, propOrder = {
-    "name",
+    "memberName",
     "direction",
     "description",
     "optionality",
@@ -65,7 +79,7 @@ import static org.apache.sis.internal.ja
     "valueType"
 })
 @XmlRootElement(name = "SV_Parameter", namespace = Namespaces.SRV)
-public final class ServiceParameter<T> extends SimpleIdentifiedObject implements ParameterDescriptor<T> {
+public final class ServiceParameter extends SimpleIdentifiedObject implements ParameterDescriptor {
     /**
      * Serial number for compatibility with different versions.
      */
@@ -76,21 +90,21 @@ public final class ServiceParameter<T> e
      *
      * @see #getValueType()
      */
-    @XmlElement(required = true)
+    @XmlElement(required=true, name="name")
     @XmlJavaTypeAdapter(GO_MemberName.class)
-    public MemberName name;
+    MemberName memberName;
 
     /**
      * Indication if the parameter is an input to the service, an output or both.
      */
     @XmlElement
-    public ParameterDirection direction;
+    ParameterDirection direction;
 
     /**
      * A narrative explanation of the role of the parameter.
      */
     @XmlElement
-    public InternationalString description;
+    InternationalString description;
 
     /**
      * Indication if the parameter is required.
@@ -112,17 +126,27 @@ public final class ServiceParameter<T> e
     public boolean repeatability;
 
     /**
+     * A copy of {@code this} as a fully-implemented parameter descriptor.
+     * This is created when first needed for implementation of {@link #createValue()}.
+     */
+    private transient ParameterDescriptor descriptor;
+
+    /**
      * Creates an initially empty parameter.
      * This constructor is needed by JAXB.
+     *
+     * <p><strong>Consider this constructor as private</strong> except for testing purpose.
+     * See <cite>Note about raw-type usage</cite> in class javadoc.</p>
      */
-    public ServiceParameter() {
+    ServiceParameter() {
     }
 
     /**
      * Creates a parameter initialized to the values of the given one.
      */
-    private ServiceParameter(final ParameterDescriptor<T> parameter) {
-        name          = getName(parameter);
+    private ServiceParameter(final ParameterDescriptor<?> parameter) {
+        super(parameter);
+        memberName    = getMemberName(parameter);
         direction     = parameter.getDirection();
         description   = parameter.getDescription();
         optionality   = parameter.getMinimumOccurs() > 0;
@@ -135,22 +159,22 @@ public final class ServiceParameter<T> e
      * @param  parameter The parameter (may be {@code null}).
      * @return The service parameter, or {@code null} if the given argument was null.
      */
-    public static ServiceParameter<?> castOrCopy(final ParameterDescriptor<?> parameter) {
-        if (parameter == null || parameter instanceof ServiceParameter<?>) {
-            return (ServiceParameter<?>) parameter;
+    public static ServiceParameter castOrCopy(final ParameterDescriptor<?> parameter) {
+        if (parameter == null || parameter instanceof ServiceParameter) {
+            return (ServiceParameter) parameter;
         }
         return new ServiceParameter(parameter);
     }
 
     /**
-     * Gets the parameter name as a {@code MemberName}. This method first check if the primary name is an instance of
+     * Gets the parameter name as a {@code MemberName}. This method first checks if the primary name is an instance of
      * {@code MemberName}. If not, this method searches for the first alias which is an instance of {@code MemberName}.
      * If none is found, then this method tries to build a member name from the primary name and value class.
      *
      * @param  parameter The parameter from which to get the name (may be {@code null}).
      * @return The member name, or {@code null} if none.
      */
-    public static MemberName getName(final ParameterDescriptor<?> parameter) {
+    public static MemberName getMemberName(final ParameterDescriptor<?> parameter) {
         if (parameter != null) {
             final ReferenceIdentifier id = parameter.getName();
             if (id instanceof MemberName) {
@@ -166,7 +190,7 @@ public final class ServiceParameter<T> e
                 if (valueClass != null) {
                     final String code = id.getCode();
                     if (code != null) {
-                        // TODO return Names.createMemberName(id.getCodeSpace(), ":", code, valueClass);
+                        return Names.createMemberName(id.getCodeSpace(), ":", code, valueClass);
                     }
                 }
             }
@@ -174,9 +198,37 @@ public final class ServiceParameter<T> e
         return null;
     }
 
+    /**
+     * Returns the name as an {@code Identifier}, which is the type requested by ISO 19111.
+     * Note that this is different than the type requested by ISO 19115, which is {@link MemberName}.
+     *
+     * This method is the converse of {@link #getMemberName(ParameterDescriptor)}.
+     *
+     * @return The parameter name as an identifier (the type specified by ISO 19111).
+     */
+    @Override
+    public synchronized ReferenceIdentifier getName() {
+        if (name == null && memberName != null) {
+            if (memberName instanceof ReferenceIdentifier) {
+                name = (ReferenceIdentifier) memberName;
+            } else {
+                name = new NameToIdentifier(memberName);
+            }
+        }
+        return name;
+    }
+
+    /**
+     * Infers the value class from the attribute type.
+     * This method is the reason why we can not parameterize this {@code ServiceParameter} class
+     * (see <cite>Note about raw-type usage</cite> in class javadoc), since there is no way we
+     * can ensure that the returned class is really for type {@code <T>}.
+     *
+     * @return The value class inferred from the attribute type, or {@code null} if unknown.
+     */
     @Override
-    public Class<T> getValueClass() {
-        throw new UnsupportedOperationException("Not supported yet."); // TODO
+    public Class<?> getValueClass() {
+        return (memberName != null) ? Names.toClass(memberName.getAttributeType()) : null;
     }
 
     /**
@@ -186,14 +238,24 @@ public final class ServiceParameter<T> e
      */
     @XmlElement(name = "valueType")
     final TypeName getValueType() {
-        return (LEGACY_XML && name != null) ? name.getAttributeType() : null;
+        return (LEGACY_XML && memberName != null) ? memberName.getAttributeType() : null;
     }
 
+    /**
+     * Returns an indication if the parameter is an input to the service, an output or both.
+     *
+     * @return Indication if the parameter is an input or output to the service, or {@code null} if unspecified.
+     */
     @Override
     public ParameterDirection getDirection() {
         return direction;
     }
 
+    /**
+     * Returns a narrative explanation of the role of the parameter.
+     *
+     * @return A narrative explanation of the role of the parameter, or {@code null} if none.
+     */
     @Override
     public InternationalString getDescription() {
         return description;
@@ -217,24 +279,93 @@ public final class ServiceParameter<T> e
         }
     }
 
+    /**
+     * The minimum number of times that values for this parameter group or parameter are required.
+     *
+     * @return The minimum occurrence.
+     */
     @Override
     public int getMinimumOccurs() {
         return optionality ? 0 : 1;
     }
 
+    /**
+     * The maximum number of times that values for this parameter group or parameter can be included.
+     *
+     * @return The maximum occurrence.
+     */
     @Override
     public int getMaximumOccurs() {
         return repeatability ? Integer.MAX_VALUE : 1;
     }
 
-    @Override public Set<T>        getValidValues()  {return null;}
-    @Override public Comparable<T> getMinimumValue() {return null;}
-    @Override public Comparable<T> getMaximumValue() {return null;}
-    @Override public T             getDefaultValue() {return null;}
+    /**
+     * Optional properties.
+     * @return {@code null}.
+     */
+    @Override public Set<?>        getValidValues()  {return null;} // Really null, not an empty set. See method contract.
+    @Override public Comparable<?> getMinimumValue() {return null;}
+    @Override public Comparable<?> getMaximumValue() {return null;}
+    @Override public Object        getDefaultValue() {return null;}
     @Override public Unit<?>       getUnit()         {return null;}
 
+    /**
+     * Creates a new instance of {@code ParameterValue}.
+     * This method delegates the work to {@link org.apache.sis.parameter.DefaultParameterDescriptor}
+     * since this {@code ServiceParameter} class is not a full-featured parameter descriptor implementation.
+     *
+     * @return A new instance of {@code ParameterValue}.
+     */
     @Override
-    public ParameterValue<T> createValue() {
-        throw new UnsupportedOperationException("Not supported yet."); // TODO
+    public ParameterValue<?> createValue() {
+        ParameterDescriptor<?> desc;
+        synchronized (this) {
+            desc = descriptor;
+            if (desc == null) {
+                descriptor = desc = ReferencingServices.getInstance().toImplementation(this);
+            }
+        }
+        return desc.createValue();
+    }
+
+    /**
+     * Compares this object with the given one for equality.
+     *
+     * @param  object The object to compare with this reference system.
+     * @param  mode The strictness level of the comparison.
+     * @return {@code true} if both objects are equal.
+     */
+    @Override
+    public boolean equals(final Object object, final ComparisonMode mode) {
+        if (object == this) {
+            return true;
+        }
+        if (super.equals(object, mode) && object instanceof ParameterDescriptor<?>) {
+            final ParameterDescriptor<?> that = (ParameterDescriptor<?>) object;
+            if (that.getUnit()         == null &&
+                that.getDefaultValue() == null &&
+                that.getValueClass()   == getValueClass())
+            {
+                if (mode.ordinal() >= ComparisonMode.IGNORE_METADATA.ordinal()) {
+                    return Objects.equals(toString(getName()), toString(that.getName()));
+                }
+                return deepEquals(that.getDescription(), getDescription(), mode) &&
+                       that.getDirection()     == getDirection()     &&
+                       that.getMinimumOccurs() == getMinimumOccurs() &&
+                       that.getMaximumOccurs() == getMaximumOccurs() &&
+                       that.getValidValues()   == null &&
+                       that.getMinimumValue()  == null &&
+                       that.getMaximumValue()  == null;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Null-safe string representation of the given identifier, for comparison purpose.
+     * We ignore codespace because they can not be represented in ISO 19139 XML documents.
+     */
+    private static String toString(final ReferenceIdentifier identifier) {
+        return (identifier != null) ? identifier.toString() : null;
     }
 }

Copied: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java (from r1625167, sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java?p2=sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java&p1=sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java&r1=1625167&r2=1625169&rev=1625169&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -29,7 +29,7 @@ import org.apache.sis.util.iso.DefaultNa
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
 // Branch-dependent imports
-import java.util.Objects;
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.metadata;
 
 import org.opengis.geometry.Envelope;
+import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
@@ -38,8 +39,8 @@ import org.apache.sis.util.resources.Err
  * implementation using Java reflection.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.4 (derived from geotk-3.18)
- * @version 0.3
+ * @since   0.3 (derived from geotk-3.18)
+ * @version 0.5
  * @module
  */
 public abstract class ReferencingServices extends SystemListener {
@@ -118,6 +119,16 @@ public abstract class ReferencingService
     public abstract Matrix getMatrix(MathTransform tr);
 
     /**
+     * Returns a fully implemented parameter descriptor.
+     *
+     * @param  parameter A partially implemented parameter descriptor, or {@code null}.
+     * @return A fully implemented parameter descriptor, or {@code null} if the given argument was null.
+     *
+     * @since 0.5
+     */
+    public abstract ParameterDescriptor<?> toImplementation(ParameterDescriptor<?> parameter);
+
+    /**
      * Converts the given object in a {@link org.apache.sis.io.wkt.FormattableObject} instance.
      *
      * @param  object The object to wrap.

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -217,10 +217,10 @@ public class ImmutableIdentifier extends
      *
      * @param authority
      *          Organization or party responsible for definition and maintenance of the code
-     *          space or code.
+     *          space or code, or {@code null} if not available.
      * @param codeSpace
-     *          Name or identifier of the person or organization responsible for namespace.
-     *          This is often an abbreviation of the authority name.
+     *          Name or identifier of the person or organization responsible for namespace, or
+     *          {@code null} if not available. This is often an abbreviation of the authority name.
      * @param code
      *          Identifier code or name, optionally from a controlled list or pattern defined by
      *          a code space. The code can not be null.

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -17,14 +17,13 @@
 package org.apache.sis.internal.jaxb.metadata.replace;
 
 import javax.xml.bind.JAXBException;
-import org.opengis.util.TypeName;
 import org.opengis.util.MemberName;
 import org.opengis.parameter.ParameterDirection;
-import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.util.iso.Names;
 import org.apache.sis.xml.Namespaces;
+import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.internal.system.DefaultFactories.SIS_NAMES;
 import static org.apache.sis.test.Assert.*;
 
 
@@ -42,24 +41,32 @@ public final strictfp class ServiceParam
      *
      * @return The test parameter.
      */
-    public static ServiceParameter<?> create() {
-        final TypeName   valueType = SIS_NAMES.createTypeName(null, "CharacterString");
-        final MemberName paramName = SIS_NAMES.createMemberName(null, "Version", valueType);
-        final ServiceParameter<?> param = new ServiceParameter();
-        param.name          = paramName;
+    public static ServiceParameter create() {
+        final MemberName paramName = Names.createMemberName(null, ":", "Version", String.class);
+        final ServiceParameter param = new ServiceParameter();
+        param.memberName    = paramName;
         param.optionality   = true;
         param.repeatability = false;
         param.direction     = ParameterDirection.IN;
-        assertSame("valueType", valueType, param.getValueType());
         return param;
     }
 
     /**
+     * Tests {@link ServiceParameter#getValueType()} and {@link ServiceParameter#getValueClass()}.
+     */
+    @Test
+    public void testGetValueType() {
+        final ServiceParameter param = create();
+        assertEquals("valueType", "OGC:CharacterString", param.getValueType().toFullyQualifiedName().toString());
+        assertEquals("valueClass", String.class, param.getValueClass());
+    }
+
+    /**
      * Tests {@link ServiceParameter#getOptionality()} and {@link ServiceParameter#setOptionality(String)}.
      */
     @Test
     public void testOptionalityLabel() {
-        final ServiceParameter<?> param = create();
+        final ServiceParameter param = create();
         assertEquals("Optional", param.getOptionality());
 
         param.optionality = false;

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultCoupledResourceTest.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -17,6 +17,7 @@
 package org.apache.sis.metadata.iso.service;
 
 import org.opengis.util.ScopedName;
+import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.metadata.citation.OnlineResource;
 import org.opengis.metadata.service.CoupledResource;
 import org.opengis.metadata.service.OperationMetadata;
@@ -48,7 +49,7 @@ public final strictfp class DefaultCoupl
     static DefaultCoupledResource create() {
         final DefaultOperationMetadata operation = new DefaultOperationMetadata("Get Map",
                 DistributedComputingPlatform.WEB_SERVICES, null);
-        operation.setParameters(singleton(ServiceParameterTest.create()));
+        operation.setParameters(singleton((ParameterDescriptor<?>) ServiceParameterTest.create()));
         operation.setConnectPoints(singleton(NilReason.MISSING.createNilObject(OnlineResource.class)));
 
         final DefaultCoupledResource resource = new DefaultCoupledResource();

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/DefaultServiceIdentificationTest.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -19,6 +19,7 @@ package org.apache.sis.metadata.iso.serv
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.service.CouplingType;
+import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.xml.NilReason;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.XMLTestCase;
@@ -83,6 +84,6 @@ public final strictfp class DefaultServi
      */
     @Test
     public void testUnmarshal() throws JAXBException {
-        assertEquals(create(), unmarshalFile(DefaultServiceIdentification.class, XML_FILE));
+        assertTrue(create().equals(unmarshalFile(DefaultServiceIdentification.class, XML_FILE), ComparisonMode.DEBUG));
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -17,59 +17,354 @@
 package org.apache.sis.parameter;
 
 import java.util.Map;
+import javax.measure.unit.Unit;
 import org.opengis.util.InternationalString;
 import org.opengis.parameter.ParameterDirection;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.iso.Types;
+import org.apache.sis.util.Debug;
+
+import static org.apache.sis.util.Utilities.deepEquals;
+
+// Branch-dependent imports
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**
- * Base class of parameter descriptors.
+ * Abstract definition of a parameter or group of parameters used by a coordinate operation or a process.
+ * This interface combines information provided by Referencing by Coordinates (ISO 19111),
+ * Service Metadata (ISO 19115) and Web Processing Services (WPS) standards.
+ * The main information are:
+ *
+ * <table class="ogc">
+ *   <caption>Main parameter properties</caption>
+ *   <tr>
+ *     <th>Getter method</th>
+ *     <th>ISO 19111</th>
+ *     <th>WPS</th>
+ *     <th>ISO 19115</th>
+ *     <th class="sep">Remarks</th>
+ *   </tr>
+ *   <tr>
+ *      <td>{@link #getName()}</td>
+ *      <td>{@code name}</td>
+ *      <td>{@code Identifier}</td>
+ *      <td>{@code name}</td>
+ *      <td class="sep">See {@linkplain #getName() method javadoc} for {@code MemberName} ↔ {@code Identifier} mapping.</td>
+ *   </tr>
+ *   <!-- "Title" (WPS) equivalent to "designation" (Feature), but not yet provided. -->
+ *   <tr>
+ *      <td>{@link #getDescription()}</td>
+ *      <td></td>
+ *      <td>{@code Abstract}</td>
+ *      <td>{@code description}</td>
+ *      <td class="sep">Also known as “definition”.</td>
+ *   </tr>
+ *   <tr>
+ *      <td>{@link #getDirection()}</td>
+ *      <td></td>
+ *      <td></td>
+ *      <td>{@code direction}</td>
+ *      <td class="sep">Tells if the parameter is a WPS {@code Input} or {@code Output} structure.</td>
+ *   </tr>
+ *   <tr>
+ *      <td>{@link #getMinimumOccurs()}</td>
+ *      <td>{@code minimumOccurs}</td>
+ *      <td>{@code MinOccurs}</td>
+ *      <td>{@code optionality}</td>
+ *      <td class="sep">{@code optionality   = (minimumOccurs > 0)}</td>
+ *   </tr>
+ *   <tr>
+ *      <td>{@link #getMaximumOccurs()}</td>
+ *      <td>{@code maximumOccurs}</td>
+ *      <td>{@code MaxOccurs}</td>
+ *      <td>{@code repeatability}</td>
+ *      <td class="sep">{@code repeatability = (maximumOccurs > 1)}</td>
+ *   </tr>
+ * </table>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
  * @version 0.5
  * @module
  */
-abstract class AbstractParameterDescriptor extends AbstractIdentifiedObject implements GeneralParameterDescriptor {
+public abstract class AbstractParameterDescriptor extends AbstractIdentifiedObject implements GeneralParameterDescriptor {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -4346475760810353590L;
 
-    protected AbstractParameterDescriptor(final Map<String,?> properties) {
+    /**
+     * Key for the {@value} property to be given to the constructor.
+     * This is used for setting the value to be returned by {@link #getDescription()}.
+     */
+    public static final String DESCRIPTION_KEY = "description";
+
+    /**
+     * A narrative explanation of the role of the parameter, or {@code null} if none.
+     */
+    private final InternationalString description;
+
+    /**
+     * The minimum number of times that values for this parameter group are required, as an unsigned short.
+     * We use a short because this value is usually either 0 or 1, or a very small number like 2 or 3.
+     * A large number would be a bad idea with this parameter implementation.
+     */
+    private final short minimumOccurs;
+
+    /**
+     * The maximum number of times that values for this parameter group are required, as an unsigned short.
+     * Value {@code 0xFFFF} (or -1) means an unrestricted number of occurrences.
+     *
+     * <p>We use a short because this value is usually 1 or a very small number like 2 or 3. This also serve
+     * as a safety since a large number would be a bad idea with this parameter implementation.</p>
+     */
+    private final short maximumOccurs;
+
+    /**
+     * Constructs a parameter descriptor from a set of properties. The properties map is given unchanged to the
+     * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
+     * The following table is a reminder of main (not all) properties:
+     *
+     * <table class="sis">
+     *   <caption>Recognized properties (non exhaustive list)</caption>
+     *   <tr>
+     *     <th>Property name</th>
+     *     <th>Value type</th>
+     *     <th>Returned by</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td>
+     *     <td>{@link org.opengis.referencing.ReferenceIdentifier} or {@link String}</td>
+     *     <td>{@link #getName()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td>
+     *     <td>{@link org.opengis.util.GenericName} or {@link CharSequence} (optionally as array)</td>
+     *     <td>{@link #getAlias()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td>
+     *     <td>{@link org.opengis.referencing.ReferenceIdentifier} (optionally as array)</td>
+     *     <td>{@link #getIdentifiers()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.apache.sis.parameter.AbstractParameterDescriptor#DESCRIPTION_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getDescription()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getRemarks()}</td>
+     *   </tr>
+     * </table>
+     *
+     * @param properties    The properties to be given to the identified object.
+     * @param minimumOccurs The {@linkplain #getMinimumOccurs() minimum number of times} that values
+     *                      for this parameter group are required, or 0 if no restriction.
+     * @param maximumOccurs The {@linkplain #getMaximumOccurs() maximum number of times} that values
+     *                      for this parameter group are required, or {@link Integer#MAX_VALUE} if no restriction.
+     */
+    protected AbstractParameterDescriptor(final Map<String,?> properties,
+            final int minimumOccurs, final int maximumOccurs)
+    {
         super(properties);
+        this.description   = Types.toInternationalString(properties, DESCRIPTION_KEY);
+        this.minimumOccurs = (short) minimumOccurs;
+        this.maximumOccurs = (short) maximumOccurs;
+        if (minimumOccurs < 0 || minimumOccurs > maximumOccurs || maximumOccurs == 0) {
+            throw new IllegalArgumentException(Errors.getResources(properties).getString(
+                    Errors.Keys.IllegalRange_2, minimumOccurs, maximumOccurs));
+        }
+        if (maximumOccurs > 0xFFFE && maximumOccurs != Integer.MAX_VALUE) {
+            throw new IllegalArgumentException(Errors.getResources(properties).getString(
+                    Errors.Keys.TooManyOccurrences_2, 0xFFFE, super.getName()));
+        }
+    }
+
+    /**
+     * Constructs a new parameter descriptor with the same values than the specified one.
+     * This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a
+     * user-defined one (as a subclass), usually in order to leverage some implementation-specific API.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param descriptor The object to shallow copy.
+     */
+    protected AbstractParameterDescriptor(final GeneralParameterDescriptor descriptor) {
+        super(descriptor);
+        description   = descriptor.getDescription();
+        minimumOccurs = crop(descriptor.getMinimumOccurs());
+        maximumOccurs = crop(descriptor.getMaximumOccurs());
+    }
+
+    /**
+     * Crops the given integer in the [0 … 0xFFFF] range.
+     */
+    private static short crop(final int n) {
+        return (short) Math.max(0, Math.min(0xFFFF, n));
     }
 
-    protected AbstractParameterDescriptor(final GeneralParameterDescriptor other) {
-        super(other);
+    /**
+     * Returns the GeoAPI interface implemented by this class.
+     * The default implementation returns {@code GeneralParameterDescriptor.class}.
+     * Subclasses implementing a more specific GeoAPI interface shall override this method.
+     *
+     * @return The parameter descriptor interface implemented by this class.
+     */
+    @Override
+    public Class<? extends GeneralParameterDescriptor> getInterface() {
+        return GeneralParameterDescriptor.class;
     }
 
+    /**
+     * Returns an indication if the parameter is an input to the service, an output or both.
+     * The default implementation returns {@link ParameterDirection#IN}.
+     *
+     * @return Indication if the parameter is an input or output to the service, or {@code null} if unspecified.
+     */
     @Override
     public ParameterDirection getDirection() {
         return ParameterDirection.IN;
     }
 
+    /**
+     * Returns a narrative explanation of the role of the parameter.
+     *
+     * @return A narrative explanation of the role of the parameter, or {@code null} if none.
+     */
     @Override
     public InternationalString getDescription() {
-        return null;
+        return description;
     }
 
     /**
      * The minimum number of times that values for this parameter group or parameter are required.
-     * The default value is 1. A value of 0 means an optional parameter.
+     * A value of 0 means an optional parameter.
      *
      * @return The minimum occurrence.
      */
     @Override
     public int getMinimumOccurs() {
-        return 1;
+        return minimumOccurs & 0xFFFF;
     }
 
     /**
      * The maximum number of times that values for this parameter group or parameter can be included.
-     * The default value is 1. A value grater than 1 means a repeatable parameter.
+     * A value greater than 1 means a repeatable parameter.
      *
      * @return The maximum occurrence.
      */
     @Override
     public int getMaximumOccurs() {
-        return 1;
+        return (maximumOccurs != -1) ? (maximumOccurs & 0xFFFF) : Integer.MAX_VALUE;
+    }
+
+    /**
+     * Compares the specified object with this parameter for equality.
+     *
+     * @return {@inheritDoc}
+     */
+    @Override
+    public boolean equals(final Object object, final ComparisonMode mode) {
+        if (super.equals(object, mode)) {
+            switch (mode) {
+                case STRICT: {
+                    final AbstractParameterDescriptor that = (AbstractParameterDescriptor) object;
+                    return minimumOccurs == that.minimumOccurs &&
+                           maximumOccurs == that.maximumOccurs &&
+                           Objects.equals(description, that.description);
+                }
+                default: {
+                    final GeneralParameterDescriptor that = (GeneralParameterDescriptor) object;
+                    return getMinimumOccurs() == that.getMinimumOccurs() &&
+                           getMaximumOccurs() == that.getMaximumOccurs() &&
+                           deepEquals(getDescription(), that.getDescription(), mode);
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Returns a string representation of this descriptor.
+     *
+     * <p>This method is for information purpose only and may change in future SIS version.</p>
+     */
+    @Debug
+    @Override
+    public String toString() {
+        if (this instanceof ParameterDescriptorGroup) {
+            return ParameterFormat.sharedFormat(this);
+        } else {
+            return super.toString();
+        }
+    }
+
+    /**
+     * Prints a string representation of this descriptor to the {@linkplain System#out standard output stream}.
+     * If a {@linkplain java.io.Console console} is attached to the running JVM (i.e. if the application is run
+     * from the command-line and the output is not redirected to a file) and if Apache SIS thinks that the console
+     * supports the ANSI escape codes (a.k.a. X3.64), then a syntax coloring will be applied.
+     *
+     * <p>This is a convenience method for debugging purpose and for console applications.</p>
+     */
+    @Debug
+    @Override
+    public void print() {
+        if (this instanceof ParameterDescriptorGroup) {
+            ParameterFormat.print(this);
+        } else {
+            super.print();
+        }
+    }
+
+    /**
+     * Formats this descriptor as a pseudo-<cite>Well Known Text</cite> element. The WKT specification
+     * does not define any representation of parameter descriptors. Apache SIS fallback on a list of
+     * {@linkplain DefaultParameterDescriptor#formatTo(Formatter) descriptors}.
+     * The text formatted by this method is {@linkplain Formatter#setInvalidWKT flagged as invalid WKT}.
+     *
+     * @param  formatter The formatter where to format the inner content of this WKT element.
+     * @return {@code "Parameter"} or {@code "ParameterGroup"}.
+     */
+    @Override
+    @SuppressWarnings({"unchecked","rawtypes"})
+    protected String formatTo(final Formatter formatter) {
+        super.formatTo(formatter);
+        formatter.setInvalidWKT(this, null);
+        if (this instanceof ParameterDescriptorGroup) {
+            for (GeneralParameterDescriptor parameter : ((ParameterDescriptorGroup) this).descriptors()) {
+                if (!(parameter instanceof FormattableObject)) {
+                    if (parameter instanceof ParameterDescriptor<?>) {
+                        parameter = new DefaultParameterDescriptor((ParameterDescriptor<?>) parameter);
+                    } else if (parameter instanceof ParameterDescriptorGroup) {
+                        parameter = new DefaultParameterDescriptorGroup((ParameterDescriptorGroup) parameter);
+                    } else {
+                        continue;
+                    }
+                }
+                formatter.newLine();
+                formatter.append((FormattableObject) parameter);
+            }
+            return "ParameterGroup";
+        } else if (this instanceof ParameterDescriptor<?>) {
+            formatter.appendAny(((ParameterDescriptor<?>) this).getDefaultValue());
+            final Unit<?> unit = ((ParameterDescriptor<?>) this).getUnit();
+            if (unit != null) {
+                if (!formatter.getConvention().isSimplified() || !unit.equals(formatter.toContextualUnit(unit))) {
+                    formatter.append(unit);
+                }
+            }
+        }
+        return "Parameter";
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -27,15 +27,11 @@ import org.apache.sis.util.Classes;
 import org.apache.sis.util.Numbers;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.io.wkt.Formatter;
-import org.apache.sis.io.wkt.ElementKind;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.referencing.AbstractIdentifiedObject;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.ArgumentChecks.ensureCanCast;
@@ -78,14 +74,7 @@ public class DefaultParameterDescriptor<
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = 7433401733923393656L;
-
-    /**
-     * {@code true} if this parameter is mandatory, or {@code false} if it is optional.
-     *
-     * @see #getMinimumOccurs()
-     */
-    private final boolean required;
+    private static final long serialVersionUID = -1978932430298071693L;
 
     /**
      * The class that describe the type of parameter values.
@@ -126,7 +115,7 @@ public class DefaultParameterDescriptor<
 
     /**
      * Constructs a descriptor from the given properties. The properties map is given unchanged to the
-     * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
+     * {@linkplain AbstractParameterDescriptor#AbstractParameterDescriptor(Map) super-class constructor}.
      * The following table is a reminder of main (not all) properties:
      *
      * <table class="sis">
@@ -152,6 +141,11 @@ public class DefaultParameterDescriptor<
      *     <td>{@link #getIdentifiers()}</td>
      *   </tr>
      *   <tr>
+     *     <td>{@value org.apache.sis.parameter.AbstractParameterDescriptor#DESCRIPTION_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getDescription()}</td>
+     *   </tr>
+     *   <tr>
      *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
      *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
      *     <td>{@link #getRemarks()}</td>
@@ -179,25 +173,29 @@ public class DefaultParameterDescriptor<
      * If both {@code valueDomain} and {@code validValues} are non-null, then all valid values shall be contained
      * in the value domain.
      *
-     * @param properties   The properties to be given to the identified object.
-     * @param valueClass   The class that describes the type of the parameter value.
-     * @param valueDomain  The minimum value, maximum value and unit of measurement, or {@code null} if none.
-     * @param validValues  The list of valid values, or {@code null} if there is no restriction.
-     *                     This property is mostly for restricting values to a {@linkplain CodeList code list}
-     *                     or enumeration subset. It is not necessary to provide this property when all values
-     *                     from the code list or enumeration are valid.
-     * @param defaultValue The default value for the parameter, or {@code null} if none.
-     * @param required     {@code true} if this parameter is mandatory, or {@code false} if it is optional.
+     * @param properties    The properties to be given to the identified object.
+     * @param minimumOccurs The {@linkplain #getMinimumOccurs() minimum number of times} that values
+     *                      for this parameter group are required, or 0 if no restriction.
+     * @param maximumOccurs The {@linkplain #getMaximumOccurs() maximum number of times} that values
+     *                      for this parameter group are required, or {@link Integer#MAX_VALUE} if no restriction.
+     * @param valueClass    The class that describes the type of the parameter value.
+     * @param valueDomain   The minimum value, maximum value and unit of measurement, or {@code null} if none.
+     * @param validValues   The list of valid values, or {@code null} if there is no restriction.
+     *                      This property is mostly for restricting values to a {@linkplain CodeList code list}
+     *                      or enumeration subset. It is not necessary to provide this property when all values
+     *                      from the code list or enumeration are valid.
+     * @param defaultValue  The default value for the parameter, or {@code null} if none.
      */
     @SuppressWarnings("unchecked")
     public DefaultParameterDescriptor(final Map<String,?> properties,
+                                      final int           minimumOccurs,
+                                      final int           maximumOccurs,
                                       final Class<T>      valueClass,
                                       final Range<?>      valueDomain,
                                       final T[]           validValues,
-                                      final T             defaultValue,
-                                      final boolean       required)
+                                      final T             defaultValue)
     {
-        super(properties);
+        super(properties, minimumOccurs, maximumOccurs);
         ensureNonNull("valueClass",   valueClass);
         ensureCanCast("defaultValue", valueClass, defaultValue);
         if (valueDomain != null) {
@@ -218,7 +216,6 @@ public class DefaultParameterDescriptor<
                         .getString(Errors.Keys.IllegalRange_2, valueDomain.getMinValue(), valueDomain.getMaxValue()));
             }
         }
-        this.required     = required;
         this.valueClass   = valueClass;
         this.valueDomain  = valueDomain;
         this.defaultValue = Numerics.cached(defaultValue);
@@ -254,6 +251,33 @@ public class DefaultParameterDescriptor<
     }
 
     /**
+     * Creates an optional or mandatory parameter. As a consequence of the merge with ISO 19115 {@code SV_Parameter},
+     * {@code DefaultParameterDescriptor} has been generalized to accept an arbitrary amount of occurrences.
+     *
+     * @param properties   The properties to be given to the identified object.
+     * @param valueClass   The class that describes the type of the parameter value.
+     * @param valueDomain  The minimum value, maximum value and unit of measurement, or {@code null} if none.
+     * @param validValues  The list of valid values, or {@code null} if there is no restriction.
+     *                     This property is mostly for restricting values to a {@linkplain CodeList code list}
+     *                     or enumeration subset. It is not necessary to provide this property when all values
+     *                     from the code list or enumeration are valid.
+     * @param defaultValue The default value for the parameter, or {@code null} if none.
+     * @param required     {@code true} if this parameter is mandatory, or {@code false} if it is optional.
+     *
+     * @deprecated Replaced by the constructor with explicit minimum and maximum number of occurrences.
+     */
+    @Deprecated
+    public DefaultParameterDescriptor(final Map<String,?> properties,
+                                      final Class<T>      valueClass,
+                                      final Range<?>      valueDomain,
+                                      final T[]           validValues,
+                                      final T             defaultValue,
+                                      final boolean       required)
+    {
+        this(properties, required ? 1 : 0, 1, valueClass, valueDomain, validValues, defaultValue);
+    }
+
+    /**
      * Creates a new descriptor with the same values than the specified one.
      * This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a
      * user-defined one (as a subclass), usually in order to leverage some implementation-specific API.
@@ -267,7 +291,6 @@ public class DefaultParameterDescriptor<
     @SuppressWarnings("unchecked")
     protected DefaultParameterDescriptor(final ParameterDescriptor<T> descriptor) {
         super(descriptor);
-        required     = descriptor.getMinimumOccurs() != 0;
         valueClass   = descriptor.getValueClass();
         validValues  = descriptor.getValidValues();
         defaultValue = descriptor.getDefaultValue();
@@ -308,30 +331,6 @@ public class DefaultParameterDescriptor<
     }
 
     /**
-     * The minimum number of times that values for this parameter are required.
-     * A value of 0 means an optional parameter and a value of 1 means a mandatory parameter.
-     *
-     * @see #getMaximumOccurs()
-     */
-    @Override
-    public int getMinimumOccurs() {
-        return required ? 1 : 0;
-    }
-
-    /**
-     * The maximum number of times that values for this parameter can be included.
-     * For a {@code ParameterDescriptor}, the value is always 1.
-     *
-     * @return The maximum occurrence.
-     *
-     * @see #getMinimumOccurs()
-     */
-    @Override
-    public int getMaximumOccurs() {
-        return 1;
-    }
-
-    /**
      * Creates a new parameter value instance initialized with the {@linkplain #getDefaultValue() default value}.
      * The {@linkplain DefaultParameterDescriptor parameter descriptor} for the created parameter value will be
      * {@code this} object.
@@ -507,8 +506,7 @@ public class DefaultParameterDescriptor<
                 }
                 case STRICT: {
                     final DefaultParameterDescriptor<?> that = (DefaultParameterDescriptor<?>) object;
-                    return                    this.required   == that.required     &&
-                                              this.valueClass == that.valueClass   &&
+                    return                    this.valueClass == that.valueClass   &&
                            Objects.    equals(this.validValues,  that.validValues) &&
                            Objects.    equals(this.valueDomain,  that.valueDomain) &&
                            Objects.deepEquals(this.defaultValue, that.defaultValue);
@@ -525,31 +523,6 @@ public class DefaultParameterDescriptor<
      */
     @Override
     protected long computeHashCode() {
-        return Arrays.deepHashCode(new Object[] {required, valueClass, valueDomain, defaultValue})
-                + super.computeHashCode();
-    }
-
-    /**
-     * Formats this parameter as a pseudo-<cite>Well Known Text</cite> element. The WKT specification
-     * does not define any representation of parameter descriptors. Apache SIS fallback on the
-     * {@linkplain DefaultParameterValue#formatTo(Formatter) same representation than parameter value},
-     * with the descriptor {@linkplain #getDefaultValue() default value} in place of the parameter value.
-     * The text formatted by this method is {@linkplain Formatter#setInvalidWKT flagged as invalid WKT}.
-     *
-     * @param  formatter The formatter where to format the inner content of this WKT element.
-     * @return {@code "Parameter"}.
-     */
-    @Override
-    protected String formatTo(final Formatter formatter) {
-        WKTUtilities.appendName(this, formatter, ElementKind.PARAMETER);
-        formatter.setInvalidWKT(this, null);
-        formatter.appendAny(defaultValue);
-        final Unit<?> unit = getUnit();
-        if (unit != null) {
-            if (!formatter.getConvention().isSimplified() || !unit.equals(formatter.toContextualUnit(unit))) {
-                formatter.append(unit);
-            }
-        }
-        return "Parameter";
+        return Arrays.deepHashCode(new Object[] {valueClass, valueDomain, defaultValue}) + super.computeHashCode();
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -22,21 +22,15 @@ import java.util.List;
 import java.util.HashSet;
 import java.util.Collections;
 import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterNotFoundException;
 import org.opengis.parameter.InvalidParameterNameException;
-import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
-import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.io.wkt.FormattableObject;
-import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Debug;
 
 import static org.apache.sis.util.Utilities.deepEquals;
 
@@ -99,17 +93,7 @@ public class DefaultParameterDescriptorG
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -4613190550542423839L;
-
-    /**
-     * The minimum number of times that values for this parameter group are required.
-     */
-    private final int minimumOccurs;
-
-    /**
-     * The maximum number of times that values for this parameter group are required.
-     */
-    private final int maximumOccurs;
+    private static final long serialVersionUID = 6058599597772994456L;
 
     /**
      * The {@linkplain #descriptors() parameter descriptors} for this group.
@@ -118,7 +102,7 @@ public class DefaultParameterDescriptorG
 
     /**
      * Constructs a parameter group from a set of properties. The properties map is given unchanged to the
-     * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
+     * {@linkplain AbstractParameterDescriptor#AbstractParameterDescriptor(Map) super-class constructor}.
      * The following table is a reminder of main (not all) properties:
      *
      * <table class="sis">
@@ -144,6 +128,11 @@ public class DefaultParameterDescriptorG
      *     <td>{@link #getIdentifiers()}</td>
      *   </tr>
      *   <tr>
+     *     <td>{@value org.apache.sis.parameter.AbstractParameterDescriptor#DESCRIPTION_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getDescription()}</td>
+     *   </tr>
+     *   <tr>
      *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
      *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
      *     <td>{@link #getRemarks()}</td>
@@ -151,10 +140,10 @@ public class DefaultParameterDescriptorG
      * </table>
      *
      * @param properties    The properties to be given to the identified object.
-     * @param minimumOccurs The {@linkplain #getMinimumOccurs() minimum number of times}
-     *                      that values for this parameter group are required.
-     * @param maximumOccurs The {@linkplain #getMaximumOccurs() maximum number of times}
-     *                      that values for this parameter group are required.
+     * @param minimumOccurs The {@linkplain #getMinimumOccurs() minimum number of times} that values
+     *                      for this parameter group are required, or 0 if no restriction.
+     * @param maximumOccurs The {@linkplain #getMaximumOccurs() maximum number of times} that values
+     *                      for this parameter group are required, or {@link Integer#MAX_VALUE} if no restriction.
      * @param parameters    The {@linkplain #descriptors() parameter descriptors} for this group.
      *
      * @throws InvalidParameterNameException If a parameter name is duplicated.
@@ -162,13 +151,7 @@ public class DefaultParameterDescriptorG
     public DefaultParameterDescriptorGroup(final Map<String,?> properties,
             final int minimumOccurs, final int maximumOccurs, GeneralParameterDescriptor... parameters)
     {
-        super(properties);
-        this.minimumOccurs = minimumOccurs;
-        this.maximumOccurs = maximumOccurs;
-        if (minimumOccurs < 0  || minimumOccurs > maximumOccurs || maximumOccurs == 0) {
-            throw new IllegalArgumentException(Errors.getResources(properties).getString(
-                    Errors.Keys.IllegalRange_2, minimumOccurs, maximumOccurs));
-        }
+        super(properties, minimumOccurs, maximumOccurs);
         ArgumentChecks.ensureNonNull("parameters", parameters);
         parameters = parameters.clone();
         for (int i=0; i<parameters.length; i++) {
@@ -198,8 +181,6 @@ public class DefaultParameterDescriptorG
      */
     protected DefaultParameterDescriptorGroup(final ParameterDescriptorGroup descriptor) {
         super(descriptor);
-        minimumOccurs = descriptor.getMinimumOccurs();
-        maximumOccurs = descriptor.getMaximumOccurs();
         final List<GeneralParameterDescriptor> c = descriptor.descriptors();
         if (descriptor instanceof DefaultParameterDescriptorGroup &&
                 ((DefaultParameterDescriptorGroup) descriptor).descriptors == c)
@@ -282,27 +263,6 @@ public class DefaultParameterDescriptorG
     }
 
     /**
-     * The minimum number of times that values for this parameter group or parameter are required.
-     * A value of 0 means an optional parameter.
-     *
-     * @return The minimum occurrence.
-     */
-    @Override
-    public int getMinimumOccurs() {
-        return minimumOccurs;
-    }
-
-    /**
-     * The maximum number of times that values for this parameter group are required.
-     *
-     * @return The maximum occurrence.
-     */
-    @Override
-    public int getMaximumOccurs() {
-        return maximumOccurs;
-    }
-
-    /**
      * Creates a new instance of {@linkplain DefaultParameterValueGroup parameter value group}
      * initialized with the {@linkplain DefaultParameterDescriptor#getDefaultValue default values}.
      * The {@linkplain DefaultParameterValueGroup#getDescriptor() parameter descriptor} for the
@@ -375,16 +335,10 @@ public class DefaultParameterDescriptorG
         if (super.equals(object, mode)) {
             switch (mode) {
                 case STRICT: {
-                    final DefaultParameterDescriptorGroup that = (DefaultParameterDescriptorGroup) object;
-                    return minimumOccurs == that.minimumOccurs &&
-                           maximumOccurs == that.maximumOccurs &&
-                           descriptors.equals(that.descriptors);
+                    return descriptors.equals(((DefaultParameterDescriptorGroup) object).descriptors);
                 }
                 default: {
-                    final ParameterDescriptorGroup that = (ParameterDescriptorGroup) object;
-                    return getMinimumOccurs() == that.getMinimumOccurs() &&
-                           getMaximumOccurs() == that.getMaximumOccurs() &&
-                           deepEquals(descriptors(), that.descriptors(), mode);
+                    return deepEquals(descriptors(), ((ParameterDescriptorGroup) object).descriptors(), mode);
                 }
             }
         }
@@ -400,60 +354,4 @@ public class DefaultParameterDescriptorG
     protected long computeHashCode() {
         return super.computeHashCode() + descriptors.hashCode();
     }
-
-    /**
-     * Returns a string representation of this descriptor.
-     * The default implementation delegates to {@link ParameterFormat}.
-     *
-     * <p>This method is for information purpose only and may change in future SIS version.</p>
-     */
-    @Debug
-    @Override
-    public String toString() {
-        return ParameterFormat.sharedFormat(this);
-    }
-
-    /**
-     * Prints a string representation of this descriptor to the {@linkplain System#out standard output stream}.
-     * If a {@linkplain java.io.Console console} is attached to the running JVM (i.e. if the application is run
-     * from the command-line and the output is not redirected to a file) and if Apache SIS thinks that the console
-     * supports the ANSI escape codes (a.k.a. X3.64), then a syntax coloring will be applied.
-     *
-     * <p>This is a convenience method for debugging purpose and for console applications.</p>
-     */
-    @Debug
-    @Override
-    public void print() {
-        ParameterFormat.print(this);
-    }
-
-    /**
-     * Formats this group as a pseudo-<cite>Well Known Text</cite> element. The WKT specification
-     * does not define any representation of parameter descriptors. Apache SIS fallback on a list
-     * of {@linkplain DefaultParameterDescriptor#formatTo(Formatter) single descriptors}.
-     * The text formatted by this method is {@linkplain Formatter#setInvalidWKT flagged as invalid WKT}.
-     *
-     * @param  formatter The formatter where to format the inner content of this WKT element.
-     * @return {@code "ParameterGroup"}.
-     */
-    @Override
-    @SuppressWarnings({"unchecked","rawtypes"})
-    protected String formatTo(final Formatter formatter) {
-        WKTUtilities.appendName(this, formatter, null);
-        formatter.setInvalidWKT(this, null);
-        for (GeneralParameterDescriptor parameter : descriptors) {
-            if (!(parameter instanceof FormattableObject)) {
-                if (parameter instanceof ParameterDescriptor<?>) {
-                    parameter = new DefaultParameterDescriptor((ParameterDescriptor<?>) parameter);
-                } else if (parameter instanceof ParameterDescriptorGroup) {
-                    parameter = new DefaultParameterDescriptorGroup((ParameterDescriptorGroup) parameter);
-                } else {
-                    continue;
-                }
-            }
-            formatter.newLine();
-            formatter.append((FormattableObject) parameter);
-        }
-        return "ParameterGroup";
-    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -276,8 +276,8 @@ public class ParameterBuilder extends Bu
         final ParameterDescriptor<T> descriptor;
         onCreate(false);
         try {
-            descriptor = new DefaultParameterDescriptor<T>(properties,
-                    valueClass, valueDomain, validValues, defaultValue, required);
+            descriptor = new DefaultParameterDescriptor<T>(properties, required ? 1 : 0, 1,
+                    valueClass, valueDomain, validValues, defaultValue);
         } finally {
             onCreate(true);
         }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -50,7 +50,7 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.internal.referencing.NameToIdentifier;
+import org.apache.sis.internal.metadata.NameToIdentifier;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.util.X364;
 

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -38,7 +38,7 @@ import org.apache.sis.io.wkt.Colors;
 import org.apache.sis.io.wkt.ElementKind;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.RangeFormat;
-import org.apache.sis.internal.referencing.NameToIdentifier;
+import org.apache.sis.internal.metadata.NameToIdentifier;
 import org.apache.sis.internal.util.X364;
 
 import static org.apache.sis.internal.util.X364.*;

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -17,8 +17,10 @@
 package org.apache.sis.parameter;
 
 import javax.measure.unit.Unit;
-import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.util.MemberName;
 import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterDescriptor;
+import org.apache.sis.internal.jaxb.metadata.replace.ServiceParameter;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.measure.MeasurementRange;
@@ -31,7 +33,7 @@ import org.apache.sis.util.Static;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4 (derived from geotk-2.1)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final class Parameters extends Static {
@@ -136,4 +138,33 @@ public final class Parameters extends St
         }
         return null;
     }
+
+    /**
+     * Gets the parameter name as an instance of {@code MemberName}.
+     * This method performs the following checks:
+     *
+     * <ul>
+     *   <li>If the {@linkplain DefaultParameterDescriptor#getName()} primary name is an instance of {@code MemberName},
+     *       returns that primary name.</li>
+     *   <li>Otherwise this method searches for the first {@linkplain DefaultParameterDescriptor#getAlias() alias}
+     *       which is an instance of {@code MemberName}. If found, that alias is returned.</li>
+     *   <li>If no alias is found, then this method tries to build a member name from the primary name and the
+     *       {@linkplain DefaultParameterDescriptor#getValueClass() value class}, using the mapping defined in
+     *       {@link org.apache.sis.util.iso.DefaultTypeName} javadoc.</li>
+     * </ul>
+     *
+     * This method can be used as a bridge between the parameter object
+     * defined by ISO 19111 (namely {@code CC_OperationParameter}) and the one
+     * defined by ISO 19115 (namely {@code SV_Parameter}).
+     *
+     * @param  parameter The parameter from which to get the name (may be {@code null}).
+     * @return The member name, or {@code null} if none.
+     *
+     * @see org.apache.sis.util.iso.Names#createMemberName(CharSequence, String, CharSequence, Class)
+     *
+     * @since 0.5
+     */
+    public static MemberName getMemberName(final ParameterDescriptor<?> parameter) {
+        return ServiceParameter.getMemberName(parameter);
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -140,9 +140,9 @@ public class TensorParameters<E> impleme
         final Map<String,Object> properties = new HashMap<String,Object>(4);
         properties.put(ReferenceIdentifier.AUTHORITY_KEY, Citations.OGC);
         properties.put(ReferenceIdentifier.CODE_KEY, "num_row");
-        numRow = new DefaultParameterDescriptor<Integer>(properties, Integer.class, valueDomain, null, defaultSize, true);
+        numRow = new DefaultParameterDescriptor<Integer>(properties, 1, 1, Integer.class, valueDomain, null, defaultSize);
         properties.put(ReferenceIdentifier.CODE_KEY, "num_col");
-        numCol = new DefaultParameterDescriptor<Integer>(properties, Integer.class, valueDomain, null, defaultSize, true);
+        numCol = new DefaultParameterDescriptor<Integer>(properties, 1, 1, Integer.class, valueDomain, null, defaultSize);
         WKT1 = new TensorParameters<Double>(Double.class, "elt_", "_", numRow, numCol);
     }
 
@@ -378,7 +378,7 @@ public class TensorParameters<E> impleme
         final Map<String,Object> properties = new HashMap<String,Object>(4);
         properties.put(ReferenceIdentifier.CODE_KEY, indicesToName(indices));
         properties.put(ReferenceIdentifier.AUTHORITY_KEY, dimensions[0].getName().getAuthority());
-        return new DefaultParameterDescriptor<E>(properties, elementType, null, null, isDiagonal ? one : zero, false);
+        return new DefaultParameterDescriptor<E>(properties, 0, 1, elementType, null, null, isDiagonal ? one : zero);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -34,6 +34,7 @@ import org.apache.sis.referencing.Identi
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.io.wkt.ElementKind;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Classes;
@@ -41,7 +42,6 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.Debug;
 
 
 /**
@@ -89,7 +89,7 @@ final class TensorValues<E> extends Abst
      */
     @SuppressWarnings({"unchecked","rawtypes"})
     TensorValues(final Map<String,?> properties, final TensorParameters<E> descriptors) {
-        super(properties);
+        super(properties, 1, 1);
         this.descriptors = descriptors;
         dimensions = new ParameterValue[descriptors.rank()];
         for (int i=0; i<dimensions.length; i++) {
@@ -436,24 +436,6 @@ final class TensorValues<E> extends Abst
     }
 
     /**
-     * Returns a string representation of this group.
-     */
-    @Debug
-    @Override
-    public String toString() {
-        return ParameterFormat.sharedFormat(this);
-    }
-
-    /**
-     * Prints a string representation of this group to the {@linkplain System#out standard output stream}.
-     */
-    @Debug
-    @Override
-    public void print() {
-        ParameterFormat.print(this);
-    }
-
-    /**
      * Formats this group as a pseudo-<cite>Well Known Text</cite> element.
      *
      * @param  formatter The formatter where to format the inner content of this WKT element.
@@ -461,7 +443,7 @@ final class TensorValues<E> extends Abst
      */
     @Override
     protected String formatTo(final Formatter formatter) {
-        super.formatTo(formatter);
+        WKTUtilities.appendName(this, formatter, ElementKind.PARAMETER);
         WKTUtilities.append(this, formatter);
         return "ParameterGroup";
     }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/UninitializedParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/UninitializedParameter.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/UninitializedParameter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/UninitializedParameter.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -33,7 +33,7 @@ import org.apache.sis.referencing.Identi
  * @version 0.4
  * @module
  */
-final class UninitializedParameter implements GeneralParameterValue, Serializable {
+final class UninitializedParameter implements GeneralParameterValue, Serializable { // Intentionally non-Cloneable.
     /**
      * For cross-version serialization compatibility.
      */

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java?rev=1625169&r1=1625168&r2=1625169&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] Mon Sep 15 21:45:25 2014
@@ -32,7 +32,7 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.metadata.Identifier;
 import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.parameter.InvalidParameterValueException;
-import org.apache.sis.internal.referencing.NameToIdentifier;
+import org.apache.sis.internal.metadata.NameToIdentifier;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;



Mime
View raw message