org.planx.xmlstore.stores
Class AbstractXMLStore<R extends Reference>

java.lang.Object
  extended by org.planx.xmlstore.stores.AbstractXMLStore<R>
All Implemented Interfaces:
XMLStore<R>
Direct Known Subclasses:
DistributedXMLStore, ExecuteXMLStore, OptimisticReadXMLStore

public abstract class AbstractXMLStore<R extends Reference>
extends Object
implements XMLStore<R>

A convenience class for implementing XMLStores.

Author:
Kasper Bøgebjerg, Henning Niss, Thomas Ambus

Method Summary
 void close()
          The method is used to let the XMLStore properly commit all data to the underlying ressource, release resources, and so forth.
 NameServer<R> getNameServer()
          Returns the NameServer with the largest scope associated with this XMLStore.
 Node load(R ref)
          Loads XML data identified by a reference.
 R save(Node node)
          Saves the XML data represented by the specified Node.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

save

public R save(Node node)
                         throws IOException
Description copied from interface: XMLStore
Saves the XML data represented by the specified Node. The method returns a unique location independent reference, which can be used to load the node, when needed.

Specified by:
save in interface XMLStore<R extends Reference>
Parameters:
node - representing XML data in the form of semi-structured tree data
Returns:
a reference to the saved node/tree
Throws:
IOException - if an error occurs during disk, network, etc access

load

public Node load(R ref)
          throws IOException,
                 UnknownReferenceException
Description copied from interface: XMLStore
Loads XML data identified by a reference. The returned value is semi-structured tree data, represented by a "root node" having 0 or more subtrees each represented by Nodes.

Specified by:
load in interface XMLStore<R extends Reference>
Parameters:
ref - the Reference to the data
Returns:
node representing the loaded XML data
Throws:
IOException - if an error occurs during disk, network, etc access
UnknownReferenceException - if the data referenced is not stored in the XMLStore or the Reference is of a type not supported by the XMLStore

getNameServer

public NameServer<R> getNameServer()
Description copied from interface: XMLStore
Returns the NameServer with the largest scope associated with this XMLStore. That is, an XMLStore that stores data in a distributed setting should return a global NameServer for the XMLStore network in which it participates and not a local NameServer (even though it may also have access to such an entity).

Specified by:
getNameServer in interface XMLStore<R extends Reference>

close

public void close()
           throws IOException
Description copied from interface: XMLStore
The method is used to let the XMLStore properly commit all data to the underlying ressource, release resources, and so forth. Once close has been issued on an XMLStore, the store is no longer available for handling requests. Any subsequent request to the store will result in an exception being thrown. An XMLStore implementation has to ensure that this happens.

Specified by:
close in interface XMLStore<R extends Reference>
Throws:
IOException - if it is not possible to properly close the store

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2005 Plan-X. All Rights Reserved.