Searching through Karaf source, I noticed that OsgiCommandSupport has a getBundleContext method. I can just use that to see if the services I need are there when the command is invoked. Is this considered bad practice?
On Sun, Jan 23, 2011 at 2:21 PM, Adam Crain <acr...@greenenergycorp.com>wrote: > Hmm. I guess I accidently took that from the felix tutorially. Thanks, the > example is working now! > > Where can I find some examples of using blueprint to do DI for osgi > services? My shell extension requires some services to already be registered > so that it can invoke them in doExecute. > > best, > Adam > > > On Sun, Jan 23, 2011 at 1:44 PM, Guillaume Nodet <gno...@gmail.com> wrote: > >> The namespace you use is wrong, it should be >> http://karaf.apache.org/xmlns/shell/v1.0.0 >> >> On Sun, Jan 23, 2011 at 19:18, Adam Crain <acr...@greenenergycorp.com> >> wrote: >> > Thanks for the tips. I stripped everything down to the basic example in >> the >> > manual, and it seems the problem I was having is some kind of blueprint >> > issue. When I run the example console extension, my bundle starts in the >> > "GracePeriod" and the log diplays: >> > 13:13:04,435 | WARN | rint Extender: 3 | BlueprintContainerImpl >> | >> > container.BlueprintContainerImpl 252 | 7 - org.apache.aries.blueprint - >> > 0.2.0.incubating | Bundle reef.direct-shell is waiting for namespace >> > handlers >> > >> [(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace= >> http://felix.apache.org/karaf/xmlns/shell/v1.0.0))] >> > >> > ideas? >> > -Adam >> > On Fri, Jan 21, 2011 at 5:01 PM, Guillaume Nodet <gno...@gmail.com> >> wrote: >> >> >> >> Basically, the shell will recognize service that has the >> >> osgi.command.scope and osgi.command.function properties defined. >> >> However, in order to leverage completions, you currently need to have >> >> the service implement AbstractCommand. >> >> The easiest way would be to leverage (or adapt) the code in the >> >> export() method of the following class: >> >> >> >> >> http://svn.apache.org/repos/asf/karaf/trunk/shell/console/src/main/java/org/apache/felix/gogo/commands/basic/SimpleCommand.java >> >> >> >> On Fri, Jan 21, 2011 at 22:47, Adam Crain <acr...@greenenergycorp.com> >> >> wrote: >> >> > How do I implement a console extension without blueprint? >> >> > I created a BundleActivator and tried to publish the service >> >> > "OsgiCommandSupport" guessing that would cause the system to pickup >> the >> >> > new >> >> > shell command, but I was wrong. >> >> > thanks, >> >> > Adam >> >> >> >> >> >> >> >> -- >> >> Cheers, >> >> Guillaume Nodet >> >> ------------------------ >> >> Blog: http://gnodet.blogspot.com/ >> >> ------------------------ >> >> Open Source SOA >> >> http://fusesource.com >> > >> > >> >> >> >> -- >> Cheers, >> Guillaume Nodet >> ------------------------ >> Blog: http://gnodet.blogspot.com/ >> ------------------------ >> Open Source SOA >> http://fusesource.com >> > >