JADE-LEAP on Oracle SunSpot

JADE LEAP does not natively run on the Oracle SunSpot as the SDK is not fully MIDP compatible.
To use it anyway I removed the references from the LEAP library and some other stuff.
To address the problem of lacking ip support the socket-proxy is used.

The library is compiled without optimisations and debug stuff.
For further questions drop me a line. Back to the main page.

1. Download modified MIDP Library
    modified means without the javax.microedition.lcdui.* references
2. Create new SunSpot Application
    edit build.properties and add utility.jars = /path/to/midplibrary
3. Create TestAgent.java

package org.sunspotworld.demo;
import com.sun.spot.peripheral.Spot;
import com.sun.spot.sensorboard.EDemoBoard;
import com.sun.spot.sensorboard.peripheral.ITriColorLED;
import com.sun.spot.peripheral.radio.IRadioPolicyManager;
import com.sun.spot.io.j2me.radiostream.*;
import com.sun.spot.io.j2me.radiogram.*;
import com.sun.spot.util.*;
import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;

/**
 *
 * @author frieder
 */
public class TestAgent extends Agent {

/** Creates a new instance of TestAgent */
public TestAgent() {
}

protected void setup() {
addBehaviour(new TestAgentBehaviour());
}

class TestAgentBehaviour extends OneShotBehaviour {

public void action() {
System.out.println("Hello, world");
}
}
}
}
TestAgent.java

4. Create Demo.java, replace "eris" with the name or the ip of your Main Container


public class Demo extends javax.microedition.midlet.MIDlet {

protected void startApp() throws MIDletStateChangeException {
BootloaderListenerService.getInstance().start();
System.out.println("StartApp");
Agent.midlet = this;

try {
Properties pp = new jade.util.leap.Properties();
pp.setProperty(MicroRuntime.HOST_KEY, "eris");
pp.setProperty(MicroRuntime.PORT_KEY, "1099");
MicroRuntime.startJADE(pp, new Runnable() {

public void run() {
}
});

if (MicroRuntime.isRunning()) {
MicroRuntime.startAgent("justin", "org.sunspotworld.demo.TestAgent", new String[]{});
}
}
catch (Exception e) {
System.out.println("D Oh");
e.printStackTrace();
}
}


protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {

}
}
Demo.java

5. Deploy using ant deploy
6. Start main container on host
7. Start the socket proxy on the host ant socket-proxy