/* ************************************************************************
#
#  DivConq
#
#  http://divconq.com/
#
#  Copyright:
#    Copyright 2012 eTimeline, LLC. All rights reserved.
#
#  License:
#    See the license.txt file in the project's top-level directory for details.
#
#  Authors:
#    * Andy White
#
************************************************************************ */
package divconq.db;

/**
 * Database Requests (IDatabaseRequest) are submitted to the database asynchronously.  Only once 
 * the request has finished processing will the submitter be informed via a callback.  The
 * callback object is handed the result of the request.
 * 
 * ObjectCallback is the more common callback, it assumes the database result will be a CompositeStruct
 * (a collection of Java objects that roughly supports the same structures as JSON).
 * 
 * @author Andy
 *
 */
abstract public class ObjectCallback implements IDatabaseCallback {
	/**
	 * When a Database request has completed, and a response (or error messages) is available 
	 * then "process" is called so the original request submitter can continue processing.
	 * The submitted must supply a callback when submitting a database request. 
	 * 
	 * @param res the result of the request
	 */
	@Override
	public void process(DatabaseResult res) {
		this.process((ObjectResult)res);
	}
	
	/**
	 * When a Database request has completed, and a response (or error messages) is available 
	 * then "process" is called so the original request submitter can continue processing.
	 * The submitted must supply a callback when submitting a database request. 
	 * 
	 * @param res the result of the request
	 */
	abstract public void process(ObjectResult res);
}
