Hi,

On Mon, Oct 18, 2010 at 2:32 PM, Guillaume Nodet <[email protected]> wrote:
> Note that @Autowired could be achieved by an explicit wiring in blueprint if
> the bean has setters.
> Let me know if you need more help, that's an are i'm interested in going to
> the bottom, as I'm still unclear what works and what does not.

Thanks, actually I would need more help with the shell command service:

Spring DM gets installed as a feature -- with a load of stacktraces,
but in the end it seems to run and deploy things nicely. I guess I'll
give you the stacktraces later on, when I'm sure it actually works as
expected (right now the shell is the only means I have to do so).

I now declared a blueprint service in the spring-dm bundle-context:

        <bp:service id="infoShell" ref="uimInfoShell"
interface="org.apache.felix.service.command.Function">
            <bp:service-properties>
                <bp:entry key="osgi.command.function" value="info"/>
                <bp:entry key="osgi.command.scope" value="uim"/>
            </bp:service-properties>
        </bp:service>

together with a "uimInfoShell" bean which points to the implementation.

Upon running "uim:info" in the console, I get

15:23:36,070 | INFO  | l Console Thread | Console
    | araf.shell.console.jline.Console  187 | 17 -
org.apache.karaf.shell.console - 2.1.0 | Exception caught while
executing command
java.lang.IllegalArgumentException: Cannot coerce info[] to any of []
        at 
org.apache.felix.gogo.runtime.shell.Reflective.method(Reflective.java:174)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.CommandProxy.execute(CommandProxy.java:54)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:229)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Closure.executeStatement(Closure.java:162)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Pipe.run(Pipe.java:101)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:79)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.CommandSessionImpl.execute(CommandSessionImpl.java:71)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.karaf.shell.console.jline.Console.run(Console.java:169)[17:org.apache.karaf.shell.console:2.1.0]
        at java.lang.Thread.run(Thread.java:637)[:1.6.0_20]


I found a similar trace at
http://felix.apache.org/site/rfc-147-overview.html but I'm not really
sure what it means.

The uimInfo execute() method only does a few System.out's and returns
null - is there anything else I need to do?

Thanks,

Manuel





15:23:36,070 | INFO  | l Console Thread | Console
    | araf.shell.console.jline.Console  187 | 17 -
org.apache.karaf.shell.console - 2.1.0 | Exception caught while
executing command
java.lang.IllegalArgumentException: Cannot coerce info[] to any of []
        at 
org.apache.felix.gogo.runtime.shell.Reflective.method(Reflective.java:174)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.CommandProxy.execute(CommandProxy.java:54)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:229)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Closure.executeStatement(Closure.java:162)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Pipe.run(Pipe.java:101)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:79)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.felix.gogo.runtime.shell.CommandSessionImpl.execute(CommandSessionImpl.java:71)[17:org.apache.karaf.shell.console:2.1.0]
        at 
org.apache.karaf.shell.console.jline.Console.run(Console.java:169)[17:org.apache.karaf.shell.console:2.1.0]
        at java.lang.Thread.run(Thread.java:637)[:1.6.0_20]

On Mon, Oct 18, 2010 at 2:32 PM, Guillaume Nodet <[email protected]> wrote:
> Note that @Autowired could be achieved by an explicit wiring in blueprint if
> the bean has setters.
> Let me know if you need more help, that's an are i'm interested in going to
> the bottom, as I'm still unclear what works and what does not.
>
> On Fri, Oct 15, 2010 at 22:24, Manuel Bernhardt <[email protected]>
> wrote:
>>
>> Salut!
>>
>> On Fri, Oct 15, 2010 at 7:19 PM, Guillaume Nodet <[email protected]> wrote:
>> > 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.
>>
>> Indeed. Well then I'll probably have some more surprises with the two
>> Blueprint implementations running side-by-side
>>
>> >> 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.
>>
>> Mainly the shell extension (extending OsgiCommandSupport) has a member
>> that is injected via @AutoWired. The type is declared in the spring
>> bundle context.
>>
>> >> - 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.
>>
>> Great, thanks!
>>
>> >> - 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.xsd
>> > in the mean time.
>>
>> Will file a ticket
>>
>> >> - 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?
>>
>> Actually I don't care so much for the blueprint implementation. What I
>> am after is spring's dependency injection toolset and the integration
>> test facility
>> (http://static.springsource.org/osgi/docs/2.0.0.M1/reference/html/testing.html#testing:integration).
>> If I understood things right, I do need spring dm to be running on the
>> platform in order to get those, or not?
>>
>> Thanks,
>>
>> Manuel
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>
>
>

Reply via email to