Properties:

+ version from pom.xml into system.properties
+ hello phrase for wire message
This commit is contained in:
romanman 2014-08-06 18:44:46 +03:00
parent 4216e74771
commit a4b2570c13
5 changed files with 65 additions and 9 deletions

View File

@ -4,7 +4,7 @@
<groupId>org.ethereum</groupId>
<artifactId>ethereumj</artifactId>
<packaging>jar</packaging>
<version>0.5.1</version>
<version>0.5.3</version>
<name>EthereumJ</name>
<url>http://www.ethereumj.org</url>
@ -194,6 +194,29 @@
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/classes/system.properties</file>
<replacements>
<replacement>
<token>PROJECT.VERSION</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>

View File

@ -35,6 +35,8 @@ public class SystemProperties {
private static int DEFAULT_TRACE_STARTBLOCK = -1;
private static byte DEFAULT_MAX_BLOCKS_ASK = 10;
private static int DEFAULT_MAX_BLOCKS_QUEUED = 300;
private static String DEFAULT_PROJECT_VERSION = "";
private static String DEFAULT_HELLO_PHRASE = "RJ";
public static SystemProperties CONFIG = new SystemProperties();
@ -183,6 +185,16 @@ public class SystemProperties {
return Integer.parseInt(prop.getProperty("max.blocks.queued"));
}
public String projectVersion() {
if(prop.isEmpty()) return DEFAULT_PROJECT_VERSION;
return prop.getProperty("project.version");
}
public String helloPhrase() {
if(prop.isEmpty()) return DEFAULT_HELLO_PHRASE;
return prop.getProperty("hello.phrase");
}
public static void main(String args[]) {
SystemProperties systemProperties = new SystemProperties();

View File

@ -1,5 +1,6 @@
package org.ethereum.gui;
import org.ethereum.config.SystemProperties;
import org.ethereum.manager.WorldManager;
import org.ethereum.util.Utils;
import org.slf4j.Logger;
@ -36,8 +37,10 @@ public class ToolBar extends JFrame {
public ToolBar() throws HeadlessException {
String version = SystemProperties.CONFIG.projectVersion();
introLogger.info("");
introLogger.info("|Ξ| EthereumJ [v0.5.1] by RomanJ");
introLogger.info("|Ξ| EthereumJ [v" + version + "] by RomanJ");
introLogger.info("|Ξ| Code by Roman Mandeleil, (c) 2014.");
introLogger.info("|Ξ| Contribution: Nick Savers ");
introLogger.info("|Ξ| Based on a design by Vitalik Buterin.");

View File

@ -1,5 +1,6 @@
package org.ethereum.net.message;
import org.ethereum.config.SystemProperties;
import org.ethereum.crypto.HashUtil;
import org.spongycastle.util.encoders.Hex;
@ -33,8 +34,16 @@ public class StaticMessages {
public static HelloMessage generateHelloMessage() {
byte[] peerIdBytes = HashUtil.randomPeerId();
String version = SystemProperties.CONFIG.projectVersion();
String system = System.getProperty("os.name");
if (System.getProperty("java.vm.vendor").contains("Android")) system = "Android";
String phrase = SystemProperties.CONFIG.helloPhrase();
String helloAnnouncement = String.format("Ethereum(J)/v%s/Release/%s/%s ", version, system, phrase);
return new HelloMessage((byte) 0x17, (byte) 0x00,
"EthereumJ [v0.5.1] by RomanJ", Byte.parseByte("00000111", 2),
helloAnnouncement, Byte.parseByte("00000111", 2),
(short) 30303, peerIdBytes);
}
}

View File

@ -6,6 +6,7 @@ server.acceptConnections = false
# the search of the online peers
# values: [ip:port, ip:port, ip:port ...]
peer.discovery.ip.list = 185.43.109.23:30303, \
54.211.14.10:30303, \
213.100.248.181:30303, \
54.72.69.180:30303, \
54.201.28.117:30303, \
@ -24,12 +25,12 @@ peer.discovery.ip.list = 185.43.109.23:30303,\
#peer.active.port = 30303
# RomanJ
#peer.active.ip = 54.211.14.10
#peer.active.port = 30303
peer.active.ip = 54.211.14.10
peer.active.port = 30303
# PoC-5 testnet
peer.active.ip = 185.43.109.23
peer.active.port = 30303
#peer.active.ip = 185.43.109.23
#peer.active.port = 30303
#peer.active.ip = 54.72.69.180
#peer.active.port = 30303
@ -128,3 +129,11 @@ max.blocks.ask = 100
# until the execution is set by this param
# recommended value: [100.300]
max.blocks.queued = 300
# project version auto copied during build phase
project.version = PROJECT.VERSION
# hello phrase will be included in
# the hello message of the peer
hello.phrase = RJ