Quick Tutorial
MyOODB is an Object-Oriented Database with many features not available in existing database products. MyOODB is one part of a two part SDK solution. Together with MyOOWEB, MyOOSDK provides a development environment for software hackers who desire small fast but powerful applications. It is the foundation that puts the power of true Object-Oriented Design back into App/Web development.
The fastest 100% Java OODB available (IMHO), MyOOSDK also provides seamless web integration. MyOOSDK client code can run as an application or in a web browser over the following protocols: TCP, TCPS, HTTP, or HTTPS. MyOODB database technology provides better performance for known database features, as well as, providing features not yet seen.
Like other OODB solutions, MyOODB developer objects are the database. But unlike existing solutions, MyOODB objects only exist on the server. Though client objects look and feel like the actually object, in actuality its a simple distributed reference.
While MyOODB provides some features other solutions do not have, one of the more notable ones is its self-healing and corruption-isolation properties. MyOODB database technology allows for a bad file system block or blocks to not corrupt the entire database. Each object is self contained, so if an object on a block goes bad, MyOODB will try to rewrite the object in memory back to disk. And if the MyOODB Database Server is not running to restore state, when objects are coded to use the self-healing facilities, bad object references in good objects can be fixed up (A good selling point for your manager).
Taking an example from the source distribution, the following code is how one defines a database object:
//
// MyOODB Object Interface;
//
public interface Person extends org.myoodb.collectable.Collectable
{
@org.myoodb.annotation.Access(value="Write")
public void setName(String name);
public String getName();
}
//
// MyOODB Object Implementation
//
public class PersonDbImpl extends org.myoodb.collectable.CollectableDbImpl implements Person
{
private String m_name;
public PersonDbImpl()
{
m_name = null;
}
public void setName(String name)
{
m_name = name;
}
public String getName()
{
return m_name;
}
}
Notice the @org.myoodb.MyOodbAcces annotation. This macro informs the MyOODB build process that the invocation of the setName method will cause the instance of Person to be saved to disk. Not specifying the macro simply will store the change in memory.
The storing of objects has a few behaviors. Like previously stated, client objects are really just distributed references (i.e. proxies). If one invokes a Write method without the context of a transactions, the object state is immediately stored in memory and on disk. This is called an implicit transaction.
The other type of transaction is an explicit transaction. Here is where some of MyOODB power starts to show. A result of MyOODB object clustering technology, MyOODB supports multi-concurrent nested transactions with rollback. No one object change will block another object change unless an explicit transaction is modifying a group of objects that yet another implicit or explicit transaction wants to work on. The following transaction example is taken from the source distribution:
{
MyOodbDatabase db = MyOodbDatabase.open("tcp://localhost:54321, admin, admin);
MyOodbTransaction tx = db.createTransaction();
tx.begin(); // put create in the context of a explicit transaction
Person person = db.createObject(PersonDbImpl.class);
tx.begin(); // put the setName call in a nested explicit transaction
person.setName(John Smith);
tx.rollback(); // undo the setName
person.setName(Mary Smith); // put this setName in the context of the first transaction
tx.commit(); // commit all changes
}
To reiterate, all the above object calls can be performed outside the context of an explicit transaction.
Yet another powerful feature of MyOOSDK is the ability to seamlessly run client code over HTTP or HTTPS connections. Using Java Applets or Webstart technology, one can change the above example and tunnel all object modifications over the web. The following example shows the four ways to connect to the MyOODB Database Server:
{
// app
String url = "tcp://localhost:54321;
String url = "tcps://localhost:54322;
// web
String url = "http://localhost:80;
String url = "https://localhost:443;
MyOodbDatabase db = MyOodbDatabase.open(url, admin, admin);
}
Do not fret if you have never set up a web server or written any web applications. The source distribution comes with a web server and samples on how to set it up. Itll take 5 minutes, really it will.
Once you pull down the source distributed, please take a look at the following areas so that you can get up and running in no time. The distribution is divided into three sections:
1) source
2) extensions
3) samples
Please first take a look in samples, but do not forget to build MyOODB from the root directory. The only thing you will need is the java binary in your PATH and the JAVA_HOME environment variable pointing to your java distribution.
Thats it. Start showing off your new found productivity ;-)