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 15:09:00 GMT

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

Denis Jouvin edited comment on KARAF-5202 at 6/12/17 3:08 PM:
--------------------------------------------------------------

Exemple session 2 (also extracted from a ServiceMix 5.0.0 console = Karaf 2.3.4)

Grab a Blueprint context from bundle ActiveMQ, then play with it.

{noformat}
ServiceMix-5.0.0:7412003A@root> groovy
groovy:000> :karaf list -s|grep -i activemq
[  82] [Active     ] [Created     ] [       ] [   50] org.apache.activemq.activemq-osgi (5.9.0)
[  83] [Active     ] [Created     ] [       ] [   50] activemq-karaf (5.9.0)
[  96] [Active     ] [            ] [       ] [   50] org.apache.activemq.activeio-core (3.1.4)
[ 101] [Active     ] [Created     ] [       ] [   50] activemq-service (5.0.0)
groovy:000> :bp amqBP activemq-service
===> org.apache.aries.blueprint.container.BlueprintContainerImpl@61c9708f
groovy:000> amqBP.componentIds
===> [blueprintContainer, blueprintBundle, blueprintBundleContext, blueprintConverter,
activemqConnectionFactory, pooledConnectionFactory, jmsXaPoolConnectionFactory, jmsXaConnectionFactory,
resourceManager, osgiJtaTransactionManager, .component-1, .component-2, .ext-26, org.apache.aries.managedObjectManager,
.cm-39]
groovy:000> amqRM = amqBP.getComponentInstance 'resourceManager'
===> org.apache.activemq.pool.ActiveMQResourceManager@6afcda3d
groovy:000> amqRM.
recoverResource()    connectionFactory    password             resourceName         transactionManager
userName
groovy:000> amqRM.resourceName
===> activemq.amq-broker
(...)
{noformat}





was (Author: djouvin):
Exemple session 2 (also extracted from a ServiceMix 5.0.0 console = Karaf 2.3.4)

Grab a Blueprint context from bundle ActiveMQ, then play with it.

{noformat}
groovy:000> :karaf list -s|grep -i activemq
[  82] [Active     ] [Created     ] [       ] [   50] org.apache.activemq.activemq-osgi (5.9.0)
[  83] [Active     ] [Created     ] [       ] [   50] activemq-karaf (5.9.0)
[  96] [Active     ] [            ] [       ] [   50] org.apache.activemq.activeio-core (3.1.4)
[ 101] [Active     ] [Created     ] [       ] [   50] activemq-service (5.0.0)
groovy:000> :bp amqBP activemq-service
===> org.apache.aries.blueprint.container.BlueprintContainerImpl@61c9708f
groovy:000> amqBP.componentIds
===> [blueprintContainer, blueprintBundle, blueprintBundleContext, blueprintConverter,
activemqConnectionFactory, pooledConnectionFactory, jmsXaPoolConnectionFactory, jmsXaConnectionFactory,
resourceManager, osgiJtaTransactionManager, .component-1, .component-2, .ext-26, org.apache.aries.managedObjectManager,
.cm-39]
groovy:000> amqRM = amqBP.getComponentInstance 'resourceManager'
===> org.apache.activemq.pool.ActiveMQResourceManager@6afcda3d
groovy:000> amqRM.
recoverResource()    connectionFactory    password             resourceName         transactionManager
userName
groovy:000> amqRM.resourceName
===> activemq.amq-broker
(...)
{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)

Mime
View raw message