/**
 * 
 */
package org.biomoby.registry.rdfagent.util;

import org.biomoby.shared.MobyException;

/**
 * Interface for interacting with the mobycentral data store.
 * 
 * @author Eddie created Feb 2, 2006
 */
public interface CentralDataAccess {

	/**
	 * 
	 * @param signatureURL
	 *            the signature url to update
	 * @param errorCode
	 *            the error code that caused this update
	 * @return true if the update succeeded, false otherwise.
	 * @throws MobyException
	 *             if the agent cannot connect for any reason to the data store
	 */
	public boolean incrementErrorCountForURL(String signatureURL, int errorCode)
			throws MobyException;

	/**
	 * 
	 * @param signatureURL
	 *            the signature url to update
	 *            
	 * @return true if the update succeeded, false otherwise.
	 * @throws MobyException
	 *             if the agent cannot connect for any reason to the data store
	 */
	public boolean decrementErrorCountForURL(String signatureURL)
			throws MobyException;
	
	/**
	 * 
	 * @param signatureURL
	 *            the signature url to remove from the validity table.
	 * @return true if the deletion succeeded, false otherwise.
	 * @throws MobyException
	 *             if the agent cannot connect for any reason to the data store
	 */
	public boolean deleteErrorCountForURL(String signatureURL)
			throws MobyException;

	/**
	 * 
	 * @param signatureURL
	 *            the signatureURL to insert into the validity table
	 * @param errorCode
	 *            the 'code' for the error (most likely an HTTP response code)
	 * @return true if the the error count was successfully entered into the
	 *         data store. False otherwise.
	 * @throws MobyException
	 *             if the agent cannot connect for any reason to the data store
	 */
	public boolean insertErrorCountForURL(String signatureURL, int errorCode)
			throws MobyException;

	/**
	 * 
	 * @param signatureURL
	 *            the url to query an error count for
	 * @return the error count for a specific signature url
	 * @throws MobyException
	 *             if the agent cannot connect for any reason to the data store
	 */
	public int getErrorCountForURL(String signatureURL) throws MobyException;

	/**
	 * Use this method to perform any 'clean up', i.e. for JDBC, close
	 * connections, etc.
	 * 
	 */
	public void cleanup();
}
