sis-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Desruisseaux <>
Subject Re: Question about TimePeriod & auto-generated id
Date Thu, 12 Feb 2015 22:26:27 GMT
We do not yet have a temporal module in SIS. One tricky issue will be to
leverage java.time while keeping compatibility with JDK 6 and 7. We are
exploring avenues in the Geotk temporal module before porting to SIS.

In the main time I would suggest to try the following: create a
DefaultPeriod subclass and implement IdentifiedObject as below:

    import org.apache.sis.xml.IdentifierMap;
    import org.apache.sis.xml.IdentifiedObject;
    import org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases;

    class IdentifiedPeriod extends DefaultPeriod implements IdentifiedObject {
        private final List<Identifier> identifiers = new ArrayList<>();

        public Collection<Identifier> getIdentifiers() {
            return identifiers;

        public IdentifierMap getIdentifierMap() {
            return new IdentifierMapWithSpecialCases(identifiers);

It would hopefully allow to use this period in the way proposed in my
previous email.

About controlling the date format, we do not yet have an API for that in
SIS. This is part of the things to do when we will port the temporal
module. However in the main time, it may be possible to do that by
registering a custom JAXB adapter before marshalling. Are you familiar
with javax.xml.bind.annotation.adapters?


Le 12/02/15 22:50, Emmanuel Blondel a écrit :
> Thanks for the indications,
> I've tried your suggestion, on my side i use a DefaultPeriod to
> implement the TemporalPrimitive and specify it in the metadata
> temporal extent.
> This is done by using the TemporalUtilities class:
> TemporalPrimitive temporalPrimitive =
> TemporalUtilities.createPeriod(startTime,endTime);
> ((IdentifiedObject)
> temporalPrimitive).getIdentifierMap().putSpecialized(IdentifierSpace.ID,
> "test");
> I get the exception: /org.geotoolkit.temporal.object.DefaultPeriod
> cannot be cast to org.apache.sis.xml.IdentifiedObject/
> I'm also wondering (considering there would be ideally a workaround to
> this) how i could specify the period string format as id. Before, i
> was using Geotk 3.21 and DefaultPeriod. After marshalling the id was
> generated as shown below.
> Emmanuel

View raw message