Class TransactionalOnlineAttributeWriter.TransactionValidator
- java.lang.Object
-
- cz.o2.proxima.direct.core.transaction.TransactionalOnlineAttributeWriter.TransactionValidator
-
- All Implemented Interfaces:
ContextualTransformation<DirectDataOperator>
,DataOperatorAware
,Transformation
,TransactionalOnlineAttributeWriter.TransactionAware
,DirectElementWiseTransform
,java.io.Serializable
,java.lang.AutoCloseable
- Enclosing class:
- TransactionalOnlineAttributeWriter
public abstract static class TransactionalOnlineAttributeWriter.TransactionValidator extends java.lang.Object implements TransactionalOnlineAttributeWriter.TransactionAware, DirectElementWiseTransform
Base class for enforcing constraints on outputs of transaction (e.g. unique constraints). Extend this class to do any application-specific validation of to-be-committed outputs of a transaction.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TransactionValidator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TransactionalOnlineAttributeWriter.Transaction
currentTransaction()
void
setTransaction(TransactionalOnlineAttributeWriter.Transaction transaction)
void
setup(Repository repo, DirectDataOperator directDataOperator, java.util.Map<java.lang.String,java.lang.Object> cfg)
Read the repository and setup descriptors of target entity and attributes.void
transform(StreamElement input, CommitCallback commit)
Transform and output any transformed elements.abstract void
validate(StreamElement element, TransactionalOnlineAttributeWriter.Transaction transaction)
Validate the input element.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cz.o2.proxima.core.transform.ContextualTransformation
isContextual, onRestart
-
Methods inherited from interface cz.o2.proxima.core.transform.DataOperatorAware
as
-
Methods inherited from interface cz.o2.proxima.direct.core.transform.DirectElementWiseTransform
isDelegateOf
-
Methods inherited from interface cz.o2.proxima.core.transform.Transformation
asContextualTransform, asElementWiseTransform
-
-
-
-
Method Detail
-
setup
public void setup(Repository repo, DirectDataOperator directDataOperator, java.util.Map<java.lang.String,java.lang.Object> cfg)
Description copied from interface:ContextualTransformation
Read the repository and setup descriptors of target entity and attributes.- Specified by:
setup
in interfaceContextualTransformation<DirectDataOperator>
- Specified by:
setup
in interfaceDirectElementWiseTransform
- Parameters:
repo
- the repositorydirectDataOperator
-DataOperator
that delegated this Transformationcfg
- transformation config map
-
currentTransaction
public final TransactionalOnlineAttributeWriter.Transaction currentTransaction()
- Specified by:
currentTransaction
in interfaceTransactionalOnlineAttributeWriter.TransactionAware
-
setTransaction
public final void setTransaction(TransactionalOnlineAttributeWriter.Transaction transaction)
- Specified by:
setTransaction
in interfaceTransactionalOnlineAttributeWriter.TransactionAware
-
transform
public final void transform(StreamElement input, CommitCallback commit)
Description copied from interface:DirectElementWiseTransform
Transform and output any transformed elements. The complete processing is defined by this method.- Specified by:
transform
in interfaceDirectElementWiseTransform
- Parameters:
input
- the inputStreamElement
commit
- asynchronous callback notifying about the result
-
validate
public abstract void validate(StreamElement element, TransactionalOnlineAttributeWriter.Transaction transaction) throws TransactionalOnlineAttributeWriter.TransactionPreconditionFailedException, TransactionalOnlineAttributeWriter.TransactionRejectedException
Validate the input element. Use providedTransactionalOnlineAttributeWriter.Transaction
to add new inputs (if any). MUST NOT callTransactionalOnlineAttributeWriter.Transaction.commitWrite(java.util.List<cz.o2.proxima.core.storage.StreamElement>, cz.o2.proxima.direct.core.CommitCallback)
.- Parameters:
element
- the input stream element to transform- Throws:
TransactionalOnlineAttributeWriter.TransactionPreconditionFailedException
- if any precondition for a transaction fails.TransactionalOnlineAttributeWriter.TransactionRejectedException
-
-