Example of use of the object storage.

* NOTE

This example makes Java down, when you run this with Java 1.0.1.
It's due to a bug in Sun's Java interpreter.
Java 1.0 is OK.

* description 

HORB equips a simple object storage, ObjectStorage that is accessible
remotely.  You can save an object to a file, and then load it later
when you need it through the object storage.

A remote filename may not be an absolute filename. And a remote
filename may not include ".." in the filename. 

* example1  Client.java

Client.java creates an instance of ObjectStorage on a host.
(Actually ObjectStorage is an interface, thus the implementation
is ObjectStorage_Impl class.)

saveObject() and loadObject() are methods to manipulate persistent
objects.

	c:> horb -v
	c:> java horb.examples.objectStorage.Client


* example2   Client2.java

Examples2 is an demonstration of file locking among clients.
Several clients share a persistent object. Each client updates the
persistent object in a transaction. Thus a client must get a
lock of the corresponding file, load object, save object, then
unlock the file.

In order to make sense file locking, all clients must use one
ObjectStorage. Thus you have to start ObjectStorage as a daemon
object. example2.conf is an example to start the ObjectStorage.

	c:> horb -v -conf example2.conf
	c:> java horb.examples.objectStorage.Client2

Client2 sleeps for 5 seconds after getting the lock of the file.
If you wait for a while, the Client2 proceeds. If you start
another Client2, the new one waits for the lock until the previous
one release the lock.

	c:> java horb.examples.objectStorage.Client2
	c:> java horb.examples.objectStorage.Client2
	c:> java horb.examples.objectStorage.Client2

example2.conf specifies example2.acl as an ACL file.
"horb.orb.ObjectStorage.creatable=false" in the ACL file inhibits
creation of another ObjectStorage in the same HORB process.
Try;
	java horb.examples.objectStorage.Client
now, and you will see Client fails by "no permission".



* version

Author: HIRANO Satoshi
Versioin: 1.0

* How to compile and run

c:> horbc Data.java 
c:> horbc -c Client.java Client2.java

example1

c:> horb -v
c:> java horb.examples.objectStorage.Client

example2

c:> horb -v -conf sample.conf
c:> java horb.examples.objectStorage.Client2


* Classes

   Client.java		example1: use ObjectStorage
   Client2.java		example2: use common ObjectStorage
   Data.java            object saved in a file
