You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Geoffry Roberts <th...@gmail.com> on 2014/04/22 17:29:59 UTC

Is this supposed to work in Karaf? A command question.

All,

First I apologize, I might be double posting this.

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;
        }
}

-- 
There are ways and there are ways,

Geoffry Roberts

Re: Is this supposed to work in Karaf? A command question.

Posted by Geoffry Roberts <th...@gmail.com>.
When I run the services command, I don't see my command bundle or anything
like it.


On Tue, Apr 22, 2014 at 3:37 PM, Jean-Baptiste Onofré <jb...@nanthrax.net>wrote:

> Hi Geoffry,
>
> I agree with the command bundle, but are you able to see the services
> exposed by this bundle ?
> Actually a command is a service.
>
> Regards
> JB
>
>
> On 04/22/2014 08:24 PM, Geoffry Roberts wrote:
>
>> Karaf version is 3.0.0.  My command bundle shows as active,
>>
>>
>> On Tue, Apr 22, 2014 at 11:34 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>> <ma...@nanthrax.net>> wrote:
>>
>>     Hi Geoffry,
>>
>>     An user already reported that. Are you able to see the service with
>>     the ls command ?
>>
>>     What's your Karaf version ?
>>
>>     Thanks,
>>     Regards
>>     JB
>>
>>
>>     On 04/22/2014 05:29 PM, Geoffry Roberts wrote:
>>
>>         All,
>>
>>         First I apologize, I might be double posting this.
>>
>>         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 <http://log.info> <http://log.info>("cmd");
>>
>>
>>                   }
>>
>>                   public void dofile() {
>>                           driver.doFile();
>>
>>                   }
>>
>>                   @Reference
>>                   public void bindHadoopDriver(HadoopDriver driver) {
>>                           this.driver = driver;
>>                   }
>>         }
>>
>>         --
>>         There are ways and there are ways,
>>
>>         Geoffry Roberts
>>
>>
>>     --
>>     Jean-Baptiste Onofré
>>     jbonofre@apache.org <ma...@apache.org>
>>
>>     http://blog.nanthrax.net
>>     Talend - http://www.talend.com
>>
>>
>>
>>
>> --
>> There are ways and there are ways,
>>
>> Geoffry Roberts
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



-- 
There are ways and there are ways,

Geoffry Roberts

Re: Is this supposed to work in Karaf? A command question.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Geoffry,

I agree with the command bundle, but are you able to see the services 
exposed by this bundle ?
Actually a command is a service.

Regards
JB

On 04/22/2014 08:24 PM, Geoffry Roberts wrote:
> Karaf version is 3.0.0.  My command bundle shows as active,
>
>
> On Tue, Apr 22, 2014 at 11:34 AM, Jean-Baptiste Onofré <jb@nanthrax.net
> <ma...@nanthrax.net>> wrote:
>
>     Hi Geoffry,
>
>     An user already reported that. Are you able to see the service with
>     the ls command ?
>
>     What's your Karaf version ?
>
>     Thanks,
>     Regards
>     JB
>
>
>     On 04/22/2014 05:29 PM, Geoffry Roberts wrote:
>
>         All,
>
>         First I apologize, I might be double posting this.
>
>         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 <http://log.info> <http://log.info>("cmd");
>
>                   }
>
>                   public void dofile() {
>                           driver.doFile();
>
>                   }
>
>                   @Reference
>                   public void bindHadoopDriver(HadoopDriver driver) {
>                           this.driver = driver;
>                   }
>         }
>
>         --
>         There are ways and there are ways,
>
>         Geoffry Roberts
>
>
>     --
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>
>
>
> --
> There are ways and there are ways,
>
> Geoffry Roberts

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Is this supposed to work in Karaf? A command question.

Posted by Geoffry Roberts <th...@gmail.com>.
Karaf version is 3.0.0.  My command bundle shows as active,


On Tue, Apr 22, 2014 at 11:34 AM, Jean-Baptiste Onofré <jb...@nanthrax.net>wrote:

> Hi Geoffry,
>
> An user already reported that. Are you able to see the service with the ls
> command ?
>
> What's your Karaf version ?
>
> Thanks,
> Regards
> JB
>
>
> On 04/22/2014 05:29 PM, Geoffry Roberts wrote:
>
>> All,
>>
>> First I apologize, I might be double posting this.
>>
>> 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 <http://log.info>("cmd");
>>
>>          }
>>
>>          public void dofile() {
>>                  driver.doFile();
>>
>>          }
>>
>>          @Reference
>>          public void bindHadoopDriver(HadoopDriver driver) {
>>                  this.driver = driver;
>>          }
>> }
>>
>> --
>> There are ways and there are ways,
>>
>> Geoffry Roberts
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



-- 
There are ways and there are ways,

Geoffry Roberts

Re: Is this supposed to work in Karaf? A command question.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Geoffry,

An user already reported that. Are you able to see the service with the 
ls command ?

What's your Karaf version ?

Thanks,
Regards
JB

On 04/22/2014 05:29 PM, Geoffry Roberts wrote:
> All,
>
> First I apologize, I might be double posting this.
>
> 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 <http://log.info>("cmd");
>          }
>
>          public void dofile() {
>                  driver.doFile();
>
>          }
>
>          @Reference
>          public void bindHadoopDriver(HadoopDriver driver) {
>                  this.driver = driver;
>          }
> }
>
> --
> There are ways and there are ways,
>
> Geoffry Roberts

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com