KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > server > gc > CommandRefer


1 package org.sapia.ubik.rmi.server.gc;
2
3 import org.sapia.ubik.rmi.server.*;
4
5 import java.io.IOException JavaDoc;
6 import java.io.ObjectInput JavaDoc;
7 import java.io.ObjectOutput JavaDoc;
8
9
10 /**
11  * A command sent from the client indicating that it refers to a remote
12  * object living on the server side.
13  *
14  * @author Yanick Duchesne
15  * 2002-08-25
16  */

17 public class CommandRefer extends RMICommand {
18   private OID _oid;
19
20   /** Do not call; used for externalization only */
21   public CommandRefer() {
22   }
23
24   /**
25    * This constructor takes the object identifier of the remote object
26    * to refer to.
27    *
28    * @param an <code>OID</code>
29    */

30   public CommandRefer(OID oid) {
31     _oid = oid;
32   }
33
34   /**
35    * @see org.sapia.ubik.rmi.server.RMICommand#execute()
36    */

37   public Object JavaDoc execute() throws Throwable JavaDoc {
38     Hub.serverRuntime.gc.reference(_vmId, _oid);
39
40     return null;
41   }
42
43   /**
44    * @see org.sapia.ubik.rmi.server.RMICommand#readExternal(ObjectInput)
45    */

46   public void readExternal(ObjectInput JavaDoc in)
47     throws IOException JavaDoc, ClassNotFoundException JavaDoc {
48     super.readExternal(in);
49     _oid = (OID) in.readObject();
50   }
51
52   /**
53    * @see org.sapia.ubik.rmi.server.RMICommand#writeExternal(ObjectOutput)
54    */

55   public void writeExternal(ObjectOutput JavaDoc out) throws IOException JavaDoc {
56     super.writeExternal(out);
57     out.writeObject(_oid);
58   }
59 }
60
Popular Tags