sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1546638 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/ sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/ sis-referencing/src/main/java/org/apache/sis/internal/referencin...
Date Fri, 29 Nov 2013 20:17:59 GMT
Author: desruisseaux
Date: Fri Nov 29 20:17:58 2013
New Revision: 1546638

URL: http://svn.apache.org/r1546638
Log:
Added empty constructor for JAXB in datum objects.
Added some JAXB annotations in the root referencing package.

Added:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierCode.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NilReferencingObject.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.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/cs/AbstractCS.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/package-info.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -170,18 +170,15 @@ public final class Citations extends Sta
      * Returns a citation of the given name. The method makes the following choice:
      *
      * <ul>
-     *   <li>If the given title is {@code null} or empty (ignoring spaces), then this
method
-     *       returns {@code null}.</li>
+     *   <li>If the given title is {@code null} or empty (ignoring spaces), then this
method returns {@code null}.</li>
      *   <li>Otherwise if the given name matches a {@linkplain Citation#getTitle()
title} or an
      *       {@linkplain Citation#getAlternateTitles() alternate titles} of one of the pre-defined
-     *       constants ({@link #EPSG}, {@link #GEOTIFF}, <i>etc.</i>), then that
constant
-     *       is returned.</li>
+     *       constants ({@link #EPSG}, {@link #GEOTIFF}, <i>etc.</i>), then that
constant is returned.</li>
      *   <li>Otherwise, a new citation is created with the specified name as the title.</li>
      * </ul>
      *
      * @param  title The citation title (or alternate title), or {@code null}.
-     * @return A citation using the specified name, or {@code null} if the given title is
null
-     *         or empty.
+     * @return A citation using the specified name, or {@code null} if the given title is
null or empty.
      */
     public static Citation fromName(String title) {
         if (title == null || ((title = CharSequences.trimWhitespaces(title)).isEmpty()))
{

Added: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java?rev=1546638&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.jaxb.referencing;
+
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.apache.sis.util.StringBuilders;
+
+
+/**
+ * JAXB adapter mapping the GeoAPI {@link ReferenceIdentifier} to an implementation class
that can
+ * be marshalled. See the package documentation for more information about JAXB and interfaces.
+ *
+ * <p>The XML produced by this adapter uses the GML syntax. The {@link RS_IdentifierCode}
class
+ * performs a similar mapping, but in which only the code (without codespace) is marshalled.</p>
+ *
+ * <p>Note that a class of the same name is defined in the {@link org.apache.sis.internal.jaxb.metadata}
+ * package, which serve the same purpose (wrapping exactly the same interface) but using
the ISO 19139
+ * syntax instead. The ISO 19139 syntax represents the code and codespace as XML elements,
while in this
+ * GML representation the code is a XML value and the codespace is a XML attribute.</p>
+ *
+ * @author  Guilhem Legal (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4 (derived from geotk-3.00)
+ * @version 0.4
+ * @module
+ */
+public final class RS_Identifier extends XmlAdapter<RS_Identifier, ReferenceIdentifier>
{
+    /**
+     * The identifier code.
+     *
+     * <p><b>Note:</b> GML (the target of this class) represents that code
as an XML value, while
+     * {@link org.apache.sis.metadata.iso.ImmutableIdentifier} represents it as an XML element.</p>
+     */
+    @XmlValue
+    private String code;
+
+    /**
+     * The code space, which is often {@code "EPSG"} with the version in use.
+     *
+     * <p><b>Note:</b> GML (the target of this class) represents that code
as an XML attribute, while
+     * {@link org.apache.sis.metadata.iso.ImmutableIdentifier} represents it as an XML element.</p>
+     */
+    @XmlAttribute
+    private String codeSpace;
+
+    /**
+     * Empty constructor for JAXB only.
+     */
+    public RS_Identifier() {
+    }
+
+    /**
+     * Creates a wrapper initialized to the values of the given identifier.
+     *
+     * @param identifier The identifier from which to get the values.
+     */
+    private RS_Identifier(final ReferenceIdentifier identifier) {
+        code      = identifier.getCode();
+        codeSpace = identifier.getCodeSpace();
+        if (codeSpace == null) {
+            codeSpace = "";
+        }
+        String version = identifier.getVersion();
+        if (version != null) {
+            final StringBuilder buffer = new StringBuilder(codeSpace);
+            if (buffer.length() != 0) {
+                buffer.append('_');
+            }
+            StringBuilders.remove(buffer.append('v').append(version), ".");
+            codeSpace = buffer.toString();
+        }
+    }
+
+    /**
+     * Substitutes the wrapper value read from an XML stream by the object which will
+     * represents the identifier. JAXB calls automatically this method at unmarshalling time.
+     *
+     * @param  value The wrapper for this metadata value.
+     * @return An identifier which represents the value.
+     */
+    @Override
+    public ReferenceIdentifier unmarshal(final RS_Identifier value) {
+        if (value != null) {
+            final Citation authority = Citations.fromName(value.codeSpace); // May be null.
+            return new ImmutableIdentifier(authority, Citations.getIdentifier(authority),
value.code);
+        }
+        return null;
+    }
+
+    /**
+     * Substitutes the identifier by the wrapper to be marshalled into an XML file or stream.
+     * JAXB calls automatically this method at marshalling time.
+     *
+     * @param  value The metadata value.
+     * @return The adapter for the given metadata.
+     */
+    @Override
+    public RS_Identifier marshal(final ReferenceIdentifier value) {
+        return (value != null) ? new RS_Identifier(value) : null;
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierCode.java?rev=1546638&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierCode.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierCode.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.jaxb.referencing;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
+
+
+/**
+ * JAXB adapter in order to map a {@link ReferenceIdentifier} to a {@link String}.
+ * Its goal is to keep only the {@code name} part of a {@link ReferenceIdentifier}.
+ *
+ * @author  Cédric Briançon (Geomatys)
+ * @since   0.4 (derived from geotk-3.06)
+ * @version 0.4
+ * @module
+ */
+public final class RS_IdentifierCode extends XmlAdapter<String, ReferenceIdentifier>
{
+    /**
+     * Substitutes the value read from an XML stream by the object which will
+     * contains the value. JAXB calls automatically this method at unmarshalling time.
+     *
+     * @param  code The metadata value.
+     * @return A metadata which represents the metadata value.
+     */
+    @Override
+    public ReferenceIdentifier unmarshal(final String code) {
+        if (code != null) {
+            return new ImmutableIdentifier(null, null, code);
+        }
+        return null;
+    }
+
+    /**
+     * Substitutes the identifier by the adapter to be marshalled into an XML file
+     * or stream. JAXB calls automatically this method at marshalling time.
+     *
+     * @param  value The code list value.
+     * @return The adapter for the given code list.
+     */
+    @Override
+    public String marshal(final ReferenceIdentifier value) {
+        return (value != null) ? value.getCode() : null;
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierCode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_IdentifierCode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NilReferencingObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NilReferencingObject.java?rev=1546638&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NilReferencingObject.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NilReferencingObject.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.referencing;
+
+import java.util.Set;
+import java.util.Collection;
+import org.opengis.util.GenericName;
+import org.opengis.util.InternationalString;
+import org.opengis.referencing.IdentifiedObject;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.xml.NilReason;
+import org.apache.sis.xml.NilObject;
+import org.apache.sis.io.wkt.UnformattableObjectException;
+
+
+/**
+ * A referencing object for which every methods return {@code null} or a neutral value.
+ * <strong>This is not a valid object</strong>. It is used only for initialization
of
+ * objects to be used by JAXB at unmarshalling time, as a way to simulate "no-argument"
+ * constructor required by JAXB.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4 (derived from geotk-3.00)
+ * @version 0.4
+ * @module
+ */
+public final class NilReferencingObject implements NilObject, IdentifiedObject {
+    /**
+     * The unique instance.
+     */
+    public static final NilReferencingObject INSTANCE = new NilReferencingObject();
+
+    /**
+     * Do not allow other instantiation of {@link #INSTANCE}.
+     */
+    private NilReferencingObject() {
+    }
+
+    /**
+     * This object is empty because the value will be provided later.
+     */
+    @Override
+    public NilReason getNilReason() {
+        return NilReason.TEMPLATE;
+    }
+
+    /*
+     * Simple properties. Not all of them are optional, but SIS is tolerant to null values.
+     * Returning null for collection are okay in the particular case of SIS implementation,
+     * because the constructor will replace empty collections by null references anyway.
+     */
+    @Override public ReferenceIdentifier      getName()        {return null;}
+    @Override public Collection<GenericName>  getAlias()       {return null;}
+    @Override public Set<ReferenceIdentifier> getIdentifiers() {return null;}
+    @Override public InternationalString      getRemarks()     {return null;}
+
+    /**
+     * Throws the exception in all cases.
+     *
+     * @return Never return.
+     * @throws UnformattableObjectException Always thrown.
+     */
+    @Override
+    public String toWKT() throws UnformattableObjectException {
+        throw new UnformattableObjectException();
+    }
+
+    /**
+     * Returns the unique instance on deserialization.
+     */
+    private Object readResolve() {
+        return INSTANCE;
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NilReferencingObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/NilReferencingObject.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -36,6 +36,7 @@ import org.opengis.referencing.ObjectFac
 import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.internal.jaxb.referencing.RS_Identifier;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.util.Immutable;
@@ -122,6 +123,7 @@ public class AbstractIdentifiedObject ex
      * @see #getIdentifier()
      */
     @XmlElement
+    @XmlJavaTypeAdapter(RS_Identifier.class) // Not the same RS_Identifier than metadata.
     private final ReferenceIdentifier name;
 
     /**
@@ -157,6 +159,18 @@ public class AbstractIdentifiedObject ex
     private transient int hashCode;
 
     /**
+     * Constructs a new object in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    AbstractIdentifiedObject() {
+        name        = null;
+        alias       = null;
+        identifiers = null;
+        remarks     = null;
+    }
+
+    /**
      * Constructs an object from the given properties. Keys are strings from the table below.
      * The map given in argument shall contain an entry at least for the
      * {@value org.opengis.referencing.IdentifiedObject#NAME_KEY} key.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -78,6 +78,16 @@ public class AbstractReferenceSystem ext
     private final InternationalString scope;
 
     /**
+     * Constructs a new object in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    AbstractReferenceSystem() {
+        domainOfValidity = null;
+        scope = null;
+    }
+
+    /**
      * Constructs a new reference system with the same values than the specified one.
      * This copy constructor provides a way to convert an arbitrary implementation into a
SIS one
      * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific
API.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -173,7 +173,7 @@ public class AbstractCS extends Abstract
     protected AbstractCS(final CoordinateSystem cs) {
         super(cs);
         if (cs instanceof AbstractCS) {
-            axes = ((AbstractCS) cs).axes;
+            axes = ((AbstractCS) cs).axes; // Share the array.
         } else {
             axes = new CoordinateSystemAxis[cs.getDimension()];
             for (int i=0; i<axes.length; i++) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -104,6 +104,19 @@ public class AbstractDatum extends Abstr
     private final InternationalString scope;
 
     /**
+     * Constructs a new object in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    AbstractDatum() {
+        super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
+        anchorPoint      = null;
+        realizationEpoch = Long.MIN_VALUE;
+        domainOfValidity = null;
+        scope            = null;
+    }
+
+    /**
      * Creates a datum from the given properties.
      * The properties given in argument follow the same rules than for the
      * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -180,6 +180,17 @@ public class DefaultEllipsoid extends Ab
     private Unit<Length> unit;
 
     /**
+     * Constructs a new object in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultEllipsoid() {
+        super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
+        // We need to let the DefaultEllipsoid fields unitialized
+        // because afterUnmarshal(…) will check for zero values.
+    }
+
+    /**
      * Creates a new ellipsoid using the specified axis length.
      * The properties map is given unchanged to the
      * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -49,6 +49,14 @@ public class DefaultEngineeringDatum ext
     private static final long serialVersionUID = 1498304918725248637L;
 
     /**
+     * Constructs a new datum in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultEngineeringDatum() {
+    }
+
+    /**
      * Creates an engineering datum from the given properties. The properties map is given
      * unchanged to the {@linkplain AbstractDatum#AbstractDatum(Map) super-class constructor}.
      * The following table is a reminder of main (not all) properties:

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -154,6 +154,17 @@ public class DefaultGeodeticDatum extend
     private final BursaWolfParameters[] bursaWolf;
 
     /**
+     * Constructs a new datum in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultGeodeticDatum() {
+        ellipsoid     = null;
+        primeMeridian = null;
+        bursaWolf     = null;
+    }
+
+    /**
      * Creates a geodetic datum from the given properties. The properties map is given
      * unchanged to the {@linkplain AbstractDatum#AbstractDatum(Map) super-class constructor}.
      * In addition to the properties documented in the parent constructor,

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -59,6 +59,15 @@ public class DefaultImageDatum extends A
     private final PixelInCell pixelInCell;
 
     /**
+     * Constructs a new datum in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultImageDatum() {
+        pixelInCell = null;
+    }
+
+    /**
      * Creates an image datum from the given properties. The properties map is given
      * unchanged to the {@linkplain AbstractDatum#AbstractDatum(Map) super-class constructor}.
      * The following table is a reminder of main (not all) properties:

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -99,6 +99,17 @@ public class DefaultPrimeMeridian extend
     private final Unit<Angle> angularUnit;
 
     /**
+     * Constructs a new object in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultPrimeMeridian() {
+        super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
+        greenwichLongitude = Double.NaN;
+        angularUnit = null;
+    }
+
+    /**
      * Creates a prime meridian from the given properties. The properties map is given unchanged
to the
      * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
      * The following table is a reminder of main (not all) properties:

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
(original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
Fri Nov 29 20:17:58 2013
@@ -24,6 +24,7 @@ import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.referencing.datum.TemporalDatum;
+import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Immutable;
 
@@ -77,11 +78,22 @@ public class DefaultTemporalDatum extend
     private static final long serialVersionUID = 3357241732140076884L;
 
     /**
-     * The date and time origin of this temporal datum.
+     * The date and time origin of this temporal datum, or {@link Long#MIN_VALUE} if none.
+     * This information is mandatory, but SIS is tolerant to missing value is case a XML
+     * fragment was incomplete.
      */
     private final long origin;
 
     /**
+     * Constructs a new datum in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultTemporalDatum() {
+        origin = Long.MIN_VALUE;
+    }
+
+    /**
      * Creates a temporal datum from the given properties. The properties map is given
      * unchanged to the {@linkplain AbstractDatum#AbstractDatum(Map) super-class constructor}.
      * The following table is a reminder of main (not all) properties:
@@ -156,7 +168,7 @@ public class DefaultTemporalDatum extend
      */
     protected DefaultTemporalDatum(final TemporalDatum datum) {
         super(datum);
-        origin = datum.getOrigin().getTime();
+        origin = MetadataUtilities.toMilliseconds(datum.getOrigin());
     }
 
     /**
@@ -181,7 +193,7 @@ public class DefaultTemporalDatum extend
      */
     @Override
     public Date getOrigin() {
-        return new Date(origin);
+        return MetadataUtilities.toDate(origin);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -90,6 +90,14 @@ public class DefaultVerticalDatum extend
     private VerticalDatumType type;
 
     /**
+     * Constructs a new datum in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultVerticalDatum() {
+    }
+
+    /**
      * Creates a vertical datum from the given properties. The properties map is given
      * unchanged to the {@linkplain AbstractDatum#AbstractDatum(Map) super-class constructor}.
      * The following table is a reminder of main (not all) properties:

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java?rev=1546638&r1=1546637&r2=1546638&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
[UTF-8] Fri Nov 29 20:17:58 2013
@@ -70,4 +70,28 @@
  * @version 0.4
  * @module
  */
+@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
{
+    @XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
+    @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD)
+})
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlJavaTypeAdapters({
+    @XmlJavaTypeAdapter(CI_Citation.class),
+    @XmlJavaTypeAdapter(RS_Identifier.class),
+    @XmlJavaTypeAdapter(StringAdapter.class),
+    @XmlJavaTypeAdapter(InternationalStringConverter.class)
+})
 package org.apache.sis.referencing;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
+
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.gco.*;
+import org.apache.sis.internal.jaxb.metadata.*;
+import org.apache.sis.internal.jaxb.referencing.RS_Identifier;



Mime
View raw message