My favorites | Sign in
Logo
                
Code license: Apache License 2.0
Labels: embryo, grid
Feeds:

The Embryo Grid is a lightweight Java container for component based, distributed computing. To achieve this, it combines several techniques:

The projects aims to support stateless, immutable or at least components with a clean and deterministic state. It is therefore inherently suited to grid / cloud / distributed applications.

The component paradigm can be thought of as "Inversion of Inversion of Control". IOC configures objects through method and field access. "Inverted IOC" allows the POJOs to make calls ("no, I will call you") against Interfaces which are implemented by the container. The advantages of this are:

Here are some test cases, which are working right now, that demonstrate the theory...

In this simple example, an Airline is registered with Embryo and an Aircraft is found against it...

EmbryoGrid embryo = new EmbryoGrid();

Airline airline = new Airline();
airline.addAircraft(new Aircraft("Embryo Airlines"));
embryo.addObject(airline);

Airline result = (Airline)embryo.find(Aircraft.class, "Embryo Airlines");

You can also write arbitrary interfaces which Embryo will implement at runtime.

public interface Finder {
    public Airline findVessel(String name);
}
Airline airline = new Airline();
airline.addAircraft(new Aircraft("VH123"));
embryo.addObject(airline);

Finder finder = (Finder)embryo.implement(Finder.class);
Aircraft aircraft = finder.findVessel("VH123");

This is a simple example. The real benefit comes as the model becomes increasing complex. In this example, a MaintenanceScheduler creates the Maintenance object through an indirect call to airline.getAircraft().

embryo.addObject(new MaintenanceScheduler());

Finder finder = (Finder)embryo.implement(Finder.class);
Maintenance maintenance = finder.getMaintenance("VH123");

This is equivalent to..

Maintenance maintenance = MaintenanceScheduler.getMaintenanceSchedule( airline.getVessel("VH123"));

Embryo Grid contains a persistence layer which connects to JDBC Datasources. It reflects schema information from the database and generates and manages SQL at a relational level. It is not an it is not an object-relational mapper in the same way as say Hibernate (in that you don't code directly against POJOs) and has less of it's complexity.

create table airline (
    code            CHAR(2) NOT NULL,
    name            VARCHAR(32) NOT NULL,
    PRIMARY KEY ( code )
);
embryo.addDatabase(new Database("jdbc/airline");

Finder finder = (Finder)embryo.implement(Finder.class);
Airline airline = finder.findAirline("AA");

Now finally, we move on from the test cases and write our component..

public class AirlineComponent {
    public Airline doAirlineShenanigans(FindAirline finder) {
        Airline airline = finder.findAirline("CA");

        System.out.println(airline);

        return airline;
    }
}

In the example below, a Timer component fires a Date object every second. This Date is received by the Clock Face Renderer which in turn generates an Image. This is tracked and displayed on screen.

The code base contains many APIs which can be used independently of the container:

View the BonsaiDoc









Hosted by Google Code