This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/master by this push:
new 98864df WIP on NLPCRAFT-450
98864df is described below
commit 98864df6b34f7485cda2655f2417d1d73fc685d0
Author: Aaron Radzinski <[email protected]>
AuthorDate: Mon Sep 27 15:43:36 2021 -0700
WIP on NLPCRAFT-450
---
nlpcraft/pom.xml | 1 -
.../nlpcraft/model/tools/cmdline/NCCli.scala | 34 +++++++++++++---------
.../model/tools/cmdline/NCCliCommands.scala | 16 ++++------
pom.xml | 4 +--
4 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/nlpcraft/pom.xml b/nlpcraft/pom.xml
index 42726f7..b2c5d0c 100644
--- a/nlpcraft/pom.xml
+++ b/nlpcraft/pom.xml
@@ -136,7 +136,6 @@
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-langdetect</artifactId>
- <!-- Ignite contains 13 version but it contains 12. -->
<exclusions>
<exclusion>
<groupId>com.intellij</groupId>
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
index 71162db..352d588 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
@@ -945,7 +945,11 @@ object NCCli extends NCCliBase {
throw InvalidParameter(cmd, "lines")
loadServerBeacon() match {
- case Some(beacon) => tailFile(beacon.logPath, lines)
+ case Some(beacon) =>
+ if (beacon.logPath == null)
+ throw new IllegalStateException(s"Server was started
outside or its log file cannot be found.")
+ else
+ tailFile(beacon.logPath, lines)
case None => throw NoLocalServer()
}
}
@@ -962,7 +966,11 @@ object NCCli extends NCCliBase {
throw InvalidParameter(cmd, "lines")
loadProbeBeacon() match {
- case Some(beacon) => tailFile(beacon.logPath, lines)
+ case Some(beacon) =>
+ if (beacon.logPath == null)
+ throw new IllegalStateException(s"Probe log file cannot be
found.")
+ else
+ tailFile(beacon.logPath, lines)
case None => throw NoLocalProbe()
}
}
@@ -1692,15 +1700,7 @@ object NCCli extends NCCliBase {
* @param args Arguments, if any, for this command.
* @param repl Whether or not executing from REPL.
*/
- private [cmdline] def cmdSqlGen(cmd: Command, args: Seq[Argument], repl:
Boolean): Unit = {
- // Mandatory parameters check (unless --help is specified).
- if (!isParam(cmd, args, "help")) {
- getParam(cmd, args, "driver")
- getParam(cmd, args, "schema")
- getParam(cmd, args, "out")
- getParam(cmd, args, "url")
- }
-
+ private [cmdline] def cmdGenSql(cmd: Command, args: Seq[Argument], repl:
Boolean): Unit = {
val addCp = getCpParams(args)
val jvmOpts = getParamOpt(args, "jvmopts") match {
case Some(opts) => U.splitTrimFilter(U.trimQuotes(opts), " ")
@@ -3128,8 +3128,8 @@ object NCCli extends NCCliBase {
* @param args
* @return
*/
- private def processParameters(cmd: Command, args: Seq[String]):
Seq[Argument] =
- args.map { arg =>
+ private def processParameters(cmd: Command, args: Seq[String]):
Seq[Argument] = {
+ val seq = args.map { arg =>
val parts = arg.split("=", 2)
def mkError() = new IllegalArgumentException(s"Invalid parameter:
${c(arg)}, type $C'help --cmd=${cmd.name}'$RST to get help.")
@@ -3165,6 +3165,14 @@ object NCCli extends NCCliBase {
}
}
+ for (param <- cmd.params.filter(!_.optional)) {
+ if (!seq.exists(_.parameter.id == param.id))
+ throw MissingParameter(cmd, param.id)
+ }
+
+ seq
+ }
+
/**
*
* @param args
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
index 0c35f08..307c8fd 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
@@ -351,10 +351,12 @@ private [cmdline] object NCCliCommands {
synopsis = s"Generates NLPCraft model stub from SQL databases.",
desc = Some(
s"You can choose database schema, set of tables and columns
for which you want to generate NLPCraft " +
- s"model. After the model is generated you can further
configure and customize it for your specific needs. " +
+ s"model. Note that required JDBC driver class must be
available on the classpath and therefore its " +
+ s"JAR should be added to the classpathAfter the model is
generated you can further configure and " +
+ s"customize it for your specific needs. " +
s"Find more information at
https://nlpcraft.apache.org/tools/sql_model_gen.html"
),
- body = NCCli.cmdSqlGen,
+ body = NCCli.cmdGenSql,
params = Seq(
Parameter(
id = "url",
@@ -508,14 +510,6 @@ private [cmdline] object NCCliCommands {
desc =
s"Flag on whether to use element's parent relationship
for defining " +
s"SQL columns and their containing (i.e. parent)
tables. Default is ${y("'false'")}."
- ),
- Parameter(
- id = "help",
- names = Seq("--help", "-h"),
- optional = true,
- desc =
- s"Gets extended help and usage information for the
${y("'gen-sql'")} command. " +
- s"Includes information on how to run this tool
standalone in a separate process."
)
),
examples = Seq(
@@ -713,6 +707,7 @@ private [cmdline] object NCCliCommands {
Parameter(
id = "lines",
names = Seq("--lines", "-l"),
+ optional = true,
value = Some("20"),
desc =
s"Number of the server log lines from the end to
display. Default is 20."
@@ -736,6 +731,7 @@ private [cmdline] object NCCliCommands {
params = Seq(
Parameter(
id = "lines",
+ optional = true,
names = Seq("--lines", "-l"),
value = Some("20"),
desc =
diff --git a/pom.xml b/pom.xml
index 3280136..0c955ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,8 +81,8 @@
<timestamp>${maven.build.timestamp}</timestamp>
<!-- Versions. -->
- <ignite.ver>2.10.0</ignite.ver>
- <gridgain.agent.ver>2.10.0.0</gridgain.agent.ver>
+ <ignite.ver>2.11.0</ignite.ver>
+ <gridgain.agent.ver>2.11.0.0</gridgain.agent.ver>
<scala.plugin.ver>4.3.1</scala.plugin.ver>
<log4j.ver>2.12.0</log4j.ver>
<scala.ver>${scala.base}.6</scala.ver>