Description
Before Karaf 4, it was possible to define command by "declaration".
For instance, having a simple class like this:
package net.nanthrax.test.shell; public class HelloCommand { public String hello() { return "hello"; } }
It was possible to "declare" a command (for instance using blueprint):
<?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>
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
Attachments
Issue Links
- is duplicated by
-
KARAF-4183 Plain gogo commands (for scr) don't work from the karaf shell
- Resolved