org.garret.serme
Interface IStorage

All Known Implementing Classes:
FileStorage, RmsStorage

public interface IStorage

Interface of persistent storage. Programmer should use instance of one of particular implementations if this unterface. IStorage interface is needed when the application needs to perfrom manipulations with persistent data (add/update/delete objects) without loading/saveing the whole object three to/from memory. If application needs only serialization mechanism, IStorage interface is not needed.


Method Summary
 void close()
          Close database
 boolean create()
          Open existed or create new database
 java.util.Enumeration enumerateObjects()
          Get enumeration of all live persistent objects in the database.
 java.lang.Object getRoot()
          Get root object.
 boolean open()
          Open existed database.
 boolean remove()
          Remove database.
 void remove(java.lang.Object obj)
          Remove object from the storage.
 void setRoot(java.lang.Object root)
          Set new root object.
 void store(java.lang.Object obj)
          Store object in the database.
 

Method Detail

close

public void close()
Close database


create

public boolean create()
Open existed or create new database

Returns:
true if database was successfully opened, false otherwise

enumerateObjects

public java.util.Enumeration enumerateObjects()
Get enumeration of all live persistent objects in the database. Objects are returned in arbitrary order.

Returns:
enumeration of all persistent objects in the database

getRoot

public java.lang.Object getRoot()
Get root object. Database can have only one root object. When database is just created, there are not root object at all and this method returns null


open

public boolean open()
Open existed database. Method will fail if database doesn't exist.

Returns:
true if database was successfully opened, false otherwise

remove

public boolean remove()
Remove database. This method can be invoked only for not opened database.

Returns:
true if database was successfully deleted, false otherwise

remove

public void remove(java.lang.Object obj)
Remove object from the storage. All references to the removed object will be replaced with null when database will be opened next time.


setRoot

public void setRoot(java.lang.Object root)
Set new root object. Old root object is not removed from the database.

Parameters:
root - new root object. If it is not yet persistent (has no assigned OID), it is automatically made persistent and stored in the database.

store

public void store(java.lang.Object obj)
Store object in the database. If object is not yet persistent (not assigned OID), then it is made persistent. When object is stored all transient objects (objets without assigned OID) referenced from this object are recursively stored in the database. But referenced persistent objects are not recursively stored. So you should exeplicitly invoke store method for each modified persistent object.