001    package data;
002    
003    import java.io.Serializable;
004    
005    /**
006     * A name context.
007     *
008     * <p>Name contexts are a policy to shield rename functions. You can think of a name context as a name space
009     * that comes with certain rules that decide validity of names. One rule could be, for example, that names
010     * must be unique in a name context.</p>
011     *
012     * @author Steffen Zschaler
013     * @version 2.0 25/05/1999
014     * @since v2.0
015     */
016    public interface NameContext extends Serializable {
017    
018        /**
019         * Check a name change for compliance with the rules of this NameContext.
020         *
021         * <p>If the proposed name change is not valid, a NameContextException is thrown. Otherwise,
022         * <code>checkNameChange</code> simply returns.</p>
023         *
024         * @param db the DataBasket relative to which the name change is to take place.
025         * @param sOldName the name to be changed.
026         * @param sNewName the new name.
027         *
028         * @exception NameContextException if the name change would not be valid.
029         *
030         * @override Always
031         */
032        public void checkNameChange(DataBasket db, String sOldName, String sNewName) throws NameContextException;
033    
034        /**
035         * Indicate a successful name change.
036         *
037         * <p>Calls to this method indicate to the NameContext that a name change has been successful. The
038         * NameContext may adjust internal tables or structures here.</p>
039         *
040         * @param db the DataBasket relative to which the name change has taken place.
041         * @param sOldName the old name of the object whose name was changed.
042         * @param sNewName the new name of the object.
043         *
044         * @override Always
045         */
046        public void nameHasChanged(DataBasket db, String sOldName, String sNewName);
047    
048        /**
049         * Return an object that can be used as a monitor to synchronize name changes. All changes that can
050         * influence the return value of {@link #checkNameChange} or the execution of {@link #nameHasChanged} must
051         * be synchronized on this monitor.
052         *
053         * @override Always
054         */
055        public Object getNCMonitor();
056    }