Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The GridDB CLI provides command line interface tool to manage GridDB cluster ope
Building and program execution are checked in the environment below.

OS: Ubuntu 22.04 (x64)
GridDB Server: V5.8 CE(Community Edition)
GridDB Server: V5.9 CE(Community Edition)
Java: OpenJDK 1.8.0

## Quick start from CLI Source Code
Expand Down Expand Up @@ -47,15 +47,15 @@ and the following file is created under `release/` folder.
$ CP=$CP:common/lib/commons-io-2.15.1.jar:release/griddb-cli.jar:common/lib/gridstore.jar:common/lib/gridstore-jdbc.jar:common/lib/jackson-annotations-2.16.1.jar:common/lib/jackson-core-2.16.1.jar:common/lib/jackson-databind-2.16.1.jar:common/lib/javax.json-1.0.jar:common/lib/jersey-client-1.17.1.jar:common/lib/jersey-core-1.17.1.jar:common/lib/orion-ssh2-214.jar:lib/commons-beanutils-1.9.4.jar:lib/commons-cli-1.6.0.jar:lib/commons-collections-3.2.2.jar:lib/commons-lang3-3.14.0.jar:lib/commons-logging-1.3.0.jar:lib/jline-3.21.0.jar:lib/logback-classic-1.2.13.jar:lib/logback-core-1.0.13.jar:lib/opencsv-3.9.jar:lib/slf4j-api-1.7.36.jar
$ java -Xmx1024m -Dlogback.configurationFile=gs_sh_logback.xml -classpath "$CP:$CLASSPATH" com.toshiba.mwcloud.gs.tools.shell.GridStoreShell $*
gs> version
gs_sh-ce version 5.8.0
gs_sh-ce version 5.9.0

Run GridDB CLI after build with gradle:

$ CP=.
$ CP=$CP:release/griddb-cli.jar
$ java -Xmx1024m -Dlogback.configurationFile=gs_sh_logback.xml -classpath "$CP:$CLASSPATH" com.toshiba.mwcloud.gs.tools.shell.GridStoreShell $*
gs> version
gs_sh-ce version 5.8.0
gs_sh-ce version 5.9.0

## Quick start from CLI Package

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ sourceSets {
}
}

def gridstoreVersion = '5.8.0'
def gridstoreJdbcVersion = '5.8.0'
def gridstoreVersion = '5.9.0'
def gridstoreJdbcVersion = '5.9.0'

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ sourceSets {
}
}

def gridstoreVersion = '5.8.0'
def gridstoreJdbcVersion = '5.8.0'
def gridstoreVersion = '5.9.0'
def gridstoreJdbcVersion = '5.9.0'

dependencies {
implementation 'commons-io:commons-io:2.15.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
Expand Down Expand Up @@ -53,6 +54,8 @@
import org.jline.reader.impl.completer.ArgumentCompleter;
import org.jline.reader.impl.completer.StringsCompleter;
import org.jline.reader.impl.history.DefaultHistory;
import org.jline.reader.EOFError;
import org.jline.reader.ParsedLine;
import org.jline.terminal.Size;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
Expand Down Expand Up @@ -186,7 +189,7 @@ public Object eval(Reader reader, ScriptContext context) throws ScriptException
.terminal(terminal)
.option(Option.BRACKETED_PASTE, false)
.option(Option.HISTORY_IGNORE_SPACE, false)
.parser(new DefaultParser())
.parser(new CustomParser())
.history(new DefaultHistory())
.completer(new ArgumentCompleter(completors))
.build();
Expand Down Expand Up @@ -297,6 +300,39 @@ public Object eval(Reader reader, ScriptContext context) throws ScriptException
}
}

// multi input support
private class CustomParser extends DefaultParser {

@Override
public ParsedLine parse(String line, int cursor, ParseContext context) {
String[] needEndList = {
"tql",
"sql",
"select",
"insert",
"update",
"delete",
"create",
"alter",
"set password",
"drop",
"grant",
"revoke",
"tqlexplain",
"tqlanlyze"
};
if (context == ParseContext.ACCEPT_LINE) {
String[] checkCommand = line.trim().split(" ");
if (Arrays.asList(needEndList).contains(checkCommand[0].toLowerCase())) {
if (!line.trim().endsWith(";")) {
throw new EOFError(-1, -1, "not end of statement");
}
}
}
return super.parse(line, cursor, context);
}
}

private String readAdditionalLines(BufferedReader bufferedReader, String firstLine)
throws IOException {
StringBuilder builder = new StringBuilder(firstLine);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=gs_sh version 5.8.0
version=gs_sh version 5.9.0

help.version=Show version
help.help=Show this help
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=gs_sh version 5.8.0
version=gs_sh version 5.9.0

help.version=Show version
help.help=Show this help
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,11 @@ private void stopNodeImpl(ShellNode[] nodes, Integer waitSeconds, boolean force)
throw new ShellException(
getMessage("error.someNodesNotStopped", errorCount, watchers.size()));
} else {
println(getMessage("message.allNodesStopped"));
if (nodes.length == 1) {
println(getMessage("message.nodeStopped", nodes[0].getName()));
} else {
println(getMessage("message.allNodesStopped"));
}
}
} else {
println(getMessage("error.timeout"));
Expand Down