Skip to content

Commit

Permalink
Merge branch 'Development'
Browse files Browse the repository at this point in the history
Conflicts:
	doc/build.md
  • Loading branch information
ManfredKarrer committed Jul 27, 2016
2 parents 4f953fe + 410e40c commit 13c2db8
Show file tree
Hide file tree
Showing 166 changed files with 4,557 additions and 958 deletions.
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.9</version>
<version>0.4.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
35 changes: 35 additions & 0 deletions common/src/main/java/io/bitsquare/app/Capabilities.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.bitsquare.app;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Arrays;

public class Capabilities {
private static final Logger log = LoggerFactory.getLogger(Capabilities.class);

// We can define here special features the client is supporting.
// Useful for updates to new versions where a new data type would break backwards compatibility or to
// limit a node to certain behaviour and roles like the seed nodes.
// We don't use the Enum in any serialized data, as changes in the enum would break backwards compatibility. We use the ordinal integer instead.
// Sequence in the enum must not be changed (append only).
public enum Capability {
TRADE_STATISTICS
}

public static void setCapabilities(ArrayList<Integer> capabilities) {
Capabilities.capabilities = capabilities;
}

private static ArrayList<Integer> capabilities = new ArrayList<>(Arrays.asList(
Capability.TRADE_STATISTICS.ordinal()
));

/**
* @return The Capabilities as ordinal integer the client supports.
*/
public static ArrayList<Integer> getCapabilities() {
return capabilities;
}
}
8 changes: 4 additions & 4 deletions common/src/main/java/io/bitsquare/app/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public class Log {
private static SizeBasedTriggeringPolicy triggeringPolicy;
private static Logger logbackLogger;

public static void setLevel(Level logLevel) {
logbackLogger.setLevel(logLevel);
}

public static void setup(String fileName) {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();

Expand Down Expand Up @@ -84,10 +88,6 @@ public static void setup(String fileName) {
logbackLogger.addAppender(errorAppender);*/
}

public static void setLevel(Level logLevel) {
logbackLogger.setLevel(logLevel);
}

public static void traceCall() {
if (LoggerFactory.getLogger(Log.class).isTraceEnabled()) {
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
Expand Down
5 changes: 2 additions & 3 deletions common/src/main/java/io/bitsquare/app/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Version {
private static final Logger log = LoggerFactory.getLogger(Version.class);

// The application versions
public static final String VERSION = "0.4.9";
public static final String VERSION = "0.4.9.1";

// The version nr. for the objects sent over the network. A change will break the serialization of old objects.
// If objects are used for both network and database the network version is applied.
Expand All @@ -39,14 +39,13 @@ public class Version {
// VERSION = 0.3.5 -> LOCAL_DB_VERSION = 2
// VERSION = 0.4.0 -> LOCAL_DB_VERSION = 3
// VERSION = 0.4.2 -> LOCAL_DB_VERSION = 4
public static final int LOCAL_DB_VERSION = 4;
public static final int LOCAL_DB_VERSION = 4;

// The version nr. of the current protocol. The offer holds that version.
// A taker will check the version of the offers to see if his version is compatible.
public static final int TRADE_PROTOCOL_VERSION = 1;
private static int p2pMessageVersion;


public static int getP2PMessageVersion() {
// TODO investigate why a changed NETWORK_PROTOCOL_VERSION for the serialized objects does not trigger
// reliable a disconnect., but java serialisation should be replaced anyway, so using one existing field
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/io/bitsquare/common/Clock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class Clock {
private static final Logger log = LoggerFactory.getLogger(Clock.class);

public static final int IDLE_TOLERANCE = 5000;
public static final int IDLE_TOLERANCE = 20000;

public interface Listener {
void onSecondTick();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.bitsquare.common;

public class CommonOptionKeys {
public static final String LOG_LEVEL_KEY = "logLevel";
}
6 changes: 0 additions & 6 deletions common/src/main/java/io/bitsquare/common/OptionKeys.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public static void restartApplication(String logPath) throws IOException {

try {
final String command = "nohup " + cmd.toString() + " >/dev/null 2>" + logPath + " &";
log.warn("Executing cmd for restart:\n" + command);
log.warn("\n\n############################################################\n" +
"Executing cmd for restart: {}" +
"\n############################################################\n\n",
command);
Runtime.getRuntime().exec(command);
} catch (IOException e) {
e.printStackTrace();
Expand Down
9 changes: 9 additions & 0 deletions common/src/main/java/io/bitsquare/common/util/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.gson.*;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -465,4 +466,12 @@ public static boolean isRestrictedCryptography() {
// This simply matches the Oracle JRE, but not OpenJDK.
return "Java(TM) SE Runtime Environment".equals(System.getProperty("java.runtime.name"));
}

public static String toTruncatedString(Object message, int maxLenght) {
return StringUtils.abbreviate(message.toString(), maxLenght).replace("\n", "");
}

public static String toTruncatedString(Object message) {
return toTruncatedString(message, 200);
}
}
2 changes: 1 addition & 1 deletion common/src/main/java/io/bitsquare/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public Storage(@Named(DIR_KEY) File dir) {
}

@Nullable
public T initAndGetPersisted(String fileName) {
public T initAndGetPersistedWithFileName(String fileName) {
this.fileName = fileName;
storageFile = new File(dir, fileName);
fileManager = new FileManager<>(dir, storageFile, 300);
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.9</version>
<version>0.4.9.1</version>
</parent>

<artifactId>core</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/bitsquare/alert/AlertManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import com.google.inject.Inject;
import com.google.inject.name.Named;
import io.bitsquare.common.OptionKeys;
import io.bitsquare.app.CoreOptionKeys;
import io.bitsquare.common.crypto.KeyRing;
import io.bitsquare.p2p.P2PService;
import io.bitsquare.p2p.storage.HashMapChangedListener;
Expand Down Expand Up @@ -56,7 +56,7 @@ public class AlertManager {
///////////////////////////////////////////////////////////////////////////////////////////

@Inject
public AlertManager(P2PService p2PService, KeyRing keyRing, User user, @Named(OptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg) {
public AlertManager(P2PService p2PService, KeyRing keyRing, User user, @Named(CoreOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg) {
this.p2PService = p2PService;
this.keyRing = keyRing;
this.user = user;
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/io/bitsquare/alert/AlertModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@

import com.google.inject.Singleton;
import io.bitsquare.app.AppModule;
import io.bitsquare.app.CoreOptionKeys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;

import static com.google.inject.name.Names.named;

public class AlertModule extends AppModule {
private static final Logger log = LoggerFactory.getLogger(AlertModule.class);

Expand All @@ -34,5 +37,6 @@ public AlertModule(Environment env) {
protected final void configure() {
bind(AlertManager.class).in(Singleton.class);
bind(PrivateNotificationManager.class).in(Singleton.class);
bindConstant().annotatedWith(named(CoreOptionKeys.IGNORE_DEV_MSG_KEY)).to(env.getRequiredProperty(CoreOptionKeys.IGNORE_DEV_MSG_KEY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import com.google.inject.Inject;
import com.google.inject.name.Named;
import io.bitsquare.common.OptionKeys;
import io.bitsquare.app.CoreOptionKeys;
import io.bitsquare.common.crypto.KeyRing;
import io.bitsquare.crypto.DecryptedMsgWithPubKey;
import io.bitsquare.p2p.Message;
Expand Down Expand Up @@ -58,7 +58,7 @@ public class PrivateNotificationManager {
///////////////////////////////////////////////////////////////////////////////////////////

@Inject
public PrivateNotificationManager(P2PService p2PService, KeyRing keyRing, @Named(OptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg) {
public PrivateNotificationManager(P2PService p2PService, KeyRing keyRing, @Named(CoreOptionKeys.IGNORE_DEV_MSG_KEY) boolean ignoreDevMsg) {
this.p2PService = p2PService;
this.keyRing = keyRing;

Expand Down
Loading

0 comments on commit 13c2db8

Please sign in to comment.