/*
Copyright 2002-2005 The Members of the OSS through Java(TM) Initiative.
All rights reserved. Use is subject to license terms.
*/
package javax.oss;


/**
 * This exception is thrown if a an update method (remote) contains
 * a stale value object.
 *
 * <p>
 * Note: This exception replaces the deprecated javax.oss.ResyncRequiredException
 * 
 * @author OSS through Java Initiative, Vincent Perrot Sun Microsystems Inc.
 * @version 1.2
 * @since August 2005
 * @ossj:exception
 */
//AB decision 2005-08-12: Use OSS prefix for all OSSJ exception and respect the Exception inheritence
public class OssResyncRequiredException extends Exception {
//public class OssResyncRequiredException extends ResyncRequiredException {
    private ManagedEntityKey key;

    /**
      * Constructs an ResyncRequiredException with no detail message.
     */
    public OssResyncRequiredException() {
        super();
    }

    /**
     * Constructs an ResyncRequiredException with the specified key and detail message.
     *
     * @param staleObjectKey the Managed entity Key concerned by this exception
     * @param message the description of the problem.
     */
    public OssResyncRequiredException(ManagedEntityKey staleObjectKey, String message) {
    	super(message);

        if (staleObjectKey != null) {
            key = (ManagedEntityKey) staleObjectKey.clone();
        } else {
            key = null;
        }
    }

    /**
     * Get the Key of the stale Managed Entity Value.
     * @return Key of the stale Managed Entity Value.
     *
     * @ossj:minOccursField value=1
     * @ossj:nillableField value=false
     */
    public ManagedEntityKey getManagedEntityKey() {
        return key;
    }
}
