karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Jouvin (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (KARAF-5202) Groovy and groovysh integration into Karaf console
Date Mon, 12 Jun 2017 16:22:00 GMT

    [ https://issues.apache.org/jira/browse/KARAF-5202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16046604#comment-16046604
] 

Denis Jouvin edited comment on KARAF-5202 at 6/12/17 4:21 PM:
--------------------------------------------------------------

Here is the help of the prototype implementation I have produced:

{noformat}
ServiceMix-5.0.0:7412003A@root> groovy --help
DESCRIPTION
        sncf:groovy

        Run an interactive Groovy session (use ":exit" to return to Karaf console)

SYNTAX
        sncf:groovy [options]

OPTIONS
        --command, -c
                Execute the given Groovy command, without entering interactive shell
                Exclusive with the -s (--script) and -l (--load) options
        --help
                Display this help message
        --enable-package-loading
                Enable packages pre-loading (disabled by default since very slow in OSGi)
        --reset-shell
                Reset the Groovysh shell (new instance)
        --reference, -r
                Resolve and assign OSGi service(s) in Groovy shell variables, in the form
                serviceName1=serviceInterface1(ldapFilter1),serviceName2=serviceInterface2(ldapFilter2),...
                The LDAP filter is optional. Only the best matching service found is returned.
        --import, -i
                Imports the specified packages or classes into Groovy, in the form qualifiedName1,qualifiedName2,...
        --load, -l
                Execute the given Groovy script list, in the form scriptUrlOrPath1,scriptUrlOrPath2,...
by loading them to an interactive Groovy shell
                Equivalent to the Groovy :load command. Exclusive with -c (--command) and
-s (--script) options
        --variable, -v
                Import specific Karaf variables in Groovy shell, in the form variableName1,variableName2,...
        --script, -s
                Execute the given Groovy script, in a separate Groovy dedicated (non interactive)
interpreter
                Exclusive with -c (--command) and -l (--load) options
{noformat}



was (Author: djouvin):
Here is the help of the prototype implementation I have produced:

{code}
ServiceMix-5.0.0:7412003A@root> groovy --help
DESCRIPTION
        sncf:groovy

        Run an interactive Groovy session (use ":exit" to return to Karaf console)

SYNTAX
        sncf:groovy [options]

OPTIONS
        --command, -c
                Execute the given Groovy command, without entering interactive shell
                Exclusive with the -s (--script) and -l (--load) options
        --help
                Display this help message
        --enable-package-loading
                Enable packages pre-loading (disabled by default since very slow in OSGi)
        --reset-shell
                Reset the Groovysh shell (new instance)
        --reference, -r
                Resolve and assign OSGi service(s) in Groovy shell variables, in the form
                serviceName1=serviceInterface1(ldapFilter1),serviceName2=serviceInterface2(ldapFilter2),...
                The LDAP filter is optional. Only the best matching service found is returned.
                (defaults to )
        --import, -i
                Imports the specified packages or classes into Groovy, in the form qualifiedName1,qualifiedName2,...
                (defaults to )
        --load, -l
                Execute the given Groovy script list, in the form scriptUrlOrPath1,scriptUrlOrPath2,...
by loading them to an interactive Groovy shell
                Equivalent to the Groovy :load command. Exclusive with -c (--command) and
-s (--script) options
        --variable, -v
                Import specific Karaf variables in Groovy shell, in the form variableName1,variableName2,...
                (defaults to )
        --script, -s
                Execute the given Groovy script, in a separate Groovy dedicated (non interactive)
interpreter
                Exclusive with -c (--command) and -l (--load) options
{code}


> 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é
>            Priority: Minor
>              Labels: Groovy, Groovysh, Karaf, ShellCommands
>
> The idea is to integrate Groovy into Karaf as an alternative scripting and/or interactive
shell language. Since Groovysh also uses JLine, integration is quite easy (pass the current
Jline console/session instance to Groovysh at construction time). There are some class loading
issues though since Groovy 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 Blueprint/Spring
context references, or execute Karaf commands. Groovysh has a very nice command completion
feature that enable to discover any objet (including OSGi service instance) API at runtime,
which makes it very easy to play with in a dynamic environment like Karaf. In addition, its
native closures and set operations, and very concise syntaxe, facilitates its use as a shell
replacement.
> This open nice possibilites like exploratory programming on a live running Karaf instance,
scripting, tests or analysis, etc.
> Another common use case is to modify a not yet parameterized value in a Blueprint or
Spring context at runtime (you can browse or access the Blueprint context components, and
reinstaciate them or inject properties).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message