sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1811100 - in /sis/data/non-free: sis-embedded-data/ sis-embedded-data/src/ sis-embedded-data/src/main/ sis-embedded-data/src/main/java/ sis-embedded-data/src/main/java/org/ sis-embedded-data/src/main/java/org/apache/ sis-embedded-data/src/...
Date Wed, 04 Oct 2017 16:06:48 GMT
Author: desruisseaux
Date: Wed Oct  4 16:06:47 2017
New Revision: 1811100

URL: http://svn.apache.org/viewvc?rev=1811100&view=rev
Log:
First draft of 'sis-embedded-data' module, not yet functional.

Added:
    sis/data/non-free/sis-embedded-data/   (with props)
    sis/data/non-free/sis-embedded-data/pom.xml
      - copied, changed from r1807236, sis/data/non-free/sis-epsg/pom.xml
    sis/data/non-free/sis-embedded-data/src/
    sis/data/non-free/sis-embedded-data/src/main/
    sis/data/non-free/sis-embedded-data/src/main/java/
    sis/data/non-free/sis-embedded-data/src/main/java/org/
    sis/data/non-free/sis-embedded-data/src/main/java/org/apache/
    sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/
    sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/
    sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/
    sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/EmbeddedResources.java
  (with props)
    sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/Generator.java
  (with props)
    sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/package-info.java
  (with props)
    sis/data/non-free/sis-embedded-data/src/main/resources/
    sis/data/non-free/sis-embedded-data/src/test/
    sis/data/non-free/sis-embedded-data/src/test/java/
    sis/data/non-free/sis-embedded-data/src/test/java/org/
    sis/data/non-free/sis-embedded-data/src/test/java/org/apache/
    sis/data/non-free/sis-embedded-data/src/test/java/org/apache/sis/
    sis/data/non-free/sis-embedded-data/src/test/java/org/apache/sis/resources/
    sis/data/non-free/sis-embedded-data/src/test/java/org/apache/sis/resources/embedded/
Modified:
    sis/data/non-free/sis-epsg/pom.xml
    sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/ScriptProvider.java
    sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/package-info.java
    sis/data/non-free/sis-epsg/src/main/resources/META-INF/NOTICE

Propchange: sis/data/non-free/sis-embedded-data/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct  4 16:06:47 2017
@@ -0,0 +1 @@
+target

Copied: sis/data/non-free/sis-embedded-data/pom.xml (from r1807236, sis/data/non-free/sis-epsg/pom.xml)
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-embedded-data/pom.xml?p2=sis/data/non-free/sis-embedded-data/pom.xml&p1=sis/data/non-free/sis-epsg/pom.xml&r1=1807236&r2=1811100&rev=1811100&view=diff
==============================================================================
--- sis/data/non-free/sis-epsg/pom.xml (original)
+++ sis/data/non-free/sis-embedded-data/pom.xml Wed Oct  4 16:06:47 2017
@@ -27,21 +27,22 @@
   <parent>
     <groupId>org.apache.sis</groupId>
     <artifactId>parent</artifactId>
-    <version>0.8-SNAPSHOT</version>
+    <version>0.8-jdk8-SNAPSHOT</version>
   </parent>
   <groupId>org.apache.sis.non-free</groupId>
-  <artifactId>sis-epsg</artifactId>
-  <version>0.8-SNAPSHOT</version>
+  <artifactId>sis-embedded-data</artifactId>
+  <version>0.8-jdk8-SNAPSHOT</version>
   <packaging>jar</packaging>
 
-  <name>EPSG dataset for Apache SIS</name>
-  <url>http://www.epsg.org</url>
+  <name>Data in embedded environment</name>
+  <url>http://sis.apache.org</url>
   <description>
-The EPSG geodetic dataset provides definitions for thousands of Coordinate Reference Systems
(CRS),
- together with parameter values for thousands of Coordinate Operations between various pairs
of CRS.
- This 'sis-epsg' module contains the SQL scripts for creating a local copy of EPSG geodetic
dataset.
+Provides non-free data, including the EPSG geodetic dataset, in a single read-only JAR file.
+ This 'sis-embedded-data' module contains a copy of EPSG geodetic dataset in an embedded
Apache Derby database.
+ Having this module on the classpath avoid the need to set the 'SIS_DATA' environment variable
+ for using the Coordinate Reference Systems (CRS) and Coordinate Operations defined by EPSG.
  EPSG is maintained by the IOGP Surveying &amp; Positioning Committee and reproduced
in this module
- with identical content. See http://www.epsg.org/ for more information.
+ with same content. See http://www.epsg.org/ for more information.
   </description>
 
   <licenses>
@@ -59,12 +60,12 @@ The EPSG geodetic dataset provides defin
 
   <scm>
     <connection>
-      scm:svn:http://svn.apache.org/repos/asf/sis/data/non-free/sis-epsg
+      scm:svn:http://svn.apache.org/repos/asf/sis/data/non-free/sis-embedded-data
     </connection>
     <developerConnection>
-      scm:svn:https://svn.apache.org/repos/asf/sis/data/non-free/sis-epsg
+      scm:svn:https://svn.apache.org/repos/asf/sis/data/non-free/sis-embedded-data
     </developerConnection>
-    <url>http://svn.apache.org/viewvc/sis/data/non-free/sis-epsg</url>
+    <url>http://svn.apache.org/viewvc/sis/data/non-free/sis-embedded-data</url>
   </scm>
 
   <developers>
@@ -82,34 +83,15 @@ The EPSG geodetic dataset provides defin
     </developer>
   </developers>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <configuration>
-          <instructions>
-            <Bundle-SymbolicName>org.apache.sis.referencing.epsg</Bundle-SymbolicName>
-            <Require-Capability>osgi.extender;
-            filter:="(osgi.extender=osgi.serviceloader.registrar)"</Require-Capability>
-            <Provide-Capability>osgi.serviceloader;
-            osgi.serviceloader=org.apache.sis.setup.InstallationResources</Provide-Capability>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-  <!--
-    While this module declares a dependency to SIS 0.8, it can be used with 0.8-jdk6, 0.8-jdk7
or 0.8-jdk8 as well.
-    It is up to the user to choose the Apache SIS version.
-  -->
   <dependencies>
     <dependency>
       <groupId>org.apache.sis.core</groupId>
       <artifactId>sis-referencing</artifactId>
       <version>${project.version}</version>
-      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
     </dependency>
   </dependencies>
 </project>

Added: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/EmbeddedResources.java
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/EmbeddedResources.java?rev=1811100&view=auto
==============================================================================
--- sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/EmbeddedResources.java
(added)
+++ sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/EmbeddedResources.java
[UTF-8] Wed Oct  4 16:06:47 2017
@@ -0,0 +1,149 @@
+/*
+ * 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.resources.embedded;
+
+import java.util.Set;
+import java.util.Collections;
+import java.util.Locale;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import javax.sql.DataSource;
+import org.apache.derby.jdbc.EmbeddedDataSource;
+import org.apache.sis.internal.metadata.sql.Initializer;
+import org.apache.sis.setup.InstallationResources;
+import org.apache.sis.util.resources.Errors;
+
+
+/**
+ * Provides an embedded database for the EPSG geodetic dataset and other resources.
+ * Provides also a copy of the <a href="http://www.epsg.org/TermsOfUse">EPSG terms
of use</a>,
+ * which should be accepted by users before the EPSG dataset can be installed.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ *
+ * @see <a href="http://www.epsg.org/">http://www.epsg.org/</a>
+ */
+public class EmbeddedResources extends InstallationResources {
+    /**
+     * The pseudo-authority name used for the embedded data resources.
+     */
+    private static final String AUTHORITY = "Embedded";
+
+    /**
+     * Creates a new provider for connections to the embedded database.
+     */
+    public EmbeddedResources() {
+    }
+
+    /**
+     * Returns the pseudo-authority, which is {@code "Embedded"}.
+     *
+     * @return {@code "Embedded"} pseudo-authority.
+     */
+    @Override
+    public Set<String> getAuthorities() {
+        return Collections.singleton(AUTHORITY);
+    }
+
+    /**
+     * Verifies that the given authority is the expected values.
+     */
+    private void verifyAuthority(final String authority) {
+        if (!AUTHORITY.equalsIgnoreCase(authority)) {
+            throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2,
"authority", authority));
+        }
+    }
+
+    /**
+     * Returns the license of embedded data.
+     *
+     * @param  authority  shall be {@code "Embedded"}.
+     * @param  locale     the preferred locale for the terms of use.
+     * @param  mimeType   either {@code "text/plain"} or {@code "text/html"}.
+     * @return the terms of use in plain text or HTML, or {@code null} if none.
+     * @throws IllegalArgumentException if the given {@code authority} argument is not the
expected values.
+     * @throws IOException if an error occurred while reading the license file.
+     */
+    @Override
+    public String getLicense(String authority, Locale locale, String mimeType) throws IOException
{
+        verifyAuthority(authority);
+        final String filename;
+        if ("text/plain".equalsIgnoreCase(mimeType)) {
+            filename = "LICENSE.txt";
+        } else if ("text/html".equalsIgnoreCase(mimeType)) {
+            filename = "LICENSE.html";
+        } else {
+            return null;
+        }
+        final StringBuilder buffer = new StringBuilder();
+        final String lineSeparator = System.lineSeparator();
+        try (BufferedReader in = new BufferedReader(new InputStreamReader(
+                EmbeddedResources.class.getResourceAsStream(filename), "UTF-8")))
+        {
+            String line;
+            while ((line = in.readLine()) != null) {
+                buffer.append(line).append(lineSeparator);
+            }
+        }
+        return buffer.toString();
+    }
+
+    /**
+     * Returns the data source name, which is {@code "SpatialMetadata"}.
+     *
+     * @param  authority  shall be {@code "Embedded"}.
+     * @return {@code "SpatialMetadata"}.
+     */
+    @Override
+    public String[] getResourceNames(String authority) {
+        verifyAuthority(authority);
+        return new String[] {Initializer.DATABASE};
+    }
+
+    /**
+     * Returns the data source for embedded database.
+     *
+     * @param  authority  shall be {@code "Embedded"}.
+     * @param  index      shall be 0.
+     * @return the embedded data source.
+     */
+    @Override
+    public DataSource getResource(String authority, int index) {
+        verifyAuthority(authority);
+        final EmbeddedDataSource ds = new EmbeddedDataSource();
+        ds.setDataSourceName(Initializer.DATABASE);
+        ds.setDatabaseName("classpath:SIS_DATA/Databases/" + Initializer.DATABASE);
+        return ds;
+    }
+
+    /**
+     * Unconditionally throws an exception since the embedded database is not provided as
SQL scripts.
+     *
+     * @param  authority  shall be {@code "Embedded"}.
+     * @param  resource   shall be 0.
+     * @return never return.
+     * @throws IOException always thrown.
+     */
+    @Override
+    public BufferedReader openScript(String authority, int resource) throws IOException {
+        verifyAuthority(authority);
+        throw new IOException(Errors.format(Errors.Keys.CanNotConvertFromType_2, DataSource.class,
BufferedReader.class));
+    }
+}

Propchange: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/EmbeddedResources.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/EmbeddedResources.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/Generator.java
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/Generator.java?rev=1811100&view=auto
==============================================================================
--- sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/Generator.java
(added)
+++ sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/Generator.java
[UTF-8] Wed Oct  4 16:06:47 2017
@@ -0,0 +1,205 @@
+/*
+ * 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.resources.embedded;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Locale;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.lang.reflect.Method;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.FileAlreadyExistsException;
+import java.sql.SQLException;
+import org.opengis.util.FactoryException;
+import org.opengis.referencing.crs.GeographicCRS;
+import org.apache.derby.jdbc.EmbeddedDataSource;
+import org.apache.sis.internal.metadata.sql.Initializer;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.metadata.MetadataStandard;
+import org.apache.sis.metadata.sql.MetadataSource;
+import org.apache.sis.metadata.sql.MetadataStoreException;
+import org.apache.sis.referencing.factory.sql.EPSGFactory;
+import org.apache.sis.referencing.factory.sql.InstallationScriptProvider;
+
+
+/**
+ * Generates {@code SpatialMetadata} database with EPSG geodetic dataset.
+ * This class is invoked only at build time and should be excluded from the final JAR file.
+ * The {@link #main(String[])} method generates resources directly in the {@code target/classes}
directory.
+ *
+ * <div class="note"><b>Note:</b>
+ * Maven usage is to generate resources in the {@code target/generated-resources} directory.
+ * We don't do that for avoiding unnecessary file copy operations before the package phase.
+ * Instead we write the files right in their final destination, {@code target/classes}.</div>
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ */
+final class Generator {
+    /**
+     * Generates the embedded resources in the {@code target/classes} directory.
+     * See class Javadoc for more information.
+     *
+     * @param  args  ignored.
+     * @throws Exception if a failure occurred while searching directories, executing SQL
scripts,
+     *         copying data or any other operation.
+     */
+    @SuppressWarnings("UseOfSystemOutOrSystemErr")
+    public static void main(String[] args) throws Exception {
+        Generator gen;
+        try {
+            gen = new Generator();
+        } catch (FileAlreadyExistsException e) {
+            System.err.println(e);
+            return;
+        }
+        gen.copyLicenseFiles();
+        gen.createMetadata();
+        gen.createEPSG();
+        gen.shutdown();
+    }
+
+    /**
+     * The path containing SQL scripts to use for creating the database. Those scripts are
provided by the
+     * {@code sis-epsg} module. We assume that the developer did a checkout of the whole
{@code "non-free"}
+     * repository, in which case we can locate those scripts relative to this {@code "sis-embedded-data"}
+     * repository.
+     */
+    private final Path sourceEPSG;
+
+    /**
+     * The directory where to copy license files.
+     */
+    private final Path licenseTarget;
+
+    /**
+     * Provides connection to "SpatialMetadata" database. The connection URL will reference
the
+     * {@code SIS_DATA/Databases/SpatialMetadata} directory in the Maven {@code target/classes}
directory.
+     */
+    private final EmbeddedDataSource dataSource;
+
+    /**
+     * Creates a new database generator.
+     *
+     * @throws URISyntaxException  if the class files are already in a JAR file.
+     * @throws IOException         if we did not found the expected directory, or if the
target directory already exists.
+     */
+    private Generator() throws URISyntaxException, IOException {
+        final Class<?> consumer = EmbeddedResources.class;
+        Path target = Paths.get(consumer.getResource(consumer.getSimpleName() + ".class").toURI());
+        licenseTarget = target.getParent();
+        target = Paths.get("").toAbsolutePath().relativize(target);
+        target = target.subpath(0, target.getNameCount() - 6);
+        if (!target.getFileName().toString().equals("classes")) {
+            throw new FileNotFoundException("Expected \"classes\" directory but got " + target);
+        }
+        /*
+         * Build the path to the SQL scripts for building EPSG database.
+         */
+        sourceEPSG = target.resolve(Paths.get("..","..","..","sis-epsg","src","main","resources",
+                "org","apache","sis","referencing","factory","sql","epsg")).normalize();
+        if (!Files.isDirectory(sourceEPSG)) {
+            throw new FileNotFoundException(sourceEPSG.toString());
+        }
+        /*
+         * Creates sub-directory step by step instead than invoking Files.createDirectories(…)
for making sure that we
+         * do not create undesirable directories. We also want this constructor to fail if
target directory already exist.
+         */
+        target = Files.createDirectory(target.resolve(Paths.get("SIS_DATA")));
+        target = Files.createDirectory(target.resolve(Paths.get("Databases")));
+        dataSource = new EmbeddedDataSource();
+        dataSource.setDataSourceName(Initializer.DATABASE);
+        dataSource.setDatabaseName(target.resolve(Initializer.DATABASE).toString());
+        dataSource.setCreateDatabase("create");
+    }
+
+    /**
+     * Creates the metadata database schema.
+     *
+     * @throws FactoryException  if an error occurred while creating or querying the database.
+     */
+    private void createMetadata() throws MetadataStoreException, ReflectiveOperationException
{
+        try (MetadataSource md = new MetadataSource(MetadataStandard.ISO_19115, dataSource,
"metadata", null)) {
+            Method install = md.getClass().getDeclaredMethod("install");
+            install.setAccessible(true);
+            install.invoke(md);
+        }
+    }
+
+    /**
+     * Creates the EPSG database schema.
+     *
+     * @throws FactoryException  if an error occurred while creating or querying the database.
+     */
+    private void createEPSG() throws FactoryException {
+        final Map<String,Object> properties = new HashMap<>();
+        properties.put("dataSource", dataSource);
+        properties.put("scriptProvider", new InstallationScriptProvider(Constants.EPSG,
+                "Prepare", "Tables.sql", "Data.sql", "FKeys.sql", "Finish")
+        {
+            @Override public String getLicense(String authority, Locale locale, String mimeType)
{
+                return null;        // Not used for this Generator class.
+            }
+
+            @Override protected InputStream openStream(final String name) throws IOException
{
+                return Files.newInputStream(sourceEPSG.resolve(name));
+            }
+        });
+        /*
+         * Asking for any CRS will trig the database creation.
+         * We perform a simple verification on the created CRS as a matter of principle.
+         */
+        final GeographicCRS crs;
+        try (EPSGFactory factory = new EPSGFactory(properties)) {
+            crs = factory.createGeographicCRS("4326");
+        }
+        if (!crs.getName().getCode().equals("WGS 84")) {
+            throw new FactoryException("Unexpected CRS: " + crs.getName());
+        }
+    }
+
+    /**
+     * Shutdowns the Derby database.
+     */
+    private void shutdown() throws SQLException {
+        dataSource.setCreateDatabase("no");
+        dataSource.setShutdownDatabase("shutdown");
+        try {
+            dataSource.getConnection().close();
+        } catch (SQLException e) {
+            if (Initializer.isSuccessfulShutdown(e)) {
+                return;
+            }
+            throw e;
+        }
+        throw new SQLException("Shutdown has not been completed.");
+    }
+
+    /**
+     * Copies the EPSG terms of use from the {@code sis-epsg} module to this {@code sis-embedded-data}
module.
+     */
+    private void copyLicenseFiles() throws IOException {
+        Files.copy(sourceEPSG.resolve("LICENSE.txt"),  licenseTarget.resolve("LICENSE.txt"));
+        Files.copy(sourceEPSG.resolve("LICENSE.html"), licenseTarget.resolve("LICENSE.html"));
+    }
+}

Propchange: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/Generator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/Generator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/package-info.java
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/package-info.java?rev=1811100&view=auto
==============================================================================
--- sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/package-info.java
(added)
+++ sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/package-info.java
[UTF-8] Wed Oct  4 16:06:47 2017
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides non-free data, including the EPSG geodetic dataset, in a single read-only JAR
file.
+ * This module contains a copy of EPSG geodetic dataset in an embedded Apache Derby database.
+ * Having this module on the classpath avoid the need to set the {@code SIS_DATA} environment
variable
+ * for using the Coordinate Reference Systems (CRS) and Coordinate Operations defined by
EPSG.
+ * EPSG is maintained by the IOGP Surveying &amp; Positioning Committee and reproduced
in this module
+ * with same content.
+ *
+ * <p>Note that the use of this module is subject to the following license conditions,
+ * in addition to Apache 2 license:</p>
+ *
+ * <ul>
+ *   <li><a href="http://www.epsg.org/TermsOfUse">EPSG terms of use</a></li>
+ * </ul>
+ *
+ * More resources, and consequently more licensing conditions, may be added in future SIS
releases.
+ * For choosing resources on a case-by-case basis, see other modules in the
+ * {@code org.apache.sis:non-free} Maven group.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ */
+package org.apache.sis.resources.embedded;

Propchange: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/data/non-free/sis-embedded-data/src/main/java/org/apache/sis/resources/embedded/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/data/non-free/sis-epsg/pom.xml
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-epsg/pom.xml?rev=1811100&r1=1811099&r2=1811100&view=diff
==============================================================================
--- sis/data/non-free/sis-epsg/pom.xml (original)
+++ sis/data/non-free/sis-epsg/pom.xml Wed Oct  4 16:06:47 2017
@@ -100,16 +100,11 @@ The EPSG geodetic dataset provides defin
     </plugins>
   </build>
 
-  <!--
-    While this module declares a dependency to SIS 0.8, it can be used with other branches
or versions as well.
-    It is up to the user to choose the Apache SIS version.
-  -->
   <dependencies>
     <dependency>
       <groupId>org.apache.sis.core</groupId>
       <artifactId>sis-referencing</artifactId>
       <version>${project.version}</version>
-      <scope>provided</scope>
     </dependency>
   </dependencies>
 </project>

Modified: sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/ScriptProvider.java
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/ScriptProvider.java?rev=1811100&r1=1811099&r2=1811100&view=diff
==============================================================================
--- sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/ScriptProvider.java
[UTF-8] (original)
+++ sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/ScriptProvider.java
[UTF-8] Wed Oct  4 16:06:47 2017
@@ -21,6 +21,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.referencing.factory.sql.InstallationScriptProvider;
 
@@ -35,7 +36,9 @@ import org.apache.sis.referencing.factor
  * (IOGP) Surveying &amp; Positioning Committee. The SQL scripts are given by this class
with identical content,
  * but in a more compact format.
  *
- * @author Martin Desruisseaux (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.7
  *
  * @see <a href="http://www.epsg.org/">http://www.epsg.org/</a>
  */
@@ -60,6 +63,9 @@ public class ScriptProvider extends Inst
      */
     @Override
     public String getLicense(final String authority, final Locale locale, final String mimeType)
throws IOException {
+        if (!Constants.EPSG.equals(authority)) {
+            throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2,
"authority", authority));
+        }
         final String filename;
         if ("text/plain".equalsIgnoreCase(mimeType)) {
             filename = "LICENSE.txt";
@@ -69,7 +75,7 @@ public class ScriptProvider extends Inst
             return null;
         }
         final StringBuilder buffer = new StringBuilder();
-        final String lineSeparator = System.getProperty("line.separator", "\n");
+        final String lineSeparator = System.lineSeparator();
         try (BufferedReader in = new BufferedReader(new InputStreamReader(
                 ScriptProvider.class.getResourceAsStream(filename), "UTF-8")))
         {

Modified: sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/package-info.java
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/package-info.java?rev=1811100&r1=1811099&r2=1811100&view=diff
==============================================================================
--- sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/package-info.java
[UTF-8] (original)
+++ sis/data/non-free/sis-epsg/src/main/java/org/apache/sis/referencing/factory/sql/epsg/package-info.java
[UTF-8] Wed Oct  4 16:06:47 2017
@@ -29,6 +29,8 @@
  * more compact format. All SQL scripts in this module are subject to <a href="http://www.epsg.org/TermsOfUse">EPSG
  * terms of use</a>. The remaining (Java code, configuration files) are under Apache
2 license.
  *
- * @author Martin Desruisseaux (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.7
+ * @since   0.7
  */
 package org.apache.sis.referencing.factory.sql.epsg;

Modified: sis/data/non-free/sis-epsg/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-epsg/src/main/resources/META-INF/NOTICE?rev=1811100&r1=1811099&r2=1811100&view=diff
==============================================================================
--- sis/data/non-free/sis-epsg/src/main/resources/META-INF/NOTICE [UTF-8] (original)
+++ sis/data/non-free/sis-epsg/src/main/resources/META-INF/NOTICE [UTF-8] Wed Oct  4 16:06:47
2017
@@ -1,6 +1,6 @@
-EPSG dataset for Apache SIS
+EPSG geodetic dataset for Apache SIS
+Copyright The Apache Software Foundation
 Copyright International Association of Oil and Gas Producers (IOGP)
-Copyright 2010-2016 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).



Mime
View raw message