It's a OSGi service: Karaf shell looks for the OSGi service corresponding to the interface you define by annotation.

Regards
JB

On 04/01/2016 03:11 PM, Cristiano Costantini wrote:
Yeah!
that's what I'm searching to achieve...

I've finally found the documentation page at
https://karaf.apache.org/manual/latest/developers-guide/extending.html

and in my initial attempts, I also was missing that it is required to
add this instruction on the pom:
<plugin>

     <groupId>org.apache.felix</groupId>
     <artifactId>maven-bundle-plugin</artifactId>
     <configuration>
         <instructions>
             <Karaf-Commands>*</Karaf-Commands>
         </instructions>
     </configuration>
</plugin>


but I still don't understand how @Reference works... it is not explained
on the guide:

In the Jdbc command example,

@Reference
private JdbcService jdbcService;

how the JdbcService it injected? is it resolved from OSGi services?

Thank you
Cristiano



Il giorno ven 1 apr 2016 alle ore 14:59 Morgan Hautman
<[email protected] <mailto:[email protected]>> ha scritto:

    Hi Christiano,

    If you mean custom commands, the jdbc command is an example:
    
https://github.com/apache/karaf/tree/master/jdbc/src/main/java/org/apache/karaf/jdbc/command

    Regards,
    Morgan

    2016-04-01 14:26 GMT+02:00 Cristiano Costantini
    <[email protected]
    <mailto:[email protected]>>:

        Hi all,
        in my application I've developed some shell command using the
        now @Deprecated org.apache.karaf.shell.console.OsgiCommandSupport

        Is there any guide or can you suggest me an example on how to
        implement the commands with the new API?

        Thanks.
        Cristiano



--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to