On Fri, Oct 15, 2010 at 19:08, Manuel Bernhardt
<[email protected]>wrote:

> Hello!
>
> I'm a newcomer to Karaf, and would have a question regarding the
> integration with Spring DM 2. I have an existing Karaf/Blueprint
> project and would like to use spring DM as it offers advanced DI
> features as well as a nice way of performing integration testing.
>
> So I spent a good part of the day fighting (and understanding) how
> Spring DM deals with custom namespaces, and was able to deploy a
> bundle with Spring-DM 2.0 on Karaf. For doing so I created a custom
> provision file and registered spring dm 2 as a feature.
>
> Karaf 2.1 seems to come by default without Aries installed so I didn't
> have any conflicts occurring there (or so I think at least). I mean I
> didn't see Aries running when performing a osgi:list.
>

Yeah, that has changed in 2.1 where Karaf does not display the pre-installed
bundle anymore.
Try 'la' in the console to see all the bundles.  The Aries Blueprint impl is
used by a lot of bundles in karaf.

>
> The issue I have now is that we use the Karaf shell extensions in
> order to talk to our bundles via the console. This worked nicely with
> a <command-bundle> declaration as long as I didn't inject dependencies
> with spring (but wired them via hand). Now, spring not being the one
> initializing the shell <action> classes, the dependencies are not
> initialized.
>

Not sure to exactly follow what you did with spring.


>
>
> My questions thus would be:
>
> - how does the shell console look for it's extension points? Will it
> only look in <command-bundle> definitions in a OSGI-INF/blueprint
> path, or would it in theory be fine if the definition were in a spring
> bundle-context definition file (with a custom namespace mapping). My
> aim would be to have spring initialize the instance (and wire its
> dependencies) but still have the shell know about it / how to talk to
> it.
>

The console looks for services in the registry.  The custom blueprint
namespace is just a simple way to expose the service.
To add a command to the console if you're no using blueprint, register a
service implementing the org.apache.felix.service.command.Function interface
and with the osgi.command.function and osgi.command.scope service
properties.   Try "ls -a 14' for example in the karaf console to see a bunch
of those methods.   The helper classes are located in the
o.a.karaf.shell.console bundle.


>
> - it looks like http://karaf.apache.org/xmlns/shell/v1.0.0 isn't
> online, whilst that would be handy to have
>

Wanna raise a JIRA, that should be fixed.
You can find it at
http://svn.apache.org/repos/asf/karaf/tags/karaf-2.1.0/shell/console/src/main/resources/org/apache/karaf/shell/console/commands/karaf-shell.xsdin
the mean time.

>
> - does what I am trying to do make any sense at all? (I'm rather new
> to the latest OSGi spec, and am not sure what the usual practices are)
>

What are you trying to do? Do you only need to register a set of commands
using spring-dm ?  Do you really need to use the blueprint implemnttion from
spring?


>
> Thanks!
>
> Manuel
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to