Author: desruisseaux
Date: Sun Sep 6 19:10:30 2015
New Revision: 1701516
URL: http://svn.apache.org/r1701516
Log:
Merge from the JDK8 branch.
Added:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
- copied unchanged from r1701515,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_CRS.java
- copied unchanged from r1701515,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_CRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_GeographicCRS.txt
- copied unchanged from r1701515,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_GeographicCRS.txt
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameterTest.java
- copied unchanged from r1701515,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameterTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameterGroupTest.java
- copied, changed from r1701515,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameterGroupTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
- copied unchanged from r1701515,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
- copied unchanged from r1701515,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/OperationMarshallingTest.java
- copied unchanged from r1701515,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/OperationMarshallingTest.java
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/
- copied from r1701515,
sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_Conversion.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralParameterValue.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameterGroup.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SC_GeographicCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultTransformation.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MapProjectionTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterValueGroupWrapper.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/parameter/ParameterDescriptorGroup.xml
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/parameter/ParameterValueGroup.xml
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/GeographicCRS.xml
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/ProjectedCRS.xml
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/GeodeticDatum.xml
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/TemporalDatum.xml
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/VerticalDatum
(GML 3.1).xml
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/VerticalDatum.xml
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CorruptedObjectException.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DataIdentificationTest.java
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Sep 6 19:10:30 2015
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1697533
+/sis/branches/JDK8:1584960-1701515
/sis/trunk:1394364-1508466,1519089-1519674
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -1416,6 +1416,20 @@ public class DefaultMetadata extends ISO
resourceLineages = writeCollection(newValues, resourceLineages,
Lineage.class);
}
+
+
+
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////
////////
+ //////// XML support with JAXB
////////
+ ////////
////////
+ //////// The following methods are invoked by JAXB using reflection
(even if ////////
+ //////// they are private) or are helpers for other methods invoked
by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup
Language ////////
+ //////// (GML) support is not needed.
////////
+ ////////
////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+
/**
* Invoked by JAXB {@link javax.xml.bind.Marshaller} before this object is
marshalled to XML.
* This method sets the locale to be used for XML marshalling to the
metadata language.
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -174,6 +174,20 @@ public class ISOMetadata extends Modifia
return new IdentifierMapWithSpecialCases(identifiers);
}
+
+
+
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////
////////
+ //////// XML support with JAXB
////////
+ ////////
////////
+ //////// The following methods are invoked by JAXB using reflection
(even if ////////
+ //////// they are private) or are helpers for other methods invoked
by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup
Language ////////
+ //////// (GML) support is not needed.
////////
+ ////////
////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+
/**
* Returns an identifier unique for the XML document, or {@code null} if
none.
* This method is invoked automatically by JAXB and should never be
invoked explicitely.
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -178,17 +178,6 @@ public class ImmutableIdentifier extends
private final InternationalString description;
/**
- * Empty constructor for JAXB.
- */
- private ImmutableIdentifier() {
- code = null;
- codeSpace = null;
- authority = null;
- version = null;
- description = null;
- }
-
- /**
* Creates a new identifier from the specified one. This is a copy
constructor which
* get the code, codespace, authority and version from the given
identifier.
*
@@ -677,4 +666,29 @@ public class ImmutableIdentifier extends
return WKTKeywords.URI;
}
}
+
+
+
+
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////
////////
+ //////// XML support with JAXB
////////
+ ////////
////////
+ //////// The following methods are invoked by JAXB using reflection
(even if ////////
+ //////// they are private) or are helpers for other methods invoked
by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup
Language ////////
+ //////// (GML) support is not needed.
////////
+ ////////
////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Empty constructor for JAXB.
+ */
+ private ImmutableIdentifier() {
+ code = null;
+ codeSpace = null;
+ authority = null;
+ version = null;
+ description = null;
+ }
}
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -241,13 +241,23 @@ public class DefaultCoupledResource exte
- // Bridges for elements from legacy ISO 19119
+
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////
////////
+ //////// XML support with JAXB
////////
+ ////////
////////
+ //////// The following methods are invoked by JAXB using reflection
(even if ////////
+ //////// they are private) or are helpers for other methods invoked
by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup
Language ////////
+ //////// (GML) support is not needed.
////////
+ ////////
////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
* For JAXB marhalling of ISO 19119 document only.
*/
@XmlElement(name = "operationName", namespace = Namespaces.SRV)
- final String getOperationName() {
+ private String getOperationName() {
if (LEGACY_XML) {
final OperationMetadata operation = getOperation();
if (operation != null) {
@@ -262,7 +272,7 @@ public class DefaultCoupledResource exte
* {@link OperationName} placeholder. That temporary instance will be
replaced by the real
* one when the enclosing {@link DefaultServiceIdentification} is
unmarshalled.
*/
- final void setOperationName(final String name) {
+ private void setOperationName(final String name) {
if (operation == null) {
operation = new OperationName(name);
}
@@ -272,7 +282,7 @@ public class DefaultCoupledResource exte
* Returns the resource identifier, which is assumed to be the name as a
string.
*/
@XmlElement(name = "identifier", namespace = Namespaces.SRV)
- final String getIdentifier() {
+ private String getIdentifier() {
if (LEGACY_XML) {
final ScopedName name = getScopedName();
if (name != null) {
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -246,7 +246,17 @@ public class DefaultDataIdentification e
- // Bridges for elements from legacy ISO 19115:2003
+
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////
////////
+ //////// XML support with JAXB
////////
+ ////////
////////
+ //////// The following methods are invoked by JAXB using reflection
(even if ////////
+ //////// they are private) or are helpers for other methods invoked
by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup
Language ////////
+ //////// (GML) support is not needed.
////////
+ ////////
////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
* For JAXB marhalling of ISO 19115:2003 document only.
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -311,6 +311,7 @@ public class DefaultRepresentativeFracti
* Those identifiers are marshalled in XML as {@code id} or {@code uuid}
attributes.
*/
@Override
+ @SuppressWarnings("ReturnOfCollectionOrArrayField")
public Collection<Identifier> getIdentifiers() {
if (identifiers == null) {
identifiers = new CheckedArrayList<>(Identifier.class);
@@ -328,6 +329,20 @@ public class DefaultRepresentativeFracti
return new IdentifierMapWithSpecialCases(getIdentifiers());
}
+
+
+
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////
////////
+ //////// XML support with JAXB
////////
+ ////////
////////
+ //////// The following methods are invoked by JAXB using reflection
(even if ////////
+ //////// they are private) or are helpers for other methods invoked
by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup
Language ////////
+ //////// (GML) support is not needed.
////////
+ ////////
////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+
/**
* Invoked by JAXB for fetching the unique identifier unique for the XML
document.
*
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -445,10 +445,24 @@ public class DefaultServiceIdentificatio
containsChain = writeCollection(newValues, containsChain,
OperationChainMetadata.class);
}
+
+
+
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////
////////
+ //////// XML support with JAXB
////////
+ ////////
////////
+ //////// The following methods are invoked by JAXB using reflection
(even if ////////
+ //////// they are private) or are helpers for other methods invoked
by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup
Language ////////
+ //////// (GML) support is not needed.
////////
+ ////////
////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////
+
/**
* Invoked after JAXB has unmarshalled this object.
*/
- private void afterUnmarshal(final Unmarshaller u, final Object parent) {
+ private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
if (containsOperations != null && coupledResources != null) {
OperationName.resolve(containsOperations, coupledResources);
}
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -20,7 +20,6 @@ import java.util.Set;
import java.util.Map;
import java.util.List;
import java.util.HashSet;
-import java.util.Collection;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.quality.Completeness;
import org.opengis.referencing.IdentifiedObject;
@@ -40,7 +39,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static java.util.Collections.singleton;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.Assert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
@@ -251,9 +250,7 @@ public final strictfp class MetadataStan
*/
assertEquals("title", "EPSG Geodetic Parameter Dataset",
map.get("title").toString());
assertEquals("title", "EPSG Geodetic Parameter Dataset",
map.get("getTitle").toString());
- final Object identifiers = map.get("identifiers");
- assertInstanceOf("identifiers", Collection.class, identifiers);
- assertContainsIdentifierCode("EPSG", (Collection<?>) identifiers);
+ assertEquals("EPSG",
PropertyAccessorTest.getSingletonCode(map.get("identifiers")));
}
/**
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -63,7 +63,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static java.util.Collections.singleton;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.opengis.test.Assert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
import static org.apache.sis.metadata.PropertyAccessor.APPEND;
import static org.apache.sis.metadata.PropertyAccessor.RETURN_NULL;
@@ -294,8 +294,7 @@ public final strictfp class PropertyAcce
// Collection of Identifiers
final Object identifiers =
accessor.get(accessor.indexOf("identifiers", true), instance);
- assertInstanceOf("identifiers", Collection.class, identifiers);
- assertContainsIdentifierCode("19111", (Collection<?>) identifiers);
+ assertEquals("19111", getSingletonCode(identifiers));
}
/**
@@ -457,7 +456,7 @@ public final strictfp class PropertyAcce
assertEquals("set(…, RETURN_PREVIOUS)", oldTitles, oldValue);
assertEquals("get(…)", newTitles, newValue);
assertSame ("alternateTitles", newValue,
instance.getAlternateTitles());
- assertEquals("title", "Ignored title",
instance.getTitle().toString());
+ assertTitleEquals("title", "Ignored title", instance);
}
/**
@@ -526,7 +525,7 @@ public final strictfp class PropertyAcce
// Check final collection content.
final List<InternationalString> expected = Arrays.asList(title1,
title2);
assertEquals("alternateTitles", expected, accessor.get(index,
instance));
- assertEquals("title", "Ignored title", instance.getTitle().toString());
+ assertTitleEquals("title", "Ignored title", instance);
}
/**
@@ -573,17 +572,17 @@ public final strictfp class PropertyAcce
assertEquals("set(…, APPEND)", Boolean.TRUE, changed);
assertEquals("get(…)", merged, newValue);
assertSame ("alternateTitles", newValue,
instance.getAlternateTitles());
- assertEquals("title", "Added title", instance.getTitle().toString());
+ assertTitleEquals("title", "Added title", instance);
// Test setting again the title to the same value.
titleChanged = accessor.set(titleIndex, instance, "Added title",
APPEND);
assertEquals("set(…, APPEND)", Boolean.FALSE, titleChanged);
- assertEquals("title", "Added title", instance.getTitle().toString());
+ assertTitleEquals("title", "Added title", instance);
// Test setting the title to a different value.
titleChanged = accessor.set(titleIndex, instance, "Different title",
APPEND);
assertNull("set(…, APPEND)", titleChanged); // Operation shall be
refused.
- assertEquals("title", "Added title", instance.getTitle().toString());
+ assertTitleEquals("title", "Added title", instance);
}
/**
@@ -609,7 +608,7 @@ public final strictfp class PropertyAcce
assertInstanceOf("identifiers", Collection.class, target);
assertNotSame("Distinct objects shall have distinct collections.",
source, target);
assertEquals ("The two collections shall have the same content.",
source, target);
- assertContainsIdentifierCode("EPSG", (Collection<?>) target);
+ assertEquals ("EPSG", getSingletonCode(target));
// Set the identifiers to null, which should clear the collection.
assertEquals("Expected the previous value.", source,
accessor.set(index, citation, null, RETURN_PREVIOUS));
@@ -649,4 +648,18 @@ public final strictfp class PropertyAcce
final PropertyAccessor accessor = createPropertyAccessor();
assertEquals("PropertyAccessor[14 getters (+1 ext.) & 15 setters in
DefaultCitation:Citation from “ISO 19115”]", accessor.toString());
}
+
+ /**
+ * Returns the code of the singleton identifier found in the given
collection.
+ * This method verifies that the object is of the expected type.
+ *
+ * @param identifiers A singleton {@code Collection<Identifier>}.
+ * @return {@link Identifier#getCode()}.
+ */
+ static String getSingletonCode(final Object identifiers) {
+ assertInstanceOf("identifiers", Collection.class, identifiers);
+ final Object identifier = getSingleton((Collection<?>) identifiers);
+ assertInstanceOf("identifier", Identifier.class, identifier);
+ return ((Identifier) identifier).getCode();
+ }
}
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -68,7 +68,7 @@ public final strictfp class PropertyInfo
*/
private static void assertParentIsCitation(final
ExtendedElementInformation information) {
assertInstanceOf("Specific to SIS implementation.", Identifier.class,
information);
- assertEquals("ISO 19115", ((Identifier)
information).getAuthority().getTitle().toString());
+ assertTitleEquals("authority", "ISO 19115", ((Identifier)
information).getAuthority());
assertEquals("CI_Citation",
getSingleton(information.getParentEntity()));
}
@@ -138,6 +138,7 @@ public final strictfp class PropertyInfo
* @throws NoSuchMethodException Should never happen.
*/
@Test
+ @SuppressWarnings("UnnecessaryBoxing")
public void testGetDomainValue() throws NoSuchMethodException {
final ExtendedElementInformation information = new
PropertyInformation<>(HardCodedCitations.ISO_19115,
"maxRelativeHumidity",
EnvironmentalRecord.class.getMethod("getMaxRelativeHumidity"), Double.class,
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -39,7 +39,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
import static java.util.Collections.singleton;
@@ -230,8 +230,8 @@ public final strictfp class TreeNodeTest
@Test
@DependsOnMethod("testGetIdentifier")
public void testGetIndex() {
- final Integer ZERO = Integer.valueOf(0);
- final Integer ONE = Integer.valueOf(1);
+ final Integer ZERO = 0;
+ final Integer ONE = 1;
final DefaultCitation citation = metadataWithHierarchy();
assertColumnContentEquals(create(citation,
ValueExistencePolicy.NON_EMPTY), TableColumn.INDEX,
null, // CI_Citation
@@ -339,7 +339,7 @@ public final strictfp class TreeNodeTest
child = node.newChild();
child.setValue(TableColumn.IDENTIFIER, "title");
child.setValue(TableColumn.VALUE, "A new title");
- assertEquals("A new title", citation.getTitle().toString());
+ assertTitleEquals("citation", "A new title", citation);
assertSame(citation.getTitle(), child.getValue(TableColumn.VALUE));
/*
* Try adding a new element in a collection.
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -84,8 +84,8 @@ public final strictfp class DefaultIdent
@Test
public void testUnmarshall() throws JAXBException {
final DefaultIdentifier identifier =
unmarshal(DefaultIdentifier.class, XML);
- assertNull ( identifier.getVersion());
- assertEquals("4326", identifier.getCode());
- assertEquals("EPSG", identifier.getAuthority().getTitle().toString());
+ assertNull ("identifier", identifier.getVersion());
+ assertTitleEquals("authority", "EPSG", identifier.getAuthority());
+ assertEquals ("code", "4326", identifier.getCode());
}
}
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -220,7 +220,7 @@ public final strictfp class DefaultMetad
assertEquals("parentIdentifier", "ParentID",
metadata.getParentIdentifier());
DefaultCitation c = (DefaultCitation) metadata.getParentMetadata();
- assertEquals("parentMetadata", "ParentID", c.getTitle().toString());
+ assertTitleEquals("parentMetadata", "ParentID", c);
c.setTitle(new SimpleInternationalString("New parent"));
assertEquals("parentIdentifier", "New parent",
metadata.getParentIdentifier());
}
@@ -328,7 +328,7 @@ public final strictfp class DefaultMetad
assertEquals("metadataStandardName", name,
metadata.getMetadataStandardName());
assertEquals("metadataStandardVersion", version,
metadata.getMetadataStandardVersion());
final Citation standard =
getSingleton(metadata.getMetadataStandards());
- assertEquals(name, standard.getTitle() .toString());
+ assertTitleEquals("standard", name, standard);
assertEquals(version, standard.getEdition().toString());
}
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -73,14 +73,14 @@ public final strictfp class ImmutableIde
final ImmutableIdentifier identifier = new
ImmutableIdentifier(properties);
Validators.validate(identifier);
- assertEquals(CODE_KEY, "This is a code",
identifier.getCode());
- assertNull (CODESPACE_KEY,
identifier.getCodeSpace());
- assertEquals(AUTHORITY_KEY, "This is an authority",
identifier.getAuthority().getTitle().toString());
- assertEquals(VERSION_KEY, "This is a version",
identifier.getVersion());
- assertEquals("description", "There is a description",
identifier.getDescription().toString(Locale.ENGLISH));
- assertEquals("description_fr", "Voici une description",
identifier.getDescription().toString(Locale.FRENCH));
- assertEquals("description_fr_CA", "Pareil",
identifier.getDescription().toString(Locale.CANADA_FRENCH));
- assertEquals("description_fr_BE", "Voici une description",
identifier.getDescription().toString(new Locale("fr", "BE")));
+ assertEquals (CODE_KEY, "This is a code",
identifier.getCode());
+ assertNull (CODESPACE_KEY,
identifier.getCodeSpace());
+ assertTitleEquals(AUTHORITY_KEY, "This is an authority",
identifier.getAuthority());
+ assertEquals (VERSION_KEY, "This is a version",
identifier.getVersion());
+ assertEquals ("description", "There is a description",
identifier.getDescription().toString(Locale.ENGLISH));
+ assertEquals ("description_fr", "Voici une description",
identifier.getDescription().toString(Locale.FRENCH));
+ assertEquals ("description_fr_CA", "Pareil",
identifier.getDescription().toString(Locale.CANADA_FRENCH));
+ assertEquals ("description_fr_BE", "Voici une description",
identifier.getDescription().toString(new Locale("fr", "BE")));
}
/**
@@ -94,13 +94,13 @@ public final strictfp class ImmutableIde
final ImmutableIdentifier identifier = new
ImmutableIdentifier(properties);
Validators.validate(identifier);
- assertEquals(CODE_KEY, "This is a code",
identifier.getCode());
- assertNull (CODESPACE_KEY,
identifier.getCodeSpace());
- assertEquals(AUTHORITY_KEY, "This is an authority",
identifier.getAuthority().getTitle().toString());
- assertEquals(VERSION_KEY, "This is a version",
identifier.getVersion());
- assertEquals("description", "Overwritten description",
identifier.getDescription().toString(Locale.ENGLISH));
- assertEquals("description_fr", "Voici une description",
identifier.getDescription().toString(Locale.FRENCH));
- assertEquals("description_fr_CA", "Pareil",
identifier.getDescription().toString(Locale.CANADA_FRENCH));
+ assertEquals (CODE_KEY, "This is a code",
identifier.getCode());
+ assertNull (CODESPACE_KEY,
identifier.getCodeSpace());
+ assertTitleEquals(AUTHORITY_KEY, "This is an authority",
identifier.getAuthority());
+ assertEquals (VERSION_KEY, "This is a version",
identifier.getVersion());
+ assertEquals ("description", "Overwritten description",
identifier.getDescription().toString(Locale.ENGLISH));
+ assertEquals ("description_fr", "Voici une description",
identifier.getDescription().toString(Locale.FRENCH));
+ assertEquals ("description_fr_CA", "Pareil",
identifier.getDescription().toString(Locale.CANADA_FRENCH));
}
/**
@@ -114,13 +114,13 @@ public final strictfp class ImmutableIde
final ImmutableIdentifier identifier = new
ImmutableIdentifier(properties);
Validators.validate(identifier);
- assertEquals(CODE_KEY, "This is a code",
identifier.getCode());
- assertNull (CODESPACE_KEY,
identifier.getCodeSpace());
- assertEquals(AUTHORITY_KEY, "An other authority",
identifier.getAuthority().getTitle().toString());
- assertEquals(VERSION_KEY, "This is a version",
identifier.getVersion());
- assertEquals("description", "There is a description",
identifier.getDescription().toString(Locale.ENGLISH));
- assertEquals("description_fr", "Voici une description",
identifier.getDescription().toString(Locale.FRENCH));
- assertEquals("description_fr_CA", "Pareil",
identifier.getDescription().toString(Locale.CANADA_FRENCH));
+ assertEquals (CODE_KEY, "This is a code",
identifier.getCode());
+ assertNull (CODESPACE_KEY,
identifier.getCodeSpace());
+ assertTitleEquals(AUTHORITY_KEY, "An other authority",
identifier.getAuthority());
+ assertEquals (VERSION_KEY, "This is a version",
identifier.getVersion());
+ assertEquals ("description", "There is a description",
identifier.getDescription().toString(Locale.ENGLISH));
+ assertEquals ("description_fr", "Voici une description",
identifier.getDescription().toString(Locale.FRENCH));
+ assertEquals ("description_fr_CA", "Pareil",
identifier.getDescription().toString(Locale.CANADA_FRENCH));
}
/**
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -157,19 +157,17 @@ public final strictfp class CitationsTes
*/
@Test
public void testGetTitles() {
- assertEquals("Apache Spatial Information System", SIS
.getTitle().toString(Locale.US));
- assertEquals("Identifier in OGC namespace", OGC
.getTitle().toString(Locale.US));
- assertEquals("EPSG Geodetic Parameter Dataset", EPSG
.getTitle().toString(Locale.US));
- assertEquals("International Standard Book Number", ISBN
.getTitle().toString(Locale.US));
- assertEquals("International Standard Serial Number", ISSN
.getTitle().toString(Locale.US));
- assertEquals("GeoTIFF",
GEOTIFF.getTitle().toString(Locale.US));
- assertEquals("NetCDF", NETCDF
.getTitle().toString(Locale.US));
- assertEquals("Proj.4", PROJ4
.getTitle().toString(Locale.US));
- assertEquals("S-57", S57
.getTitle().toString(Locale.US));
- assertEquals("Geographic Information — Metadata Part 1: Fundamentals",
- ISO_19115.get(0).getTitle().toString(Locale.US));
- assertEquals("Geographic Information — Metadata Part 2: Extensions for
imagery and gridded data",
- ISO_19115.get(1).getTitle().toString(Locale.US));
+ assertTitleEquals("SIS", "Apache Spatial Information System",
SIS);
+ assertTitleEquals("OGC", "Identifier in OGC namespace",
OGC);
+ assertTitleEquals("EPSG", "EPSG Geodetic Parameter Dataset",
EPSG);
+ assertTitleEquals("ISBN", "International Standard Book Number",
ISBN);
+ assertTitleEquals("ISSN", "International Standard Serial Number",
ISSN);
+ assertTitleEquals("GEOTIFF", "GeoTIFF",
GEOTIFF);
+ assertTitleEquals("NETCDF", "NetCDF",
NETCDF);
+ assertTitleEquals("PROJ4", "Proj.4",
PROJ4);
+ assertTitleEquals("S57", "S-57",
S57);
+ assertTitleEquals("ISO_19115", "Geographic Information — Metadata Part
1: Fundamentals", ISO_19115.get(0));
+ assertTitleEquals("ISO_19115", "Geographic Information — Metadata Part
2: Extensions for imagery and gridded data", ISO_19115.get(1));
}
/**
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -174,7 +174,7 @@ public final strictfp class DefaultDataI
final DefaultDataIdentification info = create();
final Map<String,Object> map = info.asMap();
assertEquals("abstract", "NCEP SST Global 5.0 x 2.5 degree model
data", map.get("abstract").toString());
- assertEquals("title", "Sea Surface Temperature Analysis Model",
((Citation) map.get("citation")).getTitle().toString());
+ assertTitleEquals("title", "Sea Surface Temperature Analysis Model",
(Citation) map.get("citation"));
assertEquals("spatialRepresentationType",
singleton(SpatialRepresentationType.GRID),
map.get("spatialRepresentationType"));
assertArrayEquals("language", LOCALES, ((Collection<?>)
map.get("language")).toArray());
assertArrayEquals("languages", LOCALES, ((Collection<?>)
map.get("languages")).toArray());
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -16,8 +16,9 @@
*/
package org.apache.sis.test;
-import java.util.Collection;
-import org.opengis.metadata.Identifier;
+import java.util.Locale;
+import org.opengis.util.InternationalString;
+import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.IdentifiedObject;
import org.apache.sis.io.wkt.Symbols;
import org.apache.sis.io.wkt.WKTFormat;
@@ -53,25 +54,19 @@ public strictfp class MetadataAssert ext
}
/**
- * Asserts that the given collection contains exactly one identifier with
the given
- * {@linkplain Identifier#getCode() code}. The {@linkplain
Identifier#getCodeSpace()
- * code space} and authority are ignored.
+ * Asserts that the English title of the given citation is equals to the
expected string.
*
- * @param expected The expected identifier code (typically {@code "ISO"}
or {@code "EPSG"}).
- * @param identifiers The collection to validate. Should be a collection
of {@link Identifier}.
+ * @param message The message to report in case of test failure.
+ * @param expected The expected English title.
+ * @param citation The citation to test.
*
- * @since 0.5
+ * @since 0.6
*/
- public static void assertContainsIdentifierCode(final String expected,
final Collection<?> identifiers) {
- assertNotNull("identifiers", identifiers);
- int count = 0;
- for (final Object id : identifiers) {
- assertInstanceOf("identifier", Identifier.class, id);
- if (((Identifier) id).getCode().equals(expected)) {
- count++;
- }
- }
- assertEquals("Unexpected amount of identifiers.", 1, count);
+ public static void assertTitleEquals(final String message, final String
expected, final Citation citation) {
+ assertNotNull(message, citation);
+ final InternationalString title = citation.getTitle();
+ assertNotNull(message, title);
+ assertEquals(message, expected, title.toString(Locale.US));
}
/**
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -57,7 +57,7 @@ public final strictfp class NilReasonMar
"</gmd:CI_Citation>";
final Citation citation = (Citation) XML.unmarshal(expected);
- assertEquals("title", "A title", citation.getTitle().toString());
+ assertTitleEquals("citation", "A title", citation);
final Series series = citation.getSeries();
assertInstanceOf("Should have instantiated a proxy.", NilObject.class,
series);
@@ -117,6 +117,7 @@ public final strictfp class NilReasonMar
*/
@Test
@DependsOnMethod("testMissing")
+ @SuppressWarnings("UnnecessaryBoxing")
public void testMissingInteger() throws JAXBException {
final String expected =
"<gmd:MD_Dimension xmlns:gmd=\"" + Namespaces.GMD + '"' +
@@ -187,7 +188,7 @@ public final strictfp class NilReasonMar
"</gmd:CI_Citation>";
final Citation citation = (Citation) XML.unmarshal(expected);
- assertEquals("title", "A title", citation.getTitle().toString());
+ assertTitleEquals("citation", "A title", citation);
final Series series = citation.getSeries();
assertInstanceOf("Should have instantiated a proxy.", NilObject.class,
series);
@@ -222,7 +223,7 @@ public final strictfp class NilReasonMar
"</gmd:CI_Citation>";
final Citation citation = (Citation) XML.unmarshal(expected);
- assertEquals("title", "A title", citation.getTitle().toString());
+ assertTitleEquals("citation", "A title", citation);
final Series series = citation.getSeries();
assertInstanceOf("Should have instantiated a proxy.", NilObject.class,
series);
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -122,7 +122,7 @@ public final strictfp class UUIDMarshall
@Test
public void testIdentification() throws JAXBException {
final Citation citation = (Citation) XML.unmarshal(IDENTIFIED_XML);
- assertEquals("title", "My data", citation.getTitle().toString());
+ assertTitleEquals("Citation", "My data", citation);
/*
* Programmatic verification of the Series properties,
* which is the main object of interest in this test.
@@ -173,7 +173,7 @@ public final strictfp class UUIDMarshall
@Test
public void testReference() throws JAXBException {
final Citation citation = (Citation)
XML.unmarshal(REFERENCED_XML_WITH_BODY);
- assertEquals("Citation.title", "My data",
citation.getTitle().toString());
+ assertTitleEquals("Citation.title", "My data", citation);
/*
* Programmatic verification of the Series properties,
* which is the main object of interest in this test.
@@ -206,7 +206,7 @@ public final strictfp class UUIDMarshall
@DependsOnMethod("testReference")
public void testReferenceInEmptyObject() throws JAXBException {
final Citation citation = (Citation) XML.unmarshal(REFERENCED_XML);
- assertEquals("Citation.title", "My data",
citation.getTitle().toString());
+ assertTitleEquals("Citation.title", "My data", citation);
/*
* Programmatic verification of the Series properties,
* which is the main object of interest in this test.
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_Conversion.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_Conversion.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_Conversion.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_Conversion.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -17,7 +17,9 @@
package org.apache.sis.internal.jaxb.referencing;
import javax.xml.bind.annotation.XmlElement;
+import org.opengis.referencing.crs.SingleCRS;
import org.opengis.referencing.operation.Conversion;
+import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.gco.PropertyType;
import org.apache.sis.referencing.operation.DefaultConversion;
@@ -33,6 +35,15 @@ import org.apache.sis.referencing.operat
*/
public final class CC_Conversion extends PropertyType<CC_Conversion,
Conversion> {
/**
+ * Temporary storage for the {@code baseCRS} during {@link
org.apache.sis.referencing.crs.AbstractDerivedCRS}
+ * unmarshalling. A temporary location is needed because {@code
AbstractDerivedCRS} does not have any explicit
+ * field for {@code baseCRS}.
+ *
+ * @see #setBaseCRS(Conversion, SingleCRS)
+ */
+ private SingleCRS baseCRS;
+
+ /**
* Empty constructor for JAXB only.
*/
public CC_Conversion() {
@@ -88,5 +99,38 @@ public final class CC_Conversion extends
*/
public void setElement(final DefaultConversion conversion) {
metadata = conversion;
+ Context.setWrapper(Context.current(), this);
+ }
+
+ /**
+ * Temporarily stores the {@code baseCRS} associated to the given {@code
Conversion}. This temporary storage is
+ * needed because {@code
org.apache.sis.referencing.crs.AbstractDerivedCRS} does not have any explicit
field for
+ * {@code baseCRS}. Instead the base CRS is stored in {@link
Conversion#getSourceCRS()}, but we can set this
+ * property only after the {@code DerivedCRS} coordinate system has been
unmarshalled.
+ *
+ * See {@code AbstractDerivedCRS.afterUnmarshal(Unmarshaller, Object
parent)} for more information.
+ *
+ * @param conversion The conversion to which to associate a base CRS.
+ * @param crs The base CRS to associate to the given conversion.
+ * @return The previous base CRS, or {@code null} if none.
+ */
+ public static SingleCRS setBaseCRS(final Conversion conversion, final
SingleCRS crs) {
+ /*
+ * Implementation note: we store the base CRS in the marshalling
context because:
+ *
+ * - we want to keep each thread isolated (using ThreadLocal), and
+ * - we want to make sure that the reference is disposed even if the
unmarshaller throws an exception.
+ * This is guaranteed because the Context is disposed by Apache
SIS in "try … finally" constructs.
+ */
+ final PropertyType<?,?> wrapper =
Context.getWrapper(Context.current());
+ if (wrapper instanceof CC_Conversion) {
+ final CC_Conversion c = (CC_Conversion) wrapper;
+ if (c.getElement() == conversion) { // For making sure that we do
not confuse with another conversion.
+ final SingleCRS previous = c.baseCRS;
+ c.baseCRS = crs;
+ return previous;
+ }
+ }
+ return null;
}
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -16,26 +16,75 @@
*/
package org.apache.sis.internal.jaxb.referencing;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.HashSet;
import javax.xml.bind.annotation.XmlElementRef;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.parameter.GeneralParameterDescriptor;
+import org.opengis.parameter.ParameterNotFoundException;
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;
+import org.apache.sis.util.CorruptedObjectException;
+import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.jaxb.gco.PropertyType;
+import org.apache.sis.internal.jaxb.Context;
/**
* JAXB adapter mapping implementing class to the GeoAPI interface. See
* package documentation for more information about JAXB and interface.
*
+ * <p>This class provides additional {@code merge(…)} methods for building a
unique descriptor
+ * instance when the same descriptor is declared in more than one place in the
GML document.
+ * Some examples of duplications are:</p>
+ *
+ * <ul>
+ * <li>The descriptors listed under the {@code <gml:group>} element, which
duplicate the descriptors listed
+ * under each {@code <gml:parameterValue>} element.</li>
+ * <li>The descriptors declared in each parameter value of a {@code
SingleOperation}, which duplicate the
+ * descriptors declared in the associated {@code OperationMethod}.</li>
+ * </ul>
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
* @version 0.6
* @module
*/
-public final class CC_GeneralOperationParameter extends
PropertyType<CC_GeneralOperationParameter,GeneralParameterDescriptor> {
+public final class CC_GeneralOperationParameter extends
PropertyType<CC_GeneralOperationParameter, GeneralParameterDescriptor> {
+ /**
+ * The default value of {@code minimumOccurs} and {@code maximumOccurs} if
the XML element is not provided.
+ */
+ public static final short DEFAULT_OCCURRENCE = 1;
+
+ /**
+ * The properties to ignore in the descriptor parsed from GML when this
descriptor is merged with a
+ * pre-defined descriptor. Remarks:
+ *
+ * <ul>
+ * <li>We ignore the name because the comparisons shall be performed by
the caller with
+ * {@link IdentifiedObjects#isHeuristicMatchForName} or something
equivalent.</li>
+ * <li>We ignore aliases and identifiers for now for avoiding the
additional complexity
+ * of dealing with collections, and because the Apache SIS
pre-defined descriptors
+ * will be more complete in a majority of case.
+ *
+ * <b>TODO - </b> this may be revised in any future SIS version.</li>
+ * </ul>
+ */
+ private static final String[] IGNORE_DURING_MERGE = {
+ GeneralParameterDescriptor.NAME_KEY,
+ GeneralParameterDescriptor.ALIAS_KEY,
+ GeneralParameterDescriptor.IDENTIFIERS_KEY
+ };
+
/**
* Empty constructor for JAXB only.
*/
@@ -105,4 +154,190 @@ public final class CC_GeneralOperationPa
public void setElement(final AbstractParameterDescriptor parameter) {
metadata = parameter;
}
+
+ /**
+ * Verifies that the given descriptor is non-null and contains at least a
name.
+ * This method is used after unmarshalling.
+ */
+ static boolean isValid(final GeneralParameterDescriptor descriptor) {
+ return descriptor != null && descriptor.getName() != null;
+ }
+
+ /**
+ * Returns a descriptor with the same properties than the {@code provided}
one, but completed with information
+ * not found in GML. Those missing information are given by the {@code
complete} descriptor, which may come from
+ * two sources:
+ *
+ * <ul>
+ * <li>The descriptor for a {@code <gml:ParameterValue>} element. Those
descriptors are more complete than the
+ * ones provided by {@code <gml:OperationParameter>} elements alone
because the parameter value allows SIS
+ * to infer the {@code valueClass}.</li>
+ * <li>A pre-defined parameter descriptor from the {@link
org.apache.sis.internal.referencing.provider} package.</li>
+ * </ul>
+ *
+ * @param provided The descriptor unmarshalled from the GML document.
+ * @param complete The descriptor to use for completing missing
information.
+ * @return The descriptor to use. May be one of the arguments given to
this method, or a new instance.
+ *
+ * @see <a href="http://issues.apache.org/jira/browse/SIS-290">SIS-290</a>
+ */
+ static GeneralParameterDescriptor merge(final GeneralParameterDescriptor
provided,
+ final GeneralParameterDescriptor
complete)
+ {
+ if (provided == complete) {
+ return complete;
+ }
+ final boolean isGroup;
+ if (provided instanceof ParameterDescriptor<?> && complete instanceof
ParameterDescriptor<?>) {
+ isGroup = false; // This is by far the most usual case.
+ } else if (provided instanceof ParameterDescriptorGroup && complete
instanceof ParameterDescriptorGroup) {
+ isGroup = true;
+ } else {
+ /*
+ * Mismatched or unknown type. It should not happen with
descriptors parsed by JAXB and with
+ * pre-defined descriptors provided by SIS. But it could happen
with a pre-defined descriptor
+ * found in a user-provided OperationMethod with malformed
parameters.
+ * Return the descriptor found in the GML document as-is.
+ */
+ return provided;
+ }
+ final int minimumOccurs = provided.getMinimumOccurs();
+ final int maximumOccurs = provided.getMaximumOccurs();
+ final Map<String,?> expected =
IdentifiedObjects.getProperties(complete);
+ final Map<String,?> actual =
IdentifiedObjects.getProperties(provided, IGNORE_DURING_MERGE);
+ final boolean canSubstitute = complete.getMinimumOccurs() ==
minimumOccurs
+ && complete.getMaximumOccurs() ==
maximumOccurs
+ &&
expected.entrySet().containsAll(actual.entrySet());
+ if (canSubstitute && !isGroup) {
+ /*
+ * The pre-defined or ParameterValue descriptor contains at least
all the information found
+ * in the descriptor parsed from the GML document, ignoring
IGNORE_DURING_MERGE properties.
+ * So we can use the existing instance directly, assuming that the
additional properties and
+ * the difference in ignored properties are acceptable.
+ */
+ return complete;
+ }
+ /*
+ * Collect the properties specified in the GML document and complete
with the properties provided
+ * by the 'complete' descriptor. If the descriptor is a group, then
this 'replacement' method will
+ * be invoked recursively for each parameter in the group.
+ */
+ final Map<String,Object> merged = new HashMap<>(expected);
+ merged.putAll(actual); // May overwrite pre-defined properties.
+ if (isGroup) {
+ final List<GeneralParameterDescriptor> descriptors =
((ParameterDescriptorGroup) provided).descriptors();
+ return merge(DefaultParameterValueGroup.class, merged, merged,
minimumOccurs, maximumOccurs,
+ descriptors.toArray(new
GeneralParameterDescriptor[descriptors.size()]),
+ (ParameterDescriptorGroup) complete, canSubstitute);
+ } else {
+ return merge(merged, (ParameterDescriptor<?>) provided,
(ParameterDescriptor<?>) complete);
+ }
+ }
+
+ /**
+ * 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()}.
+ * @param maximumOccurs Value to assign to {@link
DefaultParameterDescriptorGroup#getMaximumOccurs()}.
+ * @param provided Parameter descriptors declared in the GML
document. This array will be overwritten.
+ * @param complete More complete parameter descriptors.
+ * @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).
+ *
+ * @see <a href="http://issues.apache.org/jira/browse/SIS-290">SIS-290</a>
+ */
+ static ParameterDescriptorGroup merge(final Class<?>
caller,
+ final Map<String,?>
properties,
+ final Map<String,?>
merged,
+ final int
minimumOccurs,
+ final int
maximumOccurs,
+ final GeneralParameterDescriptor[]
provided,
+ final ParameterDescriptorGroup
complete,
+ boolean
canSubstitute)
+ {
+ boolean isCompatible = true;
+ final Set<GeneralParameterDescriptor> included = new
HashSet<>(Containers.hashMapCapacity(provided.length));
+ for (int i=0; i<provided.length; i++) {
+ final GeneralParameterDescriptor p = provided[i];
+ try {
+ /*
+ * Replace the descriptors provided in the GML document by
descriptors from the 'complete' instance,
+ * if possible. Keep trace of the complete descriptors that we
found in this process.
+ */
+ GeneralParameterDescriptor predefined =
complete.descriptor(p.getName().getCode());
+ if (predefined != null) { // Safety in case 'complete' is a
user's implementation.
+ canSubstitute &= (provided[i] = merge(p, predefined)) ==
predefined;
+ if (!included.add(predefined)) {
+ throw new CorruptedObjectException(predefined); //
Broken hashCode/equals, or object mutated.
+ }
+ continue;
+ }
+ } catch (ParameterNotFoundException e) {
+ /*
+ * 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.
+ * But we may still be able to use its properties (name, alias,
identifier) provided that the parameter
+ * not found was optional.
+ */
+ isCompatible &= p.getMinimumOccurs() == 0;
+ canSubstitute = false;
+ }
+ if (isCompatible) {
+ /*
+ * At this point, we determined that all mandatory parameters in
the GML document exist in the 'complete'
+ * descriptor. However the converse is not necessarily true.
Verify that all parameters missing in the GML
+ * document were optional.
+ */
+ for (final GeneralParameterDescriptor descriptor :
complete.descriptors()) {
+ if (!included.contains(descriptor) &&
descriptor.getMinimumOccurs() != 0
+ && !CC_OperationMethod.isImplicitParameter(descriptor))
+ {
+ canSubstitute = false;
+ isCompatible = false;
+ break;
+ }
+ }
+ }
+ if (canSubstitute) {
+ return complete;
+ } else {
+ return new DefaultParameterDescriptorGroup(isCompatible ? merged :
properties,
+ minimumOccurs, maximumOccurs, provided);
+ }
+ }
+
+ /**
+ * Creates a new descriptor with the same properties than the {@code
provided} one, but completed with
+ * information not found in GML. Those extra information are given by the
{@code complete} descriptor.
+ *
+ * <p>It is the caller's responsibility to construct the {@code
properties} map as a merge
+ * of the properties of the two given descriptors.</p>
+ */
+ private static <T> ParameterDescriptor<T> merge(final Map<String,?>
merged,
+ final
ParameterDescriptor<?> provided,
+ final
ParameterDescriptor<T> complete)
+ {
+ final Class<T> valueClass = complete.getValueClass();
+ return new DefaultParameterDescriptor<>(merged,
+ provided.getMinimumOccurs(),
+ provided.getMaximumOccurs(),
+ // Values below this point are not provided in GML documents,
+ // so they must be inferred from the pre-defined descriptor.
+ valueClass,
+ Parameters.getValueDomain(complete),
+ CollectionsExt.toArray(complete.getValidValues(), valueClass),
+ complete.getDefaultValue());
+ }
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralParameterValue.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralParameterValue.java?rev=1701516&r1=1701515&r2=1701516&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralParameterValue.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralParameterValue.java
[UTF-8] Sun Sep 6 19:10:30 2015
@@ -24,6 +24,7 @@ import org.opengis.parameter.GeneralPara
import org.apache.sis.parameter.DefaultParameterValue;
import org.apache.sis.parameter.DefaultParameterValueGroup;
import org.apache.sis.internal.jaxb.gco.PropertyType;
+import org.apache.sis.util.resources.Errors;
/**
@@ -109,6 +110,13 @@ public final class CC_GeneralParameterVa
* @param parameter The unmarshalled element.
*/
public void setElement(final GeneralParameterValue parameter) {
+ if (!CC_GeneralOperationParameter.isValid(parameter.getDescriptor())) {
+ /*
+ * Descriptors are mandatory and SIS classes need them. Provide an
error message
+ * here instead than waiting for a NullPointerException in some
arbitrary place.
+ */
+ throw new
IllegalArgumentException(Errors.format(Errors.Keys.MissingValueForProperty_1,
"operationParameter"));
+ }
metadata = parameter;
}
}