2006-03-10 Audrius Meskauskas <[EMAIL PROTECTED]>
* java/rmi/activation/ActivationDesc.java,
java/rmi/activation/ActivationGroupID.java,
java/rmi/activation/Activator.java,
java/rmi/server/Operation.java,
java/rmi/server/RemoteServer.java: Documented and formatted.
Index: java/rmi/activation/ActivationDesc.java
===================================================================
RCS file: /sources/classpath/classpath/java/rmi/activation/ActivationDesc.java,v
retrieving revision 1.5
diff -u -r1.5 ActivationDesc.java
--- java/rmi/activation/ActivationDesc.java 2 Jul 2005 20:32:40 -0000 1.5
+++ java/rmi/activation/ActivationDesc.java 10 Mar 2006 19:46:06 -0000
@@ -1,6 +1,6 @@
/* ActivationDecc.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
@@ -40,74 +40,193 @@
import java.io.Serializable;
import java.rmi.MarshalledObject;
-public final class ActivationDesc implements Serializable
+/**
+ * Contains the information, necessary to activate the object. This information
+ * includes:
+ * <ul>
+ * <li>the object class name</li>
+ * <li>the object group identifier</li>
+ * <li>the code location (codebase URL) that can be used to load the class
+ * remotely</li>
+ * <li>the object restart mode</li>
+ * <li>the object specific intialization information</li>
+ * </ul>
+ */
+public final class ActivationDesc
+ implements Serializable
{
+ /**
+ * Use SVUID for interoperability.
+ */
static final long serialVersionUID = 7455834104417690957L;
-private ActivationGroupID groupid;
-private String classname;
-private String location;
-private MarshalledObject data;
-private boolean restart;
-
-public ActivationDesc(String className, String location, MarshalledObject data) throws ActivationException {
- this(ActivationGroup.currentGroupID(), className, location, data, false);
-}
-
-public ActivationDesc(String className, String location, MarshalledObject data, boolean restart) throws ActivationException {
- this(ActivationGroup.currentGroupID(), className, location, data, restart);
-}
-
-public ActivationDesc(ActivationGroupID groupID, String className, String location, MarshalledObject data) {
- this(groupID, className, location, data, false);
-}
-
-public ActivationDesc(ActivationGroupID groupID, String className, String location, MarshalledObject data, boolean restart) {
- this.groupid = groupID;
- this.classname = className;
- this.location = location;
- this.data = data;
- this.restart = restart;
-}
-
-public ActivationGroupID getGroupID() {
- return (groupid);
-}
-
-public String getClassName() {
- return (classname);
-}
-
-public String getLocation() {
- return (location);
-}
-
-public MarshalledObject getData() {
- return (data);
-}
-
-public boolean getRestartMode() {
- return (restart);
-}
-
-public boolean equals(Object obj) {
- if (!(obj instanceof ActivationDesc)) {
- return (false);
- }
- ActivationDesc that = (ActivationDesc)obj;
-
- if (this.groupid.equals(that.groupid) &&
- this.classname.equals(that.classname) &&
- this.location.equals(that.location) &&
- this.data.equals(that.data) &&
- this.restart == that.restart) {
- return (true);
- }
- return (false);
-}
-
-public int hashCode() {
- return (groupid.hashCode() ^ classname.hashCode() ^ location.hashCode() ^ data.hashCode());
-}
-
+ /**
+ * The group id.
+ */
+ private ActivationGroupID groupid;
+
+ /**
+ * The class name.
+ */
+ private String classname;
+
+ /**
+ * The code location URL.
+ */
+ private String location;
+
+ /**
+ * The object specific intitalization data.
+ */
+ private MarshalledObject data;
+
+ /**
+ * The start mode.
+ */
+ private boolean restart;
+
+ /**
+ * Create the new activation description, assuming the object group is the
+ * [EMAIL PROTECTED] ActivationGroup#currentGroupID()}.
+ *
+ * @param className the object fully qualified class name
+ * @param location the code base URL
+ * @param data the object initialization data, contained in a marshalled form
+ */
+ public ActivationDesc(String className, String location, MarshalledObject data)
+ throws ActivationException
+ {
+ this(ActivationGroup.currentGroupID(), className, location, data, false);
+ }
+
+ /**
+ * Create the new activation description, assuming the object group is the
+ * [EMAIL PROTECTED] ActivationGroup#currentGroupID()}.
+ *
+ * @param className the object fully qualified class name
+ * @param location the code base URL
+ * @param data the object initialization data, contained in a marshalled form
+ * @param restart specifies reactivation mode after crash. If true, the object
+ * is activated when activator is restarted or the activation group
+ * is restarted. If false, the object is only activated on demand.
+ * This flag does has no effect during the normal operation (the
+ * object is normally activated on demand).
+ */
+ public ActivationDesc(String className, String location,
+ MarshalledObject data, boolean restart)
+ throws ActivationException
+ {
+ this(ActivationGroup.currentGroupID(), className, location, data, restart);
+ }
+
+ /**
+ * Create the new activation description. Under crash, the object will only
+ * be reactivated on demand.
+ *
+ * @param groupID the object group id.
+ * @param className the object fully qualified class name
+ * @param location the code base URL
+ * @param data the object initialization data, contained in a marshalled form
+ */
+ public ActivationDesc(ActivationGroupID groupID, String className,
+ String location, MarshalledObject data)
+ {
+ this(groupID, className, location, data, false);
+ }
+
+ /**
+ * Create the new activation description, providing full information.
+ *
+ * @param groupID the object group id.
+ * @param className the object fully qualified class name
+ * @param location the code base URL
+ * @param data the object initialization data, contained in a marshalled form
+ * @param restart specifies reactivation mode after crash. If true, the object
+ * is activated when activator is restarted or the activation group
+ * is restarted. If false, the object is only activated on demand.
+ * This flag does has no effect during the normal operation (the
+ * object is normally activated on demand).
+ */
+ public ActivationDesc(ActivationGroupID groupID, String className,
+ String location, MarshalledObject data, boolean restart)
+ {
+ this.groupid = groupID;
+ this.classname = className;
+ this.location = location;
+ this.data = data;
+ this.restart = restart;
+ }
+
+ public ActivationGroupID getGroupID()
+ {
+ return groupid;
+ }
+
+ /**
+ * Get the class name of the object being activated
+ *
+ * @return the fully qualified class name of the object being activated
+ */
+ public String getClassName()
+ {
+ return classname;
+ }
+
+ /**
+ * Get the code location URL ("codebase") of the object being activated.
+ *
+ * @return the codebase of the object being activated.
+ */
+ public String getLocation()
+ {
+ return location;
+ }
+
+ public MarshalledObject getData()
+ {
+ return data;
+ }
+
+ /**
+ * Get the object reactivation strategy after crash.
+ *
+ * @return true ir the object is activated when activator is restarted or the
+ * activation group is restarted. False if the object is only
+ * activated on demand. This flag does has no effect during the normal
+ * operation (the object is normally activated on demand).
+ */
+ public boolean getRestartMode()
+ {
+ return restart;
+ }
+
+ /**
+ * Compare this object with another activation description for equality.
+ *
+ * @return true if all fields have the equal values, false otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof ActivationDesc)
+ {
+ ActivationDesc that = (ActivationDesc) obj;
+ return groupid.equals(that.groupid) &&
+ classname.equals(that.classname) &&
+ location.equals(that.location) &&
+ data.equals(that.data)
+ && restart == that.restart;
+ }
+ else
+ return false;
+ }
+
+ /**
+ * Get the hash code of this object (overridden to make the returned value
+ * consistent with .equals(..).
+ */
+ public int hashCode()
+ {
+ return groupid.hashCode() ^ classname.hashCode() ^
+ location.hashCode() ^ data.hashCode();
+ }
}
Index: java/rmi/activation/ActivationGroupID.java
===================================================================
RCS file: /sources/classpath/classpath/java/rmi/activation/ActivationGroupID.java,v
retrieving revision 1.5
diff -u -r1.5 ActivationGroupID.java
--- java/rmi/activation/ActivationGroupID.java 2 Jul 2005 20:32:40 -0000 1.5
+++ java/rmi/activation/ActivationGroupID.java 10 Mar 2006 19:46:06 -0000
@@ -1,5 +1,5 @@
/* ActivationGroupID.java --
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,36 +35,73 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.rmi.activation;
import java.io.Serializable;
-public class ActivationGroupID implements Serializable
+/**
+ * This identifier identifies the activation group inside the scope of its
+ * activation system. It also contains (and can provide) the reference to the
+ * groups activation system.
+ *
+ * @see ActivationSystem#registerGroup(ActivationGroupDesc)
+ */
+public class ActivationGroupID
+ implements Serializable
{
- static final long serialVersionUID = -1648432278909740833L;
-
-private ActivationSystem system;
-
-public ActivationGroupID(ActivationSystem system) {
- this.system = system;
-}
-
-public ActivationSystem getSystem() {
- return (system);
-}
-
-public int hashCode() {
- return (system.hashCode());
-}
-
-public boolean equals(Object obj) {
- if (obj instanceof ActivationGroupID) {
- ActivationGroupID that = (ActivationGroupID)obj;
- if (this.system.equals(that.system)) {
- return (true);
- }
- }
- return (false);
-}
+ /**
+ * Use SVUID for interoperability.
+ */
+ static final long serialVersionUID = - 1648432278909740833L;
+
+ /**
+ * The associated activation system.
+ */
+ private ActivationSystem system;
+
+ /**
+ * Create the new activation group id in the scope of the given activation
+ * system
+ *
+ * @param system the activation system
+ */
+ public ActivationGroupID(ActivationSystem system)
+ {
+ this.system = system;
+ }
+
+ /**
+ * Get the associated activation system
+ *
+ * @return the associated activation system
+ */
+ public ActivationSystem getSystem()
+ {
+ return system;
+ }
+
+ /**
+ * Get the hash code of the associated activation system.
+ */
+ public int hashCode()
+ {
+ return system.hashCode();
+ }
+
+ /**
+ * Copmare for equality, returns true if the passed object is also the
+ * activation group id and its activation system is the same.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof ActivationGroupID)
+ {
+ ActivationGroupID that = (ActivationGroupID) obj;
+ return system.equals(that.system);
+ }
+ else
+ return false;
+ }
}
Index: java/rmi/activation/Activator.java
===================================================================
RCS file: /sources/classpath/classpath/java/rmi/activation/Activator.java,v
retrieving revision 1.7
diff -u -r1.7 Activator.java
--- java/rmi/activation/Activator.java 2 Jul 2005 20:32:40 -0000 1.7
+++ java/rmi/activation/Activator.java 10 Mar 2006 19:46:06 -0000
@@ -42,9 +42,31 @@
import java.rmi.Remote;
import java.rmi.RemoteException;
+/**
+ * Activates remote object, providing the live reference to the activable remote
+ * object.
+ *
+ * @see ActivationSystem
+ * @see ActivationMonitor
+ */
public interface Activator
extends Remote
{
+ /**
+ * Activate the object, associated with the given activation identifier. The
+ * activator looks for the [EMAIL PROTECTED] ActivationDesc}riptor for the passed
+ * identifier, determines the object activation group and initiates object
+ * recreation either via [EMAIL PROTECTED] ActivationInstantiator} or via
+ * [EMAIL PROTECTED] Class#newInstance()}.
+ *
+ * @param id the identifier of the object to activate.
+ * @param force if true, the activator always contacts the group to obtain the
+ * reference. If false, it may return the cached value.
+ * @return the activated remote object (its stub).
+ * @throws UnknownObjectException if the object with this id is unknown
+ * @throws ActivationException if the activation has failed due other reason
+ * @throws RemoteException if the remote call has failed.
+ */
MarshalledObject activate (ActivationID id, boolean force)
throws ActivationException, UnknownObjectException, RemoteException;
}
Index: java/rmi/server/Operation.java
===================================================================
RCS file: /sources/classpath/classpath/java/rmi/server/Operation.java,v
retrieving revision 1.6
diff -u -r1.6 Operation.java
--- java/rmi/server/Operation.java 2 Jul 2005 20:32:40 -0000 1.6
+++ java/rmi/server/Operation.java 10 Mar 2006 19:46:07 -0000
@@ -38,6 +38,9 @@
package java.rmi.server;
/**
+ * This class was used with jdk 1.1 stubs and skeletons. It is no longer
+ * needed since jdk 1.2 and higher.
+ *
* @deprecated
*/
public class Operation
@@ -45,6 +48,7 @@
private String operation;
/**
+ * Create operation with the given name.
* @deprecated
*/
public Operation (String op)
@@ -53,6 +57,8 @@
}
/**
+ * Get the name of the operation.
+ *
* @deprecated
*/
public String getOperation ()
@@ -61,6 +67,8 @@
}
/**
+ * Return the name of the operation.
+ *
* @deprecated
*/
public String toString ()
Index: java/rmi/server/RemoteServer.java
===================================================================
RCS file: /sources/classpath/classpath/java/rmi/server/RemoteServer.java,v
retrieving revision 1.7
diff -u -r1.7 RemoteServer.java
--- java/rmi/server/RemoteServer.java 2 Jul 2005 20:32:40 -0000 1.7
+++ java/rmi/server/RemoteServer.java 10 Mar 2006 19:46:07 -0000
@@ -1,5 +1,6 @@
/* RemoteServer.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,6 +36,7 @@
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;
@@ -42,35 +44,72 @@
import java.io.OutputStream;
import java.io.PrintStream;
-public abstract class RemoteServer extends RemoteObject
+/**
+ * A common superclass for the server implementations.
+ */
+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");
-}
+ private static final long serialVersionUID = - 4100238210092549637L;
+
+ /**
+ * Does nothing, delegates to super().
+ */
+ protected RemoteServer()
+ {
+ super();
+ }
+
+ /**
+ * Does nothing, delegates to super(ref).
+ */
+ protected RemoteServer(RemoteRef ref)
+ {
+ super(ref);
+ }
+
+ /**
+ * Get the host of the calling client. The current thread must be an instance
+ * of the [EMAIL PROTECTED] RMIIncomingThread}.
+ *
+ * @return the client host address
+ *
+ * @throws ServerNotActiveException if the current thread is not an instance
+ * of the RMIIncomingThread.
+ */
+ 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'");
+ }
+ }
+
+ /**
+ * Set the stream for logging RMI calls.
+ *
+ * @param out the stream to set or null to turn the logging off.
+ */
+ public static void setLog(OutputStream out)
+ {
+ throw new Error("Not implemented");
+ }
+
+ /**
+ * Get the stream for logging RMI calls.
+ *
+ * @return the associated stream.
+ */
+ public static PrintStream getLog()
+ {
+ throw new Error("Not implemented");
+ }
}