[
https://issues.apache.org/jira/browse/KARAF-5202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16046647#comment-16046647
]
Denis Jouvin edited comment on KARAF-5202 at 6/12/17 3:10 PM:
--------------------------------------------------------------
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.
{noformat}
ServiceMix-5.0.0:7412003A@root> groovy -r bus=org.apache.cxf.Bus
groovy:000> bus.
doInitializeInternal() getExtension(
hasExtensionByName( initialize()
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
===> RUNNING
groovy:000>bus.shutdown()
===> null
groovy:000>bus.run()
===> 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
(...)
{noformat}
was (Author: djouvin):
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.
{noformat}
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( initialize()
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
===> RUNNING
groovy:000>bus.shutdown()
===> null
groovy:000>bus.run()
===> 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
(...)
{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é
> 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, etc.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)