This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 781bfe91d8452a3620edcd6874b3843be3e57e86 Author: jsorel <[email protected]> AuthorDate: Mon May 11 15:36:29 2026 +0200 feat(DataStore): add timezone parameter name constant --- .../main/org/apache/sis/storage/DataStoreProvider.java | 13 +++++++++++++ .../org/apache/sis/storage/base/URIDataStoreProvider.java | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreProvider.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreProvider.java index c0baf80e12..2c5b6ab820 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreProvider.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreProvider.java @@ -82,6 +82,19 @@ public abstract class DataStoreProvider { */ public static final String LOCATION = "location"; + /** + * Name of the parameter that specifies the data store time zone. + * A parameter named {@value} should be included in the group of parameters returned by {@link #getOpenParameters()}. + * The parameter value is often a {@link String} or a {@link ZoneId}, other types should not be allowed. + * + * <p>Implementers are encouraged to define a parameter with this name + * to ensure a common and consistent definition among providers.</p> + * + * @see #CREATE + * @see #getOpenParameters() + */ + public static final String TIMEZONE = "timezone"; + /** * Name of the parameter that specifies whether to allow creation of a new {@code DataStore} if none exist * at the given location. A parameter named {@value} may be included in the group of parameters returned by diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java index dc53621cc9..e8818cec6f 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java @@ -29,6 +29,7 @@ import java.nio.file.Path; import java.nio.file.OpenOption; import java.nio.file.StandardOpenOption; import java.nio.charset.Charset; +import java.time.ZoneId; import org.opengis.parameter.ParameterValueGroup; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; @@ -193,7 +194,16 @@ public abstract class URIDataStoreProvider extends DataStoreProvider { if (parameters != null) try { final Object location = parameters.parameter(LOCATION).getValue(); if (location != null) { - return new StorageConnector(location); + StorageConnector cnx = new StorageConnector(location); + try { + final Object zoneId = parameters.parameter(TIMEZONE).getValue(); + if (zoneId instanceof ZoneId) { + cnx.setOption(org.apache.sis.setup.OptionKey.TIMEZONE, (ZoneId) zoneId); + } else if (zoneId instanceof String) { + cnx.setOption(org.apache.sis.setup.OptionKey.TIMEZONE, ZoneId.of((String) zoneId)); + } + } catch (ParameterNotFoundException e) {} + return cnx; } } catch (ParameterNotFoundException e) { cause = e;
