OpenGeoDB database installation
You are to create the following directories structure:




The OpenGeoDb will be installed with the class org.v838.j4geo.data.install.Main. The batch file install.cmd is a example:
@echo off
SET JAVA_HOME=C:\Progra~1\java\jdk1.7.0_11
SET JAVA=%JAVA_HOME%\bin\java.exe
SET J4GEO_VERSION=1.0.0
SET J4GEO_HOME=.
SET DATA_HOME=%J4GEO_HOME%\data
SET LIB_HOME=%J4GEO_HOME%\lib
REM ############################################################################
REM # Classpath
REM ############################################################################
SET CLASS_PATH=%CLASS_PATH%;%DATA_HOME%
SET CLASS_PATH=%CLASS_PATH%;%J4GEO_HOME%\j4geo-%J4GEO_VERSION%.jar
FOR /R %LIB_HOME% %%i IN (*.jar) DO ( CALL :setClassPath %%i)
REM ############################################################################
REM # Main class arguments
REM ############################################################################
SET ARGS=%ARGS% file:///c:/j4geo/install.xml
%JAVA% -Xms512m -Xmx1280m -classpath %CLASS_PATH% org.v838.j4geo.data.install.Main %ARGS%
GOTO :eof
:setClassPath
SET CLASS_PATH=%CLASS_PATH%;%*
:eof
The file install.xml has the OpenGeoDb import files configuration:
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE install \[
<!ELEMENT install (persistenceUnitName, data*)>
<!ELEMENT data (url)>
<!ELEMENT persistenceUnitName (#PCDATA)>
<!ELEMENT url (#PCDATA)>
<!ATTLIST data country (AT|BE|CH|DE|LI|LU) #REQUIRED>
\]>
<install>
<persistenceUnitName><![CDATA[j4geoDevDB]]></persistenceUnitName>
<data country="AT">
<url><![CDATA[http://www.fa-technik.adfc.de/code/opengeodb/AT.tab]]></url>
</data>
<data country="BE">
<url><![CDATA[http://www.fa-technik.adfc.de/code/opengeodb/BE.tab]]></url>
</data>
<data country="CH">
<url><![CDATA[http://www.fa-technik.adfc.de/code/opengeodb/CH.tab]]></url>
</data>
<data country="DE">
<url><![CDATA[file:///c:/j4geo/DE.tab]]></url>
</data>
<data country="LI">
<url><![CDATA[http://www.fa-technik.adfc.de/code/opengeodb/LI.tab]]></url>
</data>
<data country="LU">
<url><![CDATA[http://www.fa-technik.adfc.de/code/opengeodb/LU.tab]]></url>
</data>
</install>
</pre>
The file persistence.xml has your database configuration:
<pre>
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="opengeodb" transaction-type="RESOURCE_LOCAL">
<description>
<![CDATA[The opengeodb.]]>
</description>
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.v838.j4geo.data.sql.entity.OpenGeoDB</class>
<class>org.v838.j4geo.data.sql.entity.Zip</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:postgresql://localhost:5432/opengeodb" />
<property name="javax.persistence.jdbc.user" value="test" />
<property name="javax.persistence.jdbc.password" value="test" />
<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
<property name="eclipselink.logging.level" value="INFO" />
</properties>
</persistence-unit>
</persistence>
</pre>
Before the OpenGeoDb will be installed, you must create the database e.g. "opengeodb" with a schema "opengeo".