This package provides objects which represent real objects from the internet and the WWW. These objects are persitent in the scone database.

This is the view from outside the package. As an example we have taken NetNode. This example is analogous to Link, HtmlNode, Server, User, etc.

The NetNode objects represent nodes from the internet. They are internally stored in the scone database (this database may run on a local or a remote serer). How this is done is left to the package. Furthermore, NetNode objects are cached in NetNodeCache, a fully static class. You cannot instantiate a NetNode object, you must obtain it from NetNodeCache. This is important for consistency and speed. Please refer to the NetNodeCache documentation to learn how NetNode objects may be obtained from the NetNodeCache.

It is assumed that two pieces of code may write to the same NetNode object at the same time, ie. transactions are not supported.

Example:
`NetNode node=NetNodeCache.get("http://www.informatik.uni-hamburg.de");`

This line of code will set node to a NetNode object which represents the node located at "http://www.informatik.uni-hamburg.de". NetNodeCache will look up for the specific node in its internal cache. If it is not there, it will create a new NetNode object and cache and return it. The newly created NetNode object will load its data from the database or create a new row in the NetNodes table if neccessary.

How it internally works:

This is an example how a NetNode object is cached and linked with the database. This example holds for every other object like Link, HtmlNode, User etc.

Please note that NetNode and NetNodeCache are the only public classes in this example! All other classes work in the background and and are only visible inside the package. The user never has to store a NetNode instance in the database or read it from there. This is done automatically.

NetNode is the central class in this figure so lets have a look at it:

NetNode extends DBSet. DBSet organizes its data conviniently so that it can easily be stored to the database (that is: it declares Hashtable objects). No direct database access is possible by this class. A DBSet represents a row in a table from the scone database. Consistency lies in the (virtual) hands of DBTable.

NetNode has a class variable which holds a DBTable object which encapsulates access to a specific table (NetNodes) in the scone database. All database access is done through this object.

When a new NetNode is instantiated, DBTable loads the corresponding data from the database or creates a corresponding row in the database. Thus, it is guaranteed that every NetNode object corresponds to a set in the NetNodes table and you do not have to bother to create this correspondence manually.

However, NetNode objects may only be obtained through a NetNodeCache.

NetNode extends DBSet which implements the interface Cacheable. Thus, a CacheTable may cache it. A CacheTable is a Hashtable that allows two keys per value and uses lava.lang.ref.SoftReference objects to free unused entries from memory. NetNode must implement methods which return those two keys. They are public and you can use it in your own scone plugin if you store NetNodes in your own Hashtable.

NetNodeCache is a fully static class. It has a CacheTable to store NetNode objects. You may obtain NetNode objects from this class by using its get methods. NetNodeCache may create a new NetNode object if the desired one is currently not in the CacheTable, or just indicate whether such an object exists. This of course depends on the method invoked.