Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A5AC518DE0 for ; Mon, 27 Apr 2015 08:24:41 +0000 (UTC) Received: (qmail 14183 invoked by uid 500); 27 Apr 2015 08:24:41 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 14155 invoked by uid 500); 27 Apr 2015 08:24:41 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 14146 invoked by uid 99); 27 Apr 2015 08:24:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 08:24:41 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [54.164.171.186] (HELO mx1-us-east.apache.org) (54.164.171.186) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 08:24:36 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 7C6EF43BAD for ; Mon, 27 Apr 2015 08:24:16 +0000 (UTC) Received: (qmail 13588 invoked by uid 99); 27 Apr 2015 08:24:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 08:24:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C617FDFF44; Mon, 27 Apr 2015 08:24:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anovikov@apache.org To: commits@ignite.incubator.apache.org Message-Id: <6357fe20a8e84d5d88c7c16b3a4d9296@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: # ignite-gg-9830 WIP Date: Mon, 27 Apr 2015 08:24:15 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-ignite Updated Branches: refs/heads/ignite-gg-9830 2116b887f -> b80d41ba6 # ignite-gg-9830 WIP Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b80d41ba Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b80d41ba Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b80d41ba Branch: refs/heads/ignite-gg-9830 Commit: b80d41ba6aee7ab63c7e74ca0619cb76c4d09771 Parents: 2116b88 Author: Andrey Authored: Mon Apr 27 15:23:16 2015 +0700 Committer: Andrey Committed: Mon Apr 27 15:23:16 2015 +0700 ---------------------------------------------------------------------- .../ignite/visor/commands/VisorConsole.scala | 5 +- .../commands/events/VisorEventsCommand.scala | 54 ++++++++++++-------- 2 files changed, 38 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b80d41ba/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala index daca942..25709d0 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala @@ -202,7 +202,10 @@ class VisorConsole { case _ => adviseToHelp(line) } } catch { - case ignore: Exception => adviseToHelp(line) + case ignore: Exception => + ignore.printStackTrace() + + adviseToHelp(line) } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b80d41ba/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala index 2299c4a..c96c8ac 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala @@ -137,25 +137,35 @@ class VisorEventsCommand extends VisorConsoleCommand { } } + /** + * Gets type filter by mnemonics. + * @param typeArg Type mnemonics. + * @throws IllegalArgumentException In case unknown event mnemonic. + * @return Type id filter. + */ + @throws[IllegalArgumentException]("In case unknown event mnemonic.") protected def typeFilter(typeArg: Option[String]) = { - if (typeArg.isEmpty) - null - else { - val arr = collection.mutable.ArrayBuffer.empty[Int] - - typeArg.get split "," foreach { - case "ch" => arr ++= EVTS_CHECKPOINT.toList - case "de" => arr ++= EVTS_DEPLOYMENT.toList - case "jo" => arr ++= EVTS_JOB_EXECUTION.toList - case "ta" => arr ++= EVTS_TASK_EXECUTION.toList - case "ca" => arr ++= EVTS_CACHE.toList - case "cr" => arr ++= EVTS_CACHE_REBALANCE.toList - case "sw" => arr ++= EVTS_SWAPSPACE.toList - case "di" => arr ++= EVTS_DISCOVERY.toList - case t => throw new IllegalArgumentException("Unknown event type: " + t) - } + typeArg.map(_.split(",").map(typeIds).flatten).orNull + } - arr.toArray + /** + * Gets type filter by mnemonic. + * @param mnemonic Type mnemonic. + * @throws IllegalArgumentException In case unknown event mnemonic. + * @return Type id filter. + */ + @throws[IllegalArgumentException]("In case unknown event mnemonic.") + protected def typeIds(mnemonic: String) = { + mnemonic match { + case "ch" => EVTS_CHECKPOINT + case "de" => EVTS_DEPLOYMENT + case "di" => EVTS_DISCOVERY + case "jo" => EVTS_JOB_EXECUTION + case "ta" => EVTS_TASK_EXECUTION + case "ca" => EVTS_CACHE + case "cr" => EVTS_CACHE_REBALANCE + case "sw" => EVTS_SWAPSPACE + case t => throw new IllegalArgumentException("Unknown event mnemonic: " + t) } } @@ -163,19 +173,23 @@ class VisorEventsCommand extends VisorConsoleCommand { * Gets command's mnemonic for given event. * * @param e Event to get mnemonic for. + * @throws IllegalArgumentException In case unknown event type. + * @return Type mnemonic. */ - private def mnemonic(e: VisorGridEvent): String = { + @throws[IllegalArgumentException]("In case unknown event type.") + protected def mnemonic(e: VisorGridEvent) = { assert(e != null) e.typeId() match { - case t if EVTS_DISCOVERY_ALL.contains(t) => "di" case t if EVTS_CHECKPOINT.contains(t) => "ch" case t if EVTS_DEPLOYMENT.contains(t) => "de" + case t if EVTS_DISCOVERY_ALL.contains(t) => "di" case t if EVTS_JOB_EXECUTION.contains(t)=> "jo" case t if EVTS_TASK_EXECUTION.contains(t) => "ta" case t if EVTS_CACHE.contains(t) => "ca" - case t if EVTS_SWAPSPACE.contains(t) => "sw" case t if EVTS_CACHE_REBALANCE.contains(t) => "cr" + case t if EVTS_SWAPSPACE.contains(t) => "sw" + case t => throw new IllegalArgumentException("Unknown event type: " + t) } }