org.jboss.cache.search
Class NodeModifiedTransactionContext

java.lang.Object
  extended by org.jboss.cache.search.NodeModifiedTransactionContext
All Implemented Interfaces:
org.hibernate.search.backend.TransactionContext

public class NodeModifiedTransactionContext
extends Object
implements org.hibernate.search.backend.TransactionContext

This class implements the TransactionContext interface. It retrieves transaction context information from the NodeModifiedEvent that gets passed in.

It is used by the SearchableCoreListener to pass transaction information to a Hibernate Search Work object.

Author:
Navin Surtani (nsurtani@redhat.com)
See Also:
SearchableCoreListener

Constructor Summary
NodeModifiedTransactionContext(org.jboss.cache.notifications.event.NodeModifiedEvent event)
          Creates a new instance of NodeModifiedTransactionContext.
 
Method Summary
 Object getTransactionIdentifier()
          Returns a JTA transaction.
 boolean isTransactionInProgress()
          Returns a boolean value whether or not a transaction is in progress (JTA transaction and in this case *not* an org.hibernate transaction).
 void registerSynchronization(Synchronization synchronization)
          Registers the synchronization passed in as a parameter with the ongoing transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeModifiedTransactionContext

public NodeModifiedTransactionContext(org.jboss.cache.notifications.event.NodeModifiedEvent event)
Creates a new instance of NodeModifiedTransactionContext.

Parameters:
event - a NodeModifiedEvent to wrap. Should not be null.
Throws:
NullPointerException - if event is null.
Method Detail

isTransactionInProgress

public boolean isTransactionInProgress()
Returns a boolean value whether or not a transaction is in progress (JTA transaction and in this case *not* an org.hibernate transaction).

Specified by:
isTransactionInProgress in interface org.hibernate.search.backend.TransactionContext
Returns:
true if a transaction is in progress, false otherwise.

getTransactionIdentifier

public Object getTransactionIdentifier()
Returns a JTA transaction.

Specified by:
getTransactionIdentifier in interface org.hibernate.search.backend.TransactionContext
Returns:
a JTA transaction if one is available, or a null otherwise.
See Also:
TransactionalEvent.getTransaction()

registerSynchronization

public void registerSynchronization(Synchronization synchronization)
Registers the synchronization passed in as a parameter with the ongoing transaction.

If there is no ongoing transaction, then this method will do nothing and simply return.

Specified by:
registerSynchronization in interface org.hibernate.search.backend.TransactionContext
Parameters:
synchronization - synchronization to register. Must not be null.
Throws:
NullPointerException - if the synchronization is null.


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.