BUG Community

Welcome! Log In

Forums BUG SDK Programmatic Bug Shutdown?

Subscribe to Programmatic Bug Shutdown?  7 posts, 3 voices

Log in to reply to this topic
 
May 8, 2008 12:08am
Medium Bug Labs team finsprings 268 posts

How does the Shutdown menu item work?
I wrote a quick little app that called:

getBundleContext().getBundle(0).stop()

on a KEY_UP from hotkey 4. This shuts down a VirtualBug but on the real bug it apparently just shuts down the whole OSGi/Concierge side of the world - the OS still runs. How do I make it go beyond that and truly shut down the bug?
May 8, 2008 10:12am
Medium Bug Labs team jconnolly 285 posts

finsprings
How does the Shutdown menu item work?
I wrote a quick little app that called:

getBundleContext().getBundle(0).stop()

on a KEY_UP from hotkey 4. This shuts down a VirtualBug but on the real bug it apparently just shuts down the whole OSGi/Concierge side of the world - the OS still runs. How do I make it go beyond that and truly shut down the bug?


Dave,

You'll have to execute an OS command, like shutdown or poweroff.

Runtime.getRuntime().exec("/sbin/shutdown");

You'll have to execute this command before shutting down the VM/OSGi runtime, otherwise the command may not be executed.

We're hoping to open power controls of the BUG via the API with the next release.

I should also note, if you're running on linux or OS X, before you try running this on the Virtual BUG, you'll probably want to make sure that this won't shut down your host computer accidentally.
May 8, 2008 10:22am
Medium Bug Labs team finsprings 268 posts

Nice! I didn’t realize we had exec access! I’ll be sure not to try it with the VirtualBug though :-)

Which brings to mind another question: is there a page with the javadoc or equivalent for the SDK now? There used to be one on bugbeta.com but it’s not there anymore. I only found the OSGIi shutdown by trawling the java files in SVN.

May 8, 2008 10:41am
Medium Bug Labs team jconnolly 285 posts

finsprings
Nice! I didn't realize we had exec access! I'll be sure not to try it with the VirtualBug though :-)



Dave,

The vm is running as root, so be careful with exec access. :wink:

Which brings to mind another question: is there a page with the javadoc or equivalent for the SDK now? There used to be one on bugbeta.com but it's not there anymore. I only found the OSGIi shutdown by trawling the java files in SVN.


I'm constantly badgering our development team to get the master javadoc generated with each build. I'm not really privy to all of the details of the build process, but I know that using Ant it should be a matter of adding the appropriate javadoc build commands in the build scripts. This is a great request to add to our bugzilla, at http://bugcommunity.com/bugzilla . We need the feedback so we can prioritize our next build accordingly. :)
May 8, 2008 11:32am
Img_missing_medium akravets 25 posts

finsprings,

The JavaDocs for all bundles that run on the BUG are generated right now, but they are kept in each bundle’s root directory. We’ll change the build so that these docs are moved to public website and are easily accessible.

May 8, 2008 1:05pm
Medium Bug Labs team finsprings 268 posts

Thanks Alex, that sounds great.

May 10, 2008 10:33pm
Medium Bug Labs team finsprings 268 posts

jconnolly

You'll have to execute an OS command, like shutdown or poweroff.

Runtime.getRuntime().exec("/sbin/shutdown