Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • clients/cesium-grp/cesium-plus-pod
  • clients/java/duniter4j
  • ji_emme/duniter4j
  • dvermd/cesium-plus-pod
  • okayotanoka/cesium-plus-pod
  • pokapow/cesium-plus-pod
  • pini-gh/cesium-plus-pod
7 results
Show changes
Commits on Source (318)
Showing
with 322 additions and 403 deletions
This project is now tracked on our hosted gitlab server at:
> https://git.duniter.org/clients/java/duniter4j
The current github repository is a simple clone taken up to date at each push on the main gitlab repository.
All contributions should be performed on the main gitlab repository.
Pull requests proposed on github would generate more work for the main contributors.
Issues can be submitted on github. However, all issues created on github will be duplicated on gitlab manually and closed with a link to the gitlab issue.
Please note that all issues should be preferentially opened at
https://git.duniter.org/clients/java/duniter4j/issues/new?issue
If you open issue here, it will be duplicated manually on our hosted gitlab and closed here with a link to our main repository.
Thank you for your understanding.
This project is now tracked on our hosted gitlab server at:
> https://git.duniter.org/clients/java/duniter4j
The current github repository is a simple clone taken up to date at each push on the main gitlab repository.
All contributions should be performed on the main gitlab repository.
Pull requests proposed on github would generate more work for the main contributors, therefore we would really appreciate if you can create instead merge requests on our hosted gitlab instance.
Thank you for your understanding.
# Initial disclaimer
This project is now tracked on our hosted gitlab server at:
https://git.duniter.org/clients/java/duniter4j
The current github repository is a simple clone taken up to date at each push on the main gitlab repository.
All contributions should be performed on the main gitlab repository.
Pull requests proposed on github would generate more work for the main contributors.
Issues can be submitted on github. However, all issues created on github will be duplicated on gitlab manually and closed with a link to the gitlab issue.
# Original README.md
......@@ -7,7 +7,8 @@
.classpath
.settings
.idea
.local
target
*/target
duniter4j.iml
LICENSE.txt
\ No newline at end of file
duniter4j-client/.maven/install.log
\ No newline at end of file
stages:
- github-sync
push_to_github:
stage: github-sync
variables:
GIT_STRATEGY: none
tags:
- github
script:
- rm -rf ./*
- rm -rf .git
- git clone --mirror $CI_REPOSITORY_URL .
- git remote add github $GITHUB_URL_AND_KEY
- git config --global user.email "contact@duniter.org"
- git config --global user.name "Duniter"
# Job would fail if we don't remove refs about pull requests
- bash -c "cat packed-refs | grep -v 'refs/pull' > packed-refs-new; echo 'Removed pull refs.'"
- mv packed-refs-new packed-refs
- bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"
.enforce_readme:
stage: github-sync
variables:
GIT_STRATEGY: none
tags:
- github
script:
- rm -rf ./*
- rm -rf .git
- git clone $GITHUB_URL_AND_KEY .
- git config --global user.email "contact@duniter.org"
- git config --global user.name "Duniter"
- git checkout master
- cat .github/github_disclaimer.md > README.md.new
- cat README.md >> README.md.new
- mv README.md.new README.md
- git commit -am "Enforce github readme"
- git push origin master
[submodule "duniter4j-cesium/src/main/cesium"]
path = duniter4j-cesium/src/main/cesium
url = git://github.com/duniter/cesium.git
[submodule "duniter4j-elasticsearch/src/main/resources/cities"]
path = duniter4j-elasticsearch/src/main/resources/cities
url = git://github.com/David-Haim/CountriesToCitiesJSON.git
#!/bin/bash
set JAVA_HOME=/usr/lib/jvm/java-8-oracle
CESIUM_PLUS_POD_DIR="${HOME}/git/duniter/cesium-plus-pod"
DEPLOY_DIR="${CESIUM_PLUS_POD_DIR}/cesium-plus-pod-assembly/target/es-run-home/plugins/cesium-plus-pod-core"
# Go to project root
cd ..
ROOT=`pwd`
echo "***************************************"
echo " Compiling core-* ... "
# Remove old JAR
rm duniter4j-core-client/target/*.jar
rm duniter4j-core-shared/target/*.jar
# Compile the core-client
mvn install --quiet -DskipTests
if [[ $? -ne 0 ]]; then
exit 1
fi
echo " Successfully compiled ! "
echo "***************************************"
echo " Installing into Cesium+ pod (target assembly)... "
# Copy jar
mkdir -p ${DEPLOY_DIR}
if [[ $? -ne 0 ]]; then
exit 1
fi
rm -f "${DEPLOY_DIR}/duniter4j-core-client-*.jar"
rm -f "${DEPLOY_DIR}/duniter4j-core-shared-*.jar"
if [[ $? -ne 0 ]]; then
exit 1
fi
cd ${ROOT}/duniter4j-core-client/target/
JAR_FILE=`ls *.jar`
cp -v ${JAR_FILE} ${DEPLOY_DIR}/
if [[ $? -ne 0 ]]; then
exit 1
fi
cd ${ROOT}/duniter4j-core-shared/target/
JAR_FILE=`ls *.jar`
cp -v ${JAR_FILE} ${DEPLOY_DIR}/
if [[ $? -ne 0 ]]; then
exit 1
fi
echo " Successfully deployed !"
echo "************************"
#!/bin/bash
set JAVA_HOME=/usr/lib/jvm/java-8-oracle
CESIUM_PLUS_POD_DIR="${HOME}/git/duniter/cesium-plus-pod"
DEPLOY_DIR="${CESIUM_PLUS_POD_DIR}/cesium-plus-pod-assembly/target/es-run-home/plugins/cesium-plus-pod-core"
# Go to project root
cd ..
echo "***************************************"
echo " Compiling core-client... "
# Remove old JAR
rm duniter4j-core-client/target/*.jar
# Compile the core-client
mvn install -pl duniter4j-core-client --quiet -DskipTests
if [[ $? -ne 0 ]]; then
exit 1
fi
echo " Successfully compiled ! "
echo "***************************************"
echo " Installing into Cesium+ pod (target assembly)... "
# Copy jar
mkdir -p ${DEPLOY_DIR}
if [[ $? -ne 0 ]]; then
exit 1
fi
rm -f "${DEPLOY_DIR}/duniter4j-core-client-*.jar"
if [[ $? -ne 0 ]]; then
exit 1
fi
cd duniter4j-core-client/target/
JAR_FILE=`ls *.jar`
cp -v ${JAR_FILE} ${DEPLOY_DIR}/
if [[ $? -ne 0 ]]; then
exit 1
fi
echo " Successfully deployed !"
echo "************************"
[changelog version by version](src/changes/)
\ No newline at end of file
# Image for Cesium releases on Linux.
#
#
# Building this image:
# docker build . --network=host -t duniter/duniter4j-es
#
# Test:
# docker run --net=host -t duniter/duniter4j-es
# Test (interactive mode + bash mode):
# docker run -i --net=host -t duniter/duniter4j-es bash
#
# Pull base image.
FROM airdock/oracle-jdk:1.8
ARG DUNITER4J_VERSION=1.0.2
ARG LIBSODIUM_VERSION=1.0.13
# Installing dependencies
RUN apt-get update && \
apt-get --force-yes --yes install wget unzip build-essential
# Installing libsodium
RUN wget https://download.libsodium.org/libsodium/releases/libsodium-${LIBSODIUM_VERSION}.tar.gz && \
tar -xzf libsodium-*.tar.gz && rm *.tar.gz && mv libsodium-* libsodium && \
cd libsodium && \
./configure && \
make && make check && \
make install
# Create compiling user
RUN mkdir /duniter4j && \
adduser --system --group --quiet --shell /bin/bash --home /duniter4j duniter4j && \
chown duniter4j:duniter4j /duniter4j
WORKDIR /duniter4j
#RUN cd /duniter4j && \
# wget https://git.duniter.org/clients/cesium-grp/cesium/repository/v${CESIUM_VERSION}/archive.tar.gz
# tar -xzf archive.tar.gz && rm *.tar.gz && mv cesium-* src && \
RUN cd /duniter4j && \
wget https://github.com/duniter/duniter4j/releases/download/duniter4j-${DUNITER4J_VERSION}/duniter4j-client-${DUNITER4J_VERSION}-standalone.zip && \
unzip *.zip && rm *.zip && mv duniter4j-client-* duniter4j-client && \
mkdir duniter4j-es/data && \
chown -R duniter4j:duniter4j duniter4j-client
RUN ln -s /duniter4j/duniter4j-client/bin/elasticsearch /usr/bin/duniter4j-client
VOLUME /duniter4j/duniter4j-client
EXPOSE 9200 9400
USER duniter4j
WORKDIR /duniter4j
ENTRYPOINT ["/usr/bin/duniter4j-client"]
CMD []
......@@ -552,7 +552,7 @@ License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to reference or combine any covered work with a work licensed
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
......
duniter4j
======
Duniter4j
=========
duniter4j is a Java Client API for [Duniter](http://duniter.org).
Duniter4j is a Java Toolkit for [Duniter](http://duniter.org).
## Components
<img src="./src/site/resources/images/logos/logo_duniter.png"/>
Duniter4j has tree main components :
> See the [documentation web site](http://doc.e-is.pro/duniter4j/)
- a command line tool (duniter4j-client), to execute basic operation on a Duniter currency : transfer, view peers, ...
- an API (duniter4j-core-client), that allow developer to access to a Duniter network.
## Manual
- a ElastiSearch node (duniter4j-elasticsearch), to add store & full-text capabilities, on blockchain data, user profiles (Cesium+) and more (private message).
## Command line tool
- Download the file `duniter4j-client-<version>-full-<platform>.zip` from the [lastest releases page](/releases)
- Unzip the archive
- The open a terminal and call duniter4j.sh
## ElastiSearch node
### Prerequisites
#### Install Java
- Install Java JRE 8 or more.
- Windows: see [Oracle web site](http://oracle.com/java/index.html)
- Linux (Ubuntu):
- Install Java JRE (1.8 or higher)
- Download the file `duniter4j-client-vX.Y.Z.zip` from the [latest releases page](https://www.github.com/duniter/duniter4j/releases)
- Unzip the archive;
- The open a terminal and execute the script `duniter4j.sh` (or `duniter4j.bat`) :
```bash
sudo apt-get install openjdk-8-jre
```
- Install [libsodium](https://download.libsodium.org/doc/index.html) v1.0.11 (Linux only)
- Linux: See [installation](https://download.libsodium.org/doc/installation/index.html). After installation, make sure the file 'libsodium.so'
exists on: /usr/local/lib or /opt/local/lib. If not, create a symbolic link.
No installation need for Windows (include in binaries)
#### Install libsodium
[The Sodium crypto library (libsodium)](https://download.libsodium.org/doc/installation/) is a modern, easy-to-use software library for encryption, decryption, signatures, password hashing and more.
- Get libsodium
```
wget -kL https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gz
tar -xvf libsodium-1.0.11.tar.gz
cd duniter4j-client-vX.Y.Z
./duniter4j.sh --help
```
- Installation:
```
cd libsodium-1.0.11
sudo apt-get install build-essential
sudo ./configure
sudo make && make check
sudo make install
```
### Install bundle
## Architecture
- Install Java (see on top)
- Install Libsodium (see on top)
- Download [lastest release](https://github.com/duniter/duniter4j/releases) of file duniter4j-elasticsearch-X.Y-standalone.zip
Duniter4j has tree main modules :
- Unzip
```bash
unzip duniter4j-elasticsearch-X.Y-standalone.zip
cd duniter4j-elasticsearch-X.Y/config
```
- Edit the configuration file `config/elasticsearch.yml`, in particular this properties:
```bash
# cluster.name: my-application
cluster.name: duniter4j-elasticsearch
# Use a descriptive name for the node:
node.name: ES-NODE-1
# Set the bind address to a specific IP (IPv4 or IPv6):
network.host: 192.168.0.28
# Set a custom port for HTTP:
http.port: 9203
# Duniter node to connect with
duniter.host: gtest.duniter.org
duniter.port: 10900
# Should synchronize node blockchain ?
duniter.blockchain.sync.enable: true
```
- Launch the node
```bash
cd duniter4j-elasticsearch-X.Y/bin
./elasticsearch
```
Output example (on [GTest](https://fr.duniter.org/monnaie-gtest/) currency):
```bash
$ ./elasticsearch
[2016-09-24 00:16:45,803][INFO ][node ] [ES-NODE-1] version[2.3.3], pid[15365], build[218bdf1/2016-05-17T15:40:04Z]
[2016-09-24 00:16:45,804][INFO ][node ] [ES-NODE-1] initializing ...
[2016-09-24 00:16:46,257][INFO ][plugins ] [ES-NODE-1] modules [reindex, lang-expression, lang-groovy], plugins [mapper-attachments, duniter4j-elasticsearch], sites [duniter4j-elasticsearch]
[2016-09-24 00:16:46,270][INFO ][env ] [ES-NODE-1] using [1] data paths, mounts [[/home (/dev/mapper/isw_defjaaicfj_Volume1p1)]], net usable_space [1tb], net total_space [1.7tb], spins? [possibly], types [ext4]
[2016-09-24 00:16:46,270][INFO ][env ] [ES-NODE-1] heap size [989.8mb], compressed ordinary object pointers [true]
[2016-09-24 00:16:47,757][INFO ][node ] [ES-NODE-1] initialized
[2016-09-24 00:16:47,757][INFO ][node ] [ES-NODE-1] starting ...
[2016-09-24 00:16:47,920][INFO ][transport ] [ES-NODE-1] publish_address {192.168.0.5:9300}, bound_addresses {192.168.0.5:9300}
[2016-09-24 00:16:47,924][INFO ][discovery ] [ES-NODE-1] duniter4j-elasticsearch/jdzzh_jUTbuN26Enl-9whQ
[2016-09-24 00:16:50,982][INFO ][cluster.service ] [ES-NODE-1] detected_master {EIS-DEV}{FD0IzkxETM6tyOqzrKuVYw}{192.168.0.28}{192.168.0.28:9300}, added {{EIS-DEV}{FD0IzkxETM6tyOqzrKuVYw}{192.168.0.28}{192.168.0.28:9300},}, reason: zen-disco-receive(from master [{EIS-DEV}{FD0IzkxETM6tyOqzrKuVYw}{192.168.0.28}{192.168.0.28:9300}])
[2016-09-24 00:16:53,570][INFO ][http ] [ES-NODE-1] publish_address {192.168.0.5:9203}, bound_addresses {192.168.0.5:9203}
[2016-09-24 00:16:53,570][INFO ][node ] [ES-NODE-1] started
[2016-09-24 00:16:57,850][INFO ][node ] Checking Duniter indices...
[2016-09-24 00:16:57,859][INFO ][node ] Checking Duniter indices... [OK]
[2016-09-24 00:17:08,026][INFO ][duniter.blockchain ] [gtest] [gtest.duniter.org:10900] Indexing last blocks...
[2016-09-24 00:17:08,026][INFO ][duniter.blockchain ] [gtest] [gtest.duniter.org:10900] Indexing block #999 / 41282 (2%)...
[2016-09-24 00:17:08,045][INFO ][duniter.blockchain ] [gtest] [gtest.duniter.org:10900] Indexing block #1998 / 41282 (4%)...
[2016-09-24 00:17:09,026][INFO ][duniter.blockchain ] [gtest] [gtest.duniter.org:10900] Indexing block #2997 / 41282 (6%)...
[2016-09-24 00:17:10,057][INFO ][duniter.blockchain ] [gtest] [gtest.duniter.org:10900] Indexing block #3996 / 41282 (8%)...
...
[2016-09-24 00:17:11,026][INFO ][duniter.blockchain ] [gtest] [gtest.duniter.org:10900] Indexing block #41282 - hash [00000AAD73B0E76B870E6779CD7ACCCE175802D7867C13B5C8ED077F380548C5]
```
- `duniter4j-core-shared`: A set of useful classes, used by other modules.
- `duniter4j-core-client`: [a Java API](./src/site/markdown/Java_API.md) to help Java developers to communicate with a Duniter network.
- `duniter4j-client`: [a command line tool](./src/site/markdown/CLI.md), to execute basic operation on a Duniter currency: transfer, view peers, ...
### Install on an existing ElasticSearch node
Make sure you have a ElasticSearch v1.4.5 installed.
Then install Duniter4j plugins :
## Build from sources
- Install Apache Maven (3.1.1+)
- Run the build command:
```bash
/bin/plugin install mapper-attachments
/bin/plugin install https://github.com/duniter/duniter4j/releases/download/0.3.4/duniter4j-elasticsearch-0.3.4.zip
mvn install
```
## Use API (Developer)
## Use as Maven dependency
When a blockchain currency has been indexed, you can test some fun queries :
```xml
- get a block by number (e.g the block #0):
http://localhost:9200/gtest/block/0 -> with some additional metadata given by ES
http://localhost:9200/gtest/block/0/_source -> the original JSON block
- Block #125 with only hash, dividend and memberCount:
http://localhost:9200/gtest/block/125/_source?_source=number,hash,dividend,membersCount
- All blocks using a pubkey (or whatever):
http://localhost:9200/gtest/block/_search?q=9sbUKBMvJVxtEVhC4N9zV1GFTdaempezehAmtwA8zjKQ1
- All blocks with a dividend, with only some selected fields (like dividend, number, hahs).
Note : Query executed in command line, using CURL:
<dependencies>
<!-- Duniter4j dependency -->
<dependency>
<groupId>org.duniter</groupId>
<artifactId>duniter4j-core-client</artifactId>
<version>x.y.z</version> <!-- -->
</dependency>
</dependencies>
```bash
curl -XGET 'http://localhost:9200/gtest/block/_search' -d '{
"query": {
"filtered" : {
"filter": {
"exists" : { "field" : "dividend" }
}
}
},
"_source": ["number", "dividend", "hash", "membersCount"]
}'
<!-- Duniter4j repository -->
<repositories>
<repository>
<id>duniter4j-public-group</id>
<url>https://nexus.e-is.pro/nexus/content/groups/duniter4j</url>
</repository>
</repositories>
```
More documentation here :
- ElasticSearch [official web site](http://www.elastic.co/guide/en/elasticsearch/reference/1.3/docs-get.html#get-source-filtering)
- a good [tutorial](http://okfnlabs.org/blog/2013/07/01/elasticsearch-query-tutorial.html)
## Compile from source
Install required dependencies:
- Install Java JDK (8 or more)
- Install [libsodium](http://doc.libsodium.org/installation/index.html)
- Linux: after [installation](http://doc.libsodium.org/installation/index.html), make sure the file 'libsodium.so' exists on: /usr/local/lib or /opt/local/lib.
If not, create a symbolic link.
- Windows: copy the file 'sodium.dll' into directory 'duniter4j-core/lib/'
- Install [Maven 3](http://maven.apache.org/).
```
sudo apt-get install maven
```
- Get the source code, then compile using Maven:
```
git clone https://github.com/duniter/duniter4j.git
cd duniter4j
git submodule init
git submodule sync
git submodule update
mvn install -DskipTests
```
To package binaries :
## Create a new release
```bash
$ mvn install -DskipTests -DperformRelease
```
## Roadmap
- Maintain a updated list of peers
- Add a new index for TX, with validation percentage
- Enable P2P synchronisation between Duniter4j ES nodes
## Troubleshooting
### Could not find an implementation class.
Message:
```
java.lang.RuntimeException: java.lang.RuntimeException: Could not find an implementation class.
at org.duniter.core.util.websocket.WebsocketClientEndpoint.<init>(WebsocketClientEndpoint.java:56)
at org.duniter.core.client.service.bma.BlockchainRemoteServiceImpl.addNewBlockListener(BlockchainRemoteServiceImpl.java:545)
at org.duniter.elasticsearch.service.BlockchainService.listenAndIndexNewBlock(BlockchainService.java:106)
```
Cause:
Plugin use Websocket to get notification from a Duniter nodes. The current library ([Tyrus](https://tyrus.java.net/)) is loaded throw java Service Loader, that need access to file `META-INF/services/javax.websocket.ContainerProvider` contains by Tyrus.
ElasticSearch use separated classloader, for each plugin, that disable access to META-INF resource.
Solution :
Move Tyrus libraries into elasticsearch `lib/` directory :
```
cd <ES_HOME>
mv plugins/duniter4j-elasticsearch/tyrus-*.jar lib
mv plugins/duniter4j-elasticsearch/javax.websocket-api-*.jar lib
./release.sh
```
\ No newline at end of file
# HTTP API
## Contents
* [Contents](#contents)
* [Overview](#overview)
* [ES CORE API](#es-core-api)
* [currency](#currency)
* [currency/block](#currencyblock)
* [ES USER API](#userapi)
* [user](#user)
* [user/profile](#userprofile)
* [user/settings](#usersettings)
* [message](#message)
* [message/inbox](#messageinbox)
* [message/oubox](#messageoutbox)
* [invitation](#invitation)
* [invitation/certification](#invitationcertification)
* [ES GCHANGE API](#gchangeapi)
* [market](#market)
* [market/category](#marketcategory)
* [market/record](#marketrecord)
* [market/comment](#marletcomment)
* [registry](#registry)
* [registrymarket/category](#registrycategory)
* [registry/record](#registryrecord)
* [registry/comment](#registrycomment)
## Overview
Duniter4j Elasticsearch offer HTTP access to 3 main API :
- `ES CORE API` (ECA): BlockChain indexation;
- `ES USER API` (EUA): User data indexation, such as: profiles, private messages, settings (crypted);
- `ES GCHANGE API` (EGA): Exchange data (market place: offer, ad...), professionals registry.
Data is made accessible through an HTTP API :
http[s]://node[:port]/...
|-- <currency_name>/
| `-- lookup
|-- user/
| |-- profile
| `-- settings
|-- message/
| |-- inbox
| `-- outbox
|-- invitation/
| `-- certification
|-- market/
| |-- category
| |-- record
| `-- comment
`-- registry/
|-- category
|-- record
`-- comment
### Document format
All stored documents use a JSON format.
#### Data document
Every document have the following mandatory fields:
- `issuer` : The document's emitter
- `hash`:
- `signature`: the signature emitted by the issuer.
#### Deletion
Document deletion use a document with this mandatory fields:
- `index` : The document's index
- `type` : The document's type
- `issuer`: The deletion issuer. Should correspond to the document's `issuer`, or the `recipient` in some special case ([inbox message](#messageinbox) or [invitation](#invitation))
- `time`: the current time
- `hash`
- `signature`.
For example, a deletion on `message/inbox` should send this document:
```json
```
## ES CORE API
### `<currency>/*`
#### `<currency>/block`
- Get the current block: `<currency>/block/current`
- Get a block by number: `<currency>/block/<number>`
- Search on blocks: `<currency>/block/_search` (POST or GET)
## ES USER API
### `user/*`
#### `user/profile`
#### `user/settings`
### `message/*`
#### `message/inbox`
#### `message/outbox`
### `invitation/*`
#### `invitation/certification`
- Get an invitation, by id: `invitation/certification/<id>`
- Add a new invitation: `invitation/certification` (POST)
- Delete an existing invitation: `invitation/certification/_delete` (POST)
- Search on invitations: `invitation/certification/_search` (POST or GET)
## ES GCHANGE API
### `market/*`
#### `market/category`
#### `market/record`
#### `market/comment`
### `registry/*`
#### `registry/category`
#### `registry/record`
#### `registry/comment`
\ No newline at end of file
......@@ -552,7 +552,7 @@ License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to reference or combine any covered work with a work licensed
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>duniter4j</artifactId>
<groupId>org.duniter</groupId>
<version>0.10.6</version>
<version>1.6.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>duniter4j-client</artifactId>
<name>Duniter4j :: Client</name>
<description>A command line tools, to communicate with a Duniter network</description>
<properties>
<jTextUtilsVersion>0.3.3</jTextUtilsVersion>
......@@ -47,6 +48,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
......@@ -61,12 +66,10 @@
<dependency>
<groupId>dnl.utils</groupId>
<artifactId>j-text-utils</artifactId>
<version>${jTextUtilsVersion}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- for CSV network output -->
......@@ -344,7 +347,7 @@
<id>linux-x64-bundle</id>
<activation>
<property>
<name>performFullRelease64</name>
<name>performFullRelease</name>
<value>true</value>
</property>
</activation>
......
......@@ -14,13 +14,14 @@
# - Lesser General Public License (LGPL) v 3.0
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - Lesser General Public License (LPGL) version 3.0
# - MIT License
# - The Apache Software License, Version 2.0
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
#Tue Mar 28 09:33:08 CEST 2017
#Wed Jun 20 16:56:38 CEST 2018
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dnl.utils--j-text-utils--0.3.3=GNU General Lesser Public License (LGPL) version 3.0
net.sf.opencsv--opencsv--2.3=GNU General Lesser Public License (LGPL) version 3.0
# Duniter4j Configuration
# --------------------------------------
# Duniter4j Client Configuration file
# --------------------------------------
#
# Duniter node
#
duniter4j.node.host=g1.duniter.org
duniter4j.node.port=10901
#
# Cesium+ node (aka Duniter4j-Elasticsearch)
#
duniter4j.node.elasticsearch.host=g1.data.duniter.fr
duniter4j.node.elasticsearch.port=443
#!/bin/bash
READLINK=`which readlink`
if [ -z "$READLINK" ]; then
if [[ -z "$READLINK" ]]; then
message "Required tool 'readlink' is missing. Please install before launch \"$0\" file."
exit 1
fi
......@@ -10,8 +10,8 @@ fi
# Ensure BASEDIR points to the directory where the soft is installed.
# ------------------------------------------------------------------
SCRIPT_LOCATION=$0
if [ -x "$READLINK" ]; then
while [ -L "$SCRIPT_LOCATION" ]; do
if [[ -x "$READLINK" ]]; then
while [[ -L "$SCRIPT_LOCATION" ]]; do
SCRIPT_LOCATION=`"$READLINK" -e "$SCRIPT_LOCATION"`
done
fi
......@@ -22,11 +22,11 @@ export JAR="$JARDIR/${project.build.finalName}.${project.packaging}"
export I18N_DIR="$APPDIR/i18n"
# Retrieve the JAVA installation
if [ "$JAVA_HOME~" == "~" ]; then
if [[ "$JAVA_HOME~" == "~" ]]; then
export JAVA_HOME="$APPDIR/jre"
export JAVA_COMMAND="$JAVA_HOME/bin/java"
if [ -f "$JAVA_HOME/bin/java" ]; then
if [[ -f "$JAVA_HOME/bin/java" ]]; then
# If embedded JRE exists, make sure java is executable
chmod +x "$JAVA_COMMAND"
else
......@@ -37,7 +37,7 @@ else
export JAVA_COMMAND="$JAVA_HOME/bin/java"
fi
if [ -d "$HOME" ]; then
if [[ -d "$HOME" ]]; then
export BASEDIR="$HOME/.config/duniter4j"
export CONFIG_DIR="$BASEDIR/config"
export CONFIG_FILE="$CONFIG_DIR/duniter4j-client.config"
......@@ -48,14 +48,21 @@ else
export CONFIG_FILE="$CONFIG_DIR/config/duniter4j-client.config"
export LOG_FILE="$APPDIR/logs/${project.build.finalName}.log"
echo "Using base"
echo "Using basedir: $APPDIR"
fi
if [[ "$JAVA_OPTS~" == "~" ]]; then
# Configuring apache simplelog to use Log4j
JAVA_OPTS="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger"
exprt ${JAVA_OPTS}
fi
# Create the config dir if need
mkdir -p "$CONFIG_DIR"
# Create the config file (if need)
if [ ! -f "$CONFIG_FILE" ]; then
if [[ ! -f "$CONFIG_FILE" ]]; then
echo "INFO - Initialized configuration file: $CONFIG_FILE"
cp -u $JARDIR/duniter4j-client.config $CONFIG_FILE
fi
......@@ -68,12 +75,12 @@ while true; do
$JAVA_COMMAND $JAVA_OPTS -Dduniter4j.log.file=$LOG_FILE -Dduniter4j.i18n.directory=$I18N_DIR -jar $JAR --basedir $BASEDIR --config $CONFIG_FILE $*
exitcode=$?
if [ ! "$exitcode" -eq "130" ]; then
if [[ ! "$exitcode" -eq "130" ]]; then
echo "INFO - Application stopped with exitcode: $exitcode"
fi
## Continue only if exitcode=88 (will restart the application)
if [ ! "$exitcode" -eq "88" ]; then
if [[ ! "$exitcode" -eq "88" ]]; then
# quit now!
exit $exitcode
fi
......