Skip to content
macavity23 edited this page Sep 2, 2011 · 8 revisions

This page is to introduce developers to robonobo. It should explain:

  • How to download and build robonobo from source
  • The major components of the app
  • High-level data structures and data storage systems
  • Network protocols
  • How to write robonobo plugins

Getting and building robonobo

To build robonobo, you will need:

Each subfolder of the git repository root contains an eclipse project, but you can build it using ant if you prefer.

To build the robonobo app, run the ant target 'fatjar' in the gui project. This will produce a file robonobo-(version).jar in the target/dist subdirectory, which you can execute using java -jar robonobo-(version).jar.

To run robonobo from eclipse, execute the class com.robonobo.Robonobo from the gui project.

To build the webapp projects (midas-webapp, sonar-webapp, wang-server), run the ant target 'build' from their respective build.xml files. This will produce a .war file in the target/dist directory.

##The console To poke about in the robonobo internals, you will want to use the console rather than the standard GUI. You can access the console through the debug menu in the gui, or else you can start robonobo with the -console option to start in console-only mode. If you run robonobo on a system with no attached display, it will automatically start in console-only mode.

##robonobo components ###core This is the best starting point for the developer. It ties together the various other components, and is responsible for starting and stopping everything. To start with, look at com.robonobo.core.RobonoboController (the main ui-facing class) and com.robonobo.core.RobonoboInstance (the main application instance class). Around the instance class are various service classes that represent the different components. ###mina Mina is responsible for the finding of sources, communication with other nodes, and the broadcasting and reception of data. It follows the same instance-service pattern as the core component; the instance class is core.robonobo.mina.MinaInstance. ###eon EON (Eye Of Needle) is the networking layer. It implements a networking stack over a single udp port, allowing multiple stream-based (tcp-like, called seon) and datagram-based (udp like, called deon) connections over a single udp socket. We have reinvented the wheel in this way as it allows us to prioritize one seon connection over another, which gives the network its bandwidth-reliability. See EON Overview for more details. ###wang Wang ([http://en.wiktionary.org/wiki/%E6%97%BA 旺]) is the digital currency used by robonobo to mediate transactions. Sources continuously auction off their bandwidth and listeners bid for it, with the higher bidders getting more bandwidth (see EON Overview for more details). This enforces fairness (the more you download, the more you pay) and allows reliability within the network (you can bid more and increase the bandwidth you receive). Wang is a wrapper around the [http://anoncvs.aldigital.co.uk/lucre/ lucre] digital cash system. ###midas Midas is the web-based metadata server that acts as the central store for stream information. It is a standard j2ee webapp using hibernate. ###sonar Sonar is the node location service that allows robonobo nodes to bootstrap their way onto the network. Is is a standard j2ee webapp using hibernate.

##Data structures and storage For data interchange, robonobo uses protocol buffers an easy to use, fast and byte-efficient encoding system. See the google code pages for more details. The robonobo data types are defined in the files src/java/com/robonobo/core/api/proto/coreapi.proto in the api project, src/java/com/robonobo/mina/message/proto/mina.proto in the mina project, and src/java/com/robonobo/wang/proto/wang.proto in the wang-client project. These files are used to auto-generate the java classes for robonobo data types, and could be used to generate code for other languages if desired.

For local metadata storage, robonobo uses a [hypersql(http://hsqldb.org/) database. There are two databases, meta and page. You can access these databases at runtime through the 'dbquery' and 'dbupdate' console commands (type 'help dbquery' and 'help dbupdate' for usage). To see the structure of the databases, see the core classes com.robonobo.core.service.DbService (for the meta db) and com.robonobo.core.storage.PageInfoMgr (for the page db). To list tables, run the following SQL: select table_name from information_schema.system_tables where table_schem = 'PUBLIC'

##Network protocols For details, see: Network Protocols

##How to write plugins Developers can add their own plugins without needing to recompile the app. To create a plugin, create a class that extends com.robonobo.core.service.AbstractService (in the core component). Compile your code into a jar, and make sure this jar is in the classpath when robonobo starts. Add the fully-qualified name of your class to the 'extraServices' property in robo.cfg. If you want a plugin-specific config class to be persisted in the user's rbnb cfg dir, add it to the 'extraConfigs' property in robo.cfg (comma-separated, with format :)

On robonobo startup, your plugin class will be instantiated (with the default constructor), and the method setRobonobo() will be called with the core RobonoboInstance object. Make sure in your plugin constructor, you call addHardDependency() one or more times. This establishes dependencies between services so that they are started and stopped in the correct order - the argument to addHardDependency() should be same as the return value of getProvides() for the service you are dependent on. See the various classes in the com.robonobo.core.service package for more details.

##Config robonobo uses a home directory, which by default on OSX is ~/Library/Application Data/robonobo, on windows is %APPDATA%/robonobo and on linux is ~/.robonobo. If the environment variable RBNB_HOME is set, that will be used instead. Configuration for the app is contained in the config subdirectory of the homedir, and consists of one file per config. robonobo will automatically serialize config classes to text files in this directory.

Clone this wiki locally