This is an automated email from the ASF dual-hosted git repository.
sergeykamov 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 e9bd795 Configuration issues fixed. Minecraft example minor
improvements.
e9bd795 is described below
commit e9bd795fc55186e3830c6f8fa02bf1bede68ebd4
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue May 4 20:59:48 2021 +0300
Configuration issues fixed. Minecraft example minor improvements.
---
bin/prepare.sh | 47 ++++++---------------
.../main/resources/{nlpcraft.conf => probe.conf} | 0
.../main/resources/{nlpcraft.conf => probe.conf} | 0
.../main/resources/{nlpcraft.conf => probe.conf} | 0
.../main/resources/{nlpcraft.conf => probe.conf} | 0
nlpcraft-examples/minecraft/README.md | 45 +++++++++++---------
.../assets/forge-1.16.5-36.1.0-installer.jar | Bin 0 -> 7225119 bytes
.../minecraft/MinecraftFillMatchProcessor.kt | 3 +-
.../nlpcraft/example/minecraft/MinecraftModel.kt | 4 +-
.../example/minecraft/MinecraftValueLoader.kt | 2 -
.../minecraft/src/main/resources/block.json | 1 -
.../main/resources/{nlpcraft.conf => probe.conf} | 0
.../main/resources/{nlpcraft.conf => probe.conf} | 0
.../main/resources/{nlpcraft.conf => probe.conf} | 0
.../main/resources/{nlpcraft.conf => probe.conf} | 0
.../main/resources/{nlpcraft.conf => probe.conf} | 0
nlpcraft/src/main/resources/cli/templates.zip | Bin 82508 -> 82469 bytes
.../nlpcraft/common/config/NCConfigurable.scala | 41 +++++++-----------
.../nlpcraft/model/tools/cmdline/NCCli.scala | 10 ++---
.../org/apache/nlpcraft/probe/NCProbeBoot.scala | 20 ++++++---
.../probe/mgrs/deploy/NCDeployManager.scala | 5 ++-
.../org/apache/nlpcraft/server/NCServer.scala | 18 +++++---
22 files changed, 87 insertions(+), 109 deletions(-)
diff --git a/bin/prepare.sh b/bin/prepare.sh
index 026a0d4..de295f8 100755
--- a/bin/prepare.sh
+++ b/bin/prepare.sh
@@ -72,7 +72,6 @@ mkdir -p ${zipDir}/${tmpDir}/${exampleTime}
mkdir -p ${zipDir}/${tmpDir}/${exampleWeather}
mkdir ${zipDir}/${tmpDir}/build
-mkdir ${zipDir}/${tmpDir}/build/examples
#=====================#
# Prepare BINARY ZIP. #
@@ -104,46 +103,28 @@ cp bindist/NOTICE ${zipDir}/${tmpDir}
cp DISCLAIMER ${zipDir}/${tmpDir}
cp ${coreModule}/src/main/resources/nlpcraft.conf ${zipDir}/${tmpDir}/build
-
-function cpConf() {
- cp "$1"/src/main/resources/nlpcraft.conf
${zipDir}/${tmpDir}/build/examples/"$(echo "$1" | tr '/' '-')".conf
-}
-
-cpConf ${exampleAlarm}
-cpConf ${exampleEcho}
-cpConf ${exampleHelloworld}
-cpConf ${exampleLightswitch}
-cpConf ${exampleMinecraft}
-cpConf ${examplePhone}
-cpConf ${exampleSql}
-cpConf ${exampleTime}
-cpConf ${exampleWeather}
-
cp ${coreModule}/src/main/resources/ignite.xml ${zipDir}/${tmpDir}/build
cp ${coreModule}/src/main/resources/log4j2.xml ${zipDir}/${tmpDir}/build
rsync -avzq ${coreModule}/target/*all-deps.jar ${zipDir}/${tmpDir}/build
rsync -avzq ${coreModule}/target/apidocs/** ${zipDir}/${tmpDir}/javadoc
--exclude '**/.DS_Store'
-function cpJar() {
- rsync -avzq "$1"/target/*.jar ${zipDir}/${tmpDir}/build --exclude
'*-sources.jar'
-}
-
-function cpJarExamples() {
- rsync -avzq "$1"/target/*.jar ${zipDir}/${tmpDir}/build/examples --exclude
'*-sources.jar'
+function cpExample() {
+ mkdir -p ${zipDir}/${tmpDir}/build/"$1"
+ cp "$1"/src/main/resources/probe.conf ${zipDir}/${tmpDir}/build/"$1"
+ rsync -avzq "$1"/target/*.jar ${zipDir}/${tmpDir}/build/"$1" --exclude
'*-sources.jar'
}
-cpJar ${stanfordModule}
-cpJarExamples ${exampleAlarm}
-cpJarExamples ${exampleEcho}
-cpJarExamples ${exampleHelloworld}
-cpJarExamples ${exampleLightswitch}
-cpJarExamples ${exampleMinecraft}
-cpJarExamples ${examplePhone}
-cpJarExamples ${exampleSql}
-cpJarExamples ${exampleTime}
-cpJarExamples ${exampleWeather}
-rsync -avzq ${exampleMinecraftMod}/build/libs/*.jar
${zipDir}/${tmpDir}/build/examples --exclude '*-sources.jar'
+rsync -avzq "${stanfordModule}"/target/*.jar ${zipDir}/${tmpDir}/build
--exclude '*-sources.jar'
+cpExample ${exampleAlarm}
+cpExample ${exampleEcho}
+cpExample ${exampleHelloworld}
+cpExample ${exampleLightswitch}
+cpExample ${exampleMinecraft}
+cpExample ${examplePhone}
+cpExample ${exampleSql}
+cpExample ${exampleTime}
+cpExample ${exampleWeather}
# Prepares bin zip.
cd ${zipDir} || exit
diff --git a/nlpcraft-examples/alarm/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/alarm/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/alarm/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/alarm/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/echo/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/echo/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/echo/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/echo/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/helloworld/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/helloworld/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/helloworld/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/helloworld/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/lightswitch/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/lightswitch/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/lightswitch/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/lightswitch/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/minecraft/README.md
b/nlpcraft-examples/minecraft/README.md
index d7f5876..c388985 100644
--- a/nlpcraft-examples/minecraft/README.md
+++ b/nlpcraft-examples/minecraft/README.md
@@ -27,30 +27,33 @@
This module is part of Minecraft example. This part provides model for
Minecraft server commands.
Second part (**../minecraft-mod**) provides mod for Minecraft server sending
requests to the NLPCraft server.
-### Startup
-Start server normally. For running probe it's required to use dedicated
configuration located in [resources folder](src/main/resources/nlpcraft.conf)
-
### Installation
-1. Download [Minecraft client](https://www.minecraft.net/en-us/download)
-1. Download [Forge server installer](https://files.minecraftforge.net/) and
follow instructions
-1. Build mod (`cd ../minecraft-mod && ./gradlew clean build`)
-1. Copy mod to mods folder of your forge server folder (`cp
build/libs/nlpcraft-mod-*.jar <forge-server-location>/mods`)
-1. (Optional) If non-default settings are used, put them in
`main/resources/nlpcraft-settings.json` and copy file to
`<forge-server-location>/config`
-1. Start server (`java -jar forge.jar`). For detailed instructions refer to
[wiki](https://minecraft.gamepedia.com/Tutorials/Setting_up_a_server)
-1. Connect to the server from client and play!
+1. Download [Minecraft client](https://www.minecraft.net/en-us/download) and
install it on your local machine. This is the actual
+ game. Note that Minecraft is NOT a free game, and you will need to purchase
it and have an account to play it.
+1. Download Forge Server. Minecraft is a client-server game. This is the
server to which the Minecraft client will connect to and where the NLPCraft's
Minecraft mod will be
+ installed.
[Download](https://github.com/apache/incubator-nlpcraft/raw/master/nlpcraft-examples/minecraft/assets/forge-1.16.5-36.1.0-installer.jar)
+ the version 1.16.5-36.1.0 or grab the latest from
[here](https://files.minecraftforge.net/) (warning: _this download location,
however,
+ is full or harmful online ads and banners_).
+1. Install downloaded Forge Server by going to your download location and
running `java -jar forge-1.16.5-36.1.0-installer.jar`. Make sure
+ to select 'Install Server' when presented with options. Note the location
of the installed Forge Server (default or selected by you) in the last line of
the
+ installer log output. For example, on Windows it installs by default to
`C:\Users\User\AppData\Roaming\.minecraft`.
+ For convenience, set `%FORGE_SRV%` variable to point to this location.
+1. Copy pre-built NLPCraft's Minecraft mod to Forge Server `mods` folder.
Pre-built mod is located in `assets` sub-folder of the `minecraft-mod` module.
To copy, first
+ create folder `%FORGE_SRV%\mods` and run this
+ from the command line `cp
.\nlpcraft-examples\minecraft-mod\assets\nlpcraft-example-minecraft-mod-1.0.jar
%FORGE_SRV%\mods`
+
+### Start
+1. Start NLPCraft server in a
[standard](http://nlpcraft.apache.org/server-and-probe.html#server) way.
+1. Start NLPCraft probe with Minecraft model in a
[standard](http://nlpcraft.apache.org/server-and-probe.html#probe) way (from
`minecraft` example).
+1. Accept Forge Server EULA by opening `%FORGE_SRV%\eula.txt` file and
changing `eula=false` to `eula-=true`.
+1. Start Forge Server from the `%FORGE_SRV%` location: `java -jar
.\forge-1.16.5-36.1.0.jar`.
+1. Start Minecraft Client and login with your Minecraft account.
+1. Choose 'Multiplayer' -> 'Add Server' and add '127.0.0.1' local server.
Double-click on the newly added server to connect to it.
+1. Play Minecraft! 🤘
### Usage
-After starting Minecraft server with mod, you can use natural language to
invoke certain commands. It's not required to
-use modded client, so vanilla client could be used. Commands could be either
invoked on server side (e.g. `make it sunny`) or
-on client side, prefixed with slash (`/make it sunny`)
-
-### Supported commands
-| Command | Example of usage | Commentary
-| :---: |:---:|:---|
-`/weather` | Make it rain | |
-`/time` | Set current time to evening | |
-`/give` | Give me iron sword | You can specify quanity |
-`/fill` | Make a cube of gold near me | Can specify length (size of 10, length
10), position (10 meters in front of me/other player) |
+Natural language commands could be entered either on Forge Server (e.g. `make
it sunny`) or in the game itself, i.e. on the Minecraft client side,
+prefixed with slash (`/make it sunny`). See file `MinecraftModel.kt` file for
some examples of possible commands.
### Copyright
Copyright (C) 2020 Apache Software Foundation
diff --git
a/nlpcraft-examples/minecraft/assets/forge-1.16.5-36.1.0-installer.jar
b/nlpcraft-examples/minecraft/assets/forge-1.16.5-36.1.0-installer.jar
new file mode 100644
index 0000000..38c406f
Binary files /dev/null and
b/nlpcraft-examples/minecraft/assets/forge-1.16.5-36.1.0-installer.jar differ
diff --git
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFillMatchProcessor.kt
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFillMatchProcessor.kt
index f4dfdbe..75790e1 100644
---
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFillMatchProcessor.kt
+++
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFillMatchProcessor.kt
@@ -23,8 +23,7 @@ import org.apache.nlpcraft.model.*
import java.util.*
/**
- * Special processor for support 'fillIntent' intent processing.
- * Is is designed as separated class to simplify main model class.
+ * Special processor to support 'fillIntent' intent processing.
*/
class MinecraftFillMatchProcessor {
internal data class Coordinate(val x: Int = 0, val y: Int = 0, val z: Int
= 0) {
diff --git
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
index ca6f2f8..fa48230 100644
---
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
+++
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
@@ -25,9 +25,7 @@ import java.util.*
/**
* Minecraft example data model.
- * TODO:
- * <p>
- * See 'README.md' file in the same folder for running and testing
instructions.
+ * See 'README.md' file for installation, running and testing instructions.
*/
class MinecraftModel : NCModelFileAdapter("minecraft.yaml") {
private fun checkAmbiguous(ctx: NCIntentMatch) {
diff --git
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt
index 665a575..429adcf 100644
---
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt
+++
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt
@@ -28,8 +28,6 @@ import org.apache.nlpcraft.model.NCValueLoader
/**
* Data loader from JSON data files.
- * These files which prepared via 'minectaft-mod' module
org.apache.nplcraft.example.minecraft.utils.GameFilesDump
- * for this supported `minecraft` server version.
*/
class MinecraftValueLoader : NCValueLoader {
private data class Dump(val version: String, val data: Map<String, String>)
diff --git a/nlpcraft-examples/minecraft/src/main/resources/block.json
b/nlpcraft-examples/minecraft/src/main/resources/block.json
index ebefc91..e86e232 100644
--- a/nlpcraft-examples/minecraft/src/main/resources/block.json
+++ b/nlpcraft-examples/minecraft/src/main/resources/block.json
@@ -20,7 +20,6 @@
*/
{
- "version": "1.16.4",
"data": {
"sea lantern": "minecraft:sea_lantern",
"oak fence gate": "minecraft:oak_fence_gate",
diff --git a/nlpcraft-examples/minecraft/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/minecraft/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/minecraft/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/minecraft/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/phone/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/phone/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/phone/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/phone/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/sql/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/sql/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/sql/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/sql/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/time/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/time/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/time/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/time/src/main/resources/probe.conf
diff --git a/nlpcraft-examples/weather/src/main/resources/nlpcraft.conf
b/nlpcraft-examples/weather/src/main/resources/probe.conf
similarity index 100%
rename from nlpcraft-examples/weather/src/main/resources/nlpcraft.conf
rename to nlpcraft-examples/weather/src/main/resources/probe.conf
diff --git a/nlpcraft/src/main/resources/cli/templates.zip
b/nlpcraft/src/main/resources/cli/templates.zip
index 6431847..3267839 100644
Binary files a/nlpcraft/src/main/resources/cli/templates.zip and
b/nlpcraft/src/main/resources/cli/templates.zip differ
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
index 7fcab34..022edd9 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
@@ -282,47 +282,36 @@ object NCConfigurable extends LazyLogging {
* CONFIG_FORCE_nlpcraft_server_rest_host="localhost"
* CONFIG_FORCE_nlpcraft_server_models="com.mymodels.MyModel"
*
+ * @param cfgFile File name.
* @param overrideCfg Optional overriding configuration.
- * @param cfgFileOpt Optional file name.
* @param dfltCfg Optional default config.
* @param valFun Validation method.
*/
def initialize(
+ cfgFile: String,
overrideCfg: Option[Config],
- cfgFileOpt: Option[String],
dfltCfg: Option[Config],
valFun: Config ⇒ Boolean
): Unit = {
- require(cfgFileOpt.isDefined || dfltCfg.isDefined)
+ val tmpCfg = {
+ logger.info(s"Attempting to load/merge configuration from
configuration file: $cfgFile")
- val tmpCfg =
- // Only default configuration is provided.
- if (cfgFileOpt.isEmpty) {
- logger.info(s"Using built-in default configuration.")
+ // Order is: file, URL, resource (File and URL can override
resource)
+ var cfg = ConfigFactory.parseFile(new File(cfgFile))
- ConfigFactory.load(dfltCfg.get)
+ try
+ cfg = cfg.withFallback(ConfigFactory.parseURL(new
URL(cfgFile)))
+ catch {
+ case _: MalformedURLException ⇒ // No-op.
}
- else {
- val name = cfgFileOpt.get
- logger.info(s"Attempting to load/merge configuration from
configuration file: $name")
+ cfg = cfg.withFallback(ConfigFactory.parseResources(cfgFile))
- // Order is: file, URL, resource (File and URL can override
resource)
- var cfg = ConfigFactory.parseFile(new File(name))
+ if (dfltCfg.isDefined)
+ cfg = cfg.withFallback(dfltCfg.get)
- try
- cfg = cfg.withFallback(ConfigFactory.parseURL(new
URL(name)))
- catch {
- case _: MalformedURLException ⇒ // No-op.
- }
-
- cfg = cfg.withFallback(ConfigFactory.parseResources(name))
-
- if (dfltCfg.isDefined)
- cfg = cfg.withFallback(dfltCfg.get)
-
- cfg
- }
+ cfg
+ }
// Validate.
if (!valFun(tmpCfg)) {
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 ddf675e..97238dd 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
@@ -2044,11 +2044,11 @@ object NCCli extends NCCliBase {
def cpCommon(langDir: String, langExt: String): Unit = {
cp(".gitignore", None)
- val (startClause, exampleClause) =
+ val startClause =
langExt match {
- case "java" ⇒ (s"NCEmbeddedProbe.start($clsName.class);",
"Java example")
- case "kt" ⇒
(s"NCEmbeddedProbe.start($clsName::class.java)", "Kotlin example")
- case "scala" ⇒
(s"NCEmbeddedProbe.start(classOf[$clsName])", "Scala example")
+ case "java" ⇒ s"NCEmbeddedProbe.start($clsName.class);"
+ case "kt" ⇒ s"NCEmbeddedProbe.start($clsName::class.java)"
+ case "scala" ⇒ s"NCEmbeddedProbe.start(classOf[$clsName])"
case _ ⇒ throw new AssertionError(s"Unexpected language
extension: $langExt")
}
@@ -2062,7 +2062,7 @@ object NCCli extends NCCliBase {
)
cp(
- s"src/main/resources/nlpcraft.conf",
+ s"src/main/resources/probe.conf",
None,
"com.company.nlp.TemplateModel" → s"$pkgName.$clsName",
"templateModelId" → baseName
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
index 7d294de..a0f7820 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
@@ -132,19 +132,25 @@ private [probe] object NCProbeBoot extends LazyLogging
with NCOpenCensusTrace {
@throws[NCE]
private def initializeConfig(args: Array[String], overrideCfg:
Option[Config]): ProbeConfig = {
NCConfigurable.initialize(
- overrideCfg,
- args.find(_.startsWith("-config=")) match {
+ cfgFile = args.find(_.startsWith("-config=")) match {
case Some(s) ⇒
val cfg = s.substring("-config=".length)
if (!U.isSuitableConfig(cfg))
throw new NCE(s"Specified probe configuration file
does not exist or cannot be read: $cfg")
-
- Some(cfg)
- case None ⇒ Some("nlpcraft.conf")
+
+ cfg
+ case None ⇒
+ if (U.isSuitableConfig("probe.conf"))
+ "probe.conf"
+ else if (U.isSuitableConfig("nlpcraft.conf"))
+ "nlpcraft.conf"
+ else
+ throw new NCE(s"Default probe configuration file does
not exist or cannot be read")
},
- Some(mkDefault()),
- (cfg: Config) ⇒ cfg.hasPath("nlpcraft.probe")
+ overrideCfg = overrideCfg,
+ dfltCfg = Some(mkDefault()),
+ valFun = (cfg: Config) ⇒ cfg.hasPath("nlpcraft.probe")
)
object Cfg extends NCConfigurable {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
index 4be20b5..dabab30 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
@@ -47,7 +47,6 @@ import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.control.Exception._
-
/**
* Model deployment manager.
*/
@@ -469,8 +468,10 @@ object NCDeployManager extends NCService with
DecorateAsScala {
row._2
))
+ println("dupSyns="+dupSyns.size)
+
if (mdl.isDupSynonymsAllowed) {
- logger.trace(s"Duplicate synonyms found in '$mdlId'
model:\n${tbl.toString}")
+ logger.warn(s"Duplicate synonyms found in '$mdlId'
model:\n${tbl.toString}")
logger.warn(s"Duplicate synonyms found in '$mdlId' model -
turn on TRACE logging to see them.")
logger.warn(s" ${b("|--")} NOTE: ID of the model element is
its default built-in synonym - you don't need to add it explicitly to the list
of synonyms.")
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
index b2b9093..1015372 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
@@ -176,21 +176,25 @@ object NCServer extends App with NCIgniteInstance with
LazyLogging with NCOpenCe
setSysProps()
NCConfigurable.initialize(
- None, // No overrides.
- args.find(_.startsWith("-config=")) match {
+ cfgFile = args.find(_.startsWith("-config=")) match {
case Some(s) ⇒
val cfg = s.substring("-config=".length)
if (!U.isSuitableConfig(cfg))
throw new NCE(s"Specified server configuration file
does not exist or cannot be read: $cfg")
- Some(cfg)
-
+ cfg
case None ⇒
- Some("nlpcraft.conf") // Default to 'nlpcraft.conf'.
+ if (U.isSuitableConfig("server.conf"))
+ "server.conf"
+ else if (U.isSuitableConfig("nlpcraft.conf"))
+ "nlpcraft.conf"
+ else
+ throw new NCE(s"Default server configuration file does
not exist or cannot be read")
},
- None, // No defaults.
- (cfg: Config) ⇒ cfg.hasPath("nlpcraft.server")
+ overrideCfg = None, // No overrides.
+ dfltCfg = None, // No defaults.
+ valFun = (cfg: Config) ⇒ cfg.hasPath("nlpcraft.server")
)
asciiLogo()