karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: What's the current model for console commands?
Date Tue, 18 Jul 2017 15:39:13 GMT
Hi Steinar,

you can take a look on the documentation:


Especially the "By hand" section which is up to date.

You will see the annotations from the new Shell API, including the @Service 
"new" one.

As a complete example, you can take a look on any Karaf internal commands.


On 07/18/2017 05:24 PM, Steinar Bang wrote:
> I need to create a very simple console command to provide a way to
> forcibly unlock a liquibase changelog lock (can be left in place as
> locked if the liquibase update code crashes during a changelog update).
> However I have a hard time figuring out how to do this.
> The descriptions that google digs up are very much out of date.
>    https://karaf.apache.org/manual/latest-2.x/developers-guide/extending-console.html
>    http://icodebythesea.blogspot.no/2011/11/creating-your-own-apache-karaf-console.html
> The classes these documents refer to have changed their package names,
> have been deprecated for the last 3 years, as a fix for this issue:
>    https://issues.apache.org/jira/browse/KARAF-2805
> What I would have liked to do, was to register an OSGi service and have
> karaf pick it up.  But that sounds like the whiteboarding pattern and
> that ended up as a won't fix:
>    https://issues.apache.org/jira/browse/KARAF-2762
> Is the current way, the following?
>   1. Create a class that implements the interface
>      org.apache.karaf.shell.api.action.Action
>   2. Add a @Service annotation to the class
>   3. Karaf will find an instantiate this class
> (If so, then that's not ideal, because then that action class will need
> to use some kind of singleton to get to the OSGi services it needs...)
> Thanks!
> - Steinar

Jean-Baptiste Onofré
Talend - http://www.talend.com

View raw message