Skip to content

Commit

Permalink
ElektraInitiative#3713 updated all refrences to libelektra5j to libel…
Browse files Browse the repository at this point in the history
…ektra
  • Loading branch information
Michael Tucek committed Mar 19, 2021
1 parent db576f7 commit 7f0c1b7
Show file tree
Hide file tree
Showing 17 changed files with 148 additions and 154 deletions.
2 changes: 1 addition & 1 deletion doc/CODING.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ scripts/dev/reformat-java

```sh
# The command below reformats the file `cmake/CMakeLists.txt`.
scripts/dev/reformat-java src/bindings/jna/libelektra5j/src/main/java/org/libelektra/KDB.java
scripts/dev/reformat-java src/bindings/jna/libelektra/src/main/java/org/libelektra/KDB.java
```

.
Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ INPUT = "@PROJECT_SOURCE_DIR@/src/libs" \
"@PROJECT_SOURCE_DIR@/src/libs/getenv/README.md" \
"@PROJECT_SOURCE_DIR@/src/include" \
"@PROJECT_SOURCE_DIR@/src/bindings/cpp/include" \
"@PROJECT_SOURCE_DIR@/src/bindings/jna/libelektra5j/src" \
"@PROJECT_SOURCE_DIR@/src/bindings/jna/libelektra/src" \
"@PROJECT_SOURCE_DIR@/src/bindings/io/doc" \
"@PROJECT_SOURCE_DIR@/src/plugins" \
"@PROJECT_SOURCE_DIR@/src/plugins/doc/doc.h" \
Expand Down
2 changes: 1 addition & 1 deletion doc/todo/RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If no release critical problems are found during testing, continue.

- CMakeLists.txt
- Increment version in output of doc/tutorials/hello-elektra.md
- Increment <Version> of libelektra5j in examples/external/java/read-keys-example/pom.xml and src/bindings/jna/README.md
- Increment <Version> of libelektra in examples/external/java/read-keys-example/pom.xml and src/bindings/jna/README.md
- Increment the Elektra version in scripts/docker/alpine/*/release.Dockerfile
- Change VERSION variable in build-server:
- Go to https://build.libelektra.org
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/java-kdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ mvn clean package
Afterwards run it with (change VERSION in the command below!):

```sh
java -cp target/read-keys-example-jar-with-dependencies.jar:lib/libelektra5j-VERSION.jar org.libelektra.app.App
java -cp target/read-keys-example-jar-with-dependencies.jar:lib/libelektra-VERSION.jar org.libelektra.app.App
```

## Java Plugin Tutorial
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/java-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Here we will look into, how can we write Java Plugins using - `JNA Binding`.

### Writing a Plugin

Under the the following [path](/src/bindings/jna/libelektra5j/src/main/java/org/libelektra) you can find the examples of already existing plugins and you can look into libelektra Java library, which is used for communication with the configuration database.
Under the the following [path](/src/bindings/jna/libelektra/src/main/java/org/libelektra) you can find the examples of already existing plugins and you can look into libelektra Java library, which is used for communication with the configuration database.

In order to write a new Java Plugin, the new class has to be created under the `plugin` folder. It has also to extend the `Plugin.java` interface, which contains all required methods to communicate with Elektra’s database. You can leave some of the methods unimplemented, if there is no need for them.

Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/language-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ getReason()

Please also keep the wording identical for consistency.
Take a look how the Java Binding implemented it in the
[KDBException](../../src/bindings/jna/libelektra5j/src/main/java/org/libelektra/exception/KDBException.java)
[KDBException](../../src/bindings/jna/libelektra/src/main/java/org/libelektra/exception/KDBException.java)
2 changes: 1 addition & 1 deletion examples/external/java/read-keys-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.libelektra</groupId>
<artifactId>libelektra5j</artifactId>
<artifactId>libelektra</artifactId>
<version>0.9.4</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion scripts/dev/run_env
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ else
export MANPATH="$SOURCE/doc/man:$MANPATH"
fi

export CLASSPATH="$CLASSPATH:$BUILD/lib/libelektra5j.jar"
export CLASSPATH="$CLASSPATH:$BUILD/lib/libelektra.jar"

export PS1="[DEV] $PS1"
6 changes: 3 additions & 3 deletions scripts/randoop/randoop.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# You can pass a custom location for the two files by calling this script like:
#
# ./randoop [path to randoop jar] [path to libelektra5j jar]
# ./randoop [path to randoop jar] [path to libelektra jar]
# e.g.
# ./randoop /Users/admin/Downloads/randoop-3.1.5/randoop-all-3.1.5.jar \
# /usr/local/share/java/libelektra5j-0.8.19.jar
Expand All @@ -31,9 +31,9 @@ RANDOOP="${1:-randoop-all-3.1.5.jar}"

stringContain() { [ -z "${2##*$1*}" ] && ([ -z "$1" ] || [ -n "$2" ]); }
if stringContain "Darwin" "$(uname)"; then
BINDINGS="${2:-/usr/local/share/java/libelektra5j-@KDB_VERSION@.jar}"
BINDINGS="${2:-/usr/local/share/java/libelektra-@KDB_VERSION@.jar}"
else
BINDINGS="${2:-/usr/share/java/libelektra5j-@KDB_VERSION@.jar}"
BINDINGS="${2:-/usr/share/java/libelektra-@KDB_VERSION@.jar}"
fi
CLASSPATH="${BINDINGS}:${RANDOOP}"

Expand Down
3 changes: 0 additions & 3 deletions src/bindings/jna/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# ignore maven output directory
libelektra5j/target

# ignore java class files
*.class

Expand Down
35 changes: 17 additions & 18 deletions src/bindings/jna/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (Java_JAVAC_EXECUTABLE)
if (MAVEN_EXECUTABLE) # set by find_program
add_binding (jna)

file (MAKE_DIRECTORY libelektra5j)
file (MAKE_DIRECTORY libelektra)

if (NOT APPLE)
set (USE_SYSTEM_CLASS_LOADER "<useSystemClassLoader>false</useSystemClassLoader>")
Expand All @@ -44,17 +44,17 @@ if (Java_JAVAC_EXECUTABLE)

# first fill the elektra version in the pom file @ONLY to avoid replacing pom.xml placeholders which also use the
# format ${}
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/libelektra5j/pom.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/pom.xml" @ONLY)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/libelektra/pom.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/libelektra/pom.xml" @ONLY)

# required to have a recognizable name for the pom upon installation in case other software installs a pom to the
# target directory and calls it pom.xml
file (
GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/libelektra5j-${KDB_VERSION}.pom.xml"
INPUT "${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/pom.xml")
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libelektra/libelektra-${KDB_VERSION}.pom.xml"
INPUT "${CMAKE_CURRENT_BINARY_DIR}/libelektra/pom.xml")

set (JNA_BINDING_PREFIX libelektra5j/src)
set (JNA_BINDING_PREFIX libelektra/src)
set (JNA_BINDING_NAMESPACE java/org/libelektra)

set (JNA_BINDING_SOURCE_DIRECTORY ${JNA_BINDING_PREFIX}/main/${JNA_BINDING_NAMESPACE})
Expand Down Expand Up @@ -105,22 +105,21 @@ if (Java_JAVAC_EXECUTABLE)
# Compile the source files and build the jar. We copy the source files into the build folder as that is the easiest
# way to handle the integration between CMake and Maven.
add_custom_command (
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/target/libelektra5j-${KDB_VERSION}.jar"
COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/libelektra5j"
"${CMAKE_CURRENT_BINARY_DIR}/libelektra5j"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libelektra/target/libelektra-${KDB_VERSION}.jar"
COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/libelektra"
"${CMAKE_CURRENT_BINARY_DIR}/libelektra"
COMMAND ${MAVEN_EXECUTABLE} -q -B -DskipTests=true package
WORKING_DIRECTORY libelektra5j
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/pom.xml" ${JNA_BINDING_SOURCE_FILES})
WORKING_DIRECTORY libelektra
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libelektra/pom.xml" ${JNA_BINDING_SOURCE_FILES})

create_lib_symlink (libelektra5j-${KDB_VERSION}.jar libelektra5j.jar java-elektra JAVA)
create_lib_symlink (libelektra5j-${KDB_VERSION}.pom.xml libelektra5j.pom.xml java-elektra JAVA)
create_lib_symlink (libelektra-${KDB_VERSION}.jar libelektra.jar java-elektra JAVA)
create_lib_symlink (libelektra-${KDB_VERSION}.pom.xml libelektra.pom.xml java-elektra JAVA)

add_custom_target (jna ALL
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/target/libelektra5j-${KDB_VERSION}.jar")
add_custom_target (jna ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libelektra/target/libelektra-${KDB_VERSION}.jar")

install (
FILES "${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/target/libelektra5j-${KDB_VERSION}.jar"
"${CMAKE_CURRENT_BINARY_DIR}/libelektra5j/libelektra5j-${KDB_VERSION}.pom.xml"
FILES "${CMAKE_CURRENT_BINARY_DIR}/libelektra/target/libelektra-${KDB_VERSION}.jar"
"${CMAKE_CURRENT_BINARY_DIR}/libelektra/libelektra-${KDB_VERSION}.pom.xml"
DESTINATION "share/java"
COMPONENT java-elektra)

Expand All @@ -139,7 +138,7 @@ if (Java_JAVAC_EXECUTABLE)
NAME testjna_maven
COMMAND
${MAVEN_EXECUTABLE} -q -B -e -P ${MAVEN_TEST_ENV} test
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libelektra5j")
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libelektra")

set_property (TEST testjna_maven PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib")

Expand Down
16 changes: 8 additions & 8 deletions src/bindings/jna/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Please note that the [jni plugin](/src/plugins/jni) serves a different purpose.
use the jni plugin to develop plugins for Elektra itself, whereas the jna
bindings allow to use Elektra to access configuration in Java projects. The jni
plugin is _not_ required for the jna bindings to work. But, to develop
jni plugins, jna can be used. [Here](libelektra5j/plugin) are example
jni plugins, jna can be used. [Here](libelektra/plugin) are example
plugins, which need jni at runtime.

### Command line
Expand All @@ -31,11 +31,11 @@ plugins, which need jni at runtime.

For using the binding as standalone (to write applications using Elektra),
make sure that CLASSPATH includes jna.jar and libelektra.jar (or this directory
which contains the libelektra5j subdirectory that corresponds to the
which contains the libelektra subdirectory that corresponds to the
libelektra.jar), e.g.:

```sh
export CLASSPATH=".:/usr/share/java/libelektra5j.jar:/usr/share/java/jna.jar"
export CLASSPATH=".:/usr/share/java/libelektra.jar:/usr/share/java/jna.jar"
```

Then you can compile and run [HelloElektra](HelloElektra.java):
Expand All @@ -61,16 +61,16 @@ local maven repository from that location, execute the following command

```sh
mvn org.apache.maven.plugins:maven-install-plugin:install-file \
-Dfile=/usr/share/java/libelektra5j.jar \
-DpomFile=/usr/share/java/libelektra5j.pom.xml
-Dfile=/usr/share/java/libelektra.jar \
-DpomFile=/usr/share/java/libelektra.pom.xml
```

Then you can simply add libelektra as dependency using:

```xml
<dependency>
<groupId>org.libelektra</groupId>
<artifactId>libelektra5j</artifactId>
<artifactId>libelektra</artifactId>
<version>0.9.4</version>
</dependency>
```
Expand Down Expand Up @@ -136,7 +136,7 @@ which can be used to save and load `.properties` files into Elektra.

### Command Line

You can run unit tests after importing jUnit, JNA and the libelektra5j java
You can run unit tests after importing jUnit, JNA and the libelektra java
library into a project (eclipse, netbeans, intelliJ, ...).

Tested library versions are:
Expand All @@ -158,7 +158,7 @@ It should also be possible to run the tests by command line:

1. Compile the library and tests (run in root directory; make sure junit4 and
jna are installed and/or path is correct). Execute the following commands inside
the libelektra5j folder:
the libelektra folder:

```sh
mkdir ./target (if it does not exist yet)
Expand Down
Loading

0 comments on commit 7f0c1b7

Please sign in to comment.