de.topicmapslab.majortom.inmemory.transaction
Class TransactionCommand

java.lang.Object
  extended by de.topicmapslab.majortom.inmemory.transaction.TransactionCommand

public class TransactionCommand
extends java.lang.Object

Author:
Sven Krosse

Field Summary
private  de.topicmapslab.majortom.model.core.IConstruct context
          the context of operation
private  TransactionOperation operation
          the operation type
private  java.lang.Object[] parameters
          the parameters
private  de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramterType
          the parameter type
private  java.lang.Object result
          the result of operation
 
Constructor Summary
TransactionCommand(de.topicmapslab.majortom.model.transaction.ITransaction transaction, java.lang.Object result, TransactionOperation operation, de.topicmapslab.majortom.model.core.IConstruct context, de.topicmapslab.majortom.model.store.TopicMapStoreParameterType parameterType, java.lang.Object... parameters)
          constructor
 
Method Summary
 java.lang.Object commit(de.topicmapslab.majortom.model.store.ITopicMapStore store, java.util.Map<java.lang.Object,java.lang.Object> lazy)
          Commit the transaction store to the given topic map store.
 java.lang.Object getResult()
          The result of the transaction during the modification inside the transaction context and not the commit result.
private  java.lang.Object resolveTransactionObject(de.topicmapslab.majortom.model.store.ITopicMapStore store, java.lang.Object parameter, java.util.Map<java.lang.Object,java.lang.Object> lazy)
          Returns the real construct representing the context in the real topic map outside the transaction.
 void rollback()
          Rolling back the committed changes of this transaction command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operation

private final TransactionOperation operation
the operation type


context

private final de.topicmapslab.majortom.model.core.IConstruct context
the context of operation


paramterType

private final de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramterType
the parameter type


parameters

private final java.lang.Object[] parameters
the parameters


result

private final java.lang.Object result
the result of operation

Constructor Detail

TransactionCommand

public TransactionCommand(de.topicmapslab.majortom.model.transaction.ITransaction transaction,
                          java.lang.Object result,
                          TransactionOperation operation,
                          de.topicmapslab.majortom.model.core.IConstruct context,
                          de.topicmapslab.majortom.model.store.TopicMapStoreParameterType parameterType,
                          java.lang.Object... parameters)
constructor

Parameters:
transaction - the transaction which creates this command
result - the result of the transaction command
operation - the operation type of the transaction
context - the context of this command
parameterType - the type of operation delegated to the underlying store
parameters - parameters of the the called operation
Method Detail

commit

public java.lang.Object commit(de.topicmapslab.majortom.model.store.ITopicMapStore store,
                               java.util.Map<java.lang.Object,java.lang.Object> lazy)
                        throws de.topicmapslab.majortom.model.exception.TopicMapStoreException
Commit the transaction store to the given topic map store.

Parameters:
store - the topic map store
lazy - a lazy map containing the mapping between the transaction stubs and the real construct
Returns:
the created item if operation is TransactionOperation.CREATE, null otherwise.
Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException - thrown if operation fails

rollback

public void rollback()
Rolling back the committed changes of this transaction command.


getResult

public java.lang.Object getResult()
The result of the transaction during the modification inside the transaction context and not the commit result.

Returns:
the result

resolveTransactionObject

private final java.lang.Object resolveTransactionObject(de.topicmapslab.majortom.model.store.ITopicMapStore store,
                                                        java.lang.Object parameter,
                                                        java.util.Map<java.lang.Object,java.lang.Object> lazy)
Returns the real construct representing the context in the real topic map outside the transaction.

Parameters:
store - the store
parameter - the transaction object ( construct, string, locator etc.)
lazy - a map containing the mapping between a construct inside and outside the transaction
Returns:
the object outside the transaction