Shameless bump to give this one more chance;) I've been reading the documentation on custom commands, but nothing is jumping out...
Just to be clear on what I need. I need to automatically run diagnostics after all my OSGi bundles have loaded. The results need to be displayed to the user in Karaf's console. The running of the diagnostics is currently be triggered by Spring bean loading (using an init-method). In the past, it was in a bundle activator. In neither case, does the karaf prompt show up unless the user hits the Enter key. It's not the end of the world if I can't get this to work, but it would be nice. On Sat, May 14, 2011 at 8:10 AM, Samuel Cox <[email protected]> wrote: > I'm not executing a command. We do have our own commands, and they > work fine. This is just a bean in some bundle that displays some > diagnostics on startup. If there is a way to execute a command > automatically when a bundle starts, I could print the diagnostics > using that. I couldn't find any info on doing that. > > Thanks for the help btw! > > On Sat, May 14, 2011 at 7:36 AM, Guillaume Nodet <[email protected]> wrote: >> The prompt is displayed when the execution of a command is finished. >> If you're still executing the command, the prompt won't be dipslayed, >> but you can retrieve it from the shell's session variables and display >> it your self if you need. >> >> On Sat, May 14, 2011 at 14:32, Samuel Cox <[email protected]> wrote: >>> I tried that and it didn't work. I will say that my bean doing the >>> output is written in Scala. I'm using println(""), which I think is >>> equivalent to Java's System.out.println(""). >>> >>> On Sat, May 14, 2011 at 12:38 AM, Jean-Baptiste Onofré <[email protected]> >>> wrote: >>>> Hi Samuel, >>>> >>>> It should be the case. >>>> >>>> Karaf shell intercept the std and err output stream. >>>> It means that after a System.out.println(), the Karaf prompt should be >>>> display. >>>> It's the case in the commands. For instance, osgi:list iterates on the >>>> bundles and simply display the bundles attribute using >>>> System.out.println(). >>>> >>>> Try to add a System.out.println("") at the end of your bundle output, it >>>> should display the prompt just after your bundle output. >>>> >>>> Regards >>>> JB >>>> >>>> On 05/14/2011 03:10 AM, Samuel Cox wrote: >>>>> >>>>> Hi, >>>>> >>>>> Is it possible to get the prompt back after some bundle code does a >>>>> System.out.println()? >>>>> >>>>> I have some beans that need to print stuff to the Karaf console. I >>>>> can't figure out how to get the prompt back without the user hitting >>>>> enter. >>>>> >>>>> Many thanks. >>>> >>> >> >> >> >> -- >> Cheers, >> Guillaume Nodet >> ------------------------ >> Blog: http://gnodet.blogspot.com/ >> ------------------------ >> Open Source SOA >> http://fusesource.com >> >> Connect at CamelOne May 24-26 >> The Open Source Integration Conference >> http://camelone.com/ >> >
