/*************************************************************************
 * 
 *  The Contents of this file are made available subject to the terms of
 *  the Sun Industry Standards Source License Version 1.2
 * 
 *  Sun Microsystems Inc., March, 2001
 * 
 * 
 *  Sun Industry Standards Source License Version 1.2
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.2 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 * 
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 * 
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 * 
 *   Copyright: 2001 by Sun Microsystems, Inc.
 * 
 *   All Rights Reserved.
 * 
 ************************************************************************/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.

package com.sun.grid.jgrid.proxy;

/** This stub is modified to translate all calls to compute(Computable) into calls
 * to compute(Computable, String) and similarly for computeAsynch.  The missing
 * string parameter is filled in from the java.rmi.server.codebase system property.
 * @author dan.templeton@sun.com
 * @version 1.3
 * @since 0.2.1
 */
public final class ComputeServer_Stub extends java.rmi.server.RemoteStub implements com.sun.grid.jgrid.ComputeEngine, java.rmi.Remote
{
    private static final java.rmi.server.Operation[] operations = {
	new java.rmi.server.Operation("java.io.Serializable compute(com.sun.grid.jgrid.Computable)"),
	new java.rmi.server.Operation("java.io.Serializable compute(com.sun.grid.jgrid.Computable, java.lang.String)"),
	new java.rmi.server.Operation("java.lang.String computeAsynch(com.sun.grid.jgrid.Computable)"),
	new java.rmi.server.Operation("java.lang.String computeAsynch(com.sun.grid.jgrid.Computable, java.lang.String)"),
	new java.rmi.server.Operation("java.io.Serializable getResults(java.lang.String)"),
	new java.rmi.server.Operation("boolean isComplete(java.lang.String)")
    };
    
    private static final long interfaceHash = -8795380537253775019L;
    
    private static final long serialVersionUID = 2;
    
    private static boolean useNewInvoke;
    private static java.lang.reflect.Method $method_compute_0;
    private static java.lang.reflect.Method $method_compute_1;
    private static java.lang.reflect.Method $method_computeAsynch_2;
    private static java.lang.reflect.Method $method_computeAsynch_3;
    private static java.lang.reflect.Method $method_getResults_4;
    private static java.lang.reflect.Method $method_isComplete_5;
    
    static {
	try {
	    java.rmi.server.RemoteRef.class.getMethod("invoke",
		new java.lang.Class[] {
		    java.rmi.Remote.class,
		    java.lang.reflect.Method.class,
		    java.lang.Object[].class,
		    long.class
		});
	    useNewInvoke = true;
	    $method_compute_1 = com.sun.grid.jgrid.ComputeEngine.class.getMethod("compute", new java.lang.Class[] {com.sun.grid.jgrid.Computable.class, java.lang.String.class});
	    $method_computeAsynch_3 = com.sun.grid.jgrid.ComputeEngine.class.getMethod("computeAsynch", new java.lang.Class[] {com.sun.grid.jgrid.Computable.class, java.lang.String.class});
	    $method_getResults_4 = com.sun.grid.jgrid.ComputeEngine.class.getMethod("getResults", new java.lang.Class[] {java.lang.String.class});
	    $method_isComplete_5 = com.sun.grid.jgrid.ComputeEngine.class.getMethod("isComplete", new java.lang.Class[] {java.lang.String.class});
	} catch (java.lang.NoSuchMethodException e) {
	    useNewInvoke = false;
	}
    }
    
    // constructors
		/** Creates a new stub. */		
    public ComputeServer_Stub () {
	super();
    }
		/** Creates a new stub around the given reference object.
		 * @param ref the RMI reference object
		 */		
    public ComputeServer_Stub (java.rmi.server.RemoteRef ref) {
	super(ref);
    }
    
    // methods from remote interfaces
    
	/** This method submits a job for synchrnous execution.
	 * @param $param_Computable_1 the job to be executed
	 * @throws RemoteException if an error occurs on the server side
	 * @throws ComputeException if an error occurs during job execution
	 * @return the result object
	 */	
    public java.io.Serializable compute(com.sun.grid.jgrid.Computable $param_Computable_1)
	throws com.sun.grid.jgrid.ComputeException, java.rmi.RemoteException
    {
			String codebase = System.getProperty ("java.rmi.server.codebase", "");
			
			return this.compute ($param_Computable_1, codebase);
    }
    
	/** This method submits a job for synchrnous execution.
	 * @param $param_Computable_1 the job to be executed
	 * @param $param_String_2 an alternate codebase to use for loading the Computable class
	 * @throws RemoteException if an error occurs on the server side
	 * @throws ComputeException if an error occurs during job execution
	 * @return the result object
	 */	
    public java.io.Serializable compute(com.sun.grid.jgrid.Computable $param_Computable_1, java.lang.String $param_String_2)
	throws com.sun.grid.jgrid.ComputeException, java.rmi.RemoteException
    {
	try {
	    if (useNewInvoke) {
		Object $result = ref.invoke(this, $method_compute_1, new java.lang.Object[] {$param_Computable_1, $param_String_2}, -4135601629327455121L);
		return ((java.io.Serializable) $result);
	    } else {
		java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
		try {
		    java.io.ObjectOutput out = call.getOutputStream();
		    out.writeObject($param_Computable_1);
		    out.writeObject($param_String_2);
		} catch (java.io.IOException e) {
		    throw new java.rmi.MarshalException("error marshalling arguments", e);
		}
		ref.invoke(call);
		java.io.Serializable $result;
		try {
		    java.io.ObjectInput in = call.getInputStream();
		    $result = (java.io.Serializable) in.readObject();
		} catch (java.io.IOException e) {
		    throw new java.rmi.UnmarshalException("error unmarshalling return", e);
		} catch (java.lang.ClassNotFoundException e) {
		    throw new java.rmi.UnmarshalException("error unmarshalling return", e);
		} finally {
		    ref.done(call);
		}
		return $result;
	    }
	} catch (java.lang.RuntimeException e) {
	    throw e;
	} catch (java.rmi.RemoteException e) {
	    throw e;
	} catch (com.sun.grid.jgrid.ComputeException e) {
	    throw e;
	} catch (java.lang.Exception e) {
	    throw new java.rmi.UnexpectedException("undeclared checked exception", e);
	}
    }
    
	/** This method submits a job for asynchronous execution.  Job
	 * status can be checked with the isComplete method and the
	 * results can be retrieved by the getResults method.
	 * @param $param_Computable_1 the job to be executed
	 * @throws RemoteException if an error occurs on the server side
	 * @throws ComputeException if an error occurs during job execution
	 * @return the result object
	 */	
    public java.lang.String computeAsynch(com.sun.grid.jgrid.Computable $param_Computable_1)
	throws com.sun.grid.jgrid.ComputeException, java.rmi.RemoteException
    {
			String codebase = System.getProperty ("java.rmi.server.codebase", "");
			
			return this.computeAsynch ($param_Computable_1, codebase);
    }
    
	/** This method submits a job for asynchronous execution.  Job
	 * status can be checked with the isComplete method and the
	 * results can be retrieved by the getResults method.
	 * @param $param_Computable_1 the job to be executed
	 * @param $param_String_2 an alternate codebase to use for loading the Computable class
	 * @throws RemoteException if an error occurs on the server side
	 * @throws ComputeException if an error occurs during job execution
	 * @return the result object
	 */	
    public java.lang.String computeAsynch(com.sun.grid.jgrid.Computable $param_Computable_1, java.lang.String $param_String_2)
	throws com.sun.grid.jgrid.ComputeException, java.rmi.RemoteException
    {
	try {
	    if (useNewInvoke) {
		Object $result = ref.invoke(this, $method_computeAsynch_3, new java.lang.Object[] {$param_Computable_1, $param_String_2}, 7821822986407981337L);
		return ((java.lang.String) $result);
	    } else {
		java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
		try {
		    java.io.ObjectOutput out = call.getOutputStream();
		    out.writeObject($param_Computable_1);
		    out.writeObject($param_String_2);
		} catch (java.io.IOException e) {
		    throw new java.rmi.MarshalException("error marshalling arguments", e);
		}
		ref.invoke(call);
		java.lang.String $result;
		try {
		    java.io.ObjectInput in = call.getInputStream();
		    $result = (java.lang.String) in.readObject();
		} catch (java.io.IOException e) {
		    throw new java.rmi.UnmarshalException("error unmarshalling return", e);
		} catch (java.lang.ClassNotFoundException e) {
		    throw new java.rmi.UnmarshalException("error unmarshalling return", e);
		} finally {
		    ref.done(call);
		}
		return $result;
	    }
	} catch (java.lang.RuntimeException e) {
	    throw e;
	} catch (java.rmi.RemoteException e) {
	    throw e;
	} catch (com.sun.grid.jgrid.ComputeException e) {
	    throw e;
	} catch (java.lang.Exception e) {
	    throw new java.rmi.UnexpectedException("undeclared checked exception", e);
	}
    }
    
	/** This method retrieves the results of a job that was
	 * executed asynchronously.
	 * @param $param_String_1 the id of the job
	 * @throws RemoteException if an error occurs on the server side
	 * @throws ComputeException if an error occurs during job execution
	 * @return the results object
	 */	
    public java.io.Serializable getResults(java.lang.String $param_String_1)
	throws com.sun.grid.jgrid.ComputeException, java.rmi.RemoteException
    {
	try {
	    if (useNewInvoke) {
		Object $result = ref.invoke(this, $method_getResults_4, new java.lang.Object[] {$param_String_1}, -728148089723471111L);
		return ((java.io.Serializable) $result);
	    } else {
		java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 4, interfaceHash);
		try {
		    java.io.ObjectOutput out = call.getOutputStream();
		    out.writeObject($param_String_1);
		} catch (java.io.IOException e) {
		    throw new java.rmi.MarshalException("error marshalling arguments", e);
		}
		ref.invoke(call);
		java.io.Serializable $result;
		try {
		    java.io.ObjectInput in = call.getInputStream();
		    $result = (java.io.Serializable) in.readObject();
		} catch (java.io.IOException e) {
		    throw new java.rmi.UnmarshalException("error unmarshalling return", e);
		} catch (java.lang.ClassNotFoundException e) {
		    throw new java.rmi.UnmarshalException("error unmarshalling return", e);
		} finally {
		    ref.done(call);
		}
		return $result;
	    }
	} catch (java.lang.RuntimeException e) {
	    throw e;
	} catch (java.rmi.RemoteException e) {
	    throw e;
	} catch (com.sun.grid.jgrid.ComputeException e) {
	    throw e;
	} catch (java.lang.Exception e) {
	    throw new java.rmi.UnexpectedException("undeclared checked exception", e);
	}
    }
    
	/** This method check whether an asynchronous job has finished
	 * executing.
	 * @param $param_String_1 the id of the job
	 * @throws RemoteException if an error occurs on the server side
	 * @throws ComputeException if an error occurs during job execution
	 * @return whether the job has finished
	 */	
    public boolean isComplete(java.lang.String $param_String_1)
	throws com.sun.grid.jgrid.ComputeException, java.rmi.RemoteException
    {
	try {
	    if (useNewInvoke) {
		Object $result = ref.invoke(this, $method_isComplete_5, new java.lang.Object[] {$param_String_1}, -5321554526954319352L);
		return ((java.lang.Boolean) $result).booleanValue();
	    } else {
		java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 5, interfaceHash);
		try {
		    java.io.ObjectOutput out = call.getOutputStream();
		    out.writeObject($param_String_1);
		} catch (java.io.IOException e) {
		    throw new java.rmi.MarshalException("error marshalling arguments", e);
		}
		ref.invoke(call);
		boolean $result;
		try {
		    java.io.ObjectInput in = call.getInputStream();
		    $result = in.readBoolean();
		} catch (java.io.IOException e) {
		    throw new java.rmi.UnmarshalException("error unmarshalling return", e);
		} finally {
		    ref.done(call);
		}
		return $result;
	    }
	} catch (java.lang.RuntimeException e) {
	    throw e;
	} catch (java.rmi.RemoteException e) {
	    throw e;
	} catch (com.sun.grid.jgrid.ComputeException e) {
	    throw e;
	} catch (java.lang.Exception e) {
	    throw new java.rmi.UnexpectedException("undeclared checked exception", e);
	}
    }
}
