package de.uka.ipd.consensus.foundation.scoring;

import java.util.Properties;

import de.uka.ipd.consensus.foundation.ConsensusFoundationModule;
import de.uka.ipd.consensus.foundation.logging.LoggingManager;
import de.uka.ipd.consensus.foundation.ontology.OntologyManager;
import de.uka.ipd.consensus.foundation.user.UserManager;

/**
 * <p>The IncentiveManager triggers ScoringListeners whenever an event occurs that might change a user's score.
 * The other components do not actively push events, the IncentiveManager implementation has to register itself as a listener
 * on various other components (usually on the RatingManager, OntologyManager and EvolutionManager).</p>
 * 
 * <p>The IncentiveManager implementation can be configured with the key <code>cf.incentivemanager</code>
 * in the <code>ConsensusFoundation.properties</code> configuration file. It's an optional component.</p>
 * 
 * <p>If the key the key <code>cf.incentivemanager</code> is present, the implementation is loaded by the
 * <code>ConsensusFoundation</code> constructor. For successful instantiation, the IncentiveManager implementation must provide
 * a default constructor without arguments.</p>
 * 
 * @author Thomas Much
 * @version 2006-06-14
 * @see ScoringListener
 * @see de.uka.ipd.consensus.foundation.ConsensusFoundation
 */
public interface IncentiveManager extends ConsensusFoundationModule {

	/**
	 * This method is called by the <code>ConsensusFoundation</code> constructor to initialize the IncentiveManager.
	 * @param config all entries from <code>ConsensusFoundation.properties</code>
	 * @param logging the successfully initialized LoggingManager instance
	 * @param users the the successfully initialized UserManager instance
	 * @param ontology the the successfully initialized OntologyManager instance
	 * @throws Exception if any error occurs (startup of the application is aborted in this case)
	 * @see de.uka.ipd.consensus.foundation.ConsensusFoundation#ConsensusFoundation()
	 */
	public void init(Properties config, LoggingManager logging, UserManager users, OntologyManager ontology) throws Exception;
	
	
	/**
	 * Returns the initial score for newly created users. Usually 0.
	 * @return the initial score for newly created users
	 */
	public double getInitialUserScore();

	
	/**
	 * Registers a new ScoringListener.
	 * You don't have to call this method explicitely, since you can declare ScoringListeners in <code>ConsensusFoundation.properties</code>.
	 * @param listener the ScoringListener to be added
	 * @see ScoringListener
	 */
	public void addScoringListener(ScoringListener listener);
	

	/**
	 * Removes a ScoringListener, if it is registered with the IncentiveManager (otherwise this call is ignored).
	 * @param listener the ScoringListener to be removed
	 */
	public void removeScoringListener(ScoringListener listener);

}
