0N/A/*
2362N/A * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.rmi.server;
0N/A
0N/Aimport java.rmi.*;
0N/A
0N/A/**
0N/A * <code>RemoteRef</code> represents the handle for a remote object. A
0N/A * <code>RemoteStub</code> uses a remote reference to carry out a
0N/A * remote method invocation to a remote object.
0N/A *
0N/A * @author Ann Wollrath
0N/A * @since JDK1.1
0N/A * @see java.rmi.server.RemoteStub
0N/A */
0N/Apublic interface RemoteRef extends java.io.Externalizable {
0N/A
0N/A /** indicate compatibility with JDK 1.1.x version of class. */
0N/A static final long serialVersionUID = 3632638527362204081L;
0N/A
0N/A /**
0N/A * Initialize the server package prefix: assumes that the
0N/A * implementation of server ref classes (e.g., UnicastRef,
0N/A * UnicastServerRef) are located in the package defined by the
0N/A * prefix.
0N/A */
0N/A final static String packagePrefix = "sun.rmi.server";
0N/A
0N/A /**
0N/A * Invoke a method. This form of delegating method invocation
0N/A * to the reference allows the reference to take care of
0N/A * setting up the connection to the remote host, marshaling
0N/A * some representation for the method and parameters, then
0N/A * communicating the method invocation to the remote host.
0N/A * This method either returns the result of a method invocation
0N/A * on the remote object which resides on the remote host or
0N/A * throws a RemoteException if the call failed or an
0N/A * application-level exception if the remote invocation throws
0N/A * an exception.
0N/A *
0N/A * @param obj the object that contains the RemoteRef (e.g., the
0N/A * RemoteStub for the object.
0N/A * @param method the method to be invoked
0N/A * @param params the parameter list
0N/A * @param opnum a hash that may be used to represent the method
0N/A * @return result of remote method invocation
0N/A * @exception Exception if any exception occurs during remote method
0N/A * invocation
0N/A * @since 1.2
0N/A */
0N/A Object invoke(Remote obj,
0N/A java.lang.reflect.Method method,
0N/A Object[] params,
0N/A long opnum)
0N/A throws Exception;
0N/A
0N/A /**
0N/A * Creates an appropriate call object for a new remote method
0N/A * invocation on this object. Passing operation array and index,
0N/A * allows the stubs generator to assign the operation indexes and
0N/A * interpret them. The remote reference may need the operation to
0N/A * encode in the call.
0N/A *
0N/A * @since JDK1.1
0N/A * @deprecated 1.2 style stubs no longer use this method. Instead of
0N/A * using a sequence of method calls on the stub's the remote reference
0N/A * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
0N/A * stub uses a single method, <code>invoke(Remote, Method, Object[],
0N/A * int)</code>, on the remote reference to carry out parameter
0N/A * marshalling, remote method executing and unmarshalling of the return
0N/A * value.
0N/A *
0N/A * @param obj remote stub through which to make call
0N/A * @param op array of stub operations
0N/A * @param opnum operation number
0N/A * @param hash stub/skeleton interface hash
0N/A * @return call object representing remote call
0N/A * @throws RemoteException if failed to initiate new remote call
0N/A * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
0N/A */
0N/A @Deprecated
0N/A RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash)
0N/A throws RemoteException;
0N/A
0N/A /**
0N/A * Executes the remote call.
0N/A *
0N/A * Invoke will raise any "user" exceptions which
0N/A * should pass through and not be caught by the stub. If any
0N/A * exception is raised during the remote invocation, invoke should
0N/A * take care of cleaning up the connection before raising the
0N/A * "user" or remote exception.
0N/A *
0N/A * @since JDK1.1
0N/A * @deprecated 1.2 style stubs no longer use this method. Instead of
0N/A * using a sequence of method calls to the remote reference
0N/A * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
0N/A * stub uses a single method, <code>invoke(Remote, Method, Object[],
0N/A * int)</code>, on the remote reference to carry out parameter
0N/A * marshalling, remote method executing and unmarshalling of the return
0N/A * value.
0N/A *
0N/A * @param call object representing remote call
0N/A * @throws Exception if any exception occurs during remote method
0N/A * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
0N/A */
0N/A @Deprecated
0N/A void invoke(RemoteCall call) throws Exception;
0N/A
0N/A /**
0N/A * Allows the remote reference to clean up (or reuse) the connection.
0N/A * Done should only be called if the invoke returns successfully
0N/A * (non-exceptionally) to the stub.
0N/A *
0N/A * @since JDK1.1
0N/A * @deprecated 1.2 style stubs no longer use this method. Instead of
0N/A * using a sequence of method calls to the remote reference
0N/A * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
0N/A * stub uses a single method, <code>invoke(Remote, Method, Object[],
0N/A * int)</code>, on the remote reference to carry out parameter
0N/A * marshalling, remote method executing and unmarshalling of the return
0N/A * value.
0N/A *
0N/A * @param call object representing remote call
0N/A * @throws RemoteException if remote error occurs during call cleanup
0N/A * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
0N/A */
0N/A @Deprecated
0N/A void done(RemoteCall call) throws RemoteException;
0N/A
0N/A /**
0N/A * Returns the class name of the ref type to be serialized onto
0N/A * the stream 'out'.
0N/A * @param out the output stream to which the reference will be serialized
0N/A * @return the class name (without package qualification) of the reference
0N/A * type
0N/A * @since JDK1.1
0N/A */
0N/A String getRefClass(java.io.ObjectOutput out);
0N/A
0N/A /**
0N/A * Returns a hashcode for a remote object. Two remote object stubs
0N/A * that refer to the same remote object will have the same hash code
0N/A * (in order to support remote objects as keys in hash tables).
0N/A *
0N/A * @return remote object hashcode
0N/A * @see java.util.Hashtable
0N/A * @since JDK1.1
0N/A */
0N/A int remoteHashCode();
0N/A
0N/A /**
0N/A * Compares two remote objects for equality.
0N/A * Returns a boolean that indicates whether this remote object is
0N/A * equivalent to the specified Object. This method is used when a
0N/A * remote object is stored in a hashtable.
0N/A * @param obj the Object to compare with
0N/A * @return true if these Objects are equal; false otherwise.
0N/A * @see java.util.Hashtable
0N/A * @since JDK1.1
0N/A */
0N/A boolean remoteEquals(RemoteRef obj);
0N/A
0N/A /**
0N/A * Returns a String that represents the reference of this remote
0N/A * object.
0N/A * @return string representing remote object reference
0N/A * @since JDK1.1
0N/A */
0N/A String remoteToString();
0N/A
0N/A}