Skip to content

Commit

Permalink
Rename package, fix Java module issues, etc. (postgis#85)
Browse files Browse the repository at this point in the history
* Require Java 9

* Migrate package root from org.postgis to net.postgis

* Add module-info.java files

* Move classes in main postgis-jdbc module to net.postgis.jdbc

* Un-collide Java example package

* Move properties from illegal packages to allowed ones

In the case of the org/postgres/driverconfig.properties
this will break autoregistration – this feature needs to
be done differently.

* postgis-jdbc-geometry: Align Maven module name, Java module name, package name and directory name

* postgis-jdbc: Align directory name with Maven module and Java module name

* postgis-jdbc-java2d: Align package name with Maven module name, Java module name and directory name

* postgis-jdbc-jts: Align Maven module name, Java module name, package name and directory name

* Clean up module-info files, add exports

* Deactivate module-info.java files, add `Automatic-Module-Name`s to MANIFEST.MF instead, move driver registration property file back

* Revert to Java 8

Co-authored-by: Phillip Ross <[email protected]>
  • Loading branch information
soc and phillipross authored Sep 9, 2020
1 parent 140db1d commit 0cf56f4
Show file tree
Hide file tree
Showing 94 changed files with 383 additions and 278 deletions.
21 changes: 11 additions & 10 deletions .travis/install-zulu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
set -euf

AZUL_GPG_KEY=0xB1998361219BD9C9
ZULU_VERSION=11
ZULU_RELEASE=11.37+17
JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
ZULU_VERSION=8
ZULU_RELEASE=8.0.265-5
JAVA_HOME=/usr/lib/jvm/zulu-8-amd64

sudo apt-get update
sudo apt-get install -y gnupg2 locales
sudo locale-gen en_US.UTF-8
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${AZUL_GPG_KEY}
echo "deb http://repos.azulsystems.com/ubuntu stable main" | sudo tee -a /etc/apt/sources.list.d/zulu.list
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
sudo apt-get update
sudo apt-get install -y zulu-repo
sudo apt-get update
sudo apt-get install -y zulu-${ZULU_VERSION}=${ZULU_RELEASE}
export ALTERNATIVES_JAVA=$(realpath /etc/alternatives/java)
export JAVA_HOME=${ALTERNATIVES_JAVA%/bin/java}
sudo apt-get install -y zulu${ZULU_VERSION}=${ZULU_RELEASE}
sudo sed -i.orig -e "s/^hl /jre /g" -e "s/^jdkhl /jdk /g" /usr/lib/jvm/.zulu8-ca-amd64.jinfo
sudo update-java-alternatives --set zulu8-ca-amd64
export ALTERNATIVES_JAVAC=$(realpath /etc/alternatives/javac)
export JAVA_HOME=${ALTERNATIVES_JAVAC%/bin/javac}
export PATH=$JAVA_HOME/bin:$PATH
java -version

Expand Down

This file was deleted.

10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
</mailingLists>

<modules>
<module>tools</module>
<module>postgis-geometry</module>
<module>jdbc</module>
<module>jdbc_jtsparser</module>
<module>postgis-jdbc</module>
<module>postgis-jdbc-geometry</module>
<module>postgis-jdbc-java2d</module>
<module>postgis-jdbc-jts</module>
<module>tools</module>
</modules>

<scm>
Expand Down Expand Up @@ -100,7 +100,7 @@
<checkstyle.skip>true</checkstyle.skip>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.min.version>1.8</java.min.version>
<java.min.version>8</java.min.version>
<maven.min.version>3.6</maven.min.version>
<maven.test.skip>false</maven.test.skip>
<surefire.forkCount>1</surefire.forkCount>
Expand Down
10 changes: 10 additions & 0 deletions postgis-geometry/pom.xml → postgis-jdbc-geometry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>net.postgis.jdbc.geometry</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
9 changes: 9 additions & 0 deletions postgis-jdbc-geometry/src/main/java/module-info.java.off
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module net.postgis.jdbc.geometry {
requires java.sql;

requires org.slf4j;

exports net.postgis.jdbc.geometry;
exports net.postgis.jdbc.geometry.binary;
exports net.postgis.jdbc.geometry.util;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;
import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.postgis;
package net.postgis.jdbc.geometry;


import org.postgis.binary.BinaryParser;
import net.postgis.jdbc.geometry.binary.BinaryParser;

import java.sql.SQLException;

Expand Down Expand Up @@ -93,7 +93,7 @@ public static Geometry geomFromString(String value, BinaryParser bp, boolean hav
* Poor man's String.split() replacement, as String.split() was invented at
* jdk1.4, and the Debian PostGIS Maintainer had problems building the woody
* backport of his package using DFSG-free compilers. In all the cases we
* used split() in the org.postgis package, we only needed to split at the
* used split() in the net.postgis package, we only needed to split at the
* first occurence, and thus this code could even be faster.
*
* @param whole the String to be split
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;


import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
package org.postgis.binary;

import org.postgis.Geometry;
import org.postgis.GeometryCollection;
import org.postgis.LineString;
import org.postgis.LinearRing;
import org.postgis.MultiLineString;
import org.postgis.MultiPoint;
import org.postgis.MultiPolygon;
import org.postgis.Point;
import org.postgis.Polygon;
import org.postgis.binary.ByteGetter.BinaryByteGetter;
import org.postgis.binary.ByteGetter.StringByteGetter;
package net.postgis.jdbc.geometry.binary;

import net.postgis.jdbc.geometry.Geometry;
import net.postgis.jdbc.geometry.GeometryCollection;
import net.postgis.jdbc.geometry.LineString;
import net.postgis.jdbc.geometry.LinearRing;
import net.postgis.jdbc.geometry.MultiLineString;
import net.postgis.jdbc.geometry.MultiPoint;
import net.postgis.jdbc.geometry.MultiPolygon;
import net.postgis.jdbc.geometry.Point;
import net.postgis.jdbc.geometry.Polygon;
import net.postgis.jdbc.geometry.binary.ByteGetter.BinaryByteGetter;
import net.postgis.jdbc.geometry.binary.ByteGetter.StringByteGetter;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
package org.postgis.binary;

import org.postgis.Geometry;
import org.postgis.GeometryCollection;
import org.postgis.LineString;
import org.postgis.LinearRing;
import org.postgis.MultiLineString;
import org.postgis.MultiPoint;
import org.postgis.MultiPolygon;
import org.postgis.Point;
import org.postgis.Polygon;
package net.postgis.jdbc.geometry.binary;

import net.postgis.jdbc.geometry.Geometry;
import net.postgis.jdbc.geometry.GeometryCollection;
import net.postgis.jdbc.geometry.LineString;
import net.postgis.jdbc.geometry.LinearRing;
import net.postgis.jdbc.geometry.MultiLineString;
import net.postgis.jdbc.geometry.MultiPoint;
import net.postgis.jdbc.geometry.MultiPolygon;
import net.postgis.jdbc.geometry.Point;
import net.postgis.jdbc.geometry.Polygon;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/

package org.postgis.binary;
package net.postgis.jdbc.geometry.binary;

public abstract class ByteGetter {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/

package org.postgis.binary;
package net.postgis.jdbc.geometry.binary;

public abstract class ByteSetter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/

package org.postgis.binary;
package net.postgis.jdbc.geometry.binary;

public abstract class ValueGetter {
ByteGetter data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/

package org.postgis.binary;
package net.postgis.jdbc.geometry.binary;

public abstract class ValueSetter {
ByteSetter data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* (C) 2020 Phillip Ross, [email protected]
*/

package org.postgis.util;
package net.postgis.jdbc.geometry.util;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* (C) 2020 Phillip Ross, [email protected]
*/

package org.postgis.util;
package net.postgis.jdbc.geometry.util;


import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
*
* @author Phillip Ross
*/
package org.postgis.util;
package net.postgis.jdbc.geometry.util;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;


import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

package org.postgis;
package net.postgis.jdbc.geometry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
<logger name="org.testcontainers" level="ERROR"/>
<logger name="net.postgis" level="ERROR"/>

<logger name="org.postgis" level="ERROR"/>

</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

<test name="Postgis Geometry Tests">
<classes>
<class name="org.postgis.DatatypesTest"/>
<class name="org.postgis.TokenizerTest"/>
<class name="net.postgis.jdbc.geometry.DatatypesTest"/>
<class name="net.postgis.jdbc.geometry.TokenizerTest"/>
</classes>
</test>

Expand Down
10 changes: 10 additions & 0 deletions postgis-jdbc-java2d/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@

<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>net.postgis.jdbc.java2d</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Loading

0 comments on commit 0cf56f4

Please sign in to comment.