Author: desruisseaux
Date: Wed Sep  2 09:30:33 2015
New Revision: 1700745

URL: http://svn.apache.org/r1700745
Log:
Use public class as the source of logging messages.

Modified:
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java?rev=1700745&r1=1700744&r2=1700745&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
 [UTF-8] Wed Sep  2 09:30:33 2015
@@ -29,6 +29,7 @@ import org.opengis.parameter.ParameterNo
 import org.apache.sis.parameter.AbstractParameterDescriptor;
 import org.apache.sis.parameter.DefaultParameterDescriptor;
 import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
+import org.apache.sis.parameter.DefaultParameterValueGroup;
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.util.collection.Containers;
@@ -215,7 +216,7 @@ public final class CC_GeneralOperationPa
         merged.putAll(actual);  // May overwrite pre-defined properties.
         if (isGroup) {
             final List<GeneralParameterDescriptor> descriptors = 
((ParameterDescriptorGroup) provided).descriptors();
-            return merge(merged, merged, minimumOccurs, maximumOccurs,
+            return merge(DefaultParameterValueGroup.class, merged, merged, 
minimumOccurs, maximumOccurs,
                     descriptors.toArray(new 
GeneralParameterDescriptor[descriptors.size()]),
                     (ParameterDescriptorGroup) complete, canSubstitute);
         } else {
@@ -227,6 +228,7 @@ public final class CC_GeneralOperationPa
      * Returns a descriptor with the given properties, completed with 
information not found in GML.
      * Those extra information are given by the {@code complete} descriptor.
      *
+     * @param  caller        The public source class to report if a log 
message need to be emitted.
      * @param  properties    Properties as declared in the GML document, to be 
used if {@code complete} is incompatible.
      * @param  merged        More complete properties, to be used if {@code 
complete} is compatible.
      * @param  minimumOccurs Value to assign to {@link 
DefaultParameterDescriptorGroup#getMinimumOccurs()}.
@@ -236,7 +238,8 @@ public final class CC_GeneralOperationPa
      * @param  canSubstitute {@code true} if this method is allowed to return 
{@code complete}.
      * @return The parameter descriptor group to use (may be the {@code 
complete} instance).
      */
-    static ParameterDescriptorGroup merge(final Map<String,?>                
properties,
+    static ParameterDescriptorGroup merge(final Class<?>                     
caller,
+                                          final Map<String,?>                
properties,
                                           final Map<String,?>                
merged,
                                           final int                          
minimumOccurs,
                                           final int                          
maximumOccurs,
@@ -262,7 +265,14 @@ public final class CC_GeneralOperationPa
                     continue;
                 }
             } catch (ParameterNotFoundException e) {
-                Context.warningOccured(Context.current(), 
CC_GeneralOperationParameter.class, "replacement", e, canSubstitute);
+                /*
+                 * Log at Level.WARNING for the first parameter (canSubstitute 
== true) and at Level.FINE
+                 * for all other (canSubstitute == false).  We do not use 
CC_GeneralOperationParameter as
+                 * the source class because this is an internal class. We 
rather use the first public class
+                 * in the caller hierarchy, which is either 
DefaultParameterValueGroup or DefaultOperationMethod.
+                 */
+                Context.warningOccured(Context.current(), caller,
+                        (caller == DefaultParameterValueGroup.class) ? 
"setValues" : "setDescriptors", e, canSubstitute);
             }
             /*
              * If a parameter was not found in the 'complete' descriptor, we 
will not be able to use that descriptor.

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java?rev=1700745&r1=1700744&r2=1700745&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
 [UTF-8] Wed Sep  2 09:30:33 2015
@@ -180,8 +180,8 @@ public final class CC_OperationMethod ex
              * replacement of the given ones.
              */
             final ParameterDescriptorGroup parameters = method.getParameters();
-            return CC_GeneralOperationParameter.merge(properties,
-                    IdentifiedObjects.getProperties(parameters),
+            return 
CC_GeneralOperationParameter.merge(DefaultOperationMethod.class,
+                    properties, IdentifiedObjects.getProperties(parameters),
                     1, 1, descriptors, parameters, true);
         }
         return new DefaultParameterDescriptorGroup(properties, 1, 1, 
descriptors);

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1700745&r1=1700744&r2=1700745&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
 [UTF-8] Wed Sep  2 09:30:33 2015
@@ -521,6 +521,9 @@ public class DefaultParameterValueGroup
      * (after {@link #setDescriptor(ParameterDescriptorGroup)}) even if the 
{@code parameterValue}
      * elements were first in the XML document. This is the case at least with 
the JAXB reference
      * implementation, because the property type is an array (it would not 
work with a list).
+     *
+     * <p><b>Maintenance note:</b> the {@code "setValues"} method name is also 
hard-coded in
+     * {@link 
org.apache.sis.internal.jaxb.referencing.CC_GeneralOperationParameter} for 
logging purpose.</p>
      */
     private void setValues(final GeneralParameterValue[] parameters) {
         final GeneralParameterDescriptor[] fromValues = new 
GeneralParameterDescriptor[parameters.length];

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1700745&r1=1700744&r2=1700745&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
 [UTF-8] Wed Sep  2 09:30:33 2015
@@ -810,6 +810,9 @@ public class DefaultOperationMethod exte
      * class will be provided either by replacing this {@code OperationMethod} 
by one of the
      * pre-defined methods, or by unmarshalling the enclosing {@link 
AbstractSingleOperation}.</p>
      *
+     * <p><b>Maintenance note:</b> the {@code "setDescriptors"} method name is 
also hard-coded in
+     * {@link 
org.apache.sis.internal.jaxb.referencing.CC_GeneralOperationParameter} for 
logging purpose.</p>
+     *
      * @see AbstractSingleOperation#setParameters
      */
     private void setDescriptors(final GeneralParameterDescriptor[] 
descriptors) {


Reply via email to