The OSGi console can be a useful tool when debugging or testing Cytoscape apps under development.
To use the OSGi console, start Cytoscape using the command line. Open a terminal window and change directory to your Cytoscape installation. On MS Windows, type “cytoscape.bat”, on Mac or Linux, type “./cytoscape.sh”. After a while, Cytoscape will get started. On the terminal, a prompt that looks like the following will appear:
Cytoscape 3.0.1>
This is your OSGi interactive shell.
Presented in the next set of slides are some commands you will find useful. You can also look at this page for more information, or use the "help" command to see a full list.
The command “list” will list all the Cytoscape bundles and their states, “Active”, “Installed”.
Cytoscape 3.0.1> list
To install your app bundle, use the "install" command. If you use Maven, you can reference a bundle installed in your repository as follows:
Cytoscape 3.0.1> install mvn:org.cytoscape.sample/sample02
Bundle ID: 169
You can install a bundle from a file:
Cytoscape 3.0.1> install file:/path/2/myApp.jar
After you issue this command, you will get your bundle ID if the command is executed successfully.
To start a bundle, use the "start" command. To do this, you need the bundle number (use the "list" command mentioned above if you don't know it). Then issue the following command: (substitute your own bundle number for 169)
Cytoscape 3.0.1> start 169
Invoke the “list” command - the bundle should now show up as "Active" if it started successfully.
[ 169] [Active ] [ ] [ 200] sample02 (3.0.0.alpha8-SNAPSHOT)
You can then use the app within Cytoscape.
To stop a bundle that has been loaded, use the "stop" command with the bundle number as follows:
Cytoscape 3.0.1> stop 169
If you invoke the “list” command, you will notice that your bundle is now in state “Installed” instead of "Active".
[ 169] [Installed ] [ ] [ 200] sample02 (3.0.0.alpha8-SNAPSHOT)
To update a bundle that was previously installed, use the update command as follows:
Cytoscape 3.0.1> update 169
After you compile your app, you can use “update” to update your bundle. You may use this command a lot, when you are debugging your code.
To uninstall a bundle, use the uninstall command as follows:
Cytoscape 3.0.1> uninstall 169
This will completely remove your app from Cytoscape. You can verify it with the 'list' command.