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 2020/10/15 05:33:57 UTC

[incubator-nlpcraft] branch master updated: WIP on NLPCRAFT-148.

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 79e93ae  WIP on NLPCRAFT-148.
     new 2ea3e83  Merge branch 'master' of https://github.com/apache/incubator-nlpcraft
79e93ae is described below

commit 79e93aee88188220863e3d75894d9d88e56d2579
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Wed Oct 14 22:33:46 2020 -0700

    WIP on NLPCRAFT-148.
---
 .../src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala  | 8 ++++++++
 .../scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala     | 6 ++++++
 .../src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala    | 6 ++++++
 nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala | 6 ++++++
 4 files changed, 26 insertions(+)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
index 266b880..7890583 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
@@ -48,6 +48,8 @@ import org.apache.commons.io.IOUtils
 import org.apache.nlpcraft.common._
 import org.apache.nlpcraft.common.ansi.NCAnsi._
 import org.apache.nlpcraft.common.blowfish.NCBlowfishHasher
+import org.jsoup.Jsoup
+import org.jsoup.nodes.Document
 import resource._
 
 import scala.annotation.tailrec
@@ -1255,6 +1257,12 @@ object NCUtils extends LazyLogging {
                 a.close()
             }
 
+    /**
+     *
+     * @param url
+     */
+    def getUrlDocument(url: String): Option[Document] =
+        Option(scala.util.Try { Jsoup.connect(url).get() } getOrElse null)
 
     /**
       * Formats given double number with provided precision.
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 1959aa9..0b44165 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
@@ -2547,6 +2547,12 @@ object NCCli extends App {
      * @param args
      */
     private def boot(args: Array[String]): Unit = {
+        // Check version.
+        new Thread() {
+            override def run(): Unit = U.getUrlDocument("https://nlpcraft.apache.org/vercheck/cli.html")
+        }
+        .start()
+
         // Initialize OS-aware terminal.
         term = TerminalBuilder.builder()
             .name(NAME)
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 0d3f5fe..e5d10c7 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
@@ -169,6 +169,12 @@ private [probe] object NCProbeBoot extends LazyLogging with NCOpenCensusTrace {
       * @param fut
       */
     private def start0(cfg: ProbeConfig, fut: CompletableFuture[Integer]): Unit = {
+        // Check version.
+        new Thread() {
+            override def run(): Unit = U.getUrlDocument("https://nlpcraft.apache.org/vercheck/probe.html")
+        }
+        .start()
+
         probeThread = Thread.currentThread()
         
         asciiLogo()
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 f45b89c..f47fd13 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
@@ -350,6 +350,12 @@ object NCServer extends App with NCIgniteInstance with LazyLogging with NCOpenCe
             save()
     }
 
+    // Check version.
+    new Thread() {
+        override def run(): Unit = U.getUrlDocument("https://nlpcraft.apache.org/vercheck/server.html")
+    }
+    .start()
+
     NCIgniteRunner.runWith(
         args.find(_.startsWith("-igniteConfig=")) match {
             case None ⇒ null // Will use default on the classpath 'ignite.xml'.