Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-5202

Groovy and groovysh integration into Karaf console




      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).




            • Assignee:
              djouvin Denis Jouvin
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: