You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/01/25 18:40:07 UTC

[incubator-nlpcraft] branch NLPCRAFT-111 updated (31ab7cf -> a581129)

This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a change to branch NLPCRAFT-111
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git.


    from 31ab7cf  WIP.
     add bff04ca  Update NCExternalConfigManager.scala
     add 9077ce6  Sql generator tool test added.
     add 1107db2  Merge branch 'master' into NLPCRAFT-228
     add b28cb3f  Minor fix.
     add 79ad8cf  WIP.
     add 861373f  Merge branch 'master' into NLPCRAFT-211
     add 409ad8d  Merge branch 'master' into NLPCRAFT-228
     new a581129  WIP.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nlpcraft/pom.xml                                   |  2 +-
 .../common/extcfg/NCExternalConfigManager.scala    | 29 ++++++---
 .../nlpcraft/examples/sql/NCSqlGeneratorSpec.scala | 70 ++++++++++++++++++++++
 3 files changed, 91 insertions(+), 10 deletions(-)
 create mode 100644 nlpcraft/src/test/scala/org/apache/nlpcraft/examples/sql/NCSqlGeneratorSpec.scala


[incubator-nlpcraft] 01/01: WIP.

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch NLPCRAFT-111
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit a58112941015e2ec18da0256e340f4682eda183e
Merge: 31ab7cf 409ad8d
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Mon Jan 25 10:39:54 2021 -0800

    WIP.

 nlpcraft/pom.xml                                   |  2 +-
 .../common/extcfg/NCExternalConfigManager.scala    | 29 ++++++---
 .../nlpcraft/examples/sql/NCSqlGeneratorSpec.scala | 70 ++++++++++++++++++++++
 3 files changed, 91 insertions(+), 10 deletions(-)

diff --cc nlpcraft/src/main/scala/org/apache/nlpcraft/common/extcfg/NCExternalConfigManager.scala
index 940b3b1,3fe9379..1923cbd
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/extcfg/NCExternalConfigManager.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/extcfg/NCExternalConfigManager.scala
@@@ -205,15 -183,33 +205,33 @@@ object NCExternalConfigManager extends 
      }
  
      /**
+      *
+      * @param typ Resource type.
+      * @param res Resource name.
+      * @return
+      */
 -    private def mkFile(typ: NCResourceType, res: String): File = {
++    private def mkFile(typ: NCExternalConfigType, res: String): File = {
+         val file = new File(Config.dir, getResourcePath(typ, res))
+ 
+         if (!file.exists() || !file.canRead)
+             throw new NCE(
+                 s"Configuration file '$res' not found or not readable. Delete all files from an external " +
+                 s"configuration folder '${Config.dir}' and restart."
+             )
+ 
+         file
+     }
+ 
+     /**
        *
        * @param typ
        * @param res
        * @param parent Parent tracing span.
        */
      @throws[NCE]
 -    def getContent(typ: NCResourceType, res: String, parent: Span = null): String =
 +    def getContent(typ: NCExternalConfigType, res: String, parent: Span = null): String =
          startScopedSpan("getContent", parent, "res" → res) { _ ⇒
-             mkString(U.readFile(mkExtFile(typ, res), "UTF-8"))
+             mkString(U.readFile(mkFile(typ, res), "UTF-8"))
          }
  
      /**
@@@ -223,9 -219,9 +241,9 @@@
        * @param parent Parent tracing span.
        */
      @throws[NCE]
 -    def getStream(typ: NCResourceType, res: String, parent: Span = null): InputStream =
 +    def getStream(typ: NCExternalConfigType, res: String, parent: Span = null): InputStream =
          startScopedSpan("getStream", parent, "res" → res) { _ ⇒
-             new BufferedInputStream(new FileInputStream(mkExtFile(typ, res)))
+             new BufferedInputStream(new FileInputStream(mkFile(typ, res)))
          }
  
      /**