sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1745892 - in /sis/trunk: ./ core/sis-build-helper/src/main/java/org/apache/sis/internal/book/ core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/ core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ non...
Date Sat, 28 May 2016 16:12:29 GMT
Author: desruisseaux
Date: Sat May 28 16:12:29 2016
New Revision: 1745892

URL: http://svn.apache.org/viewvc?rev=1745892&view=rev
Log:
Merge minor editions from JDK6 branch.

Added:
    sis/trunk/non-free/
      - copied from r1745891, sis/branches/JDK6/non-free/
Modified:
    sis/trunk/   (props changed)
    sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
    sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
    sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
    sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst
    sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java
    sis/trunk/pom.xml

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat May 28 16:12:29 2016
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK6:1394364-1744475
-/sis/branches/JDK7:1394913-1744473
-/sis/branches/JDK8:1584960-1744471
+/sis/branches/JDK6:1394364-1745891
+/sis/branches/JDK7:1394913-1745890
+/sis/branches/JDK8:1584960-1745889

Modified: sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java?rev=1745892&r1=1745891&r2=1745892&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
[UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
[UTF-8] Sat May 28 16:12:29 2016
@@ -65,7 +65,7 @@ import static org.apache.sis.internal.bo
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
- * @version 0.7
+ * @version 0.8
  */
 public final class Assembler {
     /**
@@ -247,21 +247,24 @@ public final class Assembler {
      * @param filename  the source XML file in the same directory than the input file given
to the constructor.
      * @param toReplace the target XML node to be replaced by the content of the given file.
      */
-    private Node replaceByBody(final String filename, final Node toReplace) throws IOException,
SAXException, BookException {
+    private Node[] replaceByBody(final String filename, final Node toReplace) throws IOException,
SAXException, BookException {
         final NodeList nodes = load(filename).getElementsByTagName("body");
         if (nodes.getLength() != 1) {
             throw new BookException(filename + ": expected exactly one <body> element.");
         }
-        final Node element = document.createElement("section");
-        toReplace.getParentNode().replaceChild(element, toReplace);
-        for (Node child : toArray(nodes.item(0).getChildNodes())) {
+        final Node parent = toReplace.getParentNode();
+        parent.removeChild(toReplace);
+        Node[] childNodes = toArray(nodes.item(0).getChildNodes());
+        for (int i=0; i<childNodes.length; i++) {
+            Node child = childNodes[i];
             child = document.importNode(child, true);   // document.adoptNode(child) would
have been more efficient but does not seem to work.
             if (child == null) {
                 throw new BookException("Failed to copy subtree.");
             }
-            element.appendChild(child);
+            parent.appendChild(child);
+            childNodes[i] = child;
         }
-        return element;
+        return childNodes;
     }
 
     /**
@@ -289,7 +292,8 @@ public final class Assembler {
      * @param index {@code true} for including the {@code <h1>}, <i>etc.</i>
texts in the Table Of Content (TOC).
      *        This is set to {@code false} when parsing the content of {@code <aside>}
or {@code <article>} elements.
      */
-    private void process(Node node, boolean index) throws IOException, SAXException, BookException
{
+    private void process(final Node node, boolean index) throws IOException, SAXException,
BookException {
+        Node[] childNodes = toArray(node.getChildNodes());
         switch (node.getNodeType()) {
             case Node.COMMENT_NODE: {
                 final String text = node.getNodeValue().trim();
@@ -302,7 +306,7 @@ public final class Assembler {
                 final String name = node.getNodeName();
                 /* switch (name) */ {
                     if (name.equals("xi:include")) {
-                        node = replaceByBody(((Element) node).getAttribute("href"), node);
+                        childNodes = replaceByBody(((Element) node).getAttribute("href"),
node);
                     }
                     else if (name.equals("aside") || name.equals("article")) {
                         index = false;
@@ -324,7 +328,7 @@ public final class Assembler {
                         if (text != null) {
                             node.setTextContent(text);
                         }
-                        return; // Do not scan recursively the <code> text content.
+                        return;                             // Do not scan recursively the
<code> text content.
                     }
                     else {
                         if (name.length() == 2 && name.charAt(0) == 'h') {
@@ -350,7 +354,7 @@ public final class Assembler {
                                     } else {
                                         appendToTableOfContent(tableOfChapterContent, c-1,
(Element) node);
                                     }
-                                    prependSectionNumber(c, node);  // Only after insertion
in TOC.
+                                    prependSectionNumber(c, node);                      //
Only after insertion in TOC.
                                 }
                             }
                         }
@@ -359,7 +363,7 @@ public final class Assembler {
                 break;
             }
         }
-        for (final Node child : toArray(node.getChildNodes())) {
+        for (final Node child : childNodes) {
             process(child, index);
         }
     }
@@ -540,4 +544,43 @@ public final class Assembler {
         transformer.setOutputProperty(OutputKeys.INDENT, "no");
         transformer.transform(new DOMSource(document), new StreamResult(output));
     }
+
+    /**
+     * Generates the {@code "content/book/en|fr/developer-guide.html"} file from {@code "book/en|fr/body.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"}.
+     *
+     * @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.
+     *
+     * @since 0.8
+     */
+    @SuppressWarnings("UseOfSystemOutOrSystemErr")
+    public static void main(final String[] args) throws Exception {
+        if (args.length != 1) {
+            System.err.println("Expected parameter: the language (\"en\" or \"fr\").");
+            System.err.println("Current directory shall be the root of Apache SIS site source
code.");
+            System.exit(1);
+        }
+        String lang = args[0];
+        final Locale locale;
+        if ("en".equalsIgnoreCase(lang)) {
+            locale = Locale.ENGLISH;
+        } else if ("fr".equalsIgnoreCase(lang)) {
+            locale = Locale.FRENCH;
+        } else {
+            System.err.println("Unsupported language code: " + lang);
+            System.exit(1);
+            return;
+        }
+        lang = locale.getLanguage();
+        File input = new File("book/" + lang + "/body.html");
+        if (!input.isFile()) {
+            System.err.println("Can not read " + input + ". Is the current directory the
root of SIS site source code?");
+            System.exit(1);
+            return;
+        }
+        final Assembler assembler = new Assembler(input, locale);
+        assembler.run(new File("content/book/" + lang + "/developer-guide.html"));
+    }
 }

Modified: sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java?rev=1745892&r1=1745891&r2=1745892&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
[UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
[UTF-8] Sat May 28 16:12:29 2016
@@ -265,7 +265,7 @@ public final class CodeColorizer {
              */
             if (stopCondition != null) {
                 if (node.getNodeType() != Node.TEXT_NODE) {
-                    syntaticElement.appendChild(node);  // Also remove from its previous
position.
+                    syntaticElement.appendChild(node);          // Also remove from its previous
position.
                     continue;
                 }
                 final String text = node.getTextContent();

Modified: sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java?rev=1745892&r1=1745891&r2=1745892&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
[UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
[UTF-8] Sat May 28 16:12:29 2016
@@ -25,6 +25,6 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
- * @version 0.7
+ * @version 0.8
  */
 package org.apache.sis.internal.book;

Modified: sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst?rev=1745892&r1=1745891&r2=1745892&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst
[UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/GEOAPI.lst
[UTF-8] Sat May 28 16:12:29 2016
@@ -42,6 +42,7 @@ Coverage
 CoverageContentType
 CoverageDescription
 CoverageResult
+CRSFactory
 CylindricalCS
 DataIdentification
 DataQuality

Modified: sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst?rev=1745892&r1=1745891&r2=1745892&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst
[UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/resources/org/apache/sis/internal/book/SIS.lst
[UTF-8] Sat May 28 16:12:29 2016
@@ -3,6 +3,7 @@ AngleFormat
 DefaultEllipsoid
 DefaultGeodeticDatum
 DefaultMetadata
+DefaultProjectedCRS
 Envelopes
 GeneralEnvelope
 GridGeometry

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java?rev=1745892&r1=1745891&r2=1745892&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java
[UTF-8] Sat May 28 16:12:29 2016
@@ -22,6 +22,7 @@ import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.TimeUnit;
 import org.opengis.util.FactoryException;
+import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -169,7 +170,7 @@ public final strictfp class ConcurrentAu
         Thread.sleep(TimeUnit.NANOSECONDS.toMillis(waitTime));
         int n = 3;
         while (factory.isCleanScheduled()) {
-            Logging.getLogger("org.geotoolkit.referencing.factory")
+            Logging.getLogger(Loggers.CRS_FACTORY)
                     .warning("Execution of ConcurrentAuthorityFactory.disposeExpired() has
been delayed.");
             Thread.sleep(TIMEOUT);
             System.gc();

Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1745892&r1=1745891&r2=1745892&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Sat May 28 16:12:29 2016
@@ -31,7 +31,7 @@
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>17</version>
+    <version>18</version>
   </parent>
 
 
@@ -590,7 +590,6 @@ Apache SIS is a free software, Java lang
       <!-- JavaDoc configuration. -->
       <plugin>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>2.10.3</version>
         <configuration>
           <source>${maven.compile.source}</source>              <!-- Enables
javadoc to handle language constructs present in target JDK. -->
           <encoding>${project.build.sourceEncoding}</encoding>  <!-- Encoding
of Java source file. -->



Mime
View raw message