org.openmdx.compatibility.base.dataprovider.exporter
Class ReplicateHandler.RequestDispenser

java.lang.Object
  extended by org.openmdx.compatibility.base.dataprovider.exporter.ReplicateHandler.RequestDispenser
Enclosing class:
ReplicateHandler

protected static class ReplicateHandler.RequestDispenser
extends Object

Dispense the RequestCollections for accessing the dataprovider according to the current transaction behavior.

The ReplicateHandler must feed the callbacks startObject(), endObject(), startTopLevelObject(), endTopLevelObject(). The RequestDispenser needs this information to be able to follow the currrent state of work.

A toplevel object is an object specified in the startPath list.


Constructor Summary
ReplicateHandler.RequestDispenser(ServiceHeader header, Dataprovider_1_0 provider)
          Prepare the RequestDispenser.
 
Method Summary
 void abandonTraversal()
          Rollback the current transaction.
 void endObject(boolean isToplevelObject)
          An object has been treated, based in the transaction setting a new transaction is ended.
 void endTraversal()
          End the transaction if transactional behaviour is set accordingly.
 RequestCollection getRequestCollection()
          Get a RequestCollection.
 RequestCollection getTimedRequestCollection(String validFrom, String validTo)
          Get a RequestCollection which has requestedAt date set which is between validFrom and validTo.
 short getTransactionBehavior()
          Get the currently active transaction behavior.
 boolean hasOpenTransaction()
          Returns true if currently a transaction is open.
 void setTransactionBehavior(short transactionBehavior)
          Set the TransactionBehavior.
 void startObject(boolean isToplevelObject)
          An object starts, based on the transaction setting a new transaction is started.
 void startTraversal()
          Start the transaction if transactional behaviour is set accordingly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicateHandler.RequestDispenser

public ReplicateHandler.RequestDispenser(ServiceHeader header,
                                         Dataprovider_1_0 provider)
Prepare the RequestDispenser.

Parameters:
provider - the dataprovider to work with
Method Detail

setTransactionBehavior

public void setTransactionBehavior(short transactionBehavior)
Set the TransactionBehavior.

If the transaction behavior is set during a running transaction, it the new behavior only gets assigned after the current transaction has been ended. Note: changing the transaction behavior when the current behavior is ONE_TRANSACTION is useless.

Parameters:
transactionBehavior -

getTransactionBehavior

public short getTransactionBehavior()
Get the currently active transaction behavior.

If a new behavior has already been set, this can not be detected.

Returns:
short

getRequestCollection

public RequestCollection getRequestCollection()
                                       throws ServiceException
Get a RequestCollection.

This is the central part of the RequestDispenser as the RequestCollection's transaction is started (must be!) and will be commited according to the setting of transaction behavior.

Throws:
ServiceException

getTimedRequestCollection

public RequestCollection getTimedRequestCollection(String validFrom,
                                                   String validTo)
                                            throws ServiceException
Get a RequestCollection which has requestedAt date set which is between validFrom and validTo.

This request collection is intended for reading access, thus it is not related to any transaction treatment.

Parameters:
validFrom -
validTo -
Throws:
ServiceException

hasOpenTransaction

public boolean hasOpenTransaction()
Returns true if currently a transaction is open.


startTraversal

public void startTraversal()
                    throws ServiceException
Start the transaction if transactional behaviour is set accordingly.

Throws:
ServiceException

endTraversal

public void endTraversal()
                  throws ServiceException
End the transaction if transactional behaviour is set accordingly.

Throws:
ServiceException

abandonTraversal

public void abandonTraversal()
                      throws ServiceException
Rollback the current transaction.

Throws:
ServiceException

startObject

public void startObject(boolean isToplevelObject)
                 throws ServiceException
An object starts, based on the transaction setting a new transaction is started.

Throws:
ServiceException

endObject

public void endObject(boolean isToplevelObject)
               throws ServiceException
An object has been treated, based in the transaction setting a new transaction is ended.

Throws:
ServiceException


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.