org.compass.core
Class CompassCallbackWithoutResult

java.lang.Object
  extended by org.compass.core.CompassCallbackWithoutResult
All Implemented Interfaces:
CompassCallback<Object>

public abstract class CompassCallbackWithoutResult
extends Object
implements CompassCallback<Object>

Simple convenience class for the CompassCallback implementation. Allows implementing a doInCompass version without a result, i.e without the need for a return statement.

Author:
kimchy

Constructor Summary
CompassCallbackWithoutResult()
           
 
Method Summary
 Object doInCompass(CompassSession session)
          Gets called by CompassTemplate.execute with an active Compass Session.
protected abstract  void doInCompassWithoutResult(CompassSession session)
          Gets called by CompassTemplate.execute with an active Compass Session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompassCallbackWithoutResult

public CompassCallbackWithoutResult()
Method Detail

doInCompass

public Object doInCompass(CompassSession session)
                   throws CompassException
Description copied from interface: CompassCallback
Gets called by CompassTemplate.execute with an active Compass Session. Does not need to care about activating or closing the Session, or handling transactions.

If called within a thread-bound Compass transaction (initiated by an outer compass transaction abstraction), the code will simply get executed on the outer compass transaction with its transactional semantics.

Allows for returning a result object created within the callback, i.e. a domain object or a hits of domain objects. Note that there's special support for single step actions: see CompassTemplate.find etc. A thrown RuntimeException is treated as application exception, it gets propagated to the caller of the template.

Specified by:
doInCompass in interface CompassCallback<Object>
Throws:
CompassException

doInCompassWithoutResult

protected abstract void doInCompassWithoutResult(CompassSession session)
                                          throws CompassException
Gets called by CompassTemplate.execute with an active Compass Session. Does not need to care about activating or closing the Session, or handling transactions.

If called without a thread-bound Compass transaction (initiated by an outer compass transaction abstraction), the code will simply get executed on the outer compass transaction with its transactional semantics.

Parameters:
session -
Throws:
CompassException


Copyright (c) 2004-2009 The Compass Project.