sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1767899 - in /sis/branches/JDK8/storage/sis-xmlstore/src: main/java/org/apache/sis/internal/gpx/ test/java/org/apache/sis/internal/gpx/
Date Thu, 03 Nov 2016 15:02:53 GMT
Author: desruisseaux
Date: Thu Nov  3 15:02:53 2016
New Revision: 1767899

URL: http://svn.apache.org/viewvc?rev=1767899&view=rev
Log:
Document the Copyright class and adjust the value returned by some methods.

Added:
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Copyright.java
      - copied, changed from r1767898, sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/CopyRight.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/package-info.java
  (with props)
Removed:
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/CopyRight.java
Modified:
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter110.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/MetaData.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java
    sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java

Copied: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Copyright.java
(from r1767898, sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/CopyRight.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Copyright.java?p2=sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Copyright.java&p1=sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/CopyRight.java&r1=1767898&r2=1767899&rev=1767899&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/CopyRight.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Copyright.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -21,6 +21,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
+import java.util.Set;
 import java.util.Objects;
 import org.apache.sis.metadata.iso.citation.DefaultOnlineResource;
 import org.apache.sis.util.iso.SimpleInternationalString;
@@ -43,218 +44,488 @@ import org.opengis.metadata.identificati
 import org.opengis.metadata.maintenance.Scope;
 import org.opengis.util.InternationalString;
 
+
 /**
- * Copyright object as defined in GPX.
- * 
- * @author Johann Sorel (Geomatys)
- * @since   0.7
+ * Information about the copyright holder and any license governing use of a GPX file.
+ * Information in this element allow to place data into the public domain or grant additional
usage rights.
+ * This element provides 3 properties:
+ *
+ * <ul>
+ *   <li>The {@linkplaon #author}, which is the only mandatory property.</li>
+ *   <li>The copyright {@linkplain #year} (optional).</li>
+ *   <li>An URI to the license (optional).</li>
+ * </ul>
+ *
+ * Those properties can be read or modified directly. All methods defined in this class are
bridges to
+ * the ISO 19115 metadata model and can be ignored if the user only wants to manipulate the
GPX model.
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.8
  * @version 0.8
  * @module
  */
-public class CopyRight implements LegalConstraints, Responsibility, Party, Citation, CitationDate
{
-
+public final class Copyright implements LegalConstraints, Responsibility, Party, Citation,
CitationDate {
+    /**
+     * The copyright holder.
+     * This field is mandatory in principle, but {@code Copyright} implementation is robust
to null value.
+     * This field is mapped to the {@linkplain #getName() responsible party name} in ISO
19115 metadata.
+     *
+     * @see #getResponsibleParties()
+     * @see #getParties()
+     * @see #getName()
+     */
     public String author;
+
+    /**
+     * The copyright year, or {@code null} if unspecified.
+     * This field is mapped to the {@linkplain #getDate() citation date} in ISO 19115 metadata.
+     *
+     * @see #getDate()
+     */
     public Integer year;
+
+    /**
+     * Link to an external file containing the license text, or {@code null} if none.
+     * This field is mapped to the {@linkplain #getOnlineResources() online resources} in
ISO 19115 metadata.
+     *
+     * @see #getOnlineResources()
+     */
     public URI license;
 
+    /**
+     * Creates a new initially empty instance.
+     * Callers should set at least the {@link #author} field after construction.
+     */
+    public Copyright() {
+    }
+
+    /**
+     * ISO 19115 metadata property fixed to {@link Restriction#COPYRIGHT}.
+     *
+     * @return restrictions or limitations on obtaining the data.
+     */
     @Override
     public Collection<Restriction> getAccessConstraints() {
-        return Collections.EMPTY_LIST;
+        return Collections.singleton(Restriction.COPYRIGHT);
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #license} field.
+     *
+     * @return restrictions or limitations or warnings on using the data.
+     *
+     * @see #getReferences()
+     */
     @Override
     public Collection<Restriction> getUseConstraints() {
-        if (license!=null) {
-            return Arrays.asList(Restriction.LICENCE,Restriction.COPYRIGHT);
+        if (license != null) {
+            return Arrays.asList(Restriction.COPYRIGHT, Restriction.LICENCE);
         } else {
             return Collections.singleton(Restriction.COPYRIGHT);
         }
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     *
+     * @return other restrictions and legal prerequisites for accessing and using the resource.
+     */
+    @Override
+    public Collection<InternationalString> getOtherConstraints() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     *
+     * @return limitation affecting the fitness for use of the resource.
+     */
+    @Override
+    public Collection<InternationalString> getUseLimitations() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property not specified by GPX. We could said that the constraint
applies to the whole dataset
+     * with {@link org.opengis.metadata.maintenance.ScopeCode#DATASET}, but it is probably
implicit enough for GPX.
+     *
+     * @return spatial and/or temporal extent, or levels of the application of the constraints
restrictions.
+     */
     @Override
-    public Collection<? extends InternationalString> getOtherConstraints() {
-        return Collections.EMPTY_LIST;
-    }
-
-    @Override
-    public Collection<? extends InternationalString> getUseLimitations() {
-        return Collections.EMPTY_LIST;
+    public Scope getConstraintApplicationScope() {
+        return null;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     *
+     * @return graphics or symbols indicating the constraint.
+     */
+    @Override
+    public Collection<BrowseGraphic> getGraphics() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property determined by the {@link #year} and {@link #license} fields.
+     * Invoking this method is one of the steps in the path from the {@code LegalConstraints}
root
+     * to the {@link #getDate()} and {@link #getOnlineResources()} methods.
+     *
+     * @return citations for the limitation of constraint.
+     *
+     * @see #getTitle()
+     * @see #getDates()
+     * @see #getPresentationForms()
+     * @see #getOnlineResources()
+     */
+    @Override
+    public Collection<Citation> getReferences() {
+        return thisOrEmpty(this, year != null || license != null);
+    }
+
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     *
+     * @return information concerning the parties to whom the resource can or cannot be released.
+     */
     @Override
-    public Scope getConstraintApplicationScope() {
+    public Releasability getReleasability() {
         return null;
     }
 
-    @Override
-    public Collection<? extends BrowseGraphic> getGraphics() {
-        return Collections.EMPTY_LIST;
+    /**
+     * ISO 19115 metadata property determined by the {@link #author} field.
+     * Invoking this method is one of the steps in the path from the {@code LegalConstraints}
root
+     * to the {@link #getName()} method.
+     *
+     * @return parties responsible for the resource constraints.
+     *
+     * @see #getRole()
+     * @see #getParties()
+     * @see #getCitedResponsibleParties()
+     */
+    @Override
+    public Collection<Responsibility> getResponsibleParties() {
+        return thisOrEmpty(this, author != null);
     }
 
+
+    /* -------------------------------------------------------------------------------------------------
+     * Implementation of the Responsibility object returned by LegalConstraints.getResponsibleParties().
+     * Contains information about 'author' only (not 'year' or 'license').
+     * -------------------------------------------------------------------------------------------------
*/
+
+    /**
+     * ISO 19115 metadata property fixed to {@link Role#OWNER}.
+     * This is part of the properties returned by {@link #getResponsibleParties()}.
+     *
+     * @return function performed by the responsible party.
+     */
     @Override
-    public Collection<? extends Citation> getReferences() {
-        return Collections.singleton(this);
+    public Role getRole() {
+        return Role.OWNER;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getResponsibleParties()}.
+     *
+     * @return spatial or temporal extent of the role.
+     */
+    @Override
+    public Collection<Extent> getExtents() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property determined by the {@link #author} field.
+     * This is part of the properties returned by {@link #getResponsibleParties()}.
+     * Invoking this method is one of the steps in the path from the {@code LegalConstraints}
root
+     * to the {@link #getName()} method.
+     *
+     * @return information about the parties.
+     *
+     * @see #getName()
+     */
+    @Override
+    public Collection<Party> getParties() {
+        return thisOrEmpty(this, author != null);
+    }
+
+    /**
+     * ISO 19115 metadata property determined by the {@link #author} field.
+     * This is part of the properties returned by {@link #getParties()}.
+     *
+     * @return name of the party, or {@code null} if none.
+     */
     @Override
-    public Releasability getReleasability() {
-        return null;
+    public InternationalString getName() {
+        return (author != null) ? new SimpleInternationalString(author) : null;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getParties()}.
+     *
+     * @return contact information for the party.
+     */
     @Override
-    public Collection<? extends Responsibility> getResponsibleParties() {
-        return Collections.singleton(this);
+    public Collection<Contact> getContactInfo() {
+        return Collections.emptySet();
     }
 
+
+    /* -----------------------------------------------------------------------------------
+     * Implementation of the Citation object returned by LegalConstraints.getReferences().
+     * Contains information about 'year' or 'license' only (not 'author').
+     * -----------------------------------------------------------------------------------
*/
+
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     * It would be the license title if that information was provided.
+     *
+     * @return the license name.
+     */
     @Override
     public InternationalString getTitle() {
         return null;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return other names for the resource.
+     */
+    @Override
+    public Collection<InternationalString> getAlternateTitles() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property determined by the {@link #year} field.
+     * This is part of the properties returned by {@link #getReferences()}.
+     * Invoking this method is one of the steps in the path from the {@code LegalConstraints}
root
+     * to the {@link #getDate()} method.
+     *
+     * @return reference date for the cited resource.
+     *
+     * @see #getDate()
+     * @see #getDateType()
+     */
+    @Override
+    public Collection<CitationDate> getDates() {
+        return thisOrEmpty(this, year != null);
+    }
+
+    /**
+     * ISO 19115 metadata property determined by the {@link #year} field.
+     * This is part of the properties returned by {@link #getDates()}.
+     *
+     * @return reference date for the cited resource.
+     */
     @Override
-    public Collection<? extends InternationalString> getAlternateTitles() {
-        return Collections.EMPTY_LIST;
+    public Date getDate() {
+        if (year != null) {
+            return new Date(year - 1900, 0, 1);
+        }
+        return null;
     }
 
+    /**
+     * ISO 19115 metadata property fixed to {@link DateType#IN_FORCE}.
+     * This is part of the properties returned by {@link #getDates()}.
+     *
+     * @return event used for reference date.
+     */
     @Override
-    public Collection<? extends CitationDate> getDates() {
-        return Collections.singleton(this);
+    public DateType getDateType() {
+        return DateType.IN_FORCE;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the license version, or {@code null} if none.
+     */
     @Override
     public InternationalString getEdition() {
         return null;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the license edition date, or {@code null} if none.
+     */
     @Override
     public Date getEditionDate() {
         return null;
     }
 
-    @Override
-    public Collection<? extends Identifier> getIdentifiers() {
-        return Collections.EMPTY_LIST;
-    }
-
-    @Override
-    public Collection<? extends Responsibility> getCitedResponsibleParties() {
-        return Collections.EMPTY_LIST;
-    }
-
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the identifiers of the license.
+     */
+    @Override
+    public Collection<Identifier> getIdentifiers() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     * It would be the license author if that information was provided.
+     *
+     * @return the information for individuals or organisations that are responsible for
the license.
+     *
+     * @see #getResponsibleParties()
+     */
+    @Override
+    public Collection<Responsibility> getCitedResponsibleParties() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property fixed to {@link PresentationForm#DOCUMENT_DIGITAL}.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the presentation mode of the license.
+     */
     @Override
     public Collection<PresentationForm> getPresentationForms() {
-        return Collections.EMPTY_LIST;
+        return Collections.singleton(PresentationForm.DOCUMENT_DIGITAL);
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the series or aggregate dataset of which the dataset is a part.
+     */
     @Override
     public Series getSeries() {
         return null;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return other details.
+     */
+    @Override
+    public Collection<InternationalString> getOtherCitationDetails() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the common title.
+     */
     @Override
-    public Collection<? extends InternationalString> getOtherCitationDetails() {
-        return Collections.EMPTY_LIST;
-    }
-
-    @Override
+    @Deprecated
     public InternationalString getCollectiveTitle() {
         return null;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the International Standard Book Number.
+     */
     @Override
     public String getISBN() {
         return null;
     }
 
+    /**
+     * ISO 19115 metadata property not specified by GPX.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return the International Standard Serial Number.
+     */
     @Override
     public String getISSN() {
         return null;
     }
 
+    /**
+     * ISO 19115 metadata property determined by the {@link #license} field.
+     * This is part of the properties returned by {@link #getReferences()}.
+     *
+     * @return online references to the cited resource.
+     */
     @Override
-    public Collection<? extends OnlineResource> getOnlineResources() {
+    public Collection<OnlineResource> getOnlineResources() {
         if (license != null) {
             return Collections.singleton(new DefaultOnlineResource(license));
         }
-        return null;
+        return Collections.emptySet();
     }
 
+    /**
+     * Returns the given object as a singleton if the given condition is {@code true},
+     * or an empty set if the given condition is {@code false}.
+     *
+     * @param  obj  the object (usually {@code this}) to return in a singleton if the condition
is true.
+     */
+    private static <T> Set<T> thisOrEmpty(final T obj, final boolean condition)
{
+        return condition ? Collections.singleton(obj) : Collections.emptySet();
+    }
+
+    /**
+     * Compares this {@code Copyright} with the given object for equality.
+     *
+     * @param  obj  the object to compare with this {@code Copyright}.
+     * @return {@code true} if both object are equal.
+     */
     @Override
-    public Date getDate() {
-        if (year != null) {
-            return new Date(year, 0, 0);
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
         }
-        return null;
-    }
-
-    @Override
-    public DateType getDateType() {
-        return DateType.IN_FORCE;
-    }
-
-    @Override
-    public Role getRole() {
-        return Role.OWNER;
-    }
-
-    @Override
-    public Collection<? extends Extent> getExtents() {
-        return Collections.EMPTY_LIST;
-    }
-
-    @Override
-    public Collection<? extends Party> getParties() {
-        return Collections.singleton(this);
-    }
-
-    @Override
-    public InternationalString getName() {
-        if (author != null){
-            return new SimpleInternationalString(author);
+        if (obj instanceof Copyright) {
+            final Copyright that = (Copyright) obj;
+            return Objects.equals(this.author,  that.author) &&
+                   Objects.equals(this.year,    that.year) &&
+                   Objects.equals(this.license, that.license);
         }
-        return null;
+        return false;
     }
 
+    /**
+     * Returns a hash code value for this {@code Copyright}.
+     *
+     * @return a hash code value.
+     */
     @Override
-    public Collection<? extends Contact> getContactInfo() {
-        return Collections.EMPTY_LIST;
+    public int hashCode() {
+        return Objects.hash(author, year, license);
     }
 
+    /**
+     * Returns a string representation of the copyright statement.
+     *
+     * @return a string representation of the copyright statement.
+     */
     @Override
     public String toString() {
-        final StringBuilder sb = new StringBuilder("CopyRight(");
-        sb.append(author).append(',').append(year).append(',').append(license);
-        sb.append(')');
-        return sb.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final CopyRight other = (CopyRight) obj;
-        if (!Objects.equals(this.author, other.author)) {
-            return false;
-        }
-        if (!Objects.equals(this.year, other.year)) {
-            return false;
-        }
-        if (!Objects.equals(this.license, other.license)) {
-            return false;
+        final StringBuilder sb = new StringBuilder("Copyright");
+        if (year   != null) sb.append(' ').append(year);
+        if (author != null) sb.append(' ').append(author);
+        if (license != null) {
+            sb.append(System.lineSeparator()).append(license);
         }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return 44;
+        return sb.toString();
     }
-    
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java?rev=1767899&r1=1767898&r2=1767899&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -102,7 +102,7 @@ public final class GPXConstants extends
     public static final String TAG_AUTHOR_EMAIL = "email";
 
     /*
-     * CopyRight tag.
+     * Copyright tag.
      */
     /** used in version : 1.1 */
     public static final String TAG_COPYRIGHT = "copyright";

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java?rev=1767899&r1=1767898&r2=1767899&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -308,7 +308,7 @@ public class GPXReader extends StaxStrea
                     }else if(TAG_AUTHOR.equalsIgnoreCase(localName)){
                         metadata.person = parsePerson();
                     }else if(TAG_COPYRIGHT.equalsIgnoreCase(localName)){
-                        metadata.copyRight = parseCopyRight();
+                        metadata.copyRight = parseCopyright();
                     }else if(TAG_LINK.equalsIgnoreCase(localName)){
                         metadata.links.add(parseLink());
                     }else if(TAG_METADATA_TIME.equalsIgnoreCase(localName)){
@@ -335,11 +335,11 @@ public class GPXReader extends StaxStrea
      * Parse current copyright element.
      * The stax reader must be placed to the start element of the copyright.
      *
-     * @return CopyRight
+     * @return Copyright
      */
-    private CopyRight parseCopyRight() throws IOException, XMLStreamException {
+    private Copyright parseCopyright() throws IOException, XMLStreamException {
         final XMLStreamReader reader = getReader();
-        final CopyRight copyright = new CopyRight();
+        final Copyright copyright = new Copyright();
         copyright.author = reader.getAttributeValue(null, ATT_COPYRIGHT_AUTHOR);
 
         while (reader.hasNext()) {

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter110.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter110.java?rev=1767899&r1=1767898&r2=1767899&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter110.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter110.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -63,7 +63,7 @@ public class GPXWriter110 extends GPXWri
         writeSimpleTag(namespace, TAG_NAME, metadata.name);
         writeSimpleTag(namespace, TAG_DESC, metadata.description);
         writePerson(metadata.person);
-        writeCopyRight(metadata.copyRight);
+        writeCopyright(metadata.copyRight);
         for (URI uri : metadata.links) {
             writeLink(uri);
         }
@@ -132,7 +132,7 @@ public class GPXWriter110 extends GPXWri
      * @param copyRight if null nothing will be written
      * @throws XMLStreamException if underlying xml stax writer encounter an error
      */
-    public void writeCopyRight(final CopyRight copyRight) throws XMLStreamException {
+    public void writeCopyright(final Copyright copyRight) throws XMLStreamException {
         if (copyRight == null) return;
 
         writer.writeStartElement(namespace, TAG_COPYRIGHT);

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/MetaData.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/MetaData.java?rev=1767899&r1=1767898&r2=1767899&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/MetaData.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/MetaData.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -62,7 +62,7 @@ public class MetaData extends SimpleMeta
     public String name;
     public String description;
     public Person person;
-    public CopyRight copyRight;
+    public Copyright copyRight;
     public final List<URI> links = new ArrayList<>();
     public Temporal time;
     public String keywords;
@@ -142,7 +142,7 @@ public class MetaData extends SimpleMeta
         }
         return super.getDates();
     }
-    
+
     @Override
     public String toString() {
         final StringWriter writer = new StringWriter();
@@ -167,11 +167,11 @@ public class MetaData extends SimpleMeta
         }
 
         if(copyRight != null){
-            tablewriter.append("CopyRight - Author\t"+copyRight.author+"\n");
-            tablewriter.append("CopyRight - Year\t"+copyRight.year+"\n");
-            tablewriter.append("CopyRight - License\t"+copyRight.license+"\n");
+            tablewriter.append("Copyright - Author\t"+copyRight.author+"\n");
+            tablewriter.append("Copyright - Year\t"+copyRight.year+"\n");
+            tablewriter.append("Copyright - License\t"+copyRight.license+"\n");
         }else{
-            tablewriter.append("CopyRight\t"+copyRight+"\n");
+            tablewriter.append("Copyright\t"+copyRight+"\n");
         }
 
         tablewriter.append("Links\t");

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java?rev=1767899&r1=1767898&r2=1767899&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/Person.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -34,7 +34,7 @@ import org.opengis.util.InternationalStr
 
 /**
  * Person object as defined in GPX.
- * 
+ *
  * @author Johann Sorel (Geomatys)
  * @since   0.7
  * @version 0.8
@@ -47,13 +47,13 @@ public class Person implements Party, Co
     public URI link;
 
     @Override
-    public Collection<? extends Contact> getContactInfo() {
+    public Collection<Contact> getContactInfo() {
         return Collections.singleton(this);
     }
 
     @Override
-    public Collection<? extends Telephone> getPhones() {
-        return Collections.EMPTY_LIST;
+    public Collection<Telephone> getPhones() {
+        return Collections.emptyList();
     }
 
     @Override
@@ -62,7 +62,7 @@ public class Person implements Party, Co
     }
 
     @Override
-    public Collection<? extends Address> getAddresses() {
+    public Collection<Address> getAddresses() {
         return Collections.singleton(this);
     }
 
@@ -72,11 +72,11 @@ public class Person implements Party, Co
     }
 
     @Override
-    public Collection<? extends OnlineResource> getOnlineResources() {
+    public Collection<OnlineResource> getOnlineResources() {
         if (link!=null) {
             return Collections.singleton(new DefaultOnlineResource(link));
         }
-        return Collections.EMPTY_LIST;
+        return Collections.emptyList();
     }
 
     @Override
@@ -88,8 +88,8 @@ public class Person implements Party, Co
     }
 
     @Override
-    public Collection<? extends InternationalString> getHoursOfService() {
-        return Collections.EMPTY_LIST;
+    public Collection<InternationalString> getHoursOfService() {
+        return Collections.emptyList();
     }
 
     @Override
@@ -111,8 +111,8 @@ public class Person implements Party, Co
     }
 
     @Override
-    public Collection<? extends InternationalString> getDeliveryPoints() {
-        return Collections.EMPTY_LIST;
+    public Collection<InternationalString> getDeliveryPoints() {
+        return Collections.emptyList();
     }
 
     @Override
@@ -140,21 +140,26 @@ public class Person implements Party, Co
         if (email != null) {
             return Collections.singleton(email);
         }
-        return Collections.EMPTY_LIST;
+        return Collections.emptyList();
     }
 
+    /**
+     * ISO 19115 metadata property fixed to {@link Role#ORIGINATOR}.
+     *
+     * @return function performed by the responsible party.
+     */
     @Override
     public Role getRole() {
         return Role.ORIGINATOR;
     }
 
     @Override
-    public Collection<? extends Extent> getExtents() {
-        return Collections.EMPTY_LIST;
+    public Collection<Extent> getExtents() {
+        return Collections.emptyList();
     }
 
     @Override
-    public Collection<? extends Party> getParties() {
+    public Collection<Party> getParties() {
         return Collections.singleton(this);
     }
 

Added: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/package-info.java?rev=1767899&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/package-info.java
(added)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/package-info.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -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.
+ */
+
+
+/**
+ * Reads and writes data in GPS Exchange Format (GPX).
+ * The GPX format can be used to describe waypoints, tracks, and routes.
+ * Example (from Wikipedia):
+ *
+ * {@preformat xml
+ *   <gpx>
+ *     <metadata>
+ *       <link href="http://www.garmin.com">
+ *         <text>Garmin International</text>
+ *       </link>
+ *       <time>2009-10-17T22:58:43Z</time>
+ *     </metadata>
+ *     <trk>
+ *       <name>Example GPX Document</name>
+ *       <trkseg>
+ *         <trkpt lat="47.644548" lon="-122.326897">
+ *           <ele>4.46</ele>
+ *           <time>2009-10-17T18:37:26Z</time>
+ *         </trkpt>
+ *         <trkpt lat="47.644548" lon="-122.326897">
+ *           <ele>4.94</ele>
+ *           <time>2009-10-17T18:37:31Z</time>
+ *         </trkpt>
+ *         <trkpt lat="47.644548" lon="-122.326897">
+ *           <ele>6.87</ele>
+ *           <time>2009-10-17T18:37:34Z</time>
+ *         </trkpt>
+ *       </trkseg>
+ *     </trk>
+ *   </gpx>
+ * }
+ *
+ * @see <a href="https://en.wikipedia.org/wiki/GPS_Exchange_Format">GPS Exchange Format
on Wikipedia</a>
+ * @see <a href="http://www.topografix.com/GPX/1/1/">GPX 1.1 Schema Documentation</a>
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+package org.apache.sis.internal.gpx;

Propchange: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java?rev=1767899&r1=1767898&r2=1767899&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java
[UTF-8] Thu Nov  3 15:02:53 2016
@@ -76,7 +76,7 @@ public final strictfp class GPXWriterTes
         person.email = "jean-pierre@test.com";
         person.link = new URI("http://son-site.com");
 
-        final CopyRight copyright = new CopyRight();
+        final Copyright copyright = new Copyright();
         copyright.author = "GNU";
         copyright.year = 2010;
         copyright.license = new URI("http://gnu.org");



Mime
View raw message