This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sis.git
commit 2297254f1ea7abd1f2632cb8ccc52e754194c328 Merge: 50e75f0247 f64017ade8 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Aug 4 11:57:55 2023 +0200 Merge branch 'geoapi-3.1'. This merge upgrades and completes the parent POM, makes identification of unsigned types in SQLStore a little bit more robust, and makes information provided by `GeometryType` a little bit more accurate. .../org/apache/sis/internal/gui/Resources.java | 2 +- .../apache/sis/cloud/aws/internal/Resources.java | 2 +- .../apache/sis/feature/ExpressionOperation.java | 5 +- .../apache/sis/filter/DefaultFilterFactory.java | 43 +++++--- .../java/org/apache/sis/image/ImageProcessor.java | 7 +- .../internal/coverage/j2d/ColorModelBuilder.java | 4 +- .../sis/internal/coverage/j2d/FillValues.java | 1 + .../sis/internal/coverage/j2d/TilePlaceholder.java | 6 +- .../sis/internal/coverage/j2d/TiledImage.java | 2 +- .../apache/sis/internal/feature/Geometries.java | 4 +- .../apache/sis/internal/feature/GeometryType.java | 113 ++++++++++++++++----- .../sis/internal/feature/GeometryWrapper.java | 2 +- .../org/apache/sis/internal/feature/Resources.java | 2 +- .../apache/sis/internal/feature/esri/Factory.java | 8 +- .../sis/internal/feature/esri/package-info.java | 5 +- .../sis/internal/feature/j2d/package-info.java | 5 +- .../apache/sis/internal/feature/jts/Factory.java | 20 ++-- .../org/apache/sis/internal/feature/jts/JTS.java | 5 +- .../apache/sis/internal/feature/jts/Wrapper.java | 22 ++-- .../sis/internal/filter/FunctionRegister.java | 6 +- .../java/org/apache/sis/internal/filter/Node.java | 2 +- .../org/apache/sis/internal/filter/Visitor.java | 4 +- .../java/org/apache/sis/internal/filter/XPath.java | 2 +- .../apache/sis/internal/filter/sqlmm/SQLMM.java | 46 ++++----- .../sis/internal/filter/sqlmm/SpatialFunction.java | 3 +- .../sis/internal/feature/GeometryTypeTest.java | 34 ++++++- .../jaxb/metadata/replace/ServiceParameter.java | 4 +- .../apache/sis/internal/metadata/Resources.java | 2 +- .../internal/simple/SimpleIdentifiedObject.java | 4 +- .../org/apache/sis/util/iso/DefaultTypeName.java | 5 + .../java/org/apache/sis/util/iso/TypeNames.java | 6 +- .../META-INF/services/org.opengis.util.NameFactory | 0 .../apache/sis/test/xml/DocumentComparator.java | 2 +- .../org/apache/sis/util/iso/TypeNamesTest.java | 17 +++- .../sis/internal/map/coverage/RenderingData.java | 2 +- .../java/org/apache/sis/style/package-info.java | 2 +- .../main/java/org/apache/sis/style/se1/Fill.java | 2 +- .../org/apache/sis/style/se1/LinePlacement.java | 2 +- .../main/java/org/apache/sis/style/se1/Stroke.java | 2 +- .../org/apache/sis/style/se1/package-info.java | 2 +- .../apache/sis/internal/gazetteer/Resources.java | 2 +- .../referencing/CC_GeneralOperationParameter.java | 2 +- .../referencing/CC_OperationParameterGroup.java | 2 +- .../internal/jaxb/referencing/RS_Identifier.java | 2 +- .../sis/internal/referencing/Arithmetic.java | 9 +- .../internal/referencing/DefinitionVerifier.java | 4 +- .../apache/sis/internal/referencing/LazySet.java | 3 +- .../apache/sis/internal/referencing/Resources.java | 2 +- .../internal/referencing/j2d/AbstractShape.java | 2 +- .../sis/internal/referencing/j2d/package-info.java | 5 +- .../referencing/provider/DatumShiftGridFile.java | 12 ++- .../referencing/provider/DatumShiftGridGroup.java | 6 +- .../DefaultCoordinateOperationFactory.java | 2 +- .../operation/DefaultOperationMethod.java | 2 +- .../operation/projection/AlbersEqualArea.java | 2 +- .../operation/transform/ScaleTransform.java | 2 +- .../operation/transform/SphericalToCartesian.java | 2 +- .../operation/DefaultOperationMethodTest.java | 3 +- .../sis/internal/converter/ArrayConverter.java | 6 +- .../internal/converter/CharSequenceConverter.java | 5 +- .../internal/converter/CollectionConverter.java | 5 +- .../sis/internal/converter/DateConverter.java | 5 +- .../sis/internal/converter/PathConverter.java | 6 +- .../sis/internal/converter/StringConverter.java | 5 +- .../apache/sis/internal/util/CollectionsExt.java | 2 - .../sis/util/ResourceInternationalString.java | 4 +- .../java/org/apache/sis/util/collection/Cache.java | 2 - pom.xml | 57 ++++++++--- .../apache/sis/internal/earth/netcdf/GCOM_C.java | 2 +- .../apache/sis/internal/earth/netcdf/GCOM_W.java | 2 +- .../apache/sis/internal/geotiff/Compression.java | 2 +- .../org/apache/sis/internal/geotiff/Predictor.java | 2 +- .../org/apache/sis/internal/geotiff/Resources.java | 2 +- .../apache/sis/storage/geotiff/GeoIdentifiers.java | 2 +- .../apache/sis/storage/geotiff/GeoKeysTest.java | 14 ++- .../org/apache/sis/internal/netcdf/Resources.java | 2 +- .../org/apache/sis/internal/netcdf/Variable.java | 2 +- .../apache/sis/internal/sql/feature/Database.java | 20 +++- .../apache/sis/internal/sql/feature/Resources.java | 7 +- .../sis/internal/sql/feature/Resources.properties | 1 + .../internal/sql/feature/Resources_fr.properties | 1 + .../apache/sis/internal/sql/postgis/Postgres.java | 2 +- .../internal/storage/FeatureCatalogBuilder.java | 2 +- .../sis/internal/storage/GridResourceWrapper.java | 4 +- .../sis/internal/storage/MemoryFeatureSet.java | 2 +- .../sis/internal/storage/MemoryGridResource.java | 2 +- .../org/apache/sis/internal/storage/Resources.java | 2 +- .../sis/internal/storage/wkt/FirstKeywordPeek.java | 6 +- .../sis/internal/storage/wkt/StoreFormat.java | 1 + .../sis/internal/storage/xml/package-info.java | 2 +- .../java/org/apache/sis/storage/FeatureQuery.java | 2 +- .../sis/test/storage/CoverageReadConsistency.java | 8 +- .../sis/internal/storage/gpx/WritableStore.java | 2 +- .../internal/storage/xml/stream/StaxStreamIO.java | 2 +- 94 files changed, 433 insertions(+), 231 deletions(-) diff --cc core/sis-feature/src/main/java/org/apache/sis/filter/DefaultFilterFactory.java index 4ba11e17a5,cefc741868..cc9d1e1bc9 --- a/core/sis-feature/src/main/java/org/apache/sis/filter/DefaultFilterFactory.java +++ b/core/sis-feature/src/main/java/org/apache/sis/filter/DefaultFilterFactory.java @@@ -129,14 -125,14 +129,14 @@@ public abstract class DefaultFilterFact } /** - * Returns a factory operating on {@link Feature} instances. + * Returns a factory operating on {@link AbstractFeature} instances. * The {@linkplain GeometryLibrary geometry library} will be the system default. * - * @return factory operating on {@link Feature} instances. + * @return factory operating on {@link AbstractFeature} instances. * - * @todo The type of temporal object is not yet determined. + * @todo The type of temporal objects is not yet determined. */ - public static FilterFactory<Feature, Object, Object> forFeatures() { + public static DefaultFilterFactory<AbstractFeature, Object, Object> forFeatures() { return Features.DEFAULT; } @@@ -154,11 -162,11 +154,11 @@@ * * @see #forFeatures() */ - static final FilterFactory<Feature,Object,Object> DEFAULT = + static final DefaultFilterFactory<AbstractFeature,Object,Object> DEFAULT = - new Features<>(Object.class, Object.class, WraparoundMethod.SPLIT);; + new Features<>(Object.class, Object.class, WraparoundMethod.SPLIT); /** - * Creates a new factory operating on {@link Feature} instances. + * Creates a new factory operating on {@link AbstractFeature} instances. * See the {@linkplain DefaultFilterFactory#DefaultFilterFactory(Class, Class, WraparoundMethod)} * super-class constructor} for a list of valid class arguments. * @@@ -861,51 -994,15 +861,44 @@@ return new ArithmeticFunction.Divide<>(operand1, operand2); } + /** + * Creates an implementation-specific function with a single parameter. + * + * @param name name of the function to call. + * @param parameter expression providing values for the function argument. + * @return an expression which will call the specified function. + * @throws IllegalArgumentException if the given name is not recognized, + * or if the argument is illegal for the specified function. + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + public Expression<R,?> function(String name, Expression<? super R, ?> parameter) { + return function(name, new Expression[] {parameter}); + } + + /** + * Creates an implementation-specific function with two parameters. + * + * @param name name of the function to call. + * @param param1 expression providing values for the first function argument. + * @param param2 expression providing values for the second function argument. + * @return an expression which will call the specified function. + * @throws IllegalArgumentException if the given name is not recognized, + * or if the arguments are illegal for the specified function. + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + public Expression<R,?> function(String name, Expression<? super R, ?> param1, Expression<? super R, ?> param2) { + return function(name, new Expression[] {param1, param2}); + } + /** - * Creates an implementation-specific function. + * Returns the provider for the function of the given name. + * If the given name is {@code null}, then this method only + * ensures that {@link #availableFunctions} is initialized. * - * @param name name of the function to call. - * @param parameters expressions providing values for the function arguments. - * @return an expression which will call the specified function. - * @throws IllegalArgumentException if the given name is not recognized, - * or if the arguments are illegal for the specified function. + * @param name name of the function to get, or {@code null} if none. + * @return the register for the given function, or {@code null} if none. */ - public Expression<R,?> function(final String name, Expression<R,?>[] parameters) { - ArgumentChecks.ensureNonNull("name", name); - ArgumentChecks.ensureNonNull("parameters", parameters); - parameters = parameters.clone(); - for (int i=0; i<parameters.length; i++) { - ArgumentChecks.ensureNonNullElement("parameters", i, parameters[i]); - } + private FunctionRegister register(final String name) { final FunctionRegister register; synchronized (availableFunctions) { if (availableFunctions.isEmpty()) { @@@ -927,6 -1024,28 +920,26 @@@ } register = availableFunctions.get(name); } + return register; + } + + /** + * Creates an implementation-specific function. - * The names of available functions is given by {@link #getCapabilities()}. + * + * @param name name of the function to call. + * @param parameters expressions providing values for the function arguments. + * @return an expression which will call the specified function. + * @throws IllegalArgumentException if the given name is not recognized, + * or if the arguments are illegal for the specified function. + */ - @Override + public Expression<R,?> function(final String name, Expression<R,?>[] parameters) { + ArgumentChecks.ensureNonNull("name", name); + ArgumentChecks.ensureNonNull("parameters", parameters); + parameters = parameters.clone(); + for (int i=0; i<parameters.length; i++) { + ArgumentChecks.ensureNonNullElement("parameters", i, parameters[i]); + } + final FunctionRegister register = register(name); if (register == null) { throw new IllegalArgumentException(Resources.format(Resources.Keys.UnknownFunction_1, name)); } diff --cc core/sis-feature/src/main/java/org/apache/sis/internal/filter/FunctionRegister.java index 9639cbb7c5,15c6344218..f0e61d5e57 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/FunctionRegister.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/FunctionRegister.java @@@ -34,10 -35,8 +34,6 @@@ import org.apache.sis.filter.Expression * @author Johann Sorel (Geomatys) * @version 1.4 * @since 1.0 -- * -- * @see org.opengis.filter.FilterFactory#function(String, Expression...) - * - * @todo Replace by {@code org.opengis.filter.capability.ExtendedCapabilities}. */ public interface FunctionRegister { /** @@@ -56,10 -55,19 +52,10 @@@ */ Collection<String> getNames(); - /** - * Describes the parameters of a function. - * - * @param name name of the function to describe (not null). - * @return description of the function parameters. - * @throws IllegalArgumentException if function name is unknown.. - */ - AvailableFunction describe(String name) throws IllegalArgumentException; - /** - * Create a new function of the given name with given parameters. + * Creates a new function of the given name with given parameters. * - * @param <R> the type of resources (e.g. {@link org.opengis.feature.Feature}) used as inputs. + * @param <R> the type of resources (e.g. {@code Feature}) used as inputs. * @param name name of the function to create (not null). * @param parameters function parameters. * @return function for the given name and parameters. diff --cc core/sis-feature/src/test/java/org/apache/sis/internal/feature/GeometryTypeTest.java index bcfd8dd893,3ca324c7ce..ebba3b212a --- a/core/sis-feature/src/test/java/org/apache/sis/internal/feature/GeometryTypeTest.java +++ b/core/sis-feature/src/test/java/org/apache/sis/internal/feature/GeometryTypeTest.java @@@ -36,6 -38,30 +38,28 @@@ public final class GeometryTypeTest ext public GeometryTypeTest() { } + /** + * Verifies {@link GeometryType#name} values. + */ + @Test + public void verifyCamelCaseName() { + for (final GeometryType type : GeometryType.values()) { + assertEquals(type.name(), type.name.toUpperCase(Locale.US)); + } + } + + /** + * Tests {@link GeometryType#getTypeName(Geometries)}. + */ + @Test + public void testTypeName() { + TypeName name = GeometryType.LINESTRING.getTypeName(org.apache.sis.internal.feature.jts.Factory.INSTANCE); + assertEquals("OGC:LineString", name.toFullyQualifiedName().toString()); - assertEquals(org.locationtech.jts.geom.LineString.class, name.toJavaType().get()); + + name = GeometryType.LINESTRING.getTypeName(org.apache.sis.internal.feature.esri.Factory.INSTANCE); + assertEquals("OGC:LineString", name.toFullyQualifiedName().toString()); - assertEquals(com.esri.core.geometry.Polyline.class, name.toJavaType().get()); + } + /** * Tests {@link GeometryType#forBinaryType(int)} and verifies {@link GeometryType#binaryType()} values. */ diff --cc storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureCatalogBuilder.java index 479793affa,46dddd1c01..fd25885b33 --- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureCatalogBuilder.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureCatalogBuilder.java @@@ -48,9 -48,9 +48,9 @@@ public final class FeatureCatalogBuilde /** * The feature types created by the {@code FeatureCatalogBuilder}. * {@code DataStore} implementations can keep the reference to this {@code FeatureNaming} - * after the {@link #build(boolean)} method has been invoked. + * after the {@link #build()} method has been invoked. */ - public final FeatureNaming<FeatureType> features; + public final FeatureNaming<DefaultFeatureType> features; /** * Creates a new builder for the given data store.