Hello,

I setup an OSGi application with Felix SCR and Karaf. But how can I use the 
SCR annotations for Karaf commands? I tried the example command from the Karaf 
manual and it works fine, but if I add the Felix SCR annotations, the command 
is not working anymore in Karaf. 

I'm pretty new to OSGi but I got everything working (Karaf, Pax Exam, Sling), 
I'm only stuck

----------
@Command(scope = "sscontrol", name = "parse", description = "Parses the 
specified resource and checks for eventual errors.")
@Service
@Component
public class ParseCommand implements Action {

    @Argument(name = "resource", description = "The resource URI to be 
parsed.", required = true, multiValued = false)
    private String resource;

    @Reference
    private ParserService parseService;

    @Override
    public Object execute() throws Exception {
        Parser parser = parseService.create();
        SscontrolScript script = parser.parse(toUri(resource));
        return script;
    }

    private URI toUri(String resource) throws URISyntaxException {
        return new URI(resource);
    }
}
--------
-- 
Erwin Müller - [email protected]
Software Entwickler - (+49)  01577-9505569
Pgp - https://pgp.mit.edu/pks/lookup?op=get&search=0x02E820911DD910FD
Meine Seite - http://www.mueller-public.de/
ANRI - http://www.anr-institute.com/

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to