persistenceforosgi_crosenberger

Upload: manoj212077

Post on 06-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    1/28

    A Persistence Servicefor the OSGi framework

    Carl RosenbergerChief Software Architect

    db4objects Inc.

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    2/28

    2

    What is an object?

    ?

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    3/28

    3

    What is an object?

    a conceptional unit with Identity

    State

    Behaviour an instance of a class Car car = new Car("Ferrari");

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    4/284

    Car car = new Car("Ferrari");

    from user entry

    from machine generated data

    over the network from a database

    Where do objects come from?

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    5/285

    Databases

    Flat files (Roll Your Own) Java Serialization INSERT INTO car(name)VALUES("Ferrari")

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    6/286

    Databases

    Flat files (Roll Your Own) Is your development team experienced at writing database

    engines?

    Will flat files be failsafe and will they provide ACID transactions?

    Will you have querying functionality?

    How much will the development cost?

    How long will it take until the system stable?

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    7/287

    Databases

    Java Serialization will break upon modifications to classes

    requires loading complete graphs of objects to memory

    is not transactional

    does not provide querying functionality

    is explicitely not recommended for longterm persistence by theJava Language Specification

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    8/288

    INSERT INTO car(name)VALUES("Ferrari")

    Is SQL the best choice for storing objects?

    Databases

    Using tables to store objects is like driving your car home and

    then disassembling it to put it in the garage. It can be assembled

    again in the morning, but one eventually asks whether this is the

    most efficient way to park a car.Esther Dyson

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    9/289

    How much SQL do you want to write?

    public class Car { Colour colour;

    Motor motor;

    List doors;

    List wheels;

    Brake brake;

    /*

    [ 50 more fields here ]

    */

    }

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    10/2810

    Is there an easier way to store objects?

    Car car = new Car("Ferrari");

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    11/2811

    Car car = new Car("Ferrari");

    something.store(car);

    Is there an easier way to store objects?

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    12/2812

    Is there an easier way to store objects?

    Car car = new Car("Ferrari");

    database.store(car);

    Simply store objects to the database

    get objects back from the database Persistence by reachability

    Database engine can analyze class schema

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    13/28

    13

    What about queries?

    SELECT * FROM

    car, car_brake, brake, car_motor, motor

    WHERE car.id = car_brake.car_id

    AND brake.id = car_brake.brake_id AND car.id = car_motor.car_id

    AND motor.id = car_motor.motor_id

    AND brake.type = 'Ceramic' AND motor.power > 400;

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    14/28

    14

    Is there an easier way to query for objects?

    car.brake.type == "Ceramic"

    && car.motor.power > 400;

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    15/28

    15

    Introducing Native Queries

    return car.brake.type == "Ceramic"

    && car.motor.power > 400;

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    16/28

    16

    Introducing Native Queries

    public boolean match(Car car){

    return car.brake.type == "Ceramic"

    && car.motor.power > 400;

    }

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    17/28

    17

    Introducing Native Queries

    new Predicate (){

    public boolean match(Car car){

    return car.brake.type == "Ceramic" && car.motor.power > 400;

    }

    }

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    18/28

    18

    Introducing Native Queries

    List cars =

    database.query(new Predicate (){

    public boolean match(Car car){

    return car.brake.type == "Ceramic" && car.motor.power > 400;

    }

    });

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    19/28

    19

    Outlook: Native Queries using Closures

    List cars =

    database.query({

    Car car =>

    car.brake.type == "Ceramic" && car.motor.power > 400;

    }

    );

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    20/28

    20

    Object-Oriented Persistence

    100% pure Java 100% refactorable

    100% typesafe

    100% checked at compile-time no O-R impedance mismatch

    minimum code

    maximum performance

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    21/28

    21

    Object-Oriented Persistence

    Store Objects Native Queries

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    22/28

    22

    Introducing db4o

    database 4

    objects

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    23/28

    23

    Introducing db4o

    database 4

    OSGi

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    24/28

    24

    Introducing db4o

    Plain Object Persistence Zero Administration

    Automatic Schema Management

    Optimized Native Queries compile time

    load time

    run time

    OSGi Service Interface

    OSGi ClassLoader aware

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    25/28

    25

    Introducing db4objects

    Open Source Project db4o GPL License

    Registered Community of 20,000 developers

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    26/28

    26

    Introducing db4objects

    Commercial db4o Licenses Customers include Boeing, RICOH, Bosch, Indra

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    27/28

    27

    db4o for OSGi

    db4objects is a member of the OSGi alliance Dedicated db4o version for OSGi

    Partnership with ProSyst

    ProSyst bundles db4o with mBedded Server

  • 8/2/2019 PersistenceForOSGi_CRosenberger

    28/28

    28

    Thank You!

    http://www.db4o.com/OSGi