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 (443)
Showing
with 1092 additions and 218 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,10 +7,8 @@
.classpath
.settings
.idea
duniter4j-cesium/src/cesium/**/*.*
.local
target
*/target
duniter4j-elasticsearch/src/main/misc/.index.sh.kate-swp
duniter4j-elasticsearch/src/main/misc/fr-cities.ods
duniter4j-elasticsearch/src/main/misc/geoflar-communes-2015.geojson
duniter4j.iml
\ No newline at end of file
duniter4j.iml
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 []
File moved
duniter4j
======
Duniter4j
=========
duniter4j is a Java Client API for [Duniter](http://duniter.org).
Duniter4j is a Java Toolkit for [Duniter](http://duniter.org).
## Architecture
duniter4j has four main components :
<img src="./src/site/resources/images/logos/logo_duniter.png"/>
- shared: common classes
- core-client: a Client API to access to a Duniter network.
- elasticsearch: a ES plugin, to store blockchain, registry, market and more.
> See the [documentation web site](http://doc.e-is.pro/duniter4j/)
## Install as ES plugin
## Manual
### 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
cd duniter4j-client-vX.Y.Z
./duniter4j.sh --help
```
- Install [libsodium](https://download.libsodium.org/doc/index.html) (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 ElasticSearch 2.3.3
## Architecture
Download lastest release of ElasticSearch
Duniter4j has tree main modules :
### Install ElasticSearch plugins
/bin/plugin install mapper-attachments
/bin/plugin install https://github.com/duniter/duniter4j/releases/download/0.2.0/duniter4j-elasticsearch-0.2.0.zip
- `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 from standalone bundle
## Build from sources
- Installa Java (see on top)
- Download lastest release of file duniter4j-elasticsearch-X.Y-standalone.zip
- Unzip, then start a elasticsearch node, just do :
- Install Apache Maven (3.1.1+)
- Run the build command:
```bash
unzip duniter4j-elasticsearch-X.Y-standalone.zip
cd duniter4j-elasticsearch-X.Y
./duniter4j-elasticsearch.sh start index -h <node_host> -p <node_port>
mvn install
```
Example on test_net test currency :
```bash
$ ./duniter4j-elasticsearch.sh start index -h cgeek.fr -p 9330
2016-01-07 23:34:34,771 INFO Starting duniter4j :: ElasticSearch Indexer with arguments [start, index, -h, metab.ucoin.io, -p, 9201]
2016-01-07 23:34:34,856 INFO Application basedir: /home/user/.duniter4j-elasticsearch
2016-01-07 23:34:34,861 INFO Starts i18n with locale [fr] at [/home/user/.duniter4j-elasticsearch/data/i18n]
2016-01-07 23:34:35,683 INFO Starts ElasticSearch node with cluster name [duniter4j-elasticsearch] at [/home/user/.duniter4j-elasticsearch/data].
*** duniter4j :: Elasticsearch successfully started *** >> To quit, press [Q] or enter
2016-01-07 23:34:45,015 INFO Indexing last blocks of [test_net] from peer [cgeek.fr:9330]
2016-01-07 23:35:01,597 INFO Indexing block #999 / 47144 (2%)...
2016-01-07 23:35:15,554 INFO Indexing block #1998 / 47144 (4%)...
2016-01-07 23:35:30,713 INFO Indexing block #2997 / 47144 (6%)...
2016-01-07 23:35:45,747 INFO Indexing block #3996 / 47144 (8%)...
...
2016-01-07 23:45:00,175 INFO All blocks indexed
## Use as Maven dependency
```xml
<dependencies>
<!-- Duniter4j dependency -->
<dependency>
<groupId>org.duniter</groupId>
<artifactId>duniter4j-core-client</artifactId>
<version>x.y.z</version> <!-- -->
</dependency>
</dependencies>
<!-- Duniter4j repository -->
<repositories>
<repository>
<id>duniter4j-public-group</id>
<url>https://nexus.e-is.pro/nexus/content/groups/duniter4j</url>
</repository>
</repositories>
```
Show help :
```bash
$ ./duniter4j-elasticsearch.sh --help
Usage: duniter4j-elaticsearch.<sh|bat> <commands> [options]
Commands:
start Start elastic search node
index Index blocks from BMA Node
reset-data Reset indexed data for the uCoin node's currency
Options:
--help Output usage information
-h --host <user> uCoin node host (with Basic Merkled API)
-p --port <pwd> uCoin node port (with Basic Merkled API)
-esh --es-host <user> ElasticSearch node host
-esp --es-port <pwd> ElasticSearch node port
```
## Use API (Developer)
When a blockchain currency has been indexed, you can test some fun queries :
- get a block by number (e.g the block #0):
http://localhost:9200/test_net/block/0 -> with some additional metadata given by ES
http://localhost:9200/test_net/block/0/_source -> the original JSON block
- Block #125 with only hash, dividend and memberCount:
http://localhost:9200/test_net/block/125/_source?_source=number,hash,dividend,membersCount
- All blocks using a pubkey (or whatever):
http://localhost:9200/test_net/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:
```bash
curl -XGET 'http://localhost:9200/test_net/block/_search' -d '{
"query": {
"filtered" : {
"filter": {
"exists" : { "field" : "dividend" }
}
}
},
"_source": ["number", "dividend", "hash", "membersCount"]
}'
```
- Get blocks from 0 to 100
## Create a new release
```bash
curl -XGET 'http://localhost:9200/test_net/block/_search' -d '{
"query": {
"filtered" : {
"filter": {
"exists" : { "field" : "dividend" }
}
}
}
}'
```
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 :
```bash
$ mvn install -DskipTests -DperformRelease
```
## Roadmap
- Allow to store data in embedded database (SQLLite or HsqlDB)
- Add an embedded [Cesium](https://www.github.com/duniter/cesium) inside the ElasticSearch plugin
- Detect blockchain rollback
## 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
File added
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dnl.utils</groupId>
<artifactId>j-text-utils</artifactId>
<packaging>jar</packaging>
<version>0.3.3</version>
<name>Java Text Utilities</name>
<url>http://code.google.com/p/j-text-utils</url>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>14.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.jvnet.wagon-svn</groupId>
<artifactId>wagon-svn</artifactId>
<version>1.9</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>googlecode</id>
<url>svn:https://j-text-utils.googlecode.com/svn/trunk/repo/</url>
</repository>
</distributionManagement>
</project>
This diff is collapsed.
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - Apache 2.0
# - BSD License
# - CDDL
# - CDDL+GPL
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# - Common Development and Distribution License (CDDL) v1.0
# - Dual license consisting of the CDDL v1.1 and GPL v2
# - GPLv2+CE
# - General Public License (GPL) v3
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
# - 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 :
#
#
#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
<?xml version="1.0" encoding="UTF-8"?>
<component
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd">
<fileSets>
<fileSet>
<includes>
<include>LICENSE*</include>
</includes>
</fileSet>
<!-- Duniter4j component -->
<fileSet>
<directory>target</directory>
<outputDirectory>duniter4j</outputDirectory>
<includes>
<include>${project.build.finalName}.${project.packaging}</include>
</includes>
</fileSet>
<fileSet>
<directory>target/lib</directory>
<outputDirectory>duniter4j/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
<excludes>
<exclude>junit-*.jar</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>src/main/assembly/min</directory>
<outputDirectory/>
<filtered>true</filtered>
<fileMode>0755</fileMode>
<includes>
<include>*.sh</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/assembly/min</directory>
<outputDirectory>duniter4j</outputDirectory>
<filtered>true</filtered>
<includes>
<include>*</include>
</includes>
<excludes>
<exclude>*.sh</exclude>
<exclude>*.bat</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>src/main/assembly/min</directory>
<outputDirectory>i18n</outputDirectory>
<filtered>true</filtered>
<includes>
<include>version.appup</include>
</includes>
</fileSet>
<!-- I18N component -->
<fileSet>
<directory>target/classes/META-INF</directory>
<outputDirectory>i18n</outputDirectory>
<includes>
<include>duniter4j-client-i18n*.properties</include>
<include>duniter4j-client-i18n*.csv</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/assembly/min</directory>
<outputDirectory>i18n</outputDirectory>
<filtered>true</filtered>
<includes>
<include>version.appup</include>
</includes>
</fileSet>
</fileSets>
</component>