Quantcast

Is this supposed to work? Karaf command question.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is this supposed to work? Karaf command question.

gcr44
All,

I have a command, very simple, that works in the bndtools runtime with Felix.  But in Karaf, the bundle shows as active but when run

karaf@root()> cmd
Command not found: cmd

I've included the actual code, below.  I simply want to know if this kind of thing works in Karaf?  The command is question is titled cmd, which does nothing more than a sys out.

Thanks mucho

package iop.ahz.cmd;

import iop.hadoop.driver.HadoopDriver;
import iop.hadoop.driver.impl.HadoopDriverImpl;

import org.apache.felix.service.command.CommandProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import aQute.bnd.annotation.component.Activate;
import aQute.bnd.annotation.component.Component;
import aQute.bnd.annotation.component.Reference;

@Component(properties = { CommandProcessor.COMMAND_SCOPE + ":String=ahz",
                CommandProcessor.COMMAND_FUNCTION + ":String=dofile",
                CommandProcessor.COMMAND_FUNCTION + ":String=cmd"}, provide = Object.class)
public class AHZCommand {

        Logger log = LoggerFactory.getLogger(AHZCommand.class);
       
        HadoopDriver driver;

        public void cmd() {
                System.out.println("cmd=>");
                log.info("cmd");
        }

        public void dofile() {
                driver.doFile();
               
        }
       
        @Reference
        public void bindHadoopDriver(HadoopDriver driver) {
                this.driver = driver;
        }
}
My software always runs perfectly in the end. If it is not yet perfect, it is not yet the end.
Loading...