Initial revision

From-SVN: r102074
This commit is contained in:
Tom Tromey 2005-07-16 00:30:23 +00:00
parent 6f4434b39b
commit f911ba985a
4557 changed files with 1000262 additions and 0 deletions

View file

@ -0,0 +1,78 @@
/* ExportException.java -- an export attempt failed
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.rmi.RemoteException;
/**
* Thrown if an attempt to export a remote object fails.
*
* @author unknown
* @see UnicastRemoteObject
* @see Activatable
* @since 1.1
* @status updated to 1.4
*/
public class ExportException extends RemoteException
{
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = -9155485338494060170L;
/**
* Create an exception with the specified message.
*
* @param s the message
*/
public ExportException(String s)
{
super(s);
}
/**
* Create an exception with the specified message and cause.
*
* @param s the message
* @param e the cause
*/
public ExportException(String s, Exception e)
{
super(s, e);
}
}

View file

@ -0,0 +1,66 @@
/* LoaderHandler.java --
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.net.MalformedURLException;
import java.net.URL;
/**
* @deprecated
*/
public interface LoaderHandler
{
String packagePrefix = "";
/**
* @deprecated
*/
Class loadClass(String name)
throws MalformedURLException, ClassNotFoundException;
/**
* @deprecated
*/
Class loadClass(URL codebase, String name)
throws MalformedURLException, ClassNotFoundException;
/**
* @deprecated
*/
Object getSecurityContext(ClassLoader loader);
}

View file

@ -0,0 +1,146 @@
/* LogStream.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.OutputStream;
import java.io.PrintStream;
/**
* @deprecated
*/
public class LogStream extends PrintStream
{
public static final int SILENT = 0;
public static final int BRIEF = 10;
public static final int VERBOSE = 20;
private static PrintStream defStream;
private LogStream (OutputStream s)
{
super (s);
}
/**
* @deprecated
*/
public static LogStream log (String name)
{
throw new Error ("Not implemented");
}
/**
* @deprecated
*/
public static PrintStream getDefaultStream ()
{
return defStream;
}
/**
* @deprecated
*/
public static void setDefaultStream (PrintStream s)
{
defStream = s;
}
/**
* @deprecated
*/
public OutputStream getOutputStream ()
{
return out;
}
/**
* @deprecated
*/
public void setOutputStream (OutputStream s)
{
out = s;
}
/**
* @deprecated
*/
public void write (int buffer)
{
super.write (buffer);
}
/**
* @deprecated
*/
public void write (byte[] buffer, int offset, int len)
{
super.write (buffer, offset, len);
}
/**
* @deprecated
*/
public String toString ()
{
throw new Error ("Not implemented");
}
/**
* @deprecated
*/
public static int parseLevel (String s)
{
if (s.equalsIgnoreCase ("silent"))
{
return SILENT;
}
if (s.equalsIgnoreCase ("brief"))
{
return BRIEF;
}
if (s.equalsIgnoreCase ("verbose"))
{
return VERBOSE;
}
return SILENT;
}
}

View file

@ -0,0 +1,103 @@
/* ObjID.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
public final class ObjID implements Serializable
{
static final long serialVersionUID = -6386392263968365220L;
private static long next = 0x8000000000000000L;
private static final Object lock = ObjID.class;
public static final int REGISTRY_ID = 0;
public static final int ACTIVATOR_ID = 1;
public static final int DGC_ID = 2;
private long objNum;
private UID space;
public ObjID() {
synchronized (lock) {
objNum = next++;
}
space = new UID();
}
public ObjID(int num) {
objNum = (long)num;
space = new UID((short)0);
}
public void write(ObjectOutput out) throws IOException {
DataOutput dout = (DataOutput)out;
dout.writeLong(objNum);
space.write(dout);
}
public static ObjID read(ObjectInput in) throws IOException {
DataInput din = (DataInput)in;
ObjID id = new ObjID();
id.objNum = din.readLong();
id.space = UID.read(din);
return (id);
}
public int hashCode() {
return ((int)objNum);
}
public boolean equals(Object obj) {
if (obj instanceof ObjID && this.objNum == ((ObjID)obj).objNum) {
return (true);
}
return (false);
}
public String toString() {
return ("[objNum: " + objNum + ", " + space + "]");
}
}

View file

@ -0,0 +1,70 @@
/* Operation.java --
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
/**
* @deprecated
*/
public class Operation
{
private String operation;
/**
* @deprecated
*/
public Operation (String op)
{
operation = op;
}
/**
* @deprecated
*/
public String getOperation ()
{
return operation;
}
/**
* @deprecated
*/
public String toString ()
{
return operation;
}
}

View file

@ -0,0 +1,339 @@
/* RMIClassLoader.java --
Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Map;
import java.util.StringTokenizer;
/**
* This class provides a set of public static utility methods for supporting
* network-based class loading in RMI. These methods are called by RMI's
* internal marshal streams to implement the dynamic class loading of types for
* RMI parameters and return values.
*/
public class RMIClassLoader
{
/**
* This class isn't intended to be instantiated.
*/
private RMIClassLoader() {}
private static class MyClassLoader extends URLClassLoader
{
// Package-private to avoid a trampoline constructor.
MyClassLoader (URL[] urls, ClassLoader parent, String annotation)
{
super (urls, parent);
this.annotation = annotation;
}
private MyClassLoader (URL[] urls, ClassLoader parent)
{
super (urls, parent);
this.annotation = urlToAnnotation (urls);
}
public static String urlToAnnotation (URL[] urls)
{
if (urls.length == 0)
return null;
StringBuffer annotation = new StringBuffer (64 * urls.length);
for (int i = 0; i < urls.length; i++)
{
annotation.append (urls [i].toExternalForm());
annotation.append (' ');
}
return annotation.toString();
}
public final String getClassAnnotation()
{
return annotation;
}
private final String annotation;
}
/**
* This class is used to identify a cached classloader by its codebase and
* the context classloader that is its parent.
*/
private static class CacheKey
{
private String mCodeBase;
private ClassLoader mContextClassLoader;
public CacheKey (String theCodebase, ClassLoader theContextClassLoader)
{
mCodeBase = theCodebase;
mContextClassLoader = theContextClassLoader;
}
/**
* @return true if the codebase and the context classloader are equal
*/
public boolean equals (Object theOther)
{
if (theOther instanceof CacheKey)
{
CacheKey key = (CacheKey) theOther;
return (equals (this.mCodeBase,key.mCodeBase)
&& equals (this.mContextClassLoader, key.mContextClassLoader));
}
return false;
}
/**
* Test if the two objects are equal or both null.
* @param theOne
* @param theOther
* @return
*/
private boolean equals (Object theOne, Object theOther)
{
return theOne != null ? theOne.equals (theOther) : theOther == null;
}
/**
* @return hashCode
*/
public int hashCode()
{
return ((mCodeBase != null ? mCodeBase.hashCode() : 0)
^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1));
}
public String toString()
{
return "[" + mCodeBase + "," + mContextClassLoader + "]";
}
}
private static Map cacheLoaders; //map annotations to loaders
private static Map cacheAnnotations; //map loaders to annotations
//defaultAnnotation is got from system property
// "java.rmi.server.defaultAnnotation"
private static String defaultAnnotation;
//URL object for defaultAnnotation
private static URL defaultCodebase;
//class loader for defaultAnnotation
private static MyClassLoader defaultLoader;
static
{
// 89 is a nice prime number for Hashtable initial capacity
cacheLoaders = new Hashtable (89);
cacheAnnotations = new Hashtable (89);
defaultAnnotation = System.getProperty ("java.rmi.server.defaultAnnotation");
try
{
if (defaultAnnotation != null)
defaultCodebase = new URL (defaultAnnotation);
}
catch (Exception _)
{
defaultCodebase = null;
}
if (defaultCodebase != null)
{
defaultLoader = new MyClassLoader (new URL[] { defaultCodebase }, null,
defaultAnnotation);
cacheLoaders.put (new CacheKey (defaultAnnotation,
Thread.currentThread().getContextClassLoader()),
defaultLoader);
}
}
/**
* @deprecated
*/
public static Class loadClass (String name)
throws MalformedURLException, ClassNotFoundException
{
return loadClass ("", name);
}
public static Class loadClass (String codebases, String name)
throws MalformedURLException, ClassNotFoundException
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
//try context class loader first
try
{
return loader.loadClass (name);
}
catch (ClassNotFoundException e)
{
// class not found in the local classpath
}
if (codebases.length() == 0) //==""
{
loader = defaultLoader;
}
else
{
loader = getClassLoader(codebases);
}
if (loader == null)
{
//do not throw NullPointerException
throw new ClassNotFoundException ("Could not find class (" + name +
") at codebase (" + codebases + ")");
}
return loader.loadClass (name);
}
/**
* Gets a classloader for the given codebase and with the current
* context classloader as parent.
*
* @param codebases
*
* @return a classloader for the given codebase
*
* @throws MalformedURLException if the codebase contains a malformed URL
*/
public static ClassLoader getClassLoader (String codebases)
throws MalformedURLException
{
ClassLoader loader;
CacheKey loaderKey = new CacheKey
(codebases, Thread.currentThread().getContextClassLoader());
loader = (ClassLoader) cacheLoaders.get (loaderKey);
if (loader == null)
{
//create an entry in cacheLoaders mapping a loader to codebases.
// codebases are separated by " "
StringTokenizer tok = new StringTokenizer (codebases, " ");
ArrayList urls = new ArrayList();
while (tok.hasMoreTokens())
urls.add (new URL (tok.nextToken()));
loader = new MyClassLoader ((URL[]) urls.toArray (new URL [urls.size()]),
Thread.currentThread().getContextClassLoader(),
codebases);
cacheLoaders.put (loaderKey, loader);
}
return loader;
}
/**
* Returns a string representation of the network location where a remote
* endpoint can get the class-definition of the given class.
*
* @param cl
*
* @return a space seperated list of URLs where the class-definition
* of cl may be found
*/
public static String getClassAnnotation (Class cl)
{
ClassLoader loader = cl.getClassLoader();
if (loader == null
|| loader == ClassLoader.getSystemClassLoader())
{
return System.getProperty ("java.rmi.server.codebase");
}
if (loader instanceof MyClassLoader)
{
return ((MyClassLoader) loader).getClassAnnotation();
}
String s = (String) cacheAnnotations.get (loader);
if (s != null)
return s;
if (loader instanceof URLClassLoader)
{
URL[] urls = ((URLClassLoader) loader).getURLs();
if (urls.length == 0)
return null;
StringBuffer annotation = new StringBuffer (64 * urls.length);
for (int i = 0; i < urls.length; i++)
{
annotation.append (urls [i].toExternalForm());
annotation.append (' ');
}
s = annotation.toString();
cacheAnnotations.put (loader, s);
return s;
}
return System.getProperty ("java.rmi.server.codebase");
}
/**
* @deprecated
*/
public static Object getSecurityContext (ClassLoader loader)
{
throw new Error ("Not implemented");
}
}

View file

@ -0,0 +1,64 @@
/* RMIClassLoaderSpi.java --
Copyright (c) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.net.MalformedURLException;
/**
* @author Michael Koch
* @since 1.4
*/
public abstract class RMIClassLoaderSpi
{
public RMIClassLoaderSpi()
{
}
public abstract Class loadClass (String codeBase, String name,
ClassLoader defaultLoader)
throws MalformedURLException, ClassNotFoundException;
public abstract Class loadProxyClass (String codeBase, String[] interfaces,
ClassLoader defaultLoader)
throws MalformedURLException, ClassNotFoundException;
public abstract ClassLoader getClassLoader (String codebase)
throws MalformedURLException;
public abstract String getClassAnnotation (Class cl);
}

View file

@ -0,0 +1,47 @@
/* RMIClientSocketFactory.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.IOException;
import java.net.Socket;
public interface RMIClientSocketFactory
{
Socket createSocket (String host, int port) throws IOException;
}

View file

@ -0,0 +1,46 @@
/* RMIFailureHandler.java --
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
public interface RMIFailureHandler
{
/**
* @exception IOException If an error occurs
*/
boolean failure (Exception ex);
}

View file

@ -0,0 +1,47 @@
/* RMIServerSocketFactory.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.IOException;
import java.net.ServerSocket;
public interface RMIServerSocketFactory
{
ServerSocket createServerSocket(int port) throws IOException;
}

View file

@ -0,0 +1,108 @@
/* RMISocketFactory.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import gnu.java.rmi.server.RMIDefaultSocketFactory;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public abstract class RMISocketFactory
implements RMIClientSocketFactory, RMIServerSocketFactory
{
private static RMISocketFactory defaultFactory;
private static RMISocketFactory currentFactory;
private static RMIFailureHandler currentHandler;
static
{
defaultFactory = new RMIDefaultSocketFactory();
currentFactory = defaultFactory;
}
public RMISocketFactory ()
{
}
/**
* @exception IOException If an error occurs
*/
public abstract Socket createSocket (String host, int port)
throws IOException;
/**
* @exception IOException If an error occurs
*/
public abstract ServerSocket createServerSocket (int port)
throws IOException;
/**
* @exception IOException If an error occurs
* @exception SecurityException FIXME
*/
public static void setSocketFactory (RMISocketFactory fac)
throws IOException
{
currentFactory = fac;
}
public static RMISocketFactory getSocketFactory ()
{
return currentFactory;
}
public static RMISocketFactory getDefaultSocketFactory ()
{
return defaultFactory;
}
/**
* @exception SecurityException FIXME
*/
public static void setFailureHandler (RMIFailureHandler fh)
{
currentHandler = fh;
}
public static RMIFailureHandler getFailureHandler ()
{
return currentHandler;
}
}

View file

@ -0,0 +1,86 @@
/* RemoteCall.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.StreamCorruptedException;
/**
* @deprecated
*/
public interface RemoteCall
{
/**
* @deprecated
*/
ObjectOutput getOutputStream () throws IOException;
/**
* @deprecated
*/
void releaseOutputStream () throws IOException;
/**
* @deprecated
*/
ObjectInput getInputStream () throws IOException;
/**
* @deprecated
*/
void releaseInputStream () throws IOException;
/**
* @deprecated
*/
ObjectOutput getResultStream (boolean success)
throws IOException, StreamCorruptedException;
/**
* @deprecated
*/
void executeCall () throws Exception;
/**
* @deprecated
*/
void done () throws IOException;
}

View file

@ -0,0 +1,160 @@
/* RemoteObject.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.UnmarshalException;
import java.util.WeakHashMap;
public abstract class RemoteObject
implements Remote, Serializable {
private static final long serialVersionUID = -3215090123894869218l;
protected transient RemoteRef ref;
private static final WeakHashMap stubs = new WeakHashMap();
protected RemoteObject() {
this(null);
}
protected RemoteObject(RemoteRef newref) {
ref = newref;
}
public RemoteRef getRef() {
return (ref);
}
synchronized static void addStub(Remote obj, Remote stub)
{
stubs.put(obj, stub);
}
synchronized static void deleteStub(Remote obj)
{
stubs.remove(obj);
}
public static Remote toStub(Remote obj) throws NoSuchObjectException
{
Remote stub = (Remote)stubs.get(obj);
if (stub == null)
throw new NoSuchObjectException(obj.getClass().getName());
return stub;
}
public int hashCode() {
if (ref == null) {
return (0);
}
else {
return (ref.hashCode());
}
}
public boolean equals(Object obj) {
// We only compare references.
return (this == obj);
}
public String toString()
{
if (ref == null)
return getClass ().toString ();
return (ref.toString ());
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
String cname = in.readUTF();
if (!cname.equals(""))
{
if (cname.equals ("UnicastRef2"))
{
// hack for interoperating with JDK
cname = "UnicastRef";
in.read (); //some unknown UnicastRef2 field
}
cname = RemoteRef.packagePrefix + '.' + cname;
try
{
Class cls = Class.forName(cname);
ref = (RemoteRef)cls.newInstance();
}
catch (InstantiationException e1)
{
throw new UnmarshalException("failed to create ref", e1);
}
catch (IllegalAccessException e2)
{
throw new UnmarshalException("failed to create ref", e2);
}
ref.readExternal(in);
}
else
{
ref = (RemoteRef)in.readObject();
}
}
private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException {
if (ref == null) {
throw new UnmarshalException("no ref to serialize");
}
String cname = ref.getRefClass(out);
if (cname != null && cname.length() > 0) {
out.writeUTF(cname);
ref.writeExternal(out);
}
else {
out.writeUTF("");
out.writeObject(ref);
}
}
}

View file

@ -0,0 +1,79 @@
/* RemoteRef.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.Externalizable;
import java.io.ObjectOutput;
import java.lang.reflect.Method;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface RemoteRef extends Externalizable
{
long serialVersionUID = 3632638527362204081L;
String packagePrefix = "gnu.java.rmi.server";
/**
* @deprecated
*/
void invoke (RemoteCall call) throws Exception;
Object invoke (Remote obj, Method method, Object[] params, long opnum)
throws Exception;
/**
* @deprecated
*/
RemoteCall newCall (RemoteObject obj, Operation[] op, int opnum, long hash)
throws RemoteException;
/**
* @deprecated
*/
void done (RemoteCall call) throws RemoteException;
boolean remoteEquals (RemoteRef ref);
int remoteHashCode();
String getRefClass (ObjectOutput out);
String remoteToString();
}

View file

@ -0,0 +1,76 @@
/* RemoteServer.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import gnu.java.rmi.server.RMIIncomingThread;
import java.io.OutputStream;
import java.io.PrintStream;
public abstract class RemoteServer extends RemoteObject
{
private static final long serialVersionUID = -4100238210092549637L;
protected RemoteServer() {
super();
}
protected RemoteServer(RemoteRef ref) {
super(ref);
}
public static String getClientHost() throws ServerNotActiveException {
Thread currThread = Thread.currentThread();
if (currThread instanceof RMIIncomingThread) {
RMIIncomingThread incomingThread = (RMIIncomingThread) currThread;
return incomingThread.getClientHost();
} else {
throw new ServerNotActiveException(
"Unknown client host - current thread not instance of 'RMIIncomingThread'");
}
}
public static void setLog(OutputStream out) {
throw new Error("Not implemented");
}
public static PrintStream getLog() {
throw new Error("Not implemented");
}
}

View file

@ -0,0 +1,61 @@
/* RemoteStub.java --
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
public abstract class RemoteStub extends RemoteObject
{
static final long serialVersionUID = -1585587260594494182l;
protected RemoteStub ()
{
super ();
}
protected RemoteStub (RemoteRef ref)
{
super (ref);
}
/**
* @deprecated
*/
protected static void setRef (RemoteStub stub, RemoteRef ref)
{
stub.ref = ref;
}
} // class RemoteSub

View file

@ -0,0 +1,117 @@
/* ServerCloneException.java -- a UnicastRemoteObject could not be cloned
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
/**
* Thrown if a remote exception occurs during the cloning process of a
* <code>UnicastRemoteObject</code>.
*
* @author unknown
* @see UnicastRemoteObject#clone()
* @since 1.1
* @status updated to 1.4
*/
public class ServerCloneException extends CloneNotSupportedException
{
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 6617456357664815945L;
/**
* The cause of this exception. This pre-dates the exception chaining
* of Throwable; and although you can change this field, you are wiser
* to leave it alone.
*
* @serial the exception cause
*/
public Exception detail;
/**
* Create an exception with a message.
*
* @param s the message
*/
public ServerCloneException(String s)
{
this(s, null);
}
/**
* Create an exception with a message and a cause.
*
* @param s the message
* @param e the cause
*/
public ServerCloneException(String s, Exception e)
{
super(s);
initCause(e);
detail = e;
}
/**
* This method returns a message indicating what went wrong, in this
* format:
* <code>super.getMessage() + (detail == null ? ""
* : "; nested exception is:\n\t" + detail)</code>.
*
* @return the chained message
*/
public String getMessage()
{
if (detail == this || detail == null)
return super.getMessage();
return super.getMessage() + "; nested exception is:\n\t" + detail;
}
/**
* Returns the cause of this exception. Note that this may not be the
* original cause, thanks to the <code>detail</code> field being public
* and non-final (yuck). However, to avoid violating the contract of
* Throwable.getCause(), this returns null if <code>detail == this</code>,
* as no exception can be its own cause.
*
* @return the cause
* @since 1.4
*/
public Throwable getCause()
{
return detail == this ? null : detail;
}
}

View file

@ -0,0 +1,72 @@
/* ServerNotActiveException.java -- the method is not servicing a remote call
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
/**
* Thrown during <code>RemoteServer.getClientHost</code> if the host is
* not servicing a remote method call.
*
* @author unknown
* @see RemoteServer#getClientHost()
* @since 1.1
* @status updated to 1.4
*/
public class ServerNotActiveException extends Exception
{
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 4687940720827538231L;
/**
* Create an exception with no message.
*/
public ServerNotActiveException()
{
}
/**
* Create an exception with a message.
*
* @param s the message
*/
public ServerNotActiveException(String s)
{
super(s);
}
}

View file

@ -0,0 +1,51 @@
/* ServerRef.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ServerRef extends RemoteRef
{
long serialVersionUID = -4557750989390278438L;
RemoteStub exportObject(Remote obj, Object data) throws RemoteException;
String getClientHost() throws ServerNotActiveException;
}

View file

@ -0,0 +1,57 @@
/* Skeleton.java --
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.rmi.Remote;
/**
* @deprecated
*/
public interface Skeleton
{
/**
* @deprecated
*/
void dispatch (Remote obj, RemoteCall theCall, int opnum, long hash)
throws Exception;
/**
* @deprecated
*/
Operation[] getOperations();
}

View file

@ -0,0 +1,68 @@
/* SkeletonMismatchException.java -- thrown when stub class versions mismatch
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.rmi.RemoteException;
/**
* Thrown if a call is received that does not match a Skeleton. Note that
* Skeletons are no longer required.
*
* @author unknown
* @since 1.1
* @deprecated no replacement. Skeletons are no longer required.
* @status updated to 1.4
*/
public class SkeletonMismatchException extends RemoteException
{
/**
* Compatible with JDK 1.1.
*/
private static final long serialVersionUID = -7780460454818859281l;
/**
* Create an exception with the specified message.
*
* @param s the message
* @deprecated no longer needed
*/
public SkeletonMismatchException(String s)
{
super(s);
}
}

View file

@ -0,0 +1,79 @@
/* SkeletonNotFoundException.java -- thrown if a Skeleton is not found
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.rmi.RemoteException;
/**
* Thrown if a Skeleton corresponding to the remote object is not found.
* Note that Skeletons are no longer required.
*
* @author unknown
* @since 1.1
* @deprecated no replacement. Skeletons are no longer required.
* @status updated to 1.4
*/
public class SkeletonNotFoundException extends RemoteException
{
/**
* Compatible with JDK 1.1.
*/
private static final long serialVersionUID = -7860299673822761231L;
/**
* Create an exception with the specified message.
*
* @param s the message
*/
public SkeletonNotFoundException(String s)
{
super(s);
}
/**
* Create an exception with the specified message and cause.
*
* @param s the message
* @param e the cause
*/
public SkeletonNotFoundException(String s, Exception e)
{
super(s, e);
}
}

View file

@ -0,0 +1,75 @@
/* SocketSecurityException.java -- the socket could not be created
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
/**
* Thrown during remote object export if the code does not have permission
* to create a <code>java.net.ServerSocket</code> on the specified port.
*
* @author unknown
* @since 1.1
* @status updated to 1.4
*/
public class SocketSecurityException extends ExportException
{
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = -7622072999407781979L;
/**
* Create an exception with the specified message.
*
* @param s the message
*/
public SocketSecurityException(String s)
{
super(s);
}
/**
* Create an exception with the specified message and cause.
*
* @param s the message
* @param e the cause
*/
public SocketSecurityException(String s, Exception e)
{
super(s, e);
}
}

View file

@ -0,0 +1,127 @@
/* UID.java --
Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
public final class UID implements Serializable
{
private static final long serialVersionUID = 1086053664494604050L;
private static final Object lock = UID.class;
private static long baseTime = System.currentTimeMillis();
private static short nextCount = Short.MIN_VALUE;
// This is sun's algorithm - don't ask me why ...
private static final int uniqueNr = (new Object()).hashCode();
private int unique;
private long time;
private short count;
/**
* This is sun's algorithm - don't ask me why ...
*/
public UID() {
synchronized (lock) {
if (nextCount == Short.MAX_VALUE) {
long newtime;
for (;;) {
newtime = System.currentTimeMillis();
if (newtime - baseTime > 1000) {
break;
}
try {
Thread.sleep(1000);
}
catch (InterruptedException _) {
}
}
baseTime = newtime;
nextCount = Short.MIN_VALUE;
}
count = nextCount++;
unique = uniqueNr;
time = baseTime;
}
}
public UID(short num) {
unique = (int)num;
time = 0;
count = 0;
}
public int hashCode() {
return (unique);
}
public boolean equals(Object obj) {
if (obj instanceof UID) {
UID uid = (UID)obj;
if (this.unique == uid.unique &&
this.time == uid.time &&
this.count == uid.count) {
return (true);
}
}
return (false);
}
public String toString() {
return ("[UID: " + unique + "," + time + "," + count + "]");
}
public void write(DataOutput out) throws IOException {
out.writeInt(unique);
out.writeLong(time);
out.writeShort(count);
}
public static UID read(DataInput in) throws IOException {
UID id = new UID();
id.unique = in.readInt();
id.time = in.readLong();
id.count = in.readShort();
return (id);
}
}

View file

@ -0,0 +1,133 @@
/* UnicastRemoteObject.java --
Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
import gnu.java.rmi.server.UnicastServerRef;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
public class UnicastRemoteObject extends RemoteServer
{
private static final long serialVersionUID = 4974527148936298033L;
//The following serialized fields are from Java API Documentation "Serialized form"
private int port = 0;
private RMIClientSocketFactory csf = null;
private RMIServerSocketFactory ssf = null;
protected UnicastRemoteObject() throws RemoteException {
this(0);
}
protected UnicastRemoteObject(int port) throws RemoteException {
this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory());
}
protected UnicastRemoteObject(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
this.port = port;
//Is RMIXXXSocketFactory serializable
//this.csf = csf;
//this.ssf = ssf;
this.ref = new UnicastServerRef(new ObjID(), port, ssf);
exportObject(this);
}
protected UnicastRemoteObject(RemoteRef ref) throws RemoteException {
super((UnicastServerRef)ref);
exportObject(this);
}
public Object clone() throws CloneNotSupportedException {
throw new Error("Not implemented");
}
public static RemoteStub exportObject(Remote obj) throws RemoteException {
UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef();
return (sref.exportObject(obj));
}
public static Remote exportObject(Remote obj, int port) throws RemoteException
{
return exportObject(obj, port, null);
}
static Remote exportObject(Remote obj, int port, RMIServerSocketFactory ssf)
throws RemoteException
{
UnicastServerRef sref = null;
if (obj instanceof RemoteObject)
sref = (UnicastServerRef)((RemoteObject)obj).getRef ();
if(sref == null)
{
sref = new UnicastServerRef(new ObjID (), port, ssf);
}
Remote stub = sref.exportObject (obj);
addStub(obj, stub);
return stub;
}
/**
* FIXME
*/
public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
throws RemoteException
{
return (exportObject(obj, port, ssf));
}
public static boolean unexportObject(Remote obj, boolean force)
throws NoSuchObjectException
{
if (obj instanceof RemoteObject)
{
deleteStub(obj);
UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef();
return sref.unexportObject(obj, force);
}
else
{
//FIX ME
;
}
return true;
}
}

View file

@ -0,0 +1,43 @@
/* Unreferenced.java --
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.rmi.server;
public interface Unreferenced
{
void unreferenced();
}

View file

@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in java.rmi.server package.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. -->
<html>
<head><title>GNU Classpath - java.rmi.server</title></head>
<body>
<p></p>
</body>
</html>