You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2015/11/20 17:34:11 UTC
[jira] [Resolved] (KARAF-4118) Command service declaration doesn't
work
[ https://issues.apache.org/jira/browse/KARAF-4118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jean-Baptiste Onofré resolved KARAF-4118.
-----------------------------------------
Resolution: Fixed
> Command service declaration doesn't work
> ----------------------------------------
>
> Key: KARAF-4118
> URL: https://issues.apache.org/jira/browse/KARAF-4118
> Project: Karaf
> Issue Type: Bug
> Components: karaf-shell
> Affects Versions: 4.0.2, 4.0.3
> Reporter: Jean-Baptiste Onofré
> Assignee: Jean-Baptiste Onofré
> Fix For: 4.0.4
>
>
> Before Karaf 4, it was possible to define command by "declaration".
> For instance, having a simple class like this:
> {code}
> package net.nanthrax.test.shell;
> public class HelloCommand {
> public String hello() {
> return "hello";
> }
> }
> {code}
> It was possible to "declare" a command (for instance using blueprint):
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
> <bean id="helloCommand" class="net.nanthrax.test.shell.HelloCommand"/>
> <service ref="helloCommand" auto-export="class-hierarchy">
> <service-properties>
> <entry key="osgi.command.scope" value="hello"/>
> <entry key="osgi.command.function">
> <array>
> <value>hello</value>
> </array>
> </entry>
> </service-properties>
> </service>
> </blueprint>
> {code}
> However, in Karaf 4, the command is not found.
> The cause comes from the org.apache.karaf.shell.compat.CommandTracker: if the class doesn't implement one of the two interfaces (org.apache.karaf.shell.commands.CommandWithAction or org.apache.felix.gogo.commands.CommandWithAction interface), the command is not register.
> So basically, I gonna add the case where the class doesn't implement any interface ;)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)