package de.uka.ipd.consensus.foundation;

import java.util.Properties;

/**
 * Every implementation of a ConsensusFoundation component (one of the seven "managers") must implement this interface.
 * @author Thomas Much
 * @version 2006-06-14
 */
public interface ConsensusFoundationModule {

	/**
	 * This method is called by the <code>ConsensusFoundation</code> constructor after all available modules have
	 * been initialized (i.e. their <code>init()</code> method has been called). Here a module can perform some final
	 * initialization that is dependant on other modules.
	 * @param config all entries from <code>ConsensusFoundation.properties</code>
	 * @param cfm a reference to the ConsensusFoundation instance that set up the application
	 * @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 initCompleted(Properties config, ConsensusFoundationManager cfm) throws Exception;

	
	/**
	 * Returns a reference to the ConsensusFoundation instance that set up the application
	 * @return a reference to the ConsensusFoundation instance that set up the application
	 * @see ConsensusFoundation
	 */
	public ConsensusFoundationManager getConsensusFoundationManager();

	
	/**
	 * Called by <code>ConsensusFoundation.shutdown()</code> when the application shuts down.
	 * <p>When implementing this method make sure that the shutdown code is executed only once even if this method is called multiple times.</p>
	 * @see ConsensusFoundation#shutdown()
	 */
	public void shutdown();

	
	/**
	 * Returns a version string of the implementation of this module.
	 * @return the version of the module's implementation
	 */
	public String getVersion();
}
