Dear all,

I am using Karaf 2.1.0 and want to extend the shell with my own shell-commands.
There's a great tutorial showing how to do this with blueprint.
http://karaf.apache.org/manual/2.1.99-SNAPSHOT/developers-guide/extending-console.html

I was trying to do this with iPojo but did not succeed. That's the sample I was 
trying to run.

public interface SampleTUI {

      // the supported operations on the shell we're extending
      String FUNCTION_STR = "[list]";

      // will be used in the activator to define the namespace within the shell
      String SCOPE = "preserv";

      public void list();

}

@Component(name="sample.addons.api.command.KarafSampleTUI")
@Provides
public class KarafSampleTUI implements SampleTUI {

      // the supported operations on the shell we're extending
      @ServiceProperty(name="osgi.command.function", 
value=ServiceRegistryTUI.FUNCTION_STR)
      public String[] functions;
      // will be used in the activator to define the namespace within the shell
      @ServiceProperty(name="osgi.command.scope", 
value=ServiceRegistryTUI.SCOPE)
      public String scope;

      //these fields are injected
      //@Requires
      //private MyUtils mu;


      @Descriptor("some sample description")
      public void list() {
            System.out.println("testing list");
      }
}

<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xsi:schemaLocation="org.apache.felix.ipojo 
http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd
          org.apache.felix.ipojo.extender 
http://felix.apache.org/ipojo/schemas/CURRENT/extender-pattern.xsd";
      xmlns="org.apache.felix.ipojo">

      <instance component="sample.addons.api.command.KarafSampleTUI"/>

</ipojo>

It perfectly runs within Felix using gogo, but not in karaf (using Felix). Is 
this specific to gogo?
I also had a look at apache\felix\ipojo\arch\ and apache\felix\ipojo\arch\gogo 
but both aren't working in karaf as well.

Thanks for your support,
Kr Andrew

Reply via email to