org.planx.xmlstore.stores
Class TranslatorXMLStore

java.lang.Object
  extended by org.planx.xmlstore.stores.AbstractXMLStore
      extended by org.planx.xmlstore.stores.TranslatorXMLStore
All Implemented Interfaces:
XMLStore

public class TranslatorXMLStore
extends AbstractXMLStore

A bridge between location independent and location dependent XMLStores. The TranslatorXMLStore translates the underlying XMLStores References to ContentValueReferences that are location independent. It uses a reference server to do so. Only root nodes (i.e. ones that were at any point argument to the save method) are registered in the reference server.

Author:
Thomas Ambus

Field Summary
 
Fields inherited from class org.planx.xmlstore.stores.AbstractXMLStore
xmlstore
 
Constructor Summary
TranslatorXMLStore(LocalXMLStore xmlstore)
           
 
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.
 void release(Reference ref)
           
protected  Node resolvedLoad(Reference vref)
          ContentValueReferences will be resolved by looking up the root reference in the local reference server, loading this node in the underlying store, and traversing from this node to the node designated be the path of the global reference.
 void retain(Reference ref)
           
 Reference save(Node node)
          Saves the Node, gives it a ContentValueReference, and registers it in the local reference server.
 
Methods inherited from class org.planx.xmlstore.stores.AbstractXMLStore
checkClosed, load, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TranslatorXMLStore

public TranslatorXMLStore(LocalXMLStore xmlstore)
                   throws IOException
Throws:
IOException
Method Detail

resolvedLoad

protected Node resolvedLoad(Reference vref)
                     throws IOException,
                            UnknownReferenceException
ContentValueReferences will be resolved by looking up the root reference in the local reference server, loading this node in the underlying store, and traversing from this node to the node designated be the path of the global reference. Other references will be handed directly to the underlying store, which may or may not be able to translate them. RelativeReferences containing ContentValueReferences as roots are accepted.

Overrides:
resolvedLoad in class AbstractXMLStore
Parameters:
vref - the resolved Reference
Throws:
IOException
UnknownReferenceException

save

public Reference save(Node node)
               throws IOException
Saves the Node, gives it a ContentValueReference, and registers it in the local reference server.

Specified by:
save in interface XMLStore
Overrides:
save in class AbstractXMLStore
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

retain

public void retain(Reference ref)
            throws UnknownReferenceException
Throws:
UnknownReferenceException

release

public void release(Reference ref)
             throws UnknownReferenceException
Throws:
UnknownReferenceException

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


Copyright © 2010. All Rights Reserved.