package data; import java.io.Serializable; /** * A name context. * * <p>Name contexts are a policy to shield rename functions. You can think of a name context as a name space * that comes with certain rules that decide validity of names. One rule could be, for example, that names * must be unique in a name context.</p> * * @author Steffen Zschaler * @version 2.0 25/05/1999 * @since v2.0 */ public interface NameContext extends Serializable { /** * Check a name change for compliance with the rules of this NameContext. * * <p>If the proposed name change is not valid, a NameContextException is thrown. Otherwise, * <code>checkNameChange</code> simply returns.</p> * * @param db the DataBasket relative to which the name change is to take place. * @param sOldName the name to be changed. * @param sNewName the new name. * * @exception NameContextException if the name change would not be valid. * * @override Always */ public void checkNameChange (DataBasket db, String sOldName, String sNewName) throws NameContextException; /** * Indicate a successful name change. * * <p>Calls to this method indicate to the NameContext that a name change has been successful. The * NameContext may adjust internal tables or structures here.</p> * * @param db the DataBasket relative to which the name change has taken place. * @param sOldName the old name of the object whose name was changed. * @param sNewName the new name of the object. * * @override Always */ public void nameHasChanged (DataBasket db, String sOldName, String sNewName); /** * Return an object that can be used as a monitor to synchronize name changes. All changes that can * influence the return value of {@link #checkNameChange} or the execution of {@link #nameHasChanged} must * be synchronized on this monitor. * * @override Always */ public Object getNCMonitor(); }