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] [Commented] (KARAF-5202) Groovy and groovysh integration into Karaf console
Date Mon, 12 Jun 2017 14:49:00 GMT

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

Denis Jouvin commented on KARAF-5202:

Exemple session 1 (extracted from a live session in a ServbiceMix instance):

Enter Groovy interactive shell, then get a reference to a CXF Bus service (the default one),
then check the ID of that bus, and get the list of interceptors and their IDs. Then remove
the logging interceptor. Then shutdown the bus and restart the bus.

Then get a CXF bus named bus-siri (using service properties), and play with it.

ServiceMix-5.0.0:7412003A@root> groovy -r bus=org.apache.cxf.Bus
groovy:000> bus.  [tab bey pressed to get automatic completion of the bus object]
doInitializeInternal()         getExtension(                  hasExtensionByName(        
loadAdditionalFeatures()   run()                          setExtension(                  shutdown(
shutdown()                     blueprintContainer         bundleContext              features
id                         inFaultInterceptors            inInterceptors                 outFaultInterceptors
outInterceptors                properties                     state
groovy:000> bus.id
===> bus-halles-icv
groovy:000> bus.inInterceptors
===> [org.apache.cxf.ws.policy.PolicyInInterceptor@e6cffa6, org.apache.cxf.interceptor.LoggingInInterceptor@3713a669]
groovy:000> bus.inInterceptors*.id
===> [org.apache.cxf.ws.policy.PolicyInInterceptor, org.apache.cxf.interceptor.LoggingInInterceptor]
groovy:000> bus.inInterceptors.removeAll { it.id == 'org.apache.cxf.interceptor.LoggingInInterceptor'
===> [org.apache.cxf.ws.policy.PolicyInInterceptor@e6cffa6]
groovy:000> bus.state
===> null
===> null

groovy:000> :os busSiri org.apache.cxf.Bus (cxf.bus.id=bus-siri)
===> org.apache.cxf.bus.blueprint.BlueprintBus@60891a68
groovy:000> // alternative methode: using getOsgiService closure
===> true
groovy:000> busSiri = getOsgiService('org.apache.cxf.Bus', '(cxf.bus.id=bus-siri)')
===> org.apache.cxf.bus.blueprint.BlueprintBus@60891a68

> 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.
> The Groovysh shell then would allow to get OSGi service reference, or Blueprint/Spring
context references. 
> This open some possibilites like exploratory programming, scripting, live tests or analysis,

This message was sent by Atlassian JIRA

View raw message