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/17 17:18:11 UTC
[jira] [Created] (KARAF-4118) Command service declaration doesn't
work
Jean-Baptiste Onofré created KARAF-4118:
-------------------------------------------
Summary: 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.3, 4.0.2
Reporter: Jean-Baptiste Onofré
Assignee: Jean-Baptiste Onofré
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)