org.planx.xmlstore.stores
Class AbstractXMLStore

java.lang.Object
  extended by org.planx.xmlstore.stores.AbstractXMLStore
All Implemented Interfaces:
XMLStore
Direct Known Subclasses:
DistributedXMLStore, LocalXMLStore, NetworkProxy, OptimisticReadXMLStore, OptimisticWriteXMLStore, ReadCacheXMLStore, ReplicatorXMLStore, TranslatorXMLStore, WriteCacheXMLStore

public abstract class AbstractXMLStore
extends Object
implements XMLStore

A convenience class for implementing XMLStores. The implementation of the load(org.planx.xmlstore.Reference) method resolves any RelativeReferences before calling resolvedLoad(org.planx.xmlstore.Reference). This method calls the underlying XMLStore if one was provided in the constructor. Thus, implementations that only accept certain types of References should override the resolvedLoad(org.planx.xmlstore.Reference) method instead of the load(org.planx.xmlstore.Reference) method. Implementations that accept any kind of Reference can just override the load(org.planx.xmlstore.Reference) method.

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

Field Summary
protected  XMLStore xmlstore
           
 
Constructor Summary
protected AbstractXMLStore()
          Base XMLStores that do not wrap other XMLStores can use this constructor.
protected AbstractXMLStore(XMLStore xmlstore)
          Decorators that wrap other XMLStores can use this constructor.
 
Method Summary
protected  void checkClosed()
           
 void close()
          The method is used to let the XMLStore properly commit all data to the underlying ressource, release resources, and so forth.
 Node load(Reference vref)
          Resolves any RelativeReferences and calls resolvedLoad(org.planx.xmlstore.Reference).
protected  Node resolvedLoad(Reference resolvedRef)
          Called by load(org.planx.xmlstore.Reference) after resolving RelativeReferences.
 Reference save(Node node)
          Saves the XML data represented by the specified Node.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xmlstore

protected XMLStore xmlstore
Constructor Detail

AbstractXMLStore

protected AbstractXMLStore()
Base XMLStores that do not wrap other XMLStores can use this constructor.


AbstractXMLStore

protected AbstractXMLStore(XMLStore xmlstore)
Decorators that wrap other XMLStores can use this constructor.

Method Detail

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
Throws:
IOException - if it is not possible to properly close the store

checkClosed

protected void checkClosed()

save

public Reference 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
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(Reference vref)
          throws IOException,
                 UnknownReferenceException
Resolves any RelativeReferences and calls resolvedLoad(org.planx.xmlstore.Reference).

Specified by:
load in interface XMLStore
Parameters:
vref - 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

resolvedLoad

protected Node resolvedLoad(Reference resolvedRef)
                     throws IOException,
                            UnknownReferenceException
Called by load(org.planx.xmlstore.Reference) after resolving RelativeReferences.

Parameters:
resolvedRef - the resolved Reference
Throws:
IOException
UnknownReferenceException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010. All Rights Reserved.