Skip to content
Permalink
Browse files

[Java] Remove unneeded jline dependency

The functionality we use from jline can easily be replaced with the
standard Java console and the slf4j logging we already use.
  • Loading branch information...
agegov authored and donsciarra committed Feb 11, 2019
1 parent e474545 commit 1bd5911f9f837307bc9b9f347cb1a2ce684e86cb
1 NOTICE
@@ -336,7 +336,6 @@ This project has dependencies to:
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: XML utilities under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JMS 1.1 under The Apache Software License, Version 2.0
JMS 1.1 API under lgpl
JPA 2.0 API under Sun Binary Code License
@@ -105,7 +105,6 @@ This project has dependencies to:
Jetty :: Websocket :: Common under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JUnit under Eclipse Public License 1.0
libjoynr-websocket-runtime under The Apache Software License, Version 2.0
Logback Classic Module under Eclipse Public License - v 1.0 or GNU Lesser General Public License
@@ -55,7 +55,6 @@ This project has dependencies to:
Jetty :: Websocket :: API under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Client under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Common under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JUnit under Eclipse Public License 1.0
libjoynr-websocket-runtime under The Apache Software License, Version 2.0
SLF4J API Module under MIT License
@@ -60,11 +60,6 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.12</version>
</dependency>
</dependencies>

<build>
@@ -18,19 +18,18 @@
*/
package io.joynr.examples.android_example;

import java.io.IOException;
import java.io.Console;
import java.util.Properties;

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

import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import com.google.inject.Module;
import com.google.inject.util.Modules;

import edu.umd.cs.findbugs.annotations.SuppressWarnings;

import io.joynr.accesscontrol.StaticDomainAccessControlProvisioning;
import io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule;
import io.joynr.exceptions.JoynrRuntimeException;
@@ -44,7 +43,6 @@
import io.joynr.runtime.JoynrApplicationModule;
import io.joynr.runtime.JoynrInjectorFactory;
import io.joynr.runtime.LibjoynrWebSocketRuntimeModule;
import jline.console.ConsoleReader;
import joynr.infrastructure.DacTypes.MasterAccessControlEntry;
import joynr.infrastructure.DacTypes.Permission;
import joynr.infrastructure.DacTypes.TrustLevel;
@@ -161,22 +159,23 @@ public void run() {
providerQos.setPriority(System.currentTimeMillis());
runtime.registerProvider(localDomain, provider, providerQos);

ConsoleReader console;
try {
console = new ConsoleReader();
int key;
while ((key = console.readCharacter()) != 'q') {
Console console = System.console();
if (console != null) {
String key = "";
while (!key.equals("q")) {
key = console.readLine();

switch (key) {
case 'l':
case "l":
provider.notifyLocationUpdate();
break;
default:
LOG.info("\n\nUSAGE press\n" + " q\tto quit\n" + " l\tto update location\n");
break;
}
}
} catch (IOException e) {
LOG.error("error reading input from console", e);
} else {
LOG.info("\n\nNon-interactive mode detected.\n");
}
}

@@ -69,7 +69,6 @@ This project has dependencies to:
Jetty :: Websocket :: Common under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JUnit under Eclipse Public License 1.0
libjoynr-websocket-runtime under The Apache Software License, Version 2.0
SLF4J API Module under MIT License
@@ -79,13 +79,6 @@
<version>1.6.6</version>
</dependency>

<!-- Console I/O framework used in the demo app -->
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.12</version>
</dependency>

<!-- Command line parsing used in the demo app -->
<dependency>
<groupId>commons-cli</groupId>
@@ -18,7 +18,7 @@
*/
package io.joynr.demo;

import java.io.IOException;
import java.io.Console;
import java.util.Properties;

import org.apache.commons.cli.CommandLine;
@@ -39,7 +39,6 @@
import com.google.inject.util.Modules;

import edu.umd.cs.findbugs.annotations.SuppressWarnings;

import io.joynr.arbitration.ArbitrationStrategy;
import io.joynr.arbitration.DiscoveryQos;
import io.joynr.arbitration.DiscoveryScope;
@@ -61,7 +60,6 @@
import io.joynr.runtime.JoynrApplicationModule;
import io.joynr.runtime.JoynrInjectorFactory;
import io.joynr.runtime.LibjoynrWebSocketRuntimeModule;
import jline.console.ConsoleReader;
import joynr.MulticastSubscriptionQos;
import joynr.OnChangeSubscriptionQos;
import joynr.OnChangeWithKeepAliveSubscriptionQos;
@@ -70,9 +68,9 @@
import joynr.vehicle.Country;
import joynr.vehicle.GeoPosition;
import joynr.vehicle.Radio.AddFavoriteStationErrorEnum;
import joynr.vehicle.RadioBroadcastInterface;
import joynr.vehicle.RadioBroadcastInterface.NewStationDiscoveredBroadcastFilterParameters;
import joynr.vehicle.RadioBroadcastInterface.WeakSignalBroadcastAdapter;
import joynr.vehicle.RadioBroadcastInterface;
import joynr.vehicle.RadioProxy;
import joynr.vehicle.RadioStation;
import joynr.vehicle.RadioSync.GetLocationOfCurrentStationReturned;
@@ -569,17 +567,18 @@ public void onFailure(AddFavoriteStationErrorEnum errorEnum) {
+ e.getClass().getSimpleName() + "!");
}

ConsoleReader console;
try {
console = new ConsoleReader();
int key;
while ((key = console.readCharacter()) != 'q') {
Console console = System.console();
if (console != null) {
String key = "";
while (!key.equals("q")) {
key = console.readLine();

switch (key) {
case 's':
case "s":
radioProxy.shuffleStations();
LOG.info("called shuffleStations");
break;
case 'm':
case "m":
GetLocationOfCurrentStationReturned locationOfCurrentStation = radioProxy.getLocationOfCurrentStation();
LOG.info("called getLocationOfCurrentStation. country: " + locationOfCurrentStation.country
+ ", location: " + locationOfCurrentStation.location);
@@ -589,8 +588,8 @@ public void onFailure(AddFavoriteStationErrorEnum errorEnum) {
break;
}
}
} catch (IOException e) {
LOG.error("error reading input from console", e);
} else {
LOG.info("\n\nNon-interactive mode detected.\n");
}

} catch (DiscoveryException e) {
@@ -18,7 +18,7 @@
*/
package io.joynr.demo;

import java.io.IOException;
import java.io.Console;
import java.util.Properties;

import org.apache.commons.cli.CommandLine;
@@ -31,14 +31,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import com.google.inject.Inject;
import com.google.inject.Module;
import com.google.inject.util.Modules;

import edu.umd.cs.findbugs.annotations.SuppressWarnings;

import io.joynr.accesscontrol.StaticDomainAccessControlProvisioning;
import io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule;
import io.joynr.exceptions.JoynrRuntimeException;
@@ -55,7 +54,6 @@
import io.joynr.runtime.JoynrApplicationModule;
import io.joynr.runtime.JoynrInjectorFactory;
import io.joynr.runtime.LibjoynrWebSocketRuntimeModule;
import jline.console.ConsoleReader;
import joynr.exceptions.ApplicationException;
import joynr.infrastructure.DacTypes.MasterAccessControlEntry;
import joynr.infrastructure.DacTypes.Permission;
@@ -335,22 +333,23 @@ public void run() {
return;
}

ConsoleReader console;
try {
console = new ConsoleReader();
int key;
while ((key = console.readCharacter()) != 'q') {
Console console = System.console();
if (console != null) {
String key = "";
while (!key.equals("q")) {
key = console.readLine();

switch (key) {
case 's':
case "s":
provider.shuffleStations();
break;
case 'p':
case "p":
provider.fireWeakSignalEventWithPartition();
break;
case 'w':
case "w":
provider.fireWeakSignalEvent();
break;
case 'n':
case "n":
provider.fireNewStationDiscoveredEvent();
break;
default:
@@ -361,9 +360,10 @@ public void run() {
break;
}
}
} catch (IOException e) {
LOG.error("error reading input from console", e);
} else {
LOG.info("\n\nNon-interactive mode detected.\n");
}

}

@Override
@@ -214,7 +214,6 @@ This project has dependencies to:
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: XML utilities under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JMS 1.1 under The Apache Software License, Version 2.0
JMS 1.1 API under lgpl
JPA 2.0 API under Sun Binary Code License
@@ -76,7 +76,6 @@ This project has dependencies to:
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: XML utilities under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
json-path under Apache 2.0
JSON.simple under The Apache Software License, Version 2.0
JUnit under Eclipse Public License 1.0
@@ -64,7 +64,6 @@ This project has dependencies to:
Jetty :: Websocket :: Common under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JUnit under Eclipse Public License 1.0
SLF4J API Module under MIT License
SLF4J LOG4J-12 Binding under MIT License
@@ -38,11 +38,6 @@
<artifactId>joynr-mqtt-client</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Console I/O framework used in the demo app -->
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@@ -18,7 +18,7 @@
*/
package io.joynr.runtime;

import java.io.IOException;
import java.io.Console;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Properties;
@@ -43,7 +43,6 @@
import io.joynr.messaging.ConfigurableMessagingSettings;
import io.joynr.messaging.mqtt.paho.client.MqttPahoModule;
import io.joynr.messaging.websocket.WebsocketModule;
import jline.console.ConsoleReader;
import joynr.types.DiscoveryEntry;

public class ClusterController {
@@ -161,27 +160,22 @@ public void run() {
LOG.info("adding shutdown hook");
Runtime.getRuntime().addShutdownHook(shutdownHook);

if (System.console() != null) {
ConsoleReader console;
try {
console = new ConsoleReader();
String command = "";
while (!command.equals("q")) {
command = console.readLine();

if (command.equals("caps")) {
Set<DiscoveryEntry> allLocalDiscoveryEntries = capabilitiesDirectory.listLocalCapabilities();
StringBuffer discoveryEntriesAsText = new StringBuffer();
for (DiscoveryEntry capability : allLocalDiscoveryEntries) {
discoveryEntriesAsText.append(capability.toString()).append('\n');
}
LOG.info(discoveryEntriesAsText.toString());
} else {
LOG.info("\n\nUSAGE press\n" + " q\tto quit\n caps\tto list registered providers\n");
Console console = System.console();
if (console != null) {
String command = "";
while (!command.equals("q")) {
command = console.readLine();

if (command.equals("caps")) {
Set<DiscoveryEntry> allLocalDiscoveryEntries = capabilitiesDirectory.listLocalCapabilities();
StringBuffer discoveryEntriesAsText = new StringBuffer();
for (DiscoveryEntry capability : allLocalDiscoveryEntries) {
discoveryEntriesAsText.append(capability.toString()).append('\n');
}
LOG.info(discoveryEntriesAsText.toString());
} else {
LOG.info("\n\nUSAGE press\n" + " q\tto quit\n caps\tto list registered providers\n");
}
} catch (IOException e) {
LOG.error("error reading input from console", e);
}
} else {
LOG.info("\n\nNon-interactive mode detected.\n"
@@ -751,11 +751,6 @@
<artifactId>commons-cli</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.12</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
@@ -112,7 +112,6 @@ This project has dependencies to:
Jetty :: Websocket :: Common under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JUnit under Eclipse Public License 1.0
libjoynr-websocket-runtime under The Apache Software License, Version 2.0
Logback Classic Module under Eclipse Public License - v 1.0 or GNU Lesser General Public License
@@ -66,7 +66,6 @@ This project has dependencies to:
Jetty :: Websocket :: Common under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Server under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
Jetty :: Websocket :: Servlet Interface under Apache Software License - Version 2.0 or Eclipse Public License - Version 1.0
JLine under The BSD License
JUnit under Eclipse Public License 1.0
libjoynr-websocket-runtime under The Apache Software License, Version 2.0
Mockito under The MIT License
Oops, something went wrong.

0 comments on commit 1bd5911

Please sign in to comment.
You can’t perform that action at this time.