You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2017/12/09 10:57:47 UTC
svn commit: r1817597 [2/19] - in /sis/branches/ISO-19115-3: ./ application/
application/sis-console/ application/sis-console/src/main/artifact/
application/sis-console/src/main/artifact/lib/
application/sis-console/src/main/artifact/lib/darwin/ applica...
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl [UTF-8] (original)
+++ sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl [UTF-8] Sat Dec 9 10:57:44 2017
@@ -44,12 +44,16 @@ module org {
[in] string codeOrPath
);
- /// Returns the axis name for the specified dimension in an identified object.
- string getAxis(
+ /// Returns the scope of an identified object.
+ string getScope(
/// The authority code (e.g. "EPSG:4326").
- [in] string codeOrPath,
- /// The dimension (1, 2, ...).
- [in] long dimension
+ [in] string codeOrPath
+ );
+
+ /// Returns the domain of validity as country or region names for an identified object.
+ string getDomainOfValidity(
+ /// The authority code (e.g. "EPSG:4326").
+ [in] string codeOrPath
);
/// Returns the domain of validity as a geographic bounding box for an identified object.
@@ -68,6 +72,14 @@ module org {
[in] any areaOfInterest
) raises (com::sun::star::lang::IllegalArgumentException);
+ /// Returns the axis name for the specified dimension in an identified object.
+ string getAxis(
+ /// The authority code (e.g. "EPSG:4326").
+ [in] string codeOrPath,
+ /// The dimension (1, 2, ...).
+ [in] long dimension
+ );
+
/// Transforms a list of coordinates from source CRS to target CRS.
sequence< sequence< double > > transformPoints(
/// Authority code of the source coordinate reference system.
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -46,15 +46,20 @@ public interface XReferencing extends XI
String getName(String codeOrPath);
/**
- * Returns the axis name and units for the specified dimension in a coordinate reference system or coordinate system.
- * This method returns a short axis name as used in Well Known Text (WKT) format, for example <cite>"Latitude"</cite>
- * instead of <cite>"Geodetic latitude"</cite>.
+ * Returns the scope of an identified object.
*
* @param codeOrPath the code allocated by an authority, or the path to a file.
- * @param dimension the dimension (1, 2, …).
- * @return the name of the requested axis.
+ * @return the object scope.
*/
- String getAxis(String codeOrPath, int dimension);
+ String getScope(String codeOrPath);
+
+ /**
+ * Returns the domain of validity as country or region names for an identified object.
+ *
+ * @param codeOrPath the code allocated by an authority, or the path to a file.
+ * @return the domain of validity.
+ */
+ String getDomainOfValidity(String codeOrPath);
/**
* Returns the domain of validity as a geographic bounding box for an identified object.
@@ -80,6 +85,17 @@ public interface XReferencing extends XI
double getAccuracy(String sourceCRS, String targetCRS, Object areaOfInterest) throws IllegalArgumentException;
/**
+ * Returns the axis name and units for the specified dimension in a coordinate reference system or coordinate system.
+ * This method returns a short axis name as used in Well Known Text (WKT) format, for example <cite>"Latitude"</cite>
+ * instead of <cite>"Geodetic latitude"</cite>.
+ *
+ * @param codeOrPath the code allocated by an authority, or the path to a file.
+ * @param dimension the dimension (1, 2, …).
+ * @return the name of the requested axis.
+ */
+ String getAxis(String codeOrPath, int dimension);
+
+ /**
* Transforms coordinates from the specified source CRS to the specified target CRS.
*
* @param sourceCRS the authority code for the source coordinate reference system.
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/Referencing.xcu
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/Referencing.xcu?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/Referencing.xcu (original)
+++ sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/Referencing.xcu Sat Dec 9 10:57:44 2017
@@ -51,14 +51,14 @@
</node>
</node>
- <node oor:name="getAxis" oor:op="replace">
+ <node oor:name="getScope" oor:op="replace">
<prop oor:name="DisplayName">
- <value xml:lang="en">CRS.AXIS</value>
- <value xml:lang="fr">AXE.SRS</value>
+ <value xml:lang="en">CRS.USAGE</value>
+ <value xml:lang="fr">USAGE.SRS</value>
</prop>
<prop oor:name="Description">
- <value xml:lang="en">Returns the axis name for the specified dimension in a Coordinate Reference System (CRS) identified by the given code.</value>
- <value xml:lang="fr">Retourne le nom de lâaxe à la dimension spécifiée dans un Système de Références Spatiales (SRS) identifié par le code donné.</value>
+ <value xml:lang="en">Returns the usage scope of an object identified by the given code. The object is usually, but not necessarily, a Coordinate Reference System (CRS).</value>
+ <value xml:lang="fr">Retourne le domaine dâutilisation dâun objet identifié par le code donné. Lâobjet est habituellement, mais pas obligatoirement, un Système de Références Spatiales (SRS).</value>
</prop>
<prop oor:name="Category">
<value>Add-In</value>
@@ -74,14 +74,30 @@
<value xml:lang="fr">Le code alloué par une autorité ou le chemin vers un fichier.</value>
</prop>
</node>
- <node oor:name="dimension" oor:op="replace">
+ </node>
+ </node>
+
+ <node oor:name="getDomainOfValidity" oor:op="replace">
+ <prop oor:name="DisplayName">
+ <value xml:lang="en">REGION.NAME</value>
+ <value xml:lang="fr">NOM.REGION</value>
+ </prop>
+ <prop oor:name="Description">
+ <value xml:lang="en">Returns the domain of validity as country or region name(s) for an object identified by the given code.</value>
+ <value xml:lang="fr">Retourne sous forme de nom(s) de pays ou de région(s) le domaine de validité dâun objet identifié par le code donné.</value>
+ </prop>
+ <prop oor:name="Category">
+ <value>Add-In</value>
+ </prop>
+ <node oor:name="Parameters">
+ <node oor:name="codeOrPath" oor:op="replace">
<prop oor:name="DisplayName">
- <value xml:lang="en">dimension</value>
- <value xml:lang="fr">dimension</value>
+ <value xml:lang="en">identifier</value>
+ <value xml:lang="fr">identifiant</value>
</prop>
<prop oor:name="Description">
- <value xml:lang="en">The dimension (1, 2, â¦) of axis to describe.</value>
- <value xml:lang="fr">La dimension (1, 2, â¦) de lâaxe à décrire.</value>
+ <value xml:lang="en">The code allocated by authority or the path to a file.</value>
+ <value xml:lang="fr">Le code alloué par une autorité ou le chemin vers un fichier.</value>
</prop>
</node>
</node>
@@ -157,6 +173,42 @@
</prop>
</node>
</node>
+ </node>
+
+ <node oor:name="getAxis" oor:op="replace">
+ <prop oor:name="DisplayName">
+ <value xml:lang="en">CRS.AXIS</value>
+ <value xml:lang="fr">AXE.SRS</value>
+ </prop>
+ <prop oor:name="Description">
+ <value xml:lang="en">Returns the axis name for the specified dimension in a Coordinate Reference System (CRS) identified by the given code.</value>
+ <value xml:lang="fr">Retourne le nom de lâaxe à la dimension spécifiée dans un Système de Références Spatiales (SRS) identifié par le code donné.</value>
+ </prop>
+ <prop oor:name="Category">
+ <value>Add-In</value>
+ </prop>
+ <node oor:name="Parameters">
+ <node oor:name="codeOrPath" oor:op="replace">
+ <prop oor:name="DisplayName">
+ <value xml:lang="en">identifier</value>
+ <value xml:lang="fr">identifiant</value>
+ </prop>
+ <prop oor:name="Description">
+ <value xml:lang="en">The code allocated by authority or the path to a file.</value>
+ <value xml:lang="fr">Le code alloué par une autorité ou le chemin vers un fichier.</value>
+ </prop>
+ </node>
+ <node oor:name="dimension" oor:op="replace">
+ <prop oor:name="DisplayName">
+ <value xml:lang="en">dimension</value>
+ <value xml:lang="fr">dimension</value>
+ </prop>
+ <prop oor:name="Description">
+ <value xml:lang="en">The dimension (1, 2, â¦) of axis to describe.</value>
+ <value xml:lang="fr">La dimension (1, 2, â¦) de lâaxe à décrire.</value>
+ </prop>
+ </node>
+ </node>
</node>
<node oor:name="transformPoints" oor:op="replace">
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/build-instruction.html
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/build-instruction.html?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/build-instruction.html [UTF-8] (original)
+++ sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/build-instruction.html [UTF-8] Sat Dec 9 10:57:44 2017
@@ -102,7 +102,7 @@ mvn install</pre></blockquote>
<h2>Test in Apache OpenOffice:</h2>
<blockquote><pre>cd target
-unopkg add apache-sis-0.8-SNAPSHOT.oxt --log-file log.txt
+unopkg add apache-sis-1.0-SNAPSHOT.oxt --log-file log.txt
scalc -Xdebug -env:RTL_LOGFILE=log.txt</pre></blockquote>
</body>
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/description.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/description.xml?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/description.xml (original)
+++ sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/description.xml Sat Dec 9 10:57:44 2017
@@ -28,7 +28,7 @@
<platform value="all"/>
<publisher>
- <name lang="en" xlink:href="http://sis.apache.org/openoffice/">Apache SIS</name>
+ <name lang="en" xlink:href="http://sis.apache.org/openoffice/index.html">Apache SIS</name>
</publisher>
<display-name>
@@ -40,14 +40,26 @@
<default xlink:href="sis.png" />
</icon>
+ <extension-description>
+ <src lang="en" xlink:href="description.txt"/>
+ </extension-description>
+
+ <registration>
+ <simple-license accept-by="admin" suppress-on-update="true" suppress-if-required="true">
+ <license-text lang="en" xlink:href="license.txt"/>
+ </simple-license>
+ </registration>
+
+ <dependencies>
+ <OpenOffice.org-minimal-version value="3.3" d:name="OpenOffice.org 3.3"/>
+ </dependencies>
+
<release-notes>
- <src lang="en" xlink:href="http://sis.apache.org/openoffice/"/>
+ <src lang="en" xlink:href="http://sis.apache.org/openoffice/index.html"/>
</release-notes>
-<!--
<update-information>
<src xlink:href="http://sis.apache.org/openoffice/update.xml"/>
</update-information>
--->
</description>
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/org/apache/sis/openoffice/XReferencing.class
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/org/apache/sis/openoffice/XReferencing.class?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
Binary files - no diff available.
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/sis.rdb
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/main/unopkg/sis.rdb?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
Binary files - no diff available.
Modified: sis/branches/ISO-19115-3/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -84,6 +84,15 @@ public final strictfp class ReferencingF
}
/**
+ * Tests {@link ReferencingFunctions#getScope(String)}.
+ */
+ @Test
+ public void testGetScope() {
+ final String scope = instance.getScope("EPSG:4326");
+ assertTrue(scope, scope.contains("Horizontal component of 3D system"));
+ }
+
+ /**
* Tests {@link ReferencingFunctions#getAxis(String, int)}.
*/
@Test
@@ -96,13 +105,22 @@ public final strictfp class ReferencingF
}
/**
+ * Tests {@link ReferencingFunctions#getDomainOfValidity(String)}.
+ */
+ @Test
+ public void testGetDomainOfValidity() {
+ final String domain = instance.getDomainOfValidity("EPSG:4326");
+ assertTrue(domain, domain.contains("World"));
+ }
+
+ /**
* Tests {@link ReferencingFunctions#getGeographicArea(String)}.
*/
@Test
public void testGetGeographicArea() {
final double[][] bbox = instance.getGeographicArea("EPSG:32620"); // UTM zone 20
- assertEquals(2, bbox.length);
- assumeFalse(Double.isNaN(bbox[0][0])); // NaN if EPSG dataset is not installed.
+ assumeFalse(bbox.length == 0); // Empty if EPSG dataset is not installed.
+ assertEquals("bbox.length", 2, bbox.length);
assertArrayEquals("Upper left corner", new double[] {84, -66}, bbox[0], STRICT);
assertArrayEquals("Lower right corner", new double[] { 0, -60}, bbox[1], STRICT);
}
Modified: sis/branches/ISO-19115-3/application/sis-webapp/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-webapp/pom.xml?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-webapp/pom.xml (original)
+++ sis/branches/ISO-19115-3/application/sis-webapp/pom.xml Sat Dec 9 10:57:44 2017
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>application</artifactId>
- <version>0.8-jdk8-SNAPSHOT</version>
+ <version>1.0-jdk8-SNAPSHOT</version>
</parent>
<groupId>org.apache.sis.application</groupId>
Modified: sis/branches/ISO-19115-3/core/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/pom.xml?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/pom.xml (original)
+++ sis/branches/ISO-19115-3/core/pom.xml Sat Dec 9 10:57:44 2017
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.8-jdk8-SNAPSHOT</version>
+ <version>1.0-jdk8-SNAPSHOT</version>
</parent>
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/pom.xml?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/pom.xml (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/pom.xml Sat Dec 9 10:57:44 2017
@@ -32,7 +32,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>parent</artifactId>
- <version>0.8-jdk8-SNAPSHOT</version>
+ <version>1.0-jdk8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/ant/prepare-release.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/ant/prepare-release.xml?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/ant/prepare-release.xml (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/ant/prepare-release.xml Sat Dec 9 10:57:44 2017
@@ -29,12 +29,6 @@
<!-- Invoked after a branch has been created from the trunk. -->
<target name="branch">
- <!-- Ensure that the "sis-build-helper" plugin used by the build is the released version. -->
- <replaceregexp file = "${user.dir}/pom.xml"
- match = "<sis\.plugin\.version>.+</sis\.plugin\.version>"
- replace = "<sis.plugin.version>${branch.version}-SNAPSHOT</sis.plugin.version>"/>
- <!-- The -SNAPSHOT part will be removed later, at tag creation. -->
-
<!-- Replace the version number in Java code. -->
<replaceregexp file = "${user.dir}/core/sis-utility/src/main/java/org/apache/sis/util/Version.java"
match = "MINOR_VERSION\s*\+\s*"-SNAPSHOT""
@@ -69,8 +63,6 @@
<include name="**/pom.xml"/>
<replacefilter token="<version>${branch.version}-SNAPSHOT</version>"
value="<version>${sis.version}</version>"/>
- <replacefilter token="<sis.plugin.version>${branch.version}-SNAPSHOT</sis.plugin.version>"
- value="<sis.plugin.version>${sis.version}</sis.plugin.version>"/>
</replace>
</target>
</project>
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -63,6 +63,8 @@ import static org.apache.sis.internal.bo
* <li>Generate below {@code <h1>} elements the navigation bar with links to the previous and next chapters.</li>
* </ul>
*
+ * See package javadoc for usage example.
+ *
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
* @since 0.7
@@ -389,7 +391,9 @@ public final class Assembler {
tableOfChapterContent = document.createElement("ul");
tableOfChapterContent.setAttribute("class", "toc");
final Node nav = document.createElement("nav");
- nav.appendChild(document.createTextNode(resources.getString("this-chapter")));
+ final Node p = document.createElement("p");
+ p.appendChild(document.createTextNode(resources.getString("this-chapter")));
+ nav.appendChild(p);
nav.appendChild(tableOfChapterContent);
Node insertionPoint = node.getParentNode(); // The <header> element.
do insertionPoint = insertionPoint.getNextSibling(); // The first paragraph.
@@ -595,6 +599,7 @@ public final class Assembler {
* Generates the {@code "content/book/en|fr/developer-guide.html"} file from {@code "book/en|fr/index.html"}.
* The only argument expected by this method is the language: {@code "en"} or {@code "fr"}.
* The current directory shall be the parent directory of {@code "book"} and {@code "content"}.
+ * See package javadoc for usage example.
*
* @param args command-line arguments. Should contain exactly on value, which is the language.
* @throws Exception if an I/O error, a XML parsing error or other kinds of error occurred.
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -182,6 +182,17 @@ public final class CodeColorizer {
}
break;
}
+ default: {
+ int upper = word.length();
+ while (upper > 0) {
+ final int c = word.codePointBefore(upper);
+ if (Character.isUnicodeIdentifierPart(c)) {
+ word = word.substring(0, upper);
+ break;
+ }
+ upper -= Character.charCount(c);
+ }
+ }
}
/*
* Check if the keyword is a known one. The 'identifierOrigins' map contains only simple name
@@ -322,7 +333,9 @@ public final class CodeColorizer {
nextSubstringStart = lower;
lower = text.indexOf(stopCondition, lower+1);
if (lower >= 0) {
- lower += stopCondition.length();
+ if (!stopCondition.equals("\n")) {
+ lower += stopCondition.length();
+ }
stopCondition = null;
} else {
lower = text.length();
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -21,7 +21,22 @@
* {@code http://svn.apache.org/repos/asf/sis/site/trunk/content/book/} directory.
*
* <p>The main class in this package is {@link org.apache.sis.internal.book.Assembler}.
- * Other classes are helper classes that should be ignored.</p>
+ * Other classes are helper classes that should be ignored. Assuming the following directory layout:</p>
+ *
+ * <pre><current directory>
+ * ├─ trunk
+ * └─ site
+ * ├─ book
+ * └─ content
+ * </pre>
+ *
+ * Then the command can be used as below on Unix systems:
+ *
+ * <pre>cd site
+ * java -classpath ../trunk/core/sis-build-helper/target/classes org.apache.sis.internal.book.Assembler en
+ * </pre>
+ *
+ * Replace {@code en} by {@code fr} for generating the French version.
*
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Assembler.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Assembler.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Assembler.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Assembler.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -21,11 +21,14 @@ import java.io.IOException;
import java.io.FilenameFilter;
import java.io.FileInputStream;
import java.io.FilterOutputStream;
+import java.util.LinkedHashMap;
+import java.util.Map;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
@@ -36,24 +39,23 @@ import static org.apache.sis.internal.ma
/**
* Creates a ZIP files containing the content of the <code>application/sis-console/src/main/artifact</code>
* directory together with the Pack200 file created by <code>BundleCreator</code>.
- * This mojo can be invoked from the command line as below:
+ * This MOJO can be invoked from the command line in the {@code sis-console} module as below:
*
- * <blockquote><code>mvn org.apache.sis.core:sis-build-helper:dist --non-recursive</code></blockquote>
- *
- * Do not forget the <code>--non-recursive</code> option, otherwise the Mojo will be executed many time.
+ * <blockquote><code>mvn package org.apache.sis.core:sis-build-helper:dist</code></blockquote>
*
* <p><b>Current limitation:</b>
* The current implementation uses some hard-coded paths and filenames.
- * See the <cite>Distribution file and Pack200 bundle</cite> section in the <code>src/site/apt/index.apt</code>
- * file for more information.</p>
+ * See the <cite>Distribution file and Pack200 bundle</cite> section in
+ * <a href="http://sis.apache.org/build.html">Build from source</a> page
+ * for more information.</p>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
* @since 0.4
* @module
*/
-@Mojo(name = "dist", defaultPhase = LifecyclePhase.INSTALL)
-public class Assembler extends AbstractMojo implements FilenameFilter {
+@Mojo(name = "dist", defaultPhase = LifecyclePhase.INSTALL, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
+public final class Assembler extends AbstractMojo implements FilenameFilter {
/**
* Project information (name, version, URL).
*/
@@ -61,6 +63,13 @@ public class Assembler extends AbstractM
private MavenProject project;
/**
+ * Base directory of the module to compile.
+ * Artifact content is expected in the {@code "src/main/artifact"} subdirectory.
+ */
+ @Parameter(property="basedir", required=true, readonly=true)
+ private String baseDirectory;
+
+ /**
* The root directory (without the "<code>target/binaries</code>" sub-directory) where JARs
* are to be copied. It should be the directory of the root <code>pom.xml</code>.
*/
@@ -80,13 +89,14 @@ public class Assembler extends AbstractM
*/
@Override
public void execute() throws MojoExecutionException {
- final File sourceDirectory = new File(rootDirectory, ARTIFACT_PATH);
+ final File sourceDirectory = new File(baseDirectory, ARTIFACT_PATH);
if (!sourceDirectory.isDirectory()) {
throw new MojoExecutionException("Directory not found: " + sourceDirectory);
}
final File targetDirectory = new File(rootDirectory, TARGET_DIRECTORY);
final String version = project.getVersion();
final String artifactBase = FINALNAME_PREFIX + version;
+ final Map<String,byte[]> nativeFiles = new LinkedHashMap<>();
try {
final File targetFile = new File(distributionDirectory(targetDirectory), artifactBase + ".zip");
try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(targetFile)) {
@@ -97,20 +107,28 @@ public class Assembler extends AbstractM
* have been zipped. Now generate the Pack200 file and zip it directly (without creating
* a temporary "sis.pack.gz" file).
*/
- final Packer packer = new Packer(project.getName(), version, targetDirectory);
- final ZipArchiveEntry entry = new ZipArchiveEntry(
- artifactBase + '/' + LIB_DIRECTORY + '/' + FATJAR_FILE + PACK_EXTENSION);
+ final Packer packer = new Packer(project.getName(), version, BundleCreator.files(project), targetDirectory, nativeFiles);
+ ZipArchiveEntry entry = new ZipArchiveEntry(artifactBase + '/' + LIB_DIRECTORY + '/' + FATJAR_FILE + PACK_EXTENSION);
entry.setMethod(ZipArchiveEntry.STORED);
zip.putArchiveEntry(entry);
packer.preparePack200(FATJAR_FILE + ".jar").pack(new FilterOutputStream(zip) {
- /*
- * Closes the archive entry, not the ZIP file.
- */
- @Override
- public void close() throws IOException {
+ /** Closes the archive entry, not the ZIP file. */
+ @Override public void close() throws IOException {
zip.closeArchiveEntry();
}
});
+ /*
+ * At this point we finished creating all entries in the ZIP file, except native resources.
+ * Copy them now.
+ */
+ for (final Map.Entry<String,byte[]> nf : nativeFiles.entrySet()) {
+ entry = new ZipArchiveEntry(artifactBase + '/' + LIB_DIRECTORY + '/' + nf.getKey());
+ entry.setUnixMode(0555); // Readable and executable for all, but not writable.
+ zip.putArchiveEntry(entry);
+ zip.write(nf.getValue());
+ zip.closeArchiveEntry();
+ nf.setValue(null);
+ }
}
} catch (IOException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
@@ -136,6 +154,7 @@ public class Assembler extends AbstractM
out.putArchiveEntry(entry);
if (!entry.isDirectory()) {
try (FileInputStream in = new FileInputStream(file)) {
+ // TODO: use InputStream.transferTo(OutputStream) with JDK9.
int n;
while ((n = in.read(buffer)) >= 0) {
out.write(buffer, 0, n);
@@ -159,6 +178,6 @@ public class Assembler extends AbstractM
*/
@Override
public boolean accept(final File directory, final String filename) {
- return !filename.isEmpty() && filename.charAt(0) != '.';
+ return !filename.isEmpty() && filename.charAt(0) != '.' && !filename.equals(CONTENT_FILE);
}
}
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/BundleCreator.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/BundleCreator.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/BundleCreator.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/BundleCreator.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -18,11 +18,15 @@ package org.apache.sis.internal.maven;
import java.io.File;
import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import static org.apache.sis.internal.maven.Filenames.*;
@@ -38,16 +42,17 @@ import static org.apache.sis.internal.ma
*
* <p><b>Current limitation:</b>
* The current implementation uses some hard-coded paths and filenames.
- * See the <cite>Distribution file and Pack200 bundle</cite> section in the <code>src/site/apt/index.apt</code>
- * file for more information.</p>
+ * See the <cite>Distribution file and Pack200 bundle</cite> section in
+ * <a href="http://sis.apache.org/build.html">Build from source</a> page
+ * for more information.</p>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
* @since 0.3
* @module
*/
-@Mojo(name = "pack", defaultPhase = LifecyclePhase.INSTALL)
-public class BundleCreator extends AbstractMojo {
+@Mojo(name = "pack", defaultPhase = LifecyclePhase.INSTALL, requiresDependencyResolution = ResolutionScope.COMPILE)
+public final class BundleCreator extends AbstractMojo {
/**
* Project information (name, version, URL).
*/
@@ -80,10 +85,30 @@ public class BundleCreator extends Abstr
}
final String version = project.getVersion();
try {
- final Packer packer = new Packer(project.getName(), version, targetDirectory);
+ final Packer packer = new Packer(project.getName(), version, files(project), targetDirectory, null);
packer.preparePack200(FINALNAME_PREFIX + version + ".jar").pack();
} catch (IOException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
}
+
+ /**
+ * Returns all files to include for the given Maven project.
+ */
+ static Set<File> files(final MavenProject project) throws MojoExecutionException {
+ final Set<File> files = new LinkedHashSet<>();
+ files.add(project.getArtifact().getFile());
+ for (final Artifact dep : project.getArtifacts()) {
+ final String scope = dep.getScope();
+ if (Artifact.SCOPE_COMPILE.equalsIgnoreCase(scope) ||
+ Artifact.SCOPE_RUNTIME.equalsIgnoreCase(scope))
+ {
+ files.add(dep.getFile());
+ }
+ }
+ if (files.remove(null)) {
+ throw new MojoExecutionException("Invocation of this MOJO shall be done together with a \"package\" Maven phase.");
+ }
+ return files;
+ }
}
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Filenames.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Filenames.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Filenames.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Filenames.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -48,7 +48,8 @@ final class Filenames {
/**
* The name of the file inside {@value #BINARIES_DIRECTORY} where to list SIS JAR files and their
- * dependencies on platforms that do not support hard links.
+ * dependencies on platforms that do not support hard links. Also the file to ignore when copying
+ * entries in a ZIP file.
*/
static final String CONTENT_FILE = "content.txt";
@@ -59,9 +60,9 @@ final class Filenames {
static final String DISTRIBUTION_DIRECTORY = "distribution";
/**
- * The path to the directory (relative to the project root) to zip for creating the distribution ZIP file.
+ * The path to the directory (relative to the project directory) to zip for creating the distribution ZIP file.
*/
- static final String ARTIFACT_PATH = "application/sis-console/src/main/artifact";
+ static final String ARTIFACT_PATH = "src/main/artifact";
/**
* The name of the sub-directory inside {@value #ARTIFACT_PATH} where the Pack200 file will be located.
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -262,10 +262,10 @@ public final class JarCollector extends
/**
* Loads the {@value #CONTENT_FILE} from the given directory, if it exists.
- * Otherwise returns an empty but modifiable set. This method is invoked only on
+ * Otherwise returns an empty but modifiable set. This method is invoked on
* platforms that do not support hard links.
*/
- static Set<String> loadDependencyList(final File dependenciesFile) throws IOException {
+ private static Set<String> loadDependencyList(final File dependenciesFile) throws IOException {
final Set<String> dependencies = new LinkedHashSet<>();
if (dependenciesFile.exists()) {
try (BufferedReader in = new BufferedReader(new FileReader(dependenciesFile))) {
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackInput.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackInput.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackInput.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackInput.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.internal.maven;
+import java.util.Map;
import java.util.Enumeration;
import java.util.jar.*;
import java.io.File;
@@ -29,7 +30,7 @@ import java.io.InputStream;
* Those files will be open in read-only mode.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 0.8
* @since 0.3
* @module
*/
@@ -51,6 +52,12 @@ final class PackInput implements Closeab
static final String SERVICES = META_INF + "services/";
/**
+ * The prefix of native resources in JAR files. All those resources will be excluded from
+ * the PACK200 file and stored in {@link #nativeFiles} instead (unless the map is null).
+ */
+ private static final String NATIVE = "native/";
+
+ /**
* The attribute name in {@code MANIFEST.MF} files for splash screen.
*/
static final Attributes.Name SPLASH_SCREEN = new Attributes.Name("SplashScreen-Image");
@@ -63,12 +70,19 @@ final class PackInput implements Closeab
/**
* The main class obtained from the manifest, or {@code null} if none.
*/
- public final String mainClass;
+ final String mainClass;
/**
* The splash screen image obtained from the manifest, or {@code null} if none.
*/
- public final String splashScreen;
+ final String splashScreen;
+
+ /**
+ * The map where to store native files found during iteration over the JAR entries.
+ * Keys are filename without the {@value #NATIVE} prefix. Values are the actual data.
+ * If null, then no native files filtering is done.
+ */
+ private final Map<String,byte[]> nativeFiles;
/**
* An enumeration over the entries. We are going to iterate only once.
@@ -83,10 +97,12 @@ final class PackInput implements Closeab
/**
* Opens the given JAR file in read-only mode.
*
- * @param file the file to open.
+ * @param file the file to open.
+ * @param nativeFiles if non-null, where to store native files found during iteration over the JAR entries.
* @throws IOException if the file can't be open.
*/
- PackInput(final File file) throws IOException {
+ PackInput(final File file, final Map<String,byte[]> nativeFiles) throws IOException {
+ this.nativeFiles = nativeFiles;
this.file = new JarFile(file);
final Manifest manifest = this.file.getManifest();
if (manifest != null) {
@@ -106,7 +122,7 @@ final class PackInput implements Closeab
*
* @return the next entry, or {@code null} if the iteration is finished.
*/
- JarEntry nextEntry() {
+ JarEntry nextEntry() throws IOException {
if (entries == null) {
entries = file.entries();
}
@@ -118,6 +134,14 @@ final class PackInput implements Closeab
continue;
}
}
+ if (nativeFiles != null && name.startsWith(NATIVE)) {
+ if (!entry.isDirectory()) {
+ if (nativeFiles.put(name.substring(NATIVE.length()), load()) != null) {
+ throw new IOException("Duplicated entry: " + name);
+ }
+ }
+ continue;
+ }
entry.setMethod(JarEntry.DEFLATED);
entry.setCompressedSize(-1); // Change in method has changed the compression size.
return entry;
@@ -138,6 +162,26 @@ final class PackInput implements Closeab
}
/**
+ * Loads in memory the content of current JAR entry.
+ * This method should be invoked only for entries of reasonable size.
+ */
+ private byte[] load() throws IOException {
+ final long size = entry.getSize();
+ if (size <= 0 || size > Integer.MAX_VALUE) {
+ throw new IOException("Unsupported size for \"" + entry.getName() + "\": " + size);
+ }
+ final byte[] content = new byte[(int) size];
+ final int actual;
+ try (InputStream in = getInputStream()) {
+ actual = in.read(content);
+ }
+ if (actual != size) {
+ throw new IOException("Expected " + size + " bytes in \"" + entry.getName() + "\" but found " + actual);
+ }
+ return content;
+ }
+
+ /**
* Returns the input stream for the current entry.
*
* @param entry The entry for which to get an input stream.
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackOutput.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackOutput.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackOutput.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/PackOutput.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -215,7 +215,7 @@ final class PackOutput implements Closea
final byte[] buffer = new byte[64 * 1024];
for (final Iterator<Map.Entry<File,PackInput>> it = inputJARs.entrySet().iterator(); it.hasNext();) {
final Map.Entry<File,PackInput> inputJAR = it.next();
- it.remove(); // Needs to be removed before the inner loop below.
+ it.remove(); // Needs to be removed before the inner loop below.
try (PackInput input = inputJAR.getValue()) {
for (JarEntry entry; (entry = input.nextEntry()) != null;) {
final String name = entry.getName();
@@ -253,7 +253,7 @@ final class PackOutput implements Closea
* @param buffer temporary buffer to reuse at each method call.
* @throws IOException if an error occurred during the copy.
*/
- void copy(final InputStream in, final byte[] buffer) throws IOException {
+ private void copy(final InputStream in, final byte[] buffer) throws IOException {
int n;
while ((n = in.read(buffer)) >= 0) {
outputStream.write(buffer, 0, n);
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Packer.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Packer.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Packer.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/Packer.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -18,11 +18,8 @@ package org.apache.sis.internal.maven;
import java.util.Map;
import java.util.Set;
-import java.util.Arrays;
import java.util.LinkedHashMap;
import java.io.File;
-import java.io.FilenameFilter;
-import java.io.FileNotFoundException;
import java.io.IOException;
import static org.apache.sis.internal.maven.Filenames.*;
@@ -34,55 +31,51 @@ import static org.apache.sis.internal.ma
* or listed in the {@code target/binaries/content.txt} file.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @version 0.8
* @since 0.3
* @module
*/
-final class Packer implements FilenameFilter {
+final class Packer {
/**
* The project name and version to declare in the manifest file, or {@code null} if none.
*/
private final String projectName, version;
/**
+ * JAR files of the main project together with its dependencies.
+ */
+ private final Set<File> files;
+
+ /**
* The Maven target directory. Shall contain the {@code "binaries"} sub-directory,
* which shall contain all JAR files collected by {@code sis-build-helper} plugin.
*/
private final File targetDirectory;
/**
- * The directory of input JAR files. Shall be {@code "target/binaries"}.
+ * The map where to store native files found during iteration over the JAR entries.
+ * Keys are filename without the {@value #NATIVE} prefix. Values are the actual data.
+ * If null, then no native files filtering is done.
*/
- private final File binariesDirectory;
+ private final Map<String,byte[]> nativeFiles;
/**
* Creates a packer.
*
* @param projectName the project name to declare in the manifest file, or {@code null} if none.
* @param version the project version to declare in the manifest file, or {@code null} if none.
+ * @param files the JAR files of the main project together with its dependencies.
* @param targetDirectory the Maven target directory.
- * @throws FileNotFoundException if the {@code target/binaries} directory is not found.
+ * @param nativeFiles if non-null, where to store native files found during iteration over the JAR entries.
*/
- Packer(final String projectName, final String version, final File targetDirectory) throws FileNotFoundException {
- this.projectName = projectName;
- this.version = version;
+ Packer(final String projectName, final String version, final Set<File> files, final File targetDirectory,
+ final Map<String,byte[]> nativeFiles)
+ {
+ this.projectName = projectName;
+ this.version = version;
+ this.files = files;
this.targetDirectory = targetDirectory;
- this.binariesDirectory = new File(targetDirectory, BINARIES_DIRECTORY);
- if (!binariesDirectory.isDirectory()) {
- throw new FileNotFoundException("Directory not found: " + binariesDirectory);
- }
- }
-
- /**
- * Filter the input JAR files. This is for internal usage by {@link #createOutputJAR(String)} only.
- *
- * @param directory the directory (ignored).
- * @param name the filename.
- * @return {@code true} if the given filename ends with {@code ".jar"}.
- */
- @Override
- public boolean accept(final File directory, final String name) {
- return name.endsWith(".jar");
+ this.nativeFiles = nativeFiles;
}
/**
@@ -90,18 +83,12 @@ final class Packer implements FilenameFi
* All input JAR files are opened by this method. They will need to be closed by {@link PackInput#close()}.
*/
private Map<File,PackInput> getInputJARs() throws IOException {
- final Set<String> filenames = JarCollector.loadDependencyList(new File(binariesDirectory, CONTENT_FILE));
- filenames.addAll(Arrays.asList(binariesDirectory.list(this)));
- final Map<File,PackInput> inputJARs = new LinkedHashMap<>(filenames.size() * 4/3);
- for (final String filename : filenames) {
- File file = new File(filename);
- if (!file.isAbsolute()) {
- file = new File(binariesDirectory, filename);
- }
+ final Map<File,PackInput> inputJARs = new LinkedHashMap<>(files.size() * 4/3);
+ for (final File file : files) {
if (!file.isFile() || !file.canRead()) {
throw new IllegalArgumentException("Not a file or can not read: " + file);
}
- if (inputJARs.put(file, new PackInput(file)) != null) {
+ if (inputJARs.put(file, new PackInput(file, nativeFiles)) != null) {
throw new IllegalArgumentException("Duplicated JAR: " + file);
}
}
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/package-info.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/package-info.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/package-info.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -21,7 +21,7 @@
* for building Apache SIS. See the Maven-generated module description for more information.
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
+ * @version 0.8
* @since 0.3
* @module
*/
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/unopkg/UnoPkg.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/unopkg/UnoPkg.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/unopkg/UnoPkg.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/java/org/apache/sis/internal/unopkg/UnoPkg.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -31,6 +31,7 @@ import org.apache.maven.artifact.Artifac
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
import static java.util.jar.Pack200.Packer;
@@ -43,7 +44,7 @@ import static java.util.jar.Pack200.Pack
* @since 0.8
* @module
*/
-@Mojo(name = "unopkg", defaultPhase = LifecyclePhase.PACKAGE)
+@Mojo(name = "unopkg", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
public final class UnoPkg extends AbstractMojo implements FilenameFilter {
/**
* The subdirectory (relative to {@link #baseDirectory}) where the UNO files are expected.
@@ -62,7 +63,7 @@ public final class UnoPkg extends Abstra
/**
* Base directory of the module to compile.
- * The UNO files are expect in the {@code "src/main/unopkg"} subdirectory.
+ * The UNO files are expected in the {@code "src/main/unopkg"} subdirectory.
* The plugin will look for the {@code META-INF/manifest.xml} and {@code *.rdb} files in that directory.
*/
@Parameter(property="basedir", required=true, readonly=true)
@@ -132,6 +133,7 @@ public final class UnoPkg extends Abstra
name.endsWith(".rdb") || name.endsWith(".RDB") ||
name.endsWith(".xml") || name.endsWith(".XML") ||
name.endsWith(".xcu") || name.endsWith(".XCU") ||
+ name.endsWith(".txt") || name.endsWith(".TXT") ||
name.endsWith(".png") || name.endsWith(".PNG");
}
@@ -184,6 +186,8 @@ public final class UnoPkg extends Abstra
}
/*
* Copies the dependencies, optionally in a single PACK200 entry.
+ * We discard most debug information because stack traces are not
+ * easy to get from an application running in OpenOffice anyway.
*/
Pack200.Packer packer = null;
if (Boolean.parseBoolean(pack200)) {
@@ -199,11 +203,10 @@ public final class UnoPkg extends Abstra
p.put(Packer.DEFLATE_HINT, Packer.TRUE); // transmitting a single request to use "compress" mode.
p.put(Packer.UNKNOWN_ATTRIBUTE, Packer.ERROR); // throw an error if an attribute is unrecognized.
}
- for (final Artifact artifact : project.getDependencyArtifacts()) {
+ for (final Artifact artifact : project.getArtifacts()) {
final String scope = artifact.getScope();
- if (scope != null && // Maven 2.0.6 bug?
- (scope.equalsIgnoreCase(Artifact.SCOPE_COMPILE) ||
- scope.equalsIgnoreCase(Artifact.SCOPE_RUNTIME)))
+ if (Artifact.SCOPE_COMPILE.equalsIgnoreCase(scope) ||
+ Artifact.SCOPE_RUNTIME.equalsIgnoreCase(scope))
{
final File file = artifact.getFile();
String name = file.getName();
@@ -211,7 +214,7 @@ public final class UnoPkg extends Abstra
name = prefix + name;
}
if (packer != null && name.endsWith(".jar")) {
- name = name.substring(0, name.length()-3) + "pack";
+ name = name.substring(0, name.length() - 3) + "pack";
try (JarFile jar = new FilteredJarFile(file)) {
out.putNextEntry(new ZipEntry(name));
packer.pack(jar, out);
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst [UTF-8] Sat Dec 9 10:57:44 2017
@@ -64,6 +64,7 @@ Ellipsoid
EllipsoidalCS
EngineeringCRS
EngineeringDatum
+Envelope
EnvironmentalRecord
EvaluationMethodType
Event
@@ -233,3 +234,4 @@ VerticalCS
VerticalDatum
VerticalDatumType
VerticalExtent
+createGeodeticDatum
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/OGC.lst
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/OGC.lst?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/OGC.lst [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/OGC.lst [UTF-8] Sat Dec 9 10:57:44 2017
@@ -233,4 +233,6 @@ SV_OperationChainMetadata
SV_OperationMetadata
SV_ParameterDirection
SV_ServiceIdentification
+AXIS
+ORDER
TOWGS84
Modified: sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst [UTF-8] Sat Dec 9 10:57:44 2017
@@ -1,15 +1,37 @@
+AbstractCRS
AbstractMathTransform
AngleFormat
+AxesConvention
+Citations
+CommonCRS
+DataStore
+DataStores
DefaultEllipsoid
+DefaultExtent
DefaultGeodeticDatum
DefaultMetadata
DefaultProjectedCRS
+DirectPosition2D
+Envelope2D
Envelopes
+Extents
GeneralEnvelope
GridGeometry
IdentifierSpace
+KeyNamePolicy
Localized
+MathTransforms
+Matrices
+MetadataStandard
NilObject
NilReason
NumberRange
+ObjectConverter
Range
+ValueExistencePolicy
+JAVABEANS_PROPERTY
+NON_EMPTY
+RIGHT_HANDED
+asValueMap
+castOrCopy
+forConvention
Modified: sis/branches/ISO-19115-3/core/sis-feature/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-feature/pom.xml?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-feature/pom.xml (original)
+++ sis/branches/ISO-19115-3/core/sis-feature/pom.xml Sat Dec 9 10:57:44 2017
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.sis</groupId>
<artifactId>core</artifactId>
- <version>0.8-jdk8-SNAPSHOT</version>
+ <version>1.0-jdk8-SNAPSHOT</version>
</parent>
Modified: sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -19,6 +19,7 @@ package org.apache.sis.feature;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.IdentityHashMap;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
@@ -216,10 +217,14 @@ public class DefaultAssociationRole exte
* to feature <var>B</var> which has an association back to <var>A</var>. It may also be <var>A</var>
* having an association to itself, <i>etc.</i>
*
- * @param creating the feature type in process of being constructed.
+ * @param creating the feature type in process of being constructed.
+ * @param properties {@code creating.getProperties(false)} given as a direct reference to the internal field,
+ * without invoking {@code getProperties(…)}. We do that because {@code resolve(…)} is invoked while the
+ * given {@code DefaultFeatureType} is under creation. Since {@code getProperties(…)} can be overridden,
+ * invoking that method on {@code creating} may cause a failure with user code.
* @return {@code true} if this association references a resolved feature type after this method call.
*/
- final boolean resolve(final DefaultFeatureType creating) {
+ final boolean resolve(final DefaultFeatureType creating, final Collection<PropertyType> properties) {
final FeatureType type = valueType;
if (type instanceof NamedFeatureType) {
FeatureType resolved = ((NamedFeatureType) type).resolved;
@@ -234,7 +239,7 @@ public class DefaultAssociationRole exte
* the 'creating' feature itself. This is a little bit unusual, but not illegal.
*/
final List<FeatureType> deferred = new ArrayList<>();
- resolved = search(creating, name, deferred);
+ resolved = search(creating, properties, name, deferred);
if (resolved == null) {
/*
* Did not found the desired FeatureType in the 'creating' instance.
@@ -261,19 +266,25 @@ public class DefaultAssociationRole exte
* <p>Current implementation does not check that there is no duplicated names.
* See {@link #deepSearch(List, GenericName)} for a rational.</p>
*
- * @param feature the feature in which to search.
- * @param name the name of the feature to search.
- * @param deferred where to store {@code FeatureType}s to be eventually used for a deep search.
+ * @param feature the feature in which to search.
+ * @param properties {@code feature.getProperties(false)}, or {@code null} for letting this method performing the call.
+ * @param name the name of the feature to search.
+ * @param deferred where to store {@code FeatureType}s to be eventually used for a deep search.
* @return the feature of the given name, or {@code null} if none.
*/
@SuppressWarnings("null")
- private static FeatureType search(final FeatureType feature, final GenericName name, final List<FeatureType> deferred) {
+ private static FeatureType search(final FeatureType feature, Collection<? extends PropertyType> properties,
+ final GenericName name, final List<FeatureType> deferred)
+ {
/*
* Search only in associations declared in the given feature, not in inherited associations.
* The inherited associations will be checked in a separated loop below if we did not found
* the request feature type in explicitly declared associations.
*/
- for (final PropertyType property : feature.getProperties(false)) {
+ if (properties == null) {
+ properties = feature.getProperties(false);
+ }
+ for (final PropertyType property : properties) {
if (property instanceof FeatureAssociationRole) {
final FeatureType valueType;
if (property instanceof DefaultAssociationRole) {
@@ -300,7 +311,7 @@ public class DefaultAssociationRole exte
if (name.equals(type.getName())) {
return type;
}
- type = search(type, name, deferred);
+ type = search(type, null, name, deferred);
if (type != null) {
return type;
}
@@ -309,7 +320,7 @@ public class DefaultAssociationRole exte
}
/**
- * Potentially invoked after {@link #search(FeatureType, GenericName, List)} for searching
+ * Potentially invoked after {@link #search(FeatureType, Collection, GenericName, List)} for searching
* in associations of associations.
*
* <p>Current implementation does not check that there is no duplicated names. Even if we did so,
@@ -317,7 +328,7 @@ public class DefaultAssociationRole exte
* later. We rather put a warning in {@link #DefaultAssociationRole(Map, GenericName, int, int)}
* javadoc.</p>
*
- * @param deferred the feature types collected by {@link #search(FeatureType, GenericName, List)}.
+ * @param deferred the feature types collected by {@link #search(FeatureType, Collection, GenericName, List)}.
* @param name the name of the feature to search.
* @return the feature of the given name, or {@code null} if none.
*/
@@ -327,7 +338,7 @@ public class DefaultAssociationRole exte
FeatureType valueType = deferred.get(i++);
if (done.put(valueType, Boolean.TRUE) == null) {
deferred.subList(0, i).clear(); // Discard previous value for making more room.
- valueType = search(valueType, name, deferred);
+ valueType = search(valueType, null, name, deferred);
if (valueType != null) {
return valueType;
}
Modified: sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -530,7 +530,7 @@ public class DefaultFeatureType extends
*/
if (feature instanceof DefaultFeatureType) {
final DefaultFeatureType dt = (DefaultFeatureType) feature;
- return dt.isResolved = resolve(feature, dt.properties, previous, dt.isResolved);
+ return dt.isResolved = resolve(dt, dt.properties, previous, dt.isResolved);
} else {
return resolve(feature, feature.getProperties(false), previous, feature.isSimple());
}
@@ -559,7 +559,7 @@ public class DefaultFeatureType extends
for (final PropertyType property : toUpdate) {
if (property instanceof FeatureAssociationRole) {
if (property instanceof DefaultAssociationRole) {
- if (!((DefaultAssociationRole) property).resolve(this)) {
+ if (!((DefaultAssociationRole) property).resolve(this, properties)) {
resolved = false;
continue;
}
Modified: sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -43,6 +43,7 @@ import org.apache.sis.util.logging.Loggi
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.feature.Geometries;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.math.MathFunctions;
@@ -98,6 +99,11 @@ public class FeatureFormat extends Tabul
private static final long serialVersionUID = -5792086817264884947L;
/**
+ * The separator to use in comma-separated lists.
+ */
+ private static final String SEPARATOR = ", ";
+
+ /**
* An instance created when first needed and potentially shared.
*/
private static final AtomicReference<FeatureFormat> INSTANCE = new AtomicReference<>();
@@ -350,7 +356,7 @@ public class FeatureFormat extends Tabul
String separator = " ⇾ "; // UML symbol for inheritance.
for (final FeatureType parent : featureType.getSuperTypes()) {
toAppendTo.append(separator).append(toString(parent.getName()));
- separator = ", ";
+ separator = SEPARATOR;
}
}
toAppendTo.append(getLineSeparator());
@@ -463,19 +469,37 @@ public class FeatureFormat extends Tabul
if (!isFirstColumn) nextColumn(table);
isFirstColumn = false;
switch (column) {
+ /*
+ * Human-readable name of the property. May contains any characters (spaces, ideographs, etc).
+ * In many cases, this information is not provided and the whole column is skipped.
+ */
case DESIGNATION: {
final InternationalString d = propertyType.getDesignation();
if (d != null) table.append(d.toString(displayLocale));
break;
}
+ /*
+ * Machine-readable name of the property (identifier). This information is mandatory.
+ * This name is usually shorter than the designation and should contain only valid
+ * Unicode identifier characters (e.g. no spaces).
+ */
case NAME: {
table.append(toString(propertyType.getName()));
break;
}
+ /*
+ * The base class or interface for all values in properties of the same type.
+ * This is typically String, Number, Integer, Geometry or URL.
+ */
case TYPE: {
table.append(valueType);
break;
}
+ /*
+ * Minimum and maximum number of occurrences allowed for this property.
+ * If we are formatting a Feature instead than a FeatureType, then the
+ * actual number of values is also formatted. Example: 42 ∈ [0 … ∞]
+ */
case CARDINALITY: {
table.setCellAlignment(TableAppender.ALIGN_RIGHT);
if (cardinality >= 0) {
@@ -501,6 +525,12 @@ public class FeatureFormat extends Tabul
}
break;
}
+ /*
+ * If formatting a FeatureType, the default value. If formatting a Feature, the actual value.
+ * A java.text.Format instance dedicated to the value class is used if possible. In addition
+ * to types for which a java.text.Format may be available, we also have to check for other
+ * special cases. If there is more than one value, they are formatted as a coma-separated list.
+ */
case VALUE: {
table.setCellAlignment(TableAppender.ALIGN_LEFT);
final Format format = getFormat(valueClass); // Null if valueClass is null.
@@ -555,28 +585,62 @@ public class FeatureFormat extends Tabul
length = formatValue(value, table.append(separator), length);
buffer.setLength(0);
if (length < 0) break; // Value is too long, abandon remaining iterations.
- separator = ", ";
- length += 2;
+ separator = SEPARATOR;
+ length += SEPARATOR.length();
}
}
break;
}
+ /*
+ * Characteristics are optional information attached to some values. For example if a property
+ * value is a temperature measurement, a characteritic of that value may be the unit of measure.
+ * Characteristics are handled as "attributes of attributes".
+ */
case CHARACTERISTICS: {
if (propertyType instanceof AttributeType<?>) {
+ int length = 0;
String separator = "";
- for (final AttributeType<?> attribute : ((AttributeType<?>) propertyType).characteristics().values()) {
- table.append(separator).append(toString(attribute.getName()));
- Object c = attribute.getDefaultValue();
+format: for (final AttributeType<?> ct : ((AttributeType<?>) propertyType).characteristics().values()) {
+ /*
+ * Format the characteristic name. We will append the value(s) later.
+ * We keep trace of the text length in order to stop formatting if the
+ * text become too long.
+ */
+ final GenericName cn = ct.getName();
+ final String cs = toString(cn);
+ table.append(separator).append(cs);
+ length += separator.length() + cs.length();
+ Collection<?> cv = CollectionsExt.singletonOrEmpty(ct.getDefaultValue());
if (feature != null) {
- final Property p = feature.getProperty(propertyType.getName().toString());
- if (p instanceof Attribute<?>) { // Should always be true, but we are paranoiac.
- c = ((Attribute<?>) p).characteristics().get(attribute.getName().toString());
+ /*
+ * Usually, the property 'cp' below is null because all features use the same
+ * characteristic value (for example the same unit of measurement), which is
+ * given by the default value 'cv'. Nevertheless we have to check if current
+ * feature overrides this characteristic.
+ */
+ final Property cp = feature.getProperty(propertyType.getName().toString());
+ if (cp instanceof Attribute<?>) { // Should always be true, but we are paranoiac.
+ Attribute<?> ca = ((Attribute<?>) cp).characteristics().get(cn.toString());
+ if (ca != null) cv = ca.getValues();
}
}
- if (c != null) {
- formatValue(c, table.append(" = "), 0);
+ /*
+ * Now format the value, separated from the name with " = ". Example: unit = m/s
+ * If the value accepts multi-occurrences, we will format the value between {…}.
+ * We use {…} because we may have more than one characteristic in the same cell,
+ * so we need a way to distinguish multi-values from multi-characteristics.
+ */
+ final boolean multi = ct.getMaximumOccurs() > 1;
+ String sep = multi ? " = {" : " = ";
+ for (Object c : cv) {
+ length = formatValue(c, table.append(sep), length += sep.length());
+ if (length < 0) break format; // Value is too long, abandon remaining iterations.
+ sep = SEPARATOR;
+ }
+ separator = SEPARATOR;
+ if (multi && sep == SEPARATOR) {
+ table.append('}');
}
- separator = ", ";
}
}
break;
@@ -635,7 +699,7 @@ public class FeatureFormat extends Tabul
* the length exceed the maximal length (in which case the caller should break iteration).
*/
private int formatValue(final Object value, final TableAppender table, final int length) {
- final String text;
+ String text;
if (value instanceof InternationalString) {
text = ((InternationalString) value).toString(displayLocale);
} else if (value instanceof GenericName) {
@@ -644,7 +708,7 @@ public class FeatureFormat extends Tabul
text = toString(((IdentifiedType) value).getName());
} else if (value instanceof IdentifiedObject) {
text = IdentifiedObjects.getIdentifierOrName((IdentifiedObject) value);
- } else {
+ } else if ((text = Geometries.toString(value)) == null) {
text = value.toString();
}
final int remaining = MAXIMAL_VALUE_LENGTH - length;
Modified: sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -53,9 +53,9 @@ final class NamedFeatureType implements
/**
* The feature type to use instead of the {@code NamedFeatureType}. Initially null, then set to the "real"
- * feature type after {@link DefaultAssociationRole#resolve(DefaultFeatureType)} has been able to create it.
- * This information is stored in case the same {@code NamedFeatureType} instance has been used in more than
- * one {@link DefaultFeatureType}.
+ * feature type after {@link DefaultAssociationRole#resolve(DefaultFeatureType, Collection)} has been able
+ * to create it. This information is stored in case the same {@code NamedFeatureType} instance has been used
+ * in more than one {@link DefaultFeatureType}.
*/
volatile FeatureType resolved;
Modified: sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -202,6 +202,10 @@ public class FeatureTypeBuilder extends
/**
* Creates a new builder instance using the given feature type as a template.
+ * This constructor initializes the list of {@linkplain #properties() properties}, the
+ * {@linkplain #getSuperTypes() super types} and {@link #isAbstract() isAbstract} flag
+ * to values inferred from the given template. The properties list will contain properties
+ * declared explicitely in the given template, not including properties inherited from super types.
*
* @param template an existing feature type to use as a template, or {@code null} if none.
*
@@ -263,6 +267,7 @@ public class FeatureTypeBuilder extends
/**
* Sets all properties of this builder to the values of the given feature type.
* This builder is {@linkplain #clear() cleared} before the properties of the given type are copied.
+ * The copy is performed as documented in the {@linkplain #FeatureTypeBuilder(FeatureType) constructor}.
*
* @param template an existing feature type to use as a template, or {@code null} if none.
* @return {@code this} for allowing method calls chaining.
@@ -407,9 +412,10 @@ public class FeatureTypeBuilder extends
/**
* Sets the parent types (or super-type) from which to inherit properties.
- * If this method is not invoked, then the default value is to have no parent.
+ * If this method is not invoked, then the default value is no parent.
*
* @param parents the parent types from which to inherit properties, or an empty array if none.
+ * Null elements are ignored.
* @return {@code this} for allowing method calls chaining.
*/
public FeatureTypeBuilder setSuperTypes(final FeatureType... parents) {
@@ -418,6 +424,11 @@ public class FeatureTypeBuilder extends
if (!superTypes.equals(asList)) {
superTypes.clear();
superTypes.addAll(asList);
+ for (int i=superTypes.size(); --i >= 0;) {
+ if (superTypes.get(i) == null) {
+ superTypes.remove(i);
+ }
+ }
clearCache();
}
return this;
@@ -595,10 +606,12 @@ public class FeatureTypeBuilder extends
/**
* Returns a view of all attributes and associations added to the {@code FeatureType} to build.
+ * This list contains only properties declared explicitely to this builder;
+ * it does not include properties inherited from {@linkplain #getSuperTypes() super-types}.
* The returned list is <cite>live</cite>: changes in this builder are reflected in that list and conversely.
* However the returned list allows only {@linkplain List#remove(Object) remove} operations;
* new attributes or associations can be added only by calls to one of the {@code addAttribute(…)}
- * or {@code addAssociation(…)} methods.
+ * or {@code addAssociation(…)} methods. Removal operations never affect the super-types.
*
* @return a live list over the properties declared to this builder.
*
Modified: sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-feature/src/main/java/org/apache/sis/feature/builder/OperationWrapper.java [UTF-8] Sat Dec 9 10:57:44 2017
@@ -67,11 +67,11 @@ final class OperationWrapper extends Pro
/**
* Do not allow modifications.
*/
- @Override public TypeBuilder setName (GenericName name) {throw readOnly();}
- @Override public TypeBuilder setDefinition (CharSequence definition) {throw readOnly();}
- @Override public TypeBuilder setDesignation(CharSequence designation) {throw readOnly();}
- @Override public TypeBuilder setDescription(CharSequence description) {throw readOnly();}
- @Override public TypeBuilder setDeprecated (boolean deprecated) {throw readOnly();}
+ @Override public PropertyTypeBuilder setName (GenericName name) {throw readOnly();}
+ @Override public PropertyTypeBuilder setDefinition (CharSequence definition) {throw readOnly();}
+ @Override public PropertyTypeBuilder setDesignation(CharSequence designation) {throw readOnly();}
+ @Override public PropertyTypeBuilder setDescription(CharSequence description) {throw readOnly();}
+ @Override public PropertyTypeBuilder setDeprecated (boolean deprecated) {throw readOnly();}
/**
* Returns the exception to be thrown for read-only wrapper.