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

java.lang.Object
  extended by org.planx.xmlstore.stores.AbstractXMLStore<R>
      extended by org.planx.xmlstore.stores.OptimisticReadXMLStore<R>
All Implemented Interfaces:
ExecXMLStore<R>, XMLStore<R>

public class OptimisticReadXMLStore<R extends Reference>
extends AbstractXMLStore<R>
implements ExecXMLStore<R>

Optimistically reads nodes from an underlying XMLStore, returning them before they are available. Only when data in the node is actually accessed will the client be blocked until the data becomes available. The store implements the ExecXMLStore interface, but it will throw UnsupportedOperationException if exec is invoked and the underlying XML Store does not implement the ExecXMLStore interface.

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

Constructor Summary
OptimisticReadXMLStore(XMLStore<R> xmlstore)
           
 
Method Summary
 R exec(R code, R args)
          Execute the code referenced by codeRef supplied with the argument reference by argsRef.
 Node load(R ref)
          Loads XML data identified by a reference.
 
Methods inherited from class org.planx.xmlstore.stores.AbstractXMLStore
close, getNameServer, save, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.planx.xmlstore.XMLStore
close, getNameServer, save
 

Constructor Detail

OptimisticReadXMLStore

public OptimisticReadXMLStore(XMLStore<R> xmlstore)
Method Detail

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>
Overrides:
load in class AbstractXMLStore<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

exec

public R exec(R code,
              R args)
                         throws IOException,
                                ExecException,
                                UnsupportedOperationException
Description copied from interface: ExecXMLStore
Execute the code referenced by codeRef supplied with the argument reference by argsRef. Returns a reference to the result of the execution.

Specified by:
exec in interface ExecXMLStore<R extends Reference>
Parameters:
code - the Reference to a binary node containing class code implementing StoredCode
args - reference to arguments
Returns:
a reference to the result
Throws:
IOException - if an error occurs during loading of code or arguments
ExecException
UnsupportedOperationException


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