I’m currently trying to implement a custom shell command for Felix using iPOJO. My sample implementation looks like:
import java.io.PrintStream;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.shell.Command;
@Component(immediate = true)
@Provides
public class SampleCommand implements Command {
@Override
public String getName() {
return "testcmd";
}
@Override
public String getUsage() {
return "testcmd";
}
@Override
public String getShortDescription() {
return "test command";
}
@Override
public void execute(String line, PrintStream out, PrintStream err) {
out.println("execute testcmd!");
}
}
When I deploy the Bundle on Felix, my SampleCommand gets instantiated and the getName() gets called. But when I try to execute “testcmd” on the shell, I get:
gogo: CommandNotFoundException: Command not found: testcmd
Are there any further points I need to consider?
Based on the feedback given above by user1231484 and earcam, here a minimal working example: