Replied: Fri, 30 Jun 1995 17:57:11 EDT
Replied: "Arthur.Vanhoff@eng.sun.com (Arthur van Hoff) "
Return-Path: hohlfz@bass.informatik.uni-stuttgart.de
Return-Path: hohlfz@bass.informatik.uni-stuttgart.de
Received: from life.ai.mit.edu (life.ai.mit.edu [128.52.32.80]) by ludicrous-speed.ai.mit.edu (8.6.11/8.6.9) with SMTP id FAA06618 for <nathanw@ludicrous-speed.ai.mit.edu>; Tue, 27 Jun 1995 05:09:31 -0400
Received: from ifi.informatik.uni-stuttgart.de by life.ai.mit.edu (4.1/AI-4.10) for nathanw@ludicrous-speed.ai.mit.edu id AA29292; Tue, 27 Jun 95 05:09:17 EDT
Received: from bass.informatik.uni-stuttgart.de by ifi.informatik.uni-stuttgart.de with SMTP; Tue, 27 Jun 95 11:09:00 +0200
From: Fritz Hohl <hohlfz@bass.informatik.uni-stuttgart.de>
Date: Tue, 27 Jun 1995 11:09:00 +0200
Message-Id: <199506270909.LAA04592@bass.informatik.uni-stuttgart.de>
Received: by bass.informatik.uni-stuttgart.de; Tue, 27 Jun 1995 11:09:00 +0200
To: nathanw@ludicrous-speed.ai.mit.edu
Subject: Re: PersistenceManager
In-Reply-To: Mail from '"Nathan J. Williams" <nathanw@ludicrous-speed.ai.mit.edu>'
      dated: Mon, 26 Jun 1995 15:57:11 -0400
Cc: baumann@orgel.informatik.uni-stuttgart.de, hohlfz@ai.mit.edu

Hi,

>Hi, I saw on the Java-interest list that you were working on some kind of 
>a persistent storage system in Java. My group is trying to integrate Java 
>and a persistent database system and not having a very easy time of it. 
>Are there some pointers to your work avaliable? It looks interesting and 
>we'd like to know more.

We need Persistency (or Persistence??) because we need Migration, We
need Migration because we want to implement Mobile Agents, which use 
Java as their Agents Language.

It seems to me that the Sun Java Team will develop a 'real' Persistency 
mechanism (they have, for example a "transient" attribute with Objects which 
is not yet used..). A real Persistency mechanism needs to be implemented 
in the VM (in my opinion). 
Because we want to wait until the 'real' stuff, and because we don't want 
to do the same work twice nor want to modify the VM, i decided to make 
a persistency mechanism until the 'real' one is launched.

My mechanism is based on the storeOn:-ideas of Smalltalk-80:
In ST-80, you can create a persistent form of an object in form of a 
file, which is plain ST-80-Code (there is a form of a "script" mechanism in 
ST-80), which can be compiled in runtime to a dynamic object. This mechanism 
doesn't handle loops in the object tree, but it is very easy:
Every Class have to implement a storeOn: method for itself. The result of this 
method is a correct ST-80 expression which results in the object when 
executed. A storeOn:-mechanism is written mainly by sending all the 
instance variables objects a storeOn: which executes recursively.
There is also another mechanism which is more efficient and which is able 
to handle loops, but the output is produced by using internal 
VM structure.

So, my Java Persistency Manager is based on two ideas:

1) the ouput is a normal class file which can be compiled an executed 
    at runtime and which produces the stored objects

2) execept the data types of the java distribution, every "new" class 
    have to implement its storeOn-Procedure itself. This procedure is 
   called by the PersistencyManager and produces an expression which 
    results in the stored object.

No modifications of the VM are needed, the PM is a java application.

Currently, the PM is not yet finished. As by now, my PM can handle:
- all single non-class types like float and int
- single Integer, String, Object
- 1d, 2d, 3d non-class data type arrays
- n-dimensional Arrays as long as the single types are available

The whole stuff isn't tested yet, but if you want, you can have 
the current code.

The problems of this mechanism are:
==============================
1) It needs one class per Object File which should be removed 
    after the delivery of the objects (i don't know how to remove a 
    class from java..)
2) The java compiler seems to have problems..
3) You have to write the persistency code for every class
4) It's not efficient

I hope this explains my ideas.
Greets, Fritz Hohl

PS: Which mechanism do you use? Modification of the VM?
