sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1740423 - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/ core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/...
Date Thu, 21 Apr 2016 22:27:15 GMT
Author: desruisseaux
Date: Thu Apr 21 22:27:15 2016
New Revision: 1740423

URL: http://svn.apache.org/viewvc?rev=1740423&view=rev
Log:
Documentation about MBeans disabled on trunk but enabled on branches.
Safety against a discrepancy between older and newer ISO 19111 model.

Modified:
    sis/trunk/   (props changed)
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_CoordinateOperation.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 22:27:15 2016
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK6:1394364-1740397
-/sis/branches/JDK7:1394913-1740391
-/sis/branches/JDK8:1584960-1740312
+/sis/branches/JDK6:1394364-1740421
+/sis/branches/JDK7:1394913-1740420
+/sis/branches/JDK8:1584960-1740419

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java?rev=1740423&r1=1740422&r2=1740423&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java
[UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java
[UTF-8] Thu Apr 21 22:27:15 2016
@@ -20,8 +20,9 @@
  * See {@link org.apache.sis.console.Command} for the list of supported commands.
  *
  * <div class="section">SIS installation on remote machines</div>
- * Some sub-commands can operate on SIS installation on remote machines, provided
- * that the remote Java Virtual Machine has been started with the following options:
+ * Some sub-commands can operate on SIS installation on remote machines, provided that Apache
SIS
+ * has been <a href="http://sis.apache.org/branches.html#trunk">compiled with MBeans
enabled</a>
+ * and that the remote Java Virtual Machine has been started with the following options:
  *
  * {@preformat shell
  *   java -Dcom.sun.management.jmxremote.port=1099 \

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_CoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_CoordinateOperation.java?rev=1740423&r1=1740422&r2=1740423&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_CoordinateOperation.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_CoordinateOperation.java
[UTF-8] Thu Apr 21 22:27:15 2016
@@ -90,8 +90,17 @@ public final class CC_CoordinateOperatio
      */
     public void setElement(final AbstractCoordinateOperation operation) {
         metadata = operation;
-        if ((operation instanceof PassThroughOperation) && ((PassThroughOperation)
operation).getOperation() == null) {
-            incomplete("coordOperation");
+        /*
+         * In an older ISO 19111 model, PassThroughOperation extended SingleOperation.
+         * It was forcing us to provide a dummy value or null for the 'method' property.
+         * This has been fixed in newer ISO 19111 model, but for safety with object following
the older model
+         * (e.g. when using GeoAPI 3.0) we are better to skip the check for the SingleOperation
case when the
+         * operation is a PassThroughOperation.
+         */
+        if (operation instanceof PassThroughOperation) {
+            if (((PassThroughOperation) operation).getOperation() == null) {
+                incomplete("coordOperation");
+            }
         } else if ((operation instanceof SingleOperation) && ((SingleOperation) operation).getMethod()
== null) {
             incomplete("method");
         }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java?rev=1740423&r1=1740422&r2=1740423&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
[UTF-8] Thu Apr 21 22:27:15 2016
@@ -837,7 +837,7 @@ public class CoordinateOperationFinder e
                  * it is not, try to copy it in such object.
                  */
                 final SingleOperation op;
-                if (subOperation instanceof SingleOperation) {
+                if (SubTypes.isSingleOperation(subOperation)) {
                     op = (SingleOperation) subOperation;
                 } else {
                     op = factorySIS.createSingleOperation(properties,
@@ -935,7 +935,7 @@ public class CoordinateOperationFinder e
             if (isAxisChange1 && mt1.getSourceDimensions() == mt1.getTargetDimensions())
main = step2;
             if (isAxisChange2 && mt2.getSourceDimensions() == mt2.getTargetDimensions())
main = step1;
         }
-        if (main instanceof SingleOperation) {
+        if (SubTypes.isSingleOperation(main)) {
             final SingleOperation op = (SingleOperation) main;
             final MathTransform mt = factorySIS.getMathTransformFactory().createConcatenatedTransform(mt1,
mt2);
             main = createFromMathTransform(new HashMap<String,Object>(IdentifiedObjects.getProperties(main)),

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java?rev=1740423&r1=1740422&r2=1740423&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
[UTF-8] Thu Apr 21 22:27:15 2016
@@ -487,7 +487,7 @@ class CoordinateOperationRegistry {
     private CoordinateOperation inverse(final CoordinateOperation operation)
             throws NoninvertibleTransformException, FactoryException
     {
-        if (operation instanceof SingleOperation) {
+        if (SubTypes.isSingleOperation(operation)) {
             return inverse((SingleOperation) operation);
         }
         if (operation instanceof ConcatenatedOperation) {
@@ -668,7 +668,7 @@ class CoordinateOperationRegistry {
          * be prepared to see the 'redimension' call fails. In such case, we will try to
get
          * the SIS implementation of the operation method and try again.
          */
-        if (operation instanceof SingleOperation) {
+        if (SubTypes.isSingleOperation(operation)) {
             final SingleOperation single = (SingleOperation) operation;
             properties.put(ReferencingServices.PARAMETERS_KEY, single.getParameterValues());
             if (method == null) {
@@ -794,7 +794,7 @@ class CoordinateOperationRegistry {
              */
             Matrix matrix = MathTransforms.getMatrix(op.getMathTransform());
             if (matrix == null) {
-                if (op instanceof SingleOperation) {
+                if (SubTypes.isSingleOperation(op)) {
                     final MathTransformFactory mtFactory = factorySIS.getMathTransformFactory();
                     if (mtFactory instanceof DefaultMathTransformFactory) {
                         if (forward) sourceCRS = toGeodetic3D(sourceCRS, source3D);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java?rev=1740423&r1=1740422&r2=1740423&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
[UTF-8] Thu Apr 21 22:27:15 2016
@@ -122,8 +122,8 @@ public class DefaultCoordinateOperationF
     /**
      * Weak references to existing objects.
      * This set is used in order to return a pre-existing object instead of creating a new
one.
-     * This apply to object created explicitly, not to coordinate operations inferred by
a call
-     * to {@link #createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem)}.
+     * This applies to objects created explicitly, not to coordinate operations inferred
by a
+     * call to {@link #createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem)}.
      */
     private final WeakHashSet<IdentifiedObject> pool;
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java?rev=1740423&r1=1740422&r2=1740423&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
[UTF-8] Thu Apr 21 22:27:15 2016
@@ -47,6 +47,17 @@ final class SubTypes {
     }
 
     /**
+     * Returns {@code true} if the given operation is a single operation but not a pass-through
operation.
+     * In an older ISO 19111 model, {@link PassThroughOperation} extended {@link SingleOperation},
which
+     * was a problem for providing a value to the inherited {@link SingleOperation#getMethod()}
method.
+     * This has been fixed in newer ISO 19111 model, but for safety with objects following
the older model
+     * (e.g. GeoAPI 3.0) we are better to perform an explicit exclusion of {@link PassThroughOperation}.
+     */
+    static boolean isSingleOperation(final CoordinateOperation operation) {
+        return (operation instanceof SingleOperation) && !(operation instanceof PassThroughOperation);
+    }
+
+    /**
      * Returns a SIS implementation for the given coordinate operation.
      *
      * @see AbstractCoordinateOperation#castOrCopy(CoordinateOperation)
@@ -64,7 +75,7 @@ final class SubTypes {
         if (object instanceof ConcatenatedOperation) {
             return DefaultConcatenatedOperation.castOrCopy((ConcatenatedOperation) object);
         }
-        if (object instanceof SingleOperation) {
+        if (isSingleOperation(object)) {
             return (object instanceof AbstractSingleOperation) ? (AbstractSingleOperation)
object
                    : new AbstractSingleOperation((SingleOperation) object);
         }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java?rev=1740423&r1=1740422&r2=1740423&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
[UTF-8] Thu Apr 21 22:27:15 2016
@@ -797,10 +797,8 @@ public final strictfp class CoordinateOp
         final CoordinateOperation operation = inference.createOperation(sourceCRS, targetCRS);
         assertSame      ("sourceCRS", sourceCRS, operation.getSourceCRS());
         assertSame      ("targetCRS", targetCRS, operation.getTargetCRS());
-        if (false) {    // TODO need debugging
-            assertInstanceOf("operation", ConcatenatedOperation.class, operation);
-            assertEquals    ("name", "CompoundCRS[“Test3D”] → CompoundCRS[“Test4D”]",
operation.getName().getCode());
-        }
+        assertInstanceOf("operation", ConcatenatedOperation.class, operation);
+        assertEquals    ("name", "CompoundCRS[“Test3D”] → CompoundCRS[“Test4D”]",
operation.getName().getCode());
 
         transform = operation.getMathTransform();
         assertInstanceOf("transform", LinearTransform.class, transform);



Mime
View raw message