Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8046C200C92 for ; Mon, 12 Jun 2017 18:18:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7EEE6160BD9; Mon, 12 Jun 2017 16:18:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9F5B0160BD6 for ; Mon, 12 Jun 2017 18:18:04 +0200 (CEST) Received: (qmail 11544 invoked by uid 500); 12 Jun 2017 16:18:03 -0000 Mailing-List: contact issues-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list issues@karaf.apache.org Received: (qmail 11533 invoked by uid 99); 12 Jun 2017 16:18:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jun 2017 16:18:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 7215418040F for ; Mon, 12 Jun 2017 16:18:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id tEsbzffU7-DZ for ; Mon, 12 Jun 2017 16:18:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 495365F4EE for ; Mon, 12 Jun 2017 16:18:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6E832E01D8 for ; Mon, 12 Jun 2017 16:18:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2C8B221D8E for ; Mon, 12 Jun 2017 16:18:00 +0000 (UTC) Date: Mon, 12 Jun 2017 16:18:00 +0000 (UTC) From: "Denis Jouvin (JIRA)" To: issues@karaf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KARAF-5202) Groovy and groovysh integration into Karaf console MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 12 Jun 2017 16:18:05 -0000 [ https://issues.apache.org/jira/browse/KARAF-5202?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1604= 6735#comment-16046735 ]=20 Denis Jouvin commented on KARAF-5202: ------------------------------------- Here is the help from the Groovy side, including help on the 3 OSGi and Kar= af related Groovy commands introduced in my prototype implementation ({{:os= gi-service}}, {{:blueprint}} and {{:karaf}}). The 2 first commands (prefixed with {{get}} and in camel-case), are also av= ailable as Groovy closures (accessible from the current Groovysh session bi= nding). {noformat} groovy:000> :help Available commands: :help (:h ) Display this help message ? (:? ) Alias to: :help :exit (:x ) Exit the shell :quit (:q ) Alias to: :exit import (:i ) Import a class into the namespace :display (:d ) Display the current buffer :clear (:c ) Clear the buffer and reset the prompt counter :show (:S ) Show variables, classes or imports :inspect (:n ) Inspect a variable or the last result with the GUI o= bject browser :purge (:p ) Purge variables, classes, imports or preferences :edit (:e ) Edit the current buffer :load (:l ) Load a file or URL into the buffer . (:. ) Alias to: :load :save (:s ) Save the current buffer to a file :record (:r ) Record the current session to a file :history (:H ) Display, manage and recall edit-line history :alias (:a ) Create an alias :set (:=3D ) Set (or list) preferences :register (:rc) Register a new command with the shell :doc (:D ) Open a browser window displaying the doc for the arg= ument :osgi-service (:os) Resolve an OSGi service and assign it to a variable :blueprint (:bp) Resolve a blueprint container and assign it to a var= iable :karaf (:k ) Executes a Karaf command (from current Karaf session= ) For help on a specific command type: :help command groovy:000> :help :karaf usage: :karaf [ [ [...]]] Executes a Karaf command from the current Karaf session.Arguments are passe= d through without specific (un)escaping or (un)quoting that may happen atGroovy or Karaf side. A tric= k is to escape double-quoted arguments in single-quotes and vice versa. groovy:000> :help :osgi-service usage: :osgi-service [] Resolve the best matching OSGi service with the given interface, (i.e. with= the highest ranking and, if equal, lowest ID), possibly using the given LDAP filter if any, and bin= d it a local variable groovy:000> :help :blueprint usage: :blueprint [] Resolves the blueprint container OSGi service for the given bundle symboli= c name (and version if specified), and binds it to a shell variable. {noformat} > Groovy and groovysh integration into Karaf console > -------------------------------------------------- > > Key: KARAF-5202 > URL: https://issues.apache.org/jira/browse/KARAF-5202 > Project: Karaf > Issue Type: New Feature > Components: karaf-shell > Reporter: Denis Jouvin > Assignee: Jean-Baptiste Onofr=C3=A9 > Priority: Minor > Labels: Groovy, Groovysh, Karaf, ShellCommands > > The idea is to integrate Groovy into Karaf as an alternative scripting an= d/or interactive shell language. Since Groovysh also uses JLine, integratio= n is quite easy (pass the current Jline console/session instance to Groovys= h at construction time). There are some class loading issues though since G= roovy uses sometimes the TCCL even when we instruct it to use a given class= loader (I opened a Groovy JIRA issue about that). > The Groovysh shell then would allow to get OSGi service reference or Blue= print/Spring context references, or execute Karaf commands. Groovysh has a = very nice command completion feature that enable to discover any objet (inc= luding OSGi service instance) API at runtime, which makes it very easy to p= lay with in a dynamic environment like Karaf. In addition, its native closu= res and set operations, and very concise syntaxe, facilitates its use as a = shell replacement. > This open nice possibilites like exploratory programming on a live runnin= g Karaf instance, scripting, tests or analysis, etc. > Another common use case is to modify a not yet parameterized value in a B= lueprint or Spring context at runtime (you can browse or access the Bluepri= nt context components, and reinstaciate them or inject properties). -- This message was sent by Atlassian JIRA (v6.4.14#64029)