sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1575081 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/metadata/ sis-referencing/src/main/java/org/apache/sis/parameter/ sis-utility/src/main/java/org/apache/sis/util/logging/ sis-utility/src/main/java/org/apache/s...
Date Thu, 06 Mar 2014 22:45:08 GMT
Author: desruisseaux
Date: Thu Mar  6 22:45:07 2014
New Revision: 1575081

URL: http://svn.apache.org/r1575081
Log:
Initial port of parameter groups, to be used as inspiration for DefaultFeature and DefaultFeatureType
implementations.

Added:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1575081&r1=1575080&r2=1575081&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] Thu Mar  6 22:45:07 2014
@@ -479,7 +479,7 @@ class PropertyAccessor {
                 if (!mandatory) {
                     return -1;
                 }
-                throw new IllegalArgumentException(Errors.format(Errors.Keys.NoSuchProperty_2,
name, type));
+                throw new IllegalArgumentException(Errors.format(Errors.Keys.PropertyNotFound_2,
type, name));
             }
         }
         return index;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1575081&r1=1575080&r2=1575081&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] Thu Mar  6 22:45:07 2014
@@ -98,7 +98,7 @@ import java.nio.file.Path;
  * @module
  *
  * @see DefaultParameterDescriptor
- * @see DefaultParameterGroup
+ * @see DefaultParameterValueGroup
  */
 public class DefaultParameterValue<T> extends FormattableObject implements ParameterValue<T>,
Serializable, Cloneable {
     /**

Added: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1575081&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
[UTF-8] Thu Mar  6 22:45:07 2014
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.parameter;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.Serializable;
+import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.parameter.GeneralParameterValue;
+import org.opengis.parameter.GeneralParameterDescriptor;
+import org.opengis.parameter.ParameterNotFoundException;
+import org.opengis.parameter.InvalidParameterCardinalityException;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.ArgumentChecks;
+
+import static org.apache.sis.referencing.IdentifiedObjects.isHeuristicMatchForName;
+
+// Related to JDK7
+import java.util.Objects;
+
+
+/**
+ * A group of related parameter values.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.4 (derived from geotk-2.0)
+ * @version 0.4
+ * @module
+ *
+ * @see DefaultParameterDescriptorGroup
+ * @see DefaultParameterValue
+ */
+public class DefaultParameterValueGroup implements ParameterValueGroup, Serializable, Cloneable
{
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -1985309386356545126L;
+
+    /**
+     * Contains the descriptor and the {@linkplain #values() parameter values} for this group.
+     *
+     * <p>Consider this field as final. It is not for the purpose of {@link #clone()}.</p>
+     */
+    private ParameterValueList content;
+
+    /**
+     * Constructs a parameter group from the specified descriptor.
+     *
+     * @param descriptor The descriptor for this group.
+     */
+    public DefaultParameterValueGroup(final ParameterDescriptorGroup descriptor) {
+        ArgumentChecks.ensureNonNull("descriptor", descriptor);
+        final List<GeneralParameterDescriptor> parameters = descriptor.descriptors();
+        final List<GeneralParameterValue> values = new ArrayList<>(parameters.size());
+        for (final GeneralParameterDescriptor element : parameters) {
+            for (int count=element.getMinimumOccurs(); --count>=0;) {
+                values.add(element.createValue());
+            }
+        }
+        content = new ParameterValueList(descriptor, values);
+    }
+
+    /**
+     * Returns the abstract definition of this group of parameters.
+     *
+     * @return The abstract definition of this group of parameters.
+     */
+    @Override
+    public ParameterDescriptorGroup getDescriptor() {
+        return content.descriptor;
+    }
+
+    /**
+     * Returns the values in this group. Changes in this list are reflected on this {@code
ParameterValueGroup}.
+     * The returned list supports the {@code add(…)} and {@code remove(…)} operations.
+     */
+    @Override
+    public List<GeneralParameterValue> values() {
+        return content;
+    }
+
+    /**
+     * Returns the value in this group for the specified name.
+     * This method performs the first applicable action in the following choices:
+     *
+     * <ul>
+     *   <li>If this group contains a parameter value of the given name, then that
parameter is returned.</li>
+     *   <li>Otherwise if the {@linkplain #getDescriptor() descriptor} contains a definition
for a parameter
+     *       of the given name, then a new {@code ParameterValue} instance is
+     *       {@linkplain DefaultParameterDescriptor#createValue() created}, added to this
group then returned.</li>
+     *   <li>Otherwise a {@code ParameterNotFoundException} is thrown.</li>
+     * </ul>
+     *
+     * This convenience method provides a way to get and set parameter values by name. For
example
+     * the following idiom fetches a floating point value for the {@code "false_easting"}
parameter:
+     *
+     * {@preformat java
+     *     double value = parameter("false_easting").doubleValue();
+     * }
+     *
+     * This method does not search recursively in subgroups. This is because more than one
subgroup
+     * may exist for the same {@linkplain ParameterDescriptorGroup descriptor}. The user
have to
+     * {@linkplain #groups(String) query all subgroups} and select explicitly the appropriate
one.
+     *
+     * @param  name The name of the parameter to search for.
+     * @return The parameter value for the given name.
+     * @throws ParameterNotFoundException if there is no parameter value for the given name.
+     *
+     * @see Parameters#getOrCreate(ParameterDescriptor, ParameterValueGroup)
+     */
+    @Override
+    public ParameterValue<?> parameter(final String name) throws ParameterNotFoundException
{
+        ArgumentChecks.ensureNonNull("name", name);
+        final List<GeneralParameterValue> values = content.values;
+        for (final GeneralParameterValue value : values) {
+            if (value instanceof ParameterValue<?>) {
+                if (isHeuristicMatchForName(value.getDescriptor(), name)) {
+                    return (ParameterValue<?>) value;
+                }
+            }
+        }
+        /*
+         * No existing parameter found. Check if an optional parameter exists.
+         * If such a descriptor is found, create it, add it to the list of values
+         * and returns it.
+         */
+        for (final GeneralParameterDescriptor descriptor : getDescriptor().descriptors())
{
+            if (descriptor instanceof ParameterDescriptor<?>) {
+                if (isHeuristicMatchForName(descriptor, name)) {
+                    final ParameterValue<?> value = ((ParameterDescriptor<?>)
descriptor).createValue();
+                    values.add(value);
+                    return value;
+                }
+            }
+        }
+        throw new ParameterNotFoundException(Errors.format(
+                Errors.Keys.ParameterNotFound_2, content.descriptor.getName(), name), name);
+    }
+
+    /**
+     * Returns all subgroups with the specified name.
+     *
+     * <p>This method do not create new groups: if the requested group is optional
(i.e.
+     * <code>{@linkplain DefaultParameterDescriptor#getMinimumOccurs() minimumOccurs}
== 0</code>)
+     * and no value were defined previously, then this method returns an empty set.</p>
+     *
+     * @param  name The name of the parameter to search for.
+     * @return The set of all parameter group for the given name.
+     * @throws ParameterNotFoundException If no descriptor was found for the given name.
+     */
+    @Override
+    public List<ParameterValueGroup> groups(final String name) throws ParameterNotFoundException
{
+        ArgumentChecks.ensureNonNull("name", name);
+        final List<ParameterValueGroup> groups = new ArrayList<>(4);
+        for (final GeneralParameterValue value : content.values) {
+            if (value instanceof ParameterValueGroup) {
+                if (isHeuristicMatchForName(value.getDescriptor(), name)) {
+                    groups.add((ParameterValueGroup) value);
+                }
+            }
+        }
+        /*
+         * No groups were found. Check if the group actually exists (i.e. is declared in
the
+         * descriptor). If it doesn't exists, then an exception is thrown. If it exists (i.e.
+         * it is simply an optional group not yet defined), then returns an empty list.
+         */
+        if (groups.isEmpty()) {
+            final ParameterDescriptorGroup descriptor = content.descriptor;
+            if (!(descriptor.descriptor(name) instanceof ParameterDescriptorGroup)) {
+                throw new ParameterNotFoundException(Errors.format(
+                        Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
+            }
+        }
+        return groups;
+    }
+
+    /**
+     * Creates a new subgroup of the specified name, and adds it to the list of subgroups.
+     * The argument shall be the name of a {@linkplain DefaultParameterDescriptorGroup descriptor
group}
+     * which is a child of this group.
+     *
+     * <div class="note"><b>API note:</b>
+     * There is no {@code removeGroup(String)} method. To remove a group, users shall inspect
the
+     * {@link #values()} list, decide which occurrences to remove if there is many of them
for the
+     * same name, and whether to iterate recursively into sub-groups or not.</div>
+     *
+     * @param  name The name of the parameter group to create.
+     * @return A newly created parameter group for the given name.
+     * @throws ParameterNotFoundException If no descriptor was found for the given name.
+     * @throws InvalidParameterCardinalityException If this parameter group already contains
the
+     *         {@linkplain ParameterDescriptorGroup#getMaximumOccurs() maximum number of
occurrences}
+     *         of subgroups of the given name.
+     */
+    @Override
+    public ParameterValueGroup addGroup(final String name)
+            throws ParameterNotFoundException, InvalidParameterCardinalityException
+    {
+        final ParameterDescriptorGroup descriptor = content.descriptor;
+        final GeneralParameterDescriptor child = descriptor.descriptor(name);
+        if (!(child instanceof ParameterDescriptorGroup)) {
+            throw new ParameterNotFoundException(Errors.format(
+                    Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
+        }
+        int count = 0;
+        final List<GeneralParameterValue> values = content.values;
+        for (final GeneralParameterValue value : values) {
+            if (isHeuristicMatchForName(value.getDescriptor(), name)) {
+                count++;
+            }
+        }
+        if (count >= child.getMaximumOccurs()) {
+            throw new InvalidParameterCardinalityException(Errors.format(
+                    Errors.Keys.TooManyOccurrences_2, count, name), name);
+        }
+        final ParameterValueGroup value = ((ParameterDescriptorGroup) child).createValue();
+        values.add(value);
+        return value;
+    }
+
+    /**
+     * Compares the specified object with this parameter for equality.
+     *
+     * @param  object The object to compare to {@code this}.
+     * @return {@code true} if both objects are equal.
+     */
+    @Override
+    public boolean equals(final Object object) {
+        if (object == this) {
+            return true;
+        }
+        if (object != null && getClass() == object.getClass()) {
+            final DefaultParameterValueGroup that = (DefaultParameterValueGroup) object;
+            return Objects.equals(content.descriptor, that.content.descriptor) &&
+                   Objects.equals(content.values,     that.content.values);
+        }
+        return false;
+    }
+
+    /**
+     * Returns a hash value for this parameter.
+     *
+     * @return The hash code value. This value doesn't need to be the same
+     *         in past or future versions of this class.
+     */
+    @Override
+    public int hashCode() {
+        return content.descriptor.hashCode() ^ content.values.hashCode();
+    }
+
+    /**
+     * Returns a deep copy of this group of parameter values.
+     * Included parameter values and subgroups are cloned recursively.
+     *
+     * @return A copy of this group of parameter values.
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    public DefaultParameterValueGroup clone() {
+        final DefaultParameterValueGroup copy;
+        try {
+            copy = (DefaultParameterValueGroup) super.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new AssertionError(e);
+        }
+        copy.content = new ParameterValueList(content.descriptor, new ArrayList<>(content.values));
+        final List<GeneralParameterValue> values = copy.content.values;
+        for (int i=values.size(); --i>=0;) {
+            values.set(i, values.get(i).clone());
+        }
+        return copy;
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java?rev=1575081&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
[UTF-8] Thu Mar  6 22:45:07 2014
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.parameter;
+
+import java.util.List;
+import java.util.AbstractList;
+import java.util.RandomAccess;
+import java.io.Serializable;
+import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.GeneralParameterValue;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.parameter.GeneralParameterDescriptor;
+import org.opengis.parameter.InvalidParameterNameException;
+import org.opengis.parameter.InvalidParameterCardinalityException;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.util.resources.Errors;
+
+
+/**
+ * The list to be returned by {@link DefaultParameterValueGroup#values()}.
+ * This class performs checks on the parameter values to be added or removed.
+ * This implementation supports {@code add(…)} and {@code remove(…)} operations.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.4 (derived from geotk-2.1)
+ * @version 0.4
+ * @module
+ */
+final class ParameterValueList extends AbstractList<GeneralParameterValue> implements
RandomAccess, Serializable {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -7446077551686135264L;
+
+    /**
+     * The descriptor for the list as a whole.
+     */
+    final ParameterDescriptorGroup descriptor;
+
+    /**
+     * The unchecked list of parameter values for this list.
+     */
+    final List<GeneralParameterValue> values;
+
+    /**
+     * Constructs a parameter list.
+     *
+     * @param descriptor The descriptor for this list.
+     * @param values The parameter values for this list.
+     */
+    ParameterValueList(final ParameterDescriptorGroup descriptor, final List<GeneralParameterValue>
values) {
+        this.descriptor = descriptor;
+        this.values     = values;
+    }
+
+    /*
+     * CAUTION: Some methods are NOT forwarded to 'values', and this is on purpose!
+     *          This include all modification methods (add, set, remove, etc.).
+     *          We must rely on the default AbstractList implementation for them.
+     */
+    @Override public boolean               isEmpty    ()         {return values.isEmpty 
  ( );}
+    @Override public int                   size       ()         {return values.size    
  ( );}
+    @Override public GeneralParameterValue get        (int i)    {return values.get     
  (i);}
+    @Override public int                   indexOf    (Object o) {return values.indexOf 
  (o);}
+    @Override public int                   lastIndexOf(Object o) {return values.lastIndexOf(o);}
+    @Override public boolean               equals     (Object o) {return values.equals  
  (o);}
+    @Override public int                   hashCode   ()         {return values.hashCode
  ( );}
+    @Override public String                toString   ()         {return values.toString
  ( );}
+
+    /**
+     * Adds a {@link ParameterValue} or an other {@link ParameterValueGroup} to this list.
+     * If an existing parameter is already included for the same name and adding the new
+     * parameter would increase the number past what is allowable by {@code maximumOccurs},
+     * then an {@link IllegalStateException} will be thrown.
+     *
+     * @param  parameter New parameter to be added to this group.
+     * @return {@code true} if this object changed as a result of this call.
+     * @throws IllegalArgumentException if the specified parameter is not allowable by the
groups descriptor.
+     * @throws InvalidParameterCardinalityException if adding this parameter would result
in more parameters
+     *         than allowed by {@code maximumOccurs}.
+     */
+    @Override
+    public boolean add(final GeneralParameterValue parameter) {
+        final GeneralParameterDescriptor type = parameter.getDescriptor();
+        final ReferenceIdentifier name = type.getName();
+        final List<GeneralParameterDescriptor> descriptors = descriptor.descriptors();
+        if (!descriptors.contains(type)) {
+            /*
+             * For a more accurate error message, check if the operation failed because the
+             * parameter name was not found, or the parameter descriptor does not matches.
+             */
+            for (final GeneralParameterDescriptor descriptor : descriptors) {
+                if (name.equals(descriptor.getName())) {
+                    throw new IllegalArgumentException(Errors.format(
+                            Errors.Keys.MismatchedParameterDescriptor_1, name));
+                }
+            }
+            throw new InvalidParameterNameException(Errors.format(
+                    Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name.getCode());
+        }
+        /*
+         * Before to add the parameter, check the cardinality.
+         */
+        int count = 0;
+        for (final GeneralParameterValue value : values) {
+            if (name.equals(value.getDescriptor().getName())) {
+                count++;
+            }
+        }
+        if (count >= type.getMaximumOccurs()) {
+            throw new InvalidParameterCardinalityException(Errors.format(
+                    Errors.Keys.TooManyOccurrences_2, count, name), name.getCode());
+        }
+        modCount++;
+        return values.add(parameter);
+    }
+
+    /**
+     * Removes the value at the specified index, provided that this removal is allowed by
the
+     * parameter cardinality.
+     *
+     * @param  index The index of the value to remove.
+     * @return The value removed at the given index.
+     */
+    @Override
+    public GeneralParameterValue remove(final int index) {
+        final GeneralParameterDescriptor type = values.get(index).getDescriptor();
+        final int min = type.getMinimumOccurs();
+        if (min != 0) {
+            int count = 0;
+            final ReferenceIdentifier name = type.getName();
+            for (final GeneralParameterValue value : values) {
+                if (name.equals(value.getDescriptor().getName())) {
+                    if (++count > min) break;
+                }
+            }
+            if (count <= min) {
+                throw new InvalidParameterCardinalityException(Errors.format(
+                        Errors.Keys.TooFewOccurrences_2, min, name), name.getCode());
+            }
+        }
+        modCount++;
+        return values.remove(index);
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1575081&r1=1575080&r2=1575081&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
[UTF-8] Thu Mar  6 22:45:07 2014
@@ -257,7 +257,7 @@ public class WarningListeners<S> impleme
                 }
             }
         }
-        throw new NoSuchElementException(Errors.format(Errors.Keys.NoSuchElement_1, listener));
+        throw new NoSuchElementException(Errors.format(Errors.Keys.ElementNotFound_1, listener));
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1575081&r1=1575080&r2=1575081&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Thu Mar  6 22:45:07 2014
@@ -170,6 +170,11 @@ public final class Errors extends Indexe
         public static final short ElementAlreadyPresent_1 = 19;
 
         /**
+         * Element “{0}” has not been found.
+         */
+        public static final short ElementNotFound_1 = 70;
+
+        /**
          * Argument ‘{0}’ shall not be empty.
          */
         public static final short EmptyArgument_1 = 20;
@@ -398,6 +403,11 @@ public final class Errors extends Indexe
         public static final short MismatchedMatrixSize_4 = 60;
 
         /**
+         * Mismatched descriptor for “{0}” parameter.
+         */
+        public static final short MismatchedParameterDescriptor_1 = 146;
+
+        /**
          * No authority was specified for code “{0}”. The expected syntax is “AUTHORITY:CODE”.
          */
         public static final short MissingAuthority_1 = 135;
@@ -458,16 +468,6 @@ public final class Errors extends Indexe
         public static final short NoSuchAuthorityCode_3 = 137;
 
         /**
-         * Element “{0}” has not been found.
-         */
-        public static final short NoSuchElement_1 = 70;
-
-        /**
-         * No property named “{0}” has been found in “{1}”.
-         */
-        public static final short NoSuchProperty_2 = 71;
-
-        /**
          * No unit of measurement has been specified.
          */
         public static final short NoUnit = 72;
@@ -608,6 +608,16 @@ public final class Errors extends Indexe
         public static final short OddArrayLength_1 = 98;
 
         /**
+         * No parameter named “{1}” has been found in “{0}”.
+         */
+        public static final short ParameterNotFound_2 = 147;
+
+        /**
+         * No property named “{1}” has been found in “{0}”.
+         */
+        public static final short PropertyNotFound_2 = 71;
+
+        /**
          * Recursive call while creating an object for the “{0}” key.
          */
         public static final short RecursiveCreateCallForKey_1 = 99;
@@ -638,11 +648,21 @@ public final class Errors extends Indexe
         public static final short TooFewArguments_2 = 104;
 
         /**
+         * Too few occurrences of “{1}”. Expected at least {0} of them.
+         */
+        public static final short TooFewOccurrences_2 = 148;
+
+        /**
          * Expected at most {0} argument{0,choice,1#|2#s}, but got {1}.
          */
         public static final short TooManyArguments_2 = 105;
 
         /**
+         * Too many occurrences of “{1}”. There is already {0} of them.
+         */
+        public static final short TooManyOccurrences_2 = 149;
+
+        /**
          * Tree depth exceeds the maximum.
          */
         public static final short TreeDepthExceedsMaximum = 145;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1575081&r1=1575080&r2=1575081&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Thu Mar  6 22:45:07 2014
@@ -45,6 +45,7 @@ DuplicatedElement_1               = Elem
 DuplicatedIdentifier_1            = Identifier \u201c{0}\u201d is duplicated.
 DuplicatedOption_1                = Option \u201c{0}\u201d is duplicated.
 ElementAlreadyPresent_1           = Element \u201c{0}\u201d is already present.
+ElementNotFound_1                 = Element \u201c{0}\u201d has not been found.
 EmptyArgument_1                   = Argument \u2018{0}\u2019 shall not be empty.
 EmptyDictionary                   = The dictionary shall contain at least one entry.
 EmptyEnvelope2D                   = Envelope must be at least two-dimensional and non-empty.
@@ -87,6 +88,7 @@ KeyCollision_1                    = A di
 MandatoryAttribute_2              = Attribute \u201c{0}\u201d is mandatory for an object
of type \u2018{1}\u2019.
 MismatchedArrayLengths            = Mismatched array lengths.
 MismatchedCRS                     = The coordinate reference system must be the same for
all objects.
+MismatchedParameterDescriptor_1   = Mismatched descriptor for \u201c{0}\u201d parameter.
 MismatchedDimension_2             = Mismatched object dimensions: {0}D and {1}D.
 MismatchedDimension_3             = Argument \u2018{0}\u2019 has {2} dimension{2,choice,1#|2#s},
while {1} was expected.
 MismatchedMatrixSize_4            = Mismatched matrix sizes: expected {0}\u00d7{1} but got
{2}\u00d7{3}.
@@ -124,8 +126,6 @@ NotASkewSymmetricMatrix           = Matr
 NotAUnicodeIdentifier_1           = Text \u201c{0}\u201d is not a Unicode identifier.
 NotComparableClass_1              = Class \u2018{0}\u2019 is not a comparable.
 NoSuchAuthorityCode_3             = No code \u201c{2}\u201d from authority \u201c{0}\u201d
found for object of type \u2018{1}\u2019.
-NoSuchElement_1                   = Element \u201c{0}\u201d has not been found.
-NoSuchProperty_2                  = No property named \u201c{0}\u201d has been found in \u201c{1}\u201d.
 NoUnit                            = No unit of measurement has been specified.
 NullArgument_1                    = Argument \u2018{0}\u2019 shall not be null.
 NullCollectionElement_1           = \u2018{0}\u2019 collection does not accept null elements.
@@ -133,13 +133,17 @@ NullCollectionElement_1           = \u20
 NullMapKey                        = Null key is not allowed in this dictionary.
 NullMapValue                      = Null values are not allowed in this dictionary.
 OddArrayLength_1                  = Array length is {0}, while we expected an even length.
+ParameterNotFound_2               = No parameter named \u201c{1}\u201d has been found in
\u201c{0}\u201d.
+PropertyNotFound_2                = No property named \u201c{1}\u201d has been found in \u201c{0}\u201d.
 SingularMatrix                    = Matrix is singular.
 RecursiveCreateCallForKey_1       = Recursive call while creating an object for the \u201c{0}\u201d
key.
 RequireDecimalSeparator           = A decimal separator is required.
 StalledThread_1                   = Thread \u201c{0}\u201d seems stalled.
 StreamIsForwardOnly_1             = Can not move backward in the \u201c{0}\u201d stream.
 TooFewArguments_2                 = Expected at least {0} argument{0,choice,1#|2#s}, but
got {1}.
+TooFewOccurrences_2               = Too few occurrences of \u201c{1}\u201d. Expected at least
{0} of them.
 TooManyArguments_2                = Expected at most {0} argument{0,choice,1#|2#s}, but got
{1}.
+TooManyOccurrences_2              = Too many occurrences of \u201c{1}\u201d. There is already
{0} of them.
 TreeDepthExceedsMaximum           = Tree depth exceeds the maximum.
 UndefinedOrderingForElements_2    = Ordering between \u201c{0}\u201d and \u201c{1}\u201d
elements is undefined.
 UnexpectedArrayLength_2           = Expected an array of length {0}, but got {1}.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1575081&r1=1575080&r2=1575081&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Thu Mar  6 22:45:07 2014
@@ -35,6 +35,7 @@ DuplicatedElement_1               = L\u2
 DuplicatedIdentifier_1            = L\u2019identifiant \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9.
 DuplicatedOption_1                = L\u2019option \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9e.
 ElementAlreadyPresent_1           = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb est d\u00e9j\u00e0
pr\u00e9sent.
+ElementNotFound_1                 = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb n\u2019a
pas \u00e9t\u00e9 trouv\u00e9.
 EmptyArgument_1                   = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre
vide.
 EmptyDictionary                   = Le dictionnaire doit contenir au moins une entr\u00e9e.
 EmptyEnvelope2D                   = L\u2019enveloppe doit avoir au moins deux dimensions
et ne pas \u00eatre vide.
@@ -77,6 +78,7 @@ KeyCollision_1                    = Une 
 MandatoryAttribute_2              = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb est obligatoire
pour un objet de type \u2018{1}\u2019.
 MismatchedArrayLengths            = Les dimensions des tableaux ne correspondent pas.
 MismatchedCRS                     = Le syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es
doit \u00eatre le m\u00eame pour tous les objets.
+MismatchedParameterDescriptor_1   = Le descripteur du param\u00e8tre \u00ab\u202f{0}\u202f\u00bb
ne correspond pas.
 MismatchedDimension_2             = Les dimensions des objets ({0}D et {1}D) ne concordent
pas.
 MismatchedDimension_3             = L\u2019argument \u2018{0}\u2019 a {2} dimension{2,choice,1#|2#s},
alors qu\u2019on en attendait {1}.
 MismatchedMatrixSize_4            = Une matrice de taille de {0}\u00d7{1} \u00e9tait attendue
mais la matrice donn\u00e9es est de taille {2}\u00d7{3}.
@@ -114,21 +116,23 @@ NotASkewSymmetricMatrix           = La m
 NotAUnicodeIdentifier_1           = Le texte \u00ab\u202f{0}\u202f\u00bb n\u2019est pas un
identifiant Unicode.
 NotComparableClass_1              = La classe \u2018{0}\u2019 n\u2019est pas comparable.
 NoSuchAuthorityCode_3             = Aucun code \u00ab\u202f{2}\u202f\u00bb de l\u2019autorit\u00e9
\u00ab\u202f{0}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9 pour un objet de type \u2018{1}\u2019.
-NoSuchElement_1                   = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb n\u2019a
pas \u00e9t\u00e9 trouv\u00e9.
-NoSuchProperty_2                  = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{0}\u202f\u00bb
n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{1}\u202f\u00bb.
 NoUnit                            = Aucune unit\u00e9 de mesure n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e.
 NullArgument_1                    = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre
nul.
 NullCollectionElement_1           = La collection \u2018{0}\u2019 n\u2019accepte pas les
valeurs nulles.
 NullMapKey                        = La cl\u00e9 nulle n\u2019est pas autoris\u00e9e dans
ce dictionnaire.
 NullMapValue                      = Les valeurs nulles ne sont pas autoris\u00e9es dans ce
dictionnaire.
 OddArrayLength_1                  = La longueur du tableau est {0}, alors qu\u2019on attendait
une longueur paire.
+ParameterNotFound_2               = Aucun param\u00e8tre nomm\u00e9 \u00ab\u202f{1}\u202f\u00bb
n\u2019a \u00e9t\u00e9 trouv\u00e9 dans \u00ab\u202f{0}\u202f\u00bb.
+PropertyNotFound_2                = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{1}\u202f\u00bb
n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
 RecursiveCreateCallForKey_1       = Appel r\u00e9cursif lors de la cr\u00e9ation d\u2019un
objet pour la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 RequireDecimalSeparator           = Un s\u00e9parateur d\u00e9cimal est requis.
 SingularMatrix                    = La matrice est singuli\u00e8re.
 StalledThread_1                   = La t\u00e2che \u00ab\u202f{0}\u202f\u00bb semble bloqu\u00e9e.
 StreamIsForwardOnly_1             = Ne peut pas reculer dans le flux de donn\u00e9es \u00ab\u202f{0}\u202f\u00bb.
 TooFewArguments_2                 = Au moins {0} argument{0,choice,1# \u00e9tait attendu|2#s
\u00e9taient attendus}, mais seulement {1} {1,choice,1#a \u00e9t\u00e9 sp\u00e9cifi\u00e9|2#ont
\u00e9t\u00e9 sp\u00e9cifi\u00e9s}.
+TooFewOccurrences_2               = Trop peu d\u2019occurrences de \u00ab\u202f{1}\u202f\u00bb.
Il en faut au moins {0}.
 TooManyArguments_2                = Au plus {0} argument{0,choice,1# \u00e9tait attendu|2#s
\u00e9taient attendus}, mais {1} {1,choice,1#a \u00e9t\u00e9 sp\u00e9cifi\u00e9|2#ont \u00e9t\u00e9
sp\u00e9cifi\u00e9s}.
+TooManyOccurrences_2              = Trop d\u2019occurrences de \u00ab\u202f{1}\u202f\u00bb.
Il en existe d\u00e9j\u00e0 {0}.
 TreeDepthExceedsMaximum           = La profondeur de l\u2019arbre exc\u00e8de le maximum.
 UndefinedOrderingForElements_2    = L\u2019ordre entre les \u00e9l\u00e9ments \u00ab\u202f{0}\u202f\u00bb
et \u00ab\u202f{1}\u202f\u00bb n\u2019est pas d\u00e9fini.
 UnexpectedArrayLength_2           = Un tableau de longueur {0} \u00e9tait attendu, mais le
tableau re\u00e7u est de longueur {1}.



Mime
View raw message