sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1517784 - in /sis/branches/JDK7/profiles/sis-french-profile/src: main/java/org/apache/sis/internal/profile/fra/ main/java/org/apache/sis/profile/france/ test/java/org/apache/sis/internal/profile/fra/
Date Tue, 27 Aug 2013 10:56:08 GMT
Author: desruisseaux
Date: Tue Aug 27 10:56:08 2013
New Revision: 1517784

URL: http://svn.apache.org/r1517784
Log:
Provide static methods for indirect access to the classes that were removed from public API.

Added:
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/profile/france/FrenchProfile.java
  (with props)
Modified:
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/Constraints.java
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DataIdentification.java
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DirectReferenceSystem.java
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/IndirectReferenceSystem.java
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/LegalConstraints.java
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/SecurityConstraints.java
    sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
    sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/Constraints.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/Constraints.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/Constraints.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/Constraints.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -70,6 +70,16 @@ public class Constraints extends Default
     }
 
     /**
+     * Constructs an instance initialized to a copy of the given object.
+     * This constructor does <strong>not</strong> copy the FRA-specific properties.
+     *
+     * @param object The metadata to copy values from, or {@code null} if none.
+     */
+    public Constraints(final org.opengis.metadata.constraint.Constraints object) {
+        super(object);
+    }
+
+    /**
      * Returns the documents that specifies the nature of the constraints.
      *
      * @return Citations to the current documents.

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DataIdentification.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DataIdentification.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DataIdentification.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DataIdentification.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -69,6 +69,16 @@ public class DataIdentification extends 
     }
 
     /**
+     * Constructs an instance initialized to a copy of the given object.
+     * This constructor does <strong>not</strong> copy the FRA-specific properties.
+     *
+     * @param object The metadata to copy values from, or {@code null} if none.
+     */
+    public DataIdentification(final org.opengis.metadata.identification.DataIdentification
object) {
+        super(object);
+    }
+
+    /**
      * Returns the documents at the origin of the creation of the identified resources.
      *
      * @return Citations to the current documents.

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DirectReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DirectReferenceSystem.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DirectReferenceSystem.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/DirectReferenceSystem.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -18,10 +18,8 @@ package org.apache.sis.internal.profile.
 
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.ReferenceSystem;
 import org.opengis.referencing.ReferenceIdentifier;
-import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.internal.jaxb.metadata.ReferenceSystemMetadata;
 
 
@@ -75,19 +73,4 @@ public class DirectReferenceSystem exten
     public DirectReferenceSystem(final ReferenceIdentifier identifier) {
         super(identifier);
     }
-
-    /**
-     * Creates a new reference system from the specified code and authority.
-     *
-     * @param authority
-     *          Organization or party responsible for definition and maintenance of the code
space or code.
-     * @param codespace
-     *          Name or identifier of the person or organization responsible for namespace.
-     *          This is often an abbreviation of the authority name.
-     * @param code
-     *          Identifier code or name, optionally from a controlled list or pattern defined
by a code space.
-     */
-    public DirectReferenceSystem(final Citation authority, final String codespace, final
String code) {
-        super(new ImmutableIdentifier(authority, codespace, code));
-    }
 }

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/IndirectReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/IndirectReferenceSystem.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/IndirectReferenceSystem.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/IndirectReferenceSystem.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -18,10 +18,8 @@ package org.apache.sis.internal.profile.
 
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.ReferenceSystem;
 import org.opengis.referencing.ReferenceIdentifier;
-import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.internal.jaxb.metadata.ReferenceSystemMetadata;
 
 
@@ -75,19 +73,4 @@ public class IndirectReferenceSystem ext
     public IndirectReferenceSystem(final ReferenceIdentifier identifier) {
         super(identifier);
     }
-
-    /**
-     * Creates a new reference system from the specified code and authority.
-     *
-     * @param authority
-     *          Organization or party responsible for definition and maintenance of the code
space or code.
-     * @param codespace
-     *          Name or identifier of the person or organization responsible for namespace.
-     *          This is often an abbreviation of the authority name.
-     * @param code
-     *          Identifier code or name, optionally from a controlled list or pattern defined
by a code space.
-     */
-    public IndirectReferenceSystem(final Citation authority, final String codespace, final
String code) {
-        super(new ImmutableIdentifier(authority, codespace, code));
-    }
 }

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/LegalConstraints.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/LegalConstraints.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/LegalConstraints.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/LegalConstraints.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -70,6 +70,16 @@ public class LegalConstraints extends De
     }
 
     /**
+     * Constructs an instance initialized to a copy of the given object.
+     * This constructor does <strong>not</strong> copy the FRA-specific properties.
+     *
+     * @param object The metadata to copy values from, or {@code null} if none.
+     */
+    public LegalConstraints(final org.opengis.metadata.constraint.LegalConstraints object)
{
+        super(object);
+    }
+
+    /**
      * Returns the documents that specifies the nature of the constraints.
      *
      * @return Citations to the current documents.

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -35,7 +35,11 @@ public final class ProfileTypes extends 
      */
     @Override
     public void getTypes(final Collection<Class<?>> addTo) {
+        addTo.add(DataIdentification.class);
         addTo.add(DirectReferenceSystem.class);
         addTo.add(IndirectReferenceSystem.class);
+        addTo.add(Constraints.class);
+        addTo.add(LegalConstraints.class);
+        addTo.add(SecurityConstraints.class);
     }
 }

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/SecurityConstraints.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/SecurityConstraints.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/SecurityConstraints.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/SecurityConstraints.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -70,6 +70,16 @@ public class SecurityConstraints extends
     }
 
     /**
+     * Constructs an instance initialized to a copy of the given object.
+     * This constructor does <strong>not</strong> copy the FRA-specific properties.
+     *
+     * @param object The metadata to copy values from, or {@code null} if none.
+     */
+    public SecurityConstraints(final org.opengis.metadata.constraint.SecurityConstraints
object) {
+        super(object);
+    }
+
+    /**
      * Returns the documents that specifies the nature of the constraints.
      *
      * @return Citations to the current documents.

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -26,6 +26,8 @@
  * @version 0.4 (derived from geotk-3.00)
  * @since   0.4
  * @module
+ *
+ * @see org.apache.sis.profile.france
  */
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.FRA)
 @XmlAccessorType(XmlAccessType.NONE)

Added: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/profile/france/FrenchProfile.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/profile/france/FrenchProfile.java?rev=1517784&view=auto
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/profile/france/FrenchProfile.java
(added)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/profile/france/FrenchProfile.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -0,0 +1,132 @@
+/*
+ * 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.profile.france;
+
+import org.opengis.referencing.ReferenceSystem;
+import org.apache.sis.internal.profile.fra.*;
+import org.apache.sis.util.Static;
+
+
+/**
+ * Provides implementations of French extensions defined by AFNOR.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.4
+ * @since   0.4
+ * @module
+ */
+public final class FrenchProfile extends Static {
+    /**
+     * Do not allow instantiation of this class.
+     */
+    private FrenchProfile() {
+    }
+
+    /**
+     * Returns the given metadata object as an AFNOR-compliant instance.
+     * The current implementation recognizes the following types:
+     *
+     * <table>
+     *   <tr><th>GeoAPI type</th> <th>AFNOR XML element</th></tr>
+     *   <tr><td>{@link org.opengis.metadata.identification.DataIdentification}</td>
<td>{@code FRA_DataIdentification}</td>
+     *   <tr><td>{@link org.opengis.metadata.constraint.Constraints}</td>
           <td>{@code FRA_Constraints}</td>
+     *   <tr><td>{@link org.opengis.metadata.constraint.LegalConstraints}</td>
      <td>{@code FRA_LegalConstraints}</td>
+     *   <tr><td>{@link org.opengis.metadata.constraint.SecurityConstraints}</td>
   <td>{@code FRA_SecurityConstraints}</td>
+     * </table>
+     *
+     * This method does not handle the {@link ReferenceSystem} type,
+     * because AFNOR requires to specify whether the system is direct or indirect.
+     * For reference system types, use {@link #toAFNOR(ReferenceSystem, boolean)} instead.
+     *
+     * @param metadata The metadata to make AFNOR-compliant, or {@code null}.
+     * @return A copy of the metadata as an AFNOR-compliant object, or {@code metadata} if
the metadata
+     *        was {@code null}, does not have an AFNOR type, or was already of the appropriate
type.
+     */
+    public static Object toAFNOR(Object metadata) {
+        if (metadata != null) {
+            if (metadata instanceof org.opengis.metadata.identification.DataIdentification)
{
+                if (!(metadata instanceof DataIdentification)) {
+                    metadata = new DataIdentification((org.opengis.metadata.identification.DataIdentification)
metadata);
+                }
+            } else if (metadata instanceof org.opengis.metadata.constraint.Constraints) {
+                if (metadata instanceof org.opengis.metadata.constraint.LegalConstraints)
{
+                    if (!(metadata instanceof LegalConstraints)) {
+                        metadata = new LegalConstraints((org.opengis.metadata.constraint.LegalConstraints)
metadata);
+                    }
+                } else if (metadata instanceof org.opengis.metadata.constraint.SecurityConstraints)
{
+                    if (!(metadata instanceof SecurityConstraints)) {
+                        metadata = new SecurityConstraints((org.opengis.metadata.constraint.SecurityConstraints)
metadata);
+                    }
+                } else {
+                    if (!(metadata instanceof Constraints)) {
+                        metadata = new Constraints((org.opengis.metadata.constraint.Constraints)
metadata);
+                    }
+                }
+            }
+        }
+        return metadata;
+    }
+
+    /**
+     * Returns the given given reference system as an AFNOR-compliant instance.
+     * AFNOR requires the reference systems to be either <cite>direct</cite>
or <cite>indirect</cite>.
+     * Those two cases are represented by the following schema fragments:
+     *
+     * <table class="sis">
+     * <tr><th>Direct</th><th>Indirect</th></tr>
+     * <tr><td>
+     * {@preformat xml
+     *   <complexType name="FRA_DirectReferenceSystem_Type">
+     *     <complexContent>
+     *       <extension base="{http://www.isotc211.org/2005/gmd}MD_ReferenceSystem_Type">
+     *       </extension>
+     *     </complexContent>
+     *   </complexType>
+     * }
+     * </td><td>
+     * {@preformat xml
+     *   <complexType name="FRA_IndirectReferenceSystem_Type">
+     *     <complexContent>
+     *       <extension base="{http://www.isotc211.org/2005/gmd}MD_ReferenceSystem_Type">
+     *       </extension>
+     *     </complexContent>
+     *   </complexType>
+     * }
+     * </td></tr>
+     * </table>
+     *
+     * @param  rs The reference system to make AFNOR-compliant, or {@code null}.
+     * @param  indirect {@code false} for {@code FRA_DirectReferenceSystem},
+     *         or {@code true} for {@code FRA_IndirectReferenceSystem}.
+     * @return A copy of the given reference system as an AFNOR-compliant object, or {@code
rs}
+     *         if the given reference system was {@code null} or already of the appropriate
type.
+     */
+    public static ReferenceSystem toAFNOR(ReferenceSystem rs, final boolean indirect) {
+        if (rs != null) {
+            if (indirect) {
+                if (!(rs instanceof IndirectReferenceSystem)) {
+                    rs = new IndirectReferenceSystem(rs);
+                }
+            } else {
+                if (!(rs instanceof DirectReferenceSystem)) {
+                    rs = new DirectReferenceSystem(rs);
+                }
+            }
+        }
+        return rs;
+    }
+}

Propchange: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/profile/france/FrenchProfile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/profiles/sis-french-profile/src/main/java/org/apache/sis/profile/france/FrenchProfile.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java?rev=1517784&r1=1517783&r2=1517784&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
[UTF-8] Tue Aug 27 10:56:08 2013
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import javax.xml.bind.JAXBException;
 import org.apache.sis.xml.XML;
 import org.apache.sis.metadata.iso.DefaultMetadata;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.util.ComparisonMode;
@@ -52,8 +53,8 @@ public final strictfp class DirectRefere
      */
     private static DefaultMetadata createMetadata() {
         final DefaultMetadata metadata = new DefaultMetadata();
-        final DirectReferenceSystem refSys = new DirectReferenceSystem(
-                new DefaultCitation(getSingleton(HardCodedCitations.EPSG.getCitedResponsibleParties())),
null, "4326");
+        final DirectReferenceSystem refSys = new DirectReferenceSystem(new ImmutableIdentifier(
+                new DefaultCitation(getSingleton(HardCodedCitations.EPSG.getCitedResponsibleParties())),
null, "4326"));
         metadata.setReferenceSystemInfo(Arrays.asList(refSys));
         return metadata;
     }



Mime
View raw message