/*******************************************************************************
 * Copyright (c) 2004, 2005 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.data.engine.script;

import org.eclipse.birt.core.exception.BirtException;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;

/**
 * This class is used to mock a BirtException, which should been throw but due
 * to the limit of Rhino ( which sometimes return invalid expression as
 * Undefined type), it can only return as a return type.
 */
public final class DataExceptionMocker extends ScriptableObject
{
	// The DataException this instance intends to mock
	private BirtException cause = null;
	
	/** */	
	private static final long serialVersionUID = 6159134449559197540L;

	/**
	 * Constructor function
	 * 
	 * @param e
	 */
	DataExceptionMocker( BirtException e )
	{
		cause = e;
	}

	/**
	 * Return the DataException this instance intends to mock.
	 * 
	 * @return cause
	 */
	public BirtException getCause( )
	{
		return cause;
	}

	/*
	 * Dummy method
	 * 
	 * @see org.mozilla.javascript.Scriptable#getClassName()
	 */
	public String getClassName( )
	{
		return null;
	}

	/*
	 * Dummy method
	 * 
	 * @see org.mozilla.javascript.Scriptable#get(int, org.mozilla.javascript.Scriptable)
	 */
	public Object get( int i, Scriptable s )
	{
		return this;
	}

	/*
	 * Dummy method
	 * 
	 * @see org.mozilla.javascript.Scriptable#get(java.lang.String, org.mozilla.javascript.Scriptable)
	 */
	public Object get( String text, Scriptable s )
	{
		return this;
	}

	/*
	 * Dummy method
	 * 
	 * @see org.mozilla.javascript.Scriptable#has(int, org.mozilla.javascript.Scriptable)
	 */
	public boolean has( int i, Scriptable s )
	{
		return true;
	}

	/*
	 * Dummy method
	 * 
	 * @see org.mozilla.javascript.Scriptable#has(java.lang.String, org.mozilla.javascript.Scriptable)
	 */
	public boolean has( String string, Scriptable s )
	{
		return true;
	}
	
	/*
	 * Dummy method
	 * 
	 * @see org.mozilla.javascript.Scriptable#put(int,
	 *      org.mozilla.javascript.Scriptable, java.lang.Object)
	 */
	public void put( int i, Scriptable s, Object o )
	{
	}
	
	/*
	 * Dummy method
	 * 
	 * @see org.mozilla.javascript.Scriptable#put(java.lang.String,
	 *      org.mozilla.javascript.Scriptable, java.lang.Object)
	 */
	public void put( String string, Scriptable s, Object o )
	{
	}
	
}
