[e-cvs] cvs commit: e/src/jsrc/org/erights/e/ui/jed JedMain.java
markm@eros.cs.jhu.edu
markm@eros.cs.jhu.edu
Mon, 20 Aug 2001 17:17:50 -0400
markm 01/08/20 17:17:50
Modified: src/jsrc/net/captp/jcomm DelayedRedirector.java
Far3Desc.java ImportDesc.java IncomingDesc.java
NewFarDesc.java NonceLocator.java ObjectID.java
ObjectRefDesc.java ProxyConnection.java
RemoteHandler.java
src/jsrc/net/captp/tables NearGiftTable.java
src/jsrc/net/vattp/data NetConfig.java
src/jsrc/org/erights/e/elib/base SourceSpan.java
src/jsrc/org/erights/e/elib/ref Proxy.java
ProxyResolver.java Ref.java Resolver.java
src/jsrc/org/erights/e/elib/tables AtomicTwine.java
CompositeTwine.java ConstList.java
ConstListImpl.java LocatedTwine.java
SimpleTwine.java Twine.java
src/jsrc/org/erights/e/ui/jed JedMain.java
Added: src/jsrc/net/captp/jcomm NewRemotePromiseDesc.java
Promise3Desc.java RemotePromiseHandler.java
src/jsrc/net/captp/tables PromiseGiftTable.java
src/jsrc/org/erights/e/elib/ref RemotePromise.java
Removed: src/jsrc/net/captp/jcomm NewRemoteVowDesc.java
RemoteVowHandler.java Vow3Desc.java
src/jsrc/net/captp/tables GiftVowTable.java
src/jsrc/org/erights/e/elib/ref RemoteVow.java
Log:
added many serialvers
Revision Changes Path
1.5 +30 -23 e/src/jsrc/net/captp/jcomm/DelayedRedirector.java
Index: DelayedRedirector.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/DelayedRedirector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DelayedRedirector.java 2001/08/06 17:21:19 1.4
+++ DelayedRedirector.java 2001/08/20 21:17:49 1.5
@@ -33,9 +33,9 @@
import org.erights.e.elib.serial.PassByProxy;
/**
- * Wraps a ProxyResolver for a RemoteVow in a way suitable for inclusion as an
- * argument in the first whenMoreResolved message, in order to preserve
- * reference-full-order. <p>
+ * Wraps a ProxyResolver for a RemotePromise in a way suitable for inclusion
+ * as an argument in the first whenMoreResolved message, in order to preserve
+ * reference-full-order.
*
* @author Mark S. Miller
*/
@@ -56,28 +56,30 @@
/**
* On the first response, send a second whenMoreResolved on the original
- * RemoteVow, and then resolve the ProxyResolver to a Promise that will be
- * resolved by the answer to this second whenMoreResolved. <p>
- *
+ * RemotePromise, and then resolve the ProxyResolver to a Promise that
+ * will be resolved by the answer to this second whenMoreResolved.
+ * <p>
* This ensures that all messages have drained out of the previous path
* before enabling the new path. Once I've done my one-time-job, I
* become inoperative.
- *
+ * <p>
* The argument of this first response is ignored (thanks Dean!). The
* argument of the second response is used as the true resolution of my
- * vow.
+ * RemotePromise.
*/
public Object run(Object target) {
if (null == myOptResolver) {
- //If my vow is already resolved, then ignore further resolution
- //attempts
+ //If my RemotePromise is already resolved, then ignore further
+ //resolution attempts
return null;
}
- RemoteVowHandler rvh = (RemoteVowHandler)myOptResolver.optHandler();
+ RemotePromiseHandler rvh =
+ (RemotePromiseHandler)myOptResolver.optHandler();
if (rvh.isFresh()) {
- //If no messages have yet been sent over my vow, then there's no
- //message ordering issue, so resolve to target immediately.
+ //If no messages have yet been sent over my RemotePromise, then
+ //there's no message ordering issue, so resolve to target
+ //immediately.
myOptResolver.resolve(target);
return null;
}
@@ -89,11 +91,13 @@
RemoteHandler optTargetHandler =
(RemoteHandler)unsealer.unseal(optTargetBox, RemoteHandler.class);
if (null != optTargetHandler && conn == optTargetHandler.myConn) {
+
//If the new target is a remote reference into the same vat that
- //my vow is into, then messages to be sent over target will only
- //arrive after messages previously sent on this vow, so again
- //there's no message ordering issue, and we can resolve to target
- //immediately.
+ //my RemotePromise is into, then messages to be sent over target
+ //will only arrive after messages previously sent on this
+ //RemotePromise, so again there's no message ordering issue, and
+ //we can resolve to target immediately.
+
myOptResolver.resolve(target);
return null;
}
@@ -101,12 +105,15 @@
//If we fall through the above special cases, then we're in the
//general case, where we do need to deal with the message ordering
//issue. In this case, ignore the run/1 argument, send a last
- //whenMoreResolved/1 message over the vow with a simple redirector as
- //argument, and then resolve to a promise whose resolver is held by
- //that redirector. This will locally buffer messages until all
- //previous messages have been drained out, and will then resolve to
- //the argument of the second run/1 message (thereby delivering all
- //buffered messages as well).
+ //whenMoreResolved/1 message over the RemotePromise with a simple
+ //redirector as argument, and then resolve to a promise whose
+ //resolver is held by that redirector.
+ //
+ //This will locally buffer messages until all previous messages have
+ //been drained out, and will then resolve to the argument of the
+ //second run/1 message (thereby delivering all buffered messages as
+ //well).
+
Object[] pair = Ref.promise();
Redirector rdr = new Redirector((Resolver)pair[1]);
E.sendOnly(myOptResolver.getProxy(), "whenMoreResolved", rdr);
1.4 +3 -1 e/src/jsrc/net/captp/jcomm/Far3Desc.java
Index: Far3Desc.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/Far3Desc.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Far3Desc.java 2001/07/14 12:57:21 1.3
+++ Far3Desc.java 2001/08/20 21:17:49 1.4
@@ -29,11 +29,13 @@
* it points into. <p>
*
* Can't work until WormholeOp is implemented. Until then use
- * Vow3Desc instead, and suffer from the Lost Resolution bug.
+ * Promise3Desc instead, and suffer from the Lost Resolution bug.
*
* @author Mark Miller
*/
/*package*/ class Far3Desc implements ObjectRefDesc {
+
+ static private final long serialVersionUID = 1183670781832213637L;
private ConstList mySearchPath;
private String myHostID;
1.4 +2 -0 e/src/jsrc/net/captp/jcomm/ImportDesc.java
Index: ImportDesc.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/ImportDesc.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ImportDesc.java 2001/07/08 02:13:04 1.3
+++ ImportDesc.java 2001/08/20 21:17:49 1.4
@@ -33,6 +33,8 @@
*/
/*package*/ class ImportDesc implements ObjectRefDesc {
+ static private final long serialVersionUID = 5581130955096436339L;
+
private int myImportPos;
/**
1.4 +2 -0 e/src/jsrc/net/captp/jcomm/IncomingDesc.java
Index: IncomingDesc.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/IncomingDesc.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IncomingDesc.java 2001/07/08 02:13:04 1.3
+++ IncomingDesc.java 2001/08/20 21:17:49 1.4
@@ -34,6 +34,8 @@
*/
/*package*/ class IncomingDesc implements ObjectRefDesc {
+ static private final long serialVersionUID = 7071220903919564143L;
+
private int myIncomingPos;
/**
1.5 +2 -0 e/src/jsrc/net/captp/jcomm/NewFarDesc.java
Index: NewFarDesc.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/NewFarDesc.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NewFarDesc.java 2001/07/08 02:13:04 1.4
+++ NewFarDesc.java 2001/08/20 21:17:49 1.5
@@ -36,6 +36,8 @@
*/
/*package*/ class NewFarDesc implements ObjectRefDesc {
+ static private final long serialVersionUID = 2229110355967576618L;
+
private int myImportPos;
private BigInteger mySwissHash;
1.4 +10 -10 e/src/jsrc/net/captp/jcomm/NonceLocator.java
Index: NonceLocator.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/NonceLocator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NonceLocator.java 2001/07/14 12:57:21 1.3
+++ NonceLocator.java 2001/08/20 21:17:49 1.4
@@ -23,7 +23,7 @@
import java.io.IOException;
import java.math.BigInteger;
-import net.captp.tables.GiftVowTable;
+import net.captp.tables.PromiseGiftTable;
import net.captp.tables.NearGiftTable;
import net.captp.tables.SwissTable;
import net.captp.tables.Vine;
@@ -42,12 +42,12 @@
/**
*
*/
- private GiftVowTable myVowTable;
+ private PromiseGiftTable myPGifts;
/**
*
*/
- private NearGiftTable myNearTable;
+ private NearGiftTable myNGifts;
/**
*
@@ -67,14 +67,14 @@
/**
*
*/
- public NonceLocator(GiftVowTable vowTable,
- NearGiftTable nearTable,
+ public NonceLocator(PromiseGiftTable pGifts,
+ NearGiftTable nGifts,
String ownID,
ProxyMgr proxyMgr,
SwissTable swissTable)
{
- myVowTable = vowTable;
- myNearTable = nearTable;
+ myPGifts = pGifts;
+ myNGifts = nGifts;
myOwnID = ownID;
myProxyMgr = proxyMgr;
mySwissTable = swissTable;
@@ -87,7 +87,7 @@
String recipID,
BigInteger nonce)
{
- return myVowTable.provideFor(gift, recipID, nonce);
+ return myPGifts.provideFor(gift, recipID, nonce);
}
/**
@@ -108,7 +108,7 @@
if (! giftHash.equals(swissHash)) {
throw new RuntimeException("wrong hash: " + swissHash);
}
- return myNearTable.provideFor(gift, recipID, nonce, swissHash);
+ return myNGifts.provideFor(gift, recipID, nonce, swissHash);
}
/**
@@ -128,7 +128,7 @@
if (null == optDonorConn) {
return Ref.broken("The donor is gone");
}
- GiftVowTable donorTable = optDonorConn.getGiftVowTable();
+ PromiseGiftTable donorTable = optDonorConn.getPromiseGiftTable();
return donorTable.acceptFor(myOwnID, nonce);
}
1.4 +2 -0 e/src/jsrc/net/captp/jcomm/ObjectID.java
Index: ObjectID.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/ObjectID.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ObjectID.java 2001/05/03 08:58:44 1.3
+++ ObjectID.java 2001/08/20 21:17:49 1.4
@@ -33,6 +33,8 @@
*/
public class ObjectID implements Persistent, PassByConstruction {
+ static private final long serialVersionUID = 2221338666124259513L;
+
/** The vat this ID is relative to (i.e., the vat that created this ID). */
private String myVatID;
1.5 +1 -1 e/src/jsrc/net/captp/jcomm/ObjectRefDesc.java
Index: ObjectRefDesc.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/ObjectRefDesc.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ObjectRefDesc.java 2001/07/08 02:13:04 1.4
+++ ObjectRefDesc.java 2001/08/20 21:17:49 1.5
@@ -37,7 +37,7 @@
* @author Mark Miller
*/
/*package*/ interface ObjectRefDesc extends PassByConstruction {
-
+
/**
* Return an appropriate object (eg, a Proxy) matching this
* description.
1.22 +32 -30 e/src/jsrc/net/captp/jcomm/ProxyConnection.java
Index: ProxyConnection.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/ProxyConnection.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ProxyConnection.java 2001/08/06 17:21:19 1.21
+++ ProxyConnection.java 2001/08/20 21:17:49 1.22
@@ -26,7 +26,7 @@
import java.math.BigInteger;
import net.captp.tables.AnswersTable;
import net.captp.tables.ExportsTable;
-import net.captp.tables.GiftVowTable;
+import net.captp.tables.PromiseGiftTable;
import net.captp.tables.ImportsTable;
import net.captp.tables.NearGiftTable;
import net.captp.tables.QuestionsTable;
@@ -220,13 +220,13 @@
* For bringing about 3-vat introductions of unresolved references
* using nonces.
*/
- private GiftVowTable myGiftVows;
+ private PromiseGiftTable myPGifts;
/**
* For bringing about 3-vat introductions of Near references using
* nonces.
*/
- private NearGiftTable myNearGifts;
+ private NearGiftTable myNGifts;
/**
* Constructor
@@ -262,10 +262,10 @@
LookupHandler lookupHandler = new LookupHandler(this);
myRemoteNonceLocator = lookupHandler.myResolver.getProxy();
- myGiftVows = new GiftVowTable(myRemoteNonceLocator);
- myNearGifts = new NearGiftTable();
- myLocalNonceLocator = new NonceLocator(myGiftVows,
- myNearGifts,
+ myPGifts = new PromiseGiftTable(myRemoteNonceLocator);
+ myNGifts = new NearGiftTable();
+ myLocalNonceLocator = new NonceLocator(myPGifts,
+ myNGifts,
dataConn.getRemoteVatID(),
proxyMgr,
proxyMgr.getSwissTable());
@@ -282,12 +282,12 @@
/**
*
*/
- /*package*/ GiftVowTable getGiftVowTable() { return myGiftVows; }
+ /*package*/ PromiseGiftTable getPromiseGiftTable() { return myPGifts; }
/**
*
*/
- /*package*/ NearGiftTable getNearGiftTable() { return myNearGifts; }
+ /*package*/ NearGiftTable getNearGiftTable() { return myNGifts; }
/**
*
@@ -332,7 +332,7 @@
*/
/*package*/ ProxyResolver makeQuestion() {
int pos = -myQuestions.bind(null);
- RemoteVowHandler handler = new RemoteVowHandler(this, pos);
+ RemotePromiseHandler handler = new RemotePromiseHandler(this, pos);
ProxyResolver result = handler.myResolver;
myQuestions.put(-pos, result);
return result;
@@ -363,7 +363,7 @@
/**
*
*/
- /*package*/ NewRemoteVowDesc newRemoteVowDesc(Object promise) {
+ /*package*/ NewRemotePromiseDesc newRemotePromiseDesc(Object promise) {
int importPos = myExports.bind(promise);
BigInteger rdrBase = myEntropy.nextSwiss();
@@ -377,12 +377,13 @@
Object farRdr = rdrResolver.getProxy();
E.sendOnly(promise, "whenMoreResolved", farRdr);
- return new NewRemoteVowDesc(importPos, rdrPos, rdrBase);
+ return new NewRemotePromiseDesc(importPos, rdrPos, rdrBase);
}
/**
- * Returns a NewFarDesc, NewRemoteVowDesc, or an ImportDesc for exporting
- * obj, which is assumed to be suitable for being in our exports table.
+ * Returns a NewFarDesc, NewRemotePromiseDesc, or an ImportDesc for
+ * exporting obj, which is assumed to be suitable for being in our
+ * exports table.
* <p>
* obj is assumes to be a Near reference to a PassByProxy object (actual
* or HONORARY), or eventual.
@@ -396,7 +397,7 @@
return new ImportDesc(index);
}
} else if (Ref.isEventual(obj)) {
- return newRemoteVowDesc(obj);
+ return newRemotePromiseDesc(obj);
} else {
throw new RuntimeException("internal: Not exportable");
}
@@ -414,7 +415,7 @@
(RemoteHandler)unsealer.unseal(optBox, RemoteHandler.class);
if (null == optHandler) {
//a local promise
- return newRemoteVowDesc(ref);
+ return newRemotePromiseDesc(ref);
} else {
if (this == optHandler.myConn) {
int pos = optHandler.getPos();
@@ -449,24 +450,25 @@
}
/**
- * Dereferencing of a NewRemoteVowDesc. <p>
+ * Dereferencing of a NewRemotePromiseDesc. <p>
*
* On entry, importPos may be free, or may be allocated to an entry with
* a zero wireCount. In the latter case, the entry is overwritten.
*
- * @param importPos The import position at which the new RemoteVow should
- * be created.
+ * @param importPos The import position at which the new RemotePromise
+ * should be created.
* @param rdrPos The answers position at which the Redirector of that
- * new RemoteVow is made available.
+ * new RemotePromise is made available.
* @param rdrBase The sameness identity of that Redirector must be the
* cryptohash of rdrBase.
- * @return The newly created RemoteVow.
+ * @return The newly created RemotePromise.
*/
- /*package*/ Ref newRemoteVow(int importPos,
- int rdrPos,
- BigInteger rdrBase)
+ /*package*/ Ref newRemotePromise(int importPos,
+ int rdrPos,
+ BigInteger rdrBase)
{
- RemoteVowHandler handler = new RemoteVowHandler(this, importPos);
+ RemotePromiseHandler handler =
+ new RemotePromiseHandler(this, importPos);
ProxyResolver resolver = handler.myResolver;
myImports.put(importPos, resolver);
DelayedRedirector rdr = new DelayedRedirector(resolver);
@@ -518,7 +520,7 @@
}
/**
- * Dereferencing of a Vow3Desc
+ * Dereferencing of a Promise3Desc
*
* @param searchPath hints to find the vat identified by vatID
* @param vatID The fingerprint of the public key of the vat hosting the
@@ -971,15 +973,15 @@
myAnswers.smash(problem);
myImports.smash(problem);
myExports.smash(problem);
- myGiftVows.smash(problem);
- myNearGifts.smash(problem);
+ myPGifts.smash(problem);
+ myNGifts.smash(problem);
myQuestions= null;
myAnswers= null;
myImports= null;
myExports= null;
- myGiftVows= null;
- myNearGifts= null;
+ myPGifts= null;
+ myNGifts= null;
if (deliberate) {
//transfer buffered lookups to a newly spawned connection
1.11 +6 -6 e/src/jsrc/net/captp/jcomm/RemoteHandler.java
Index: RemoteHandler.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/jcomm/RemoteHandler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RemoteHandler.java 2001/08/04 06:56:52 1.10
+++ RemoteHandler.java 2001/08/20 21:17:49 1.11
@@ -41,10 +41,10 @@
* The second distinction is between handlers for resolved remote references,
* represented by the concrete subclass FarHandler, and handlers for
* remote references that aren't yet resolved, represented by the concrete
- * subclass RemoteVowHandler. As a special case, the handler at zero for the
- * other side's NonceLocator is a RemoteVowHandler, since shutdown attempts
- * may cause it to be retargeted at a newly incarnated NonceLocator from the
- * other side, which may have a new identity.
+ * subclass RemotePromiseHandler. As a special case, the handler at zero for
+ * the other side's NonceLocator is a RemotePromiseHandler, since shutdown
+ * attempts may cause it to be retargeted at a newly incarnated NonceLocator
+ * from the other side, which may have a new identity.
*
* @author Mark S. Miller
*/
@@ -59,7 +59,7 @@
* My outgoing position. <p>
*
* If < 0, in the Questions table.
- * If == 0, the special RemoteVowHandler for the other side's
+ * If == 0, the special RemotePromiseHandler for the other side's
* NonceLocator.
* If > 0, in the Imports table.
*/
@@ -169,7 +169,7 @@
}
}
ProxyResolver pr = myConn.makeQuestion();
- RemoteVowHandler rvh = (RemoteVowHandler)pr.optHandler();
+ RemotePromiseHandler rvh = (RemotePromiseHandler)pr.optHandler();
myConn.sendDeliverOp(myPos,
verb,
args,
1.1 e/src/jsrc/net/captp/jcomm/NewRemotePromiseDesc.java
Index: NewRemotePromiseDesc.java
===================================================================
package net.captp.jcomm;
/*
The contents of this file are subject to the Electric Communities E Open
Source Code License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License
at http://www.communities.com/EL/.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is the Distributed E Language Implementation, released
July 20, 1998.
The Initial Developer of the Original Code is Electric Communities.
Copyright (C) 1998 Electric Communities. All Rights Reserved.
Contributor(s): ______________________________________.
*/
import org.erights.e.develop.trace.Trace;
import java.math.BigInteger;
/**
* The first-time encoding of an exported Promise over the wire,
* received as an imported RemotePromise. <p>
*
* This is a separate class because the first time we export we also
* need to hook up the redirector, whereas the rest of the time we
* can just use ImportDesc(importPos).
*
* @author Chip Morningstar
* @author Mark Miller
*/
/*package*/ class NewRemotePromiseDesc implements ObjectRefDesc {
private int myImportPos;
private int myRdrPos;
private BigInteger myRdrBase;
/**
*
*/
private void validate() {
if (myImportPos <= 0) {
throw new RuntimeException("importPos must be positive: " +
myImportPos);
}
if (myRdrPos >= 0) {
throw new RuntimeException("rdrPos must be negative: " +
myRdrPos);
}
if (null == myRdrBase || myRdrBase.signum() <= 0) {
throw new RuntimeException("rdrBase must be positive: " +
myRdrBase);
}
}
/**
* Constructor.
*/
NewRemotePromiseDesc(int importPos, int rdrPos, BigInteger rdrBase) {
myImportPos = importPos;
myRdrPos = rdrPos;
myRdrBase = rdrBase;
validate();
}
/**
* What the other side exported, we dereference as the RemotePromise
* we will now import.
*/
public Object dereference(ProxyConnection conn) {
Object result = conn.newRemotePromise(myImportPos,
myRdrPos,
myRdrBase);
if (Trace.captp.debug && Trace.ON) {
Trace.captp.debugm("ProxyConnection " + conn +
" deref " + toString());
}
return result;
}
/**
*
*/
public String toString() {
return "NewRemotePromiseDesc(" + myImportPos + ", " +
myRdrPos + ", " +
myRdrBase + ")";
}
}
1.1 e/src/jsrc/net/captp/jcomm/Promise3Desc.java
Index: Promise3Desc.java
===================================================================
package net.captp.jcomm;
/*
The contents of this file are subject to the Electric Communities E Open
Source Code License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License
at http://www.communities.com/EL/.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is the Distributed E Language Implementation, released
July 20, 1998.
The Initial Developer of the Original Code is Electric Communities.
Copyright (C) 1998 Electric Communities. All Rights Reserved.
Contributor(s): ______________________________________.
*/
import java.math.BigInteger;
import net.captp.tables.Vine;
import org.erights.e.develop.trace.Trace;
import org.erights.e.elib.tables.ConstList;
/**
* The encoding of a RemotePromise over the wire to someone other than the
* vat it points into.
*
* @author Chip Morningstar
* @author Mark Miller
*/
/*package*/ class Promise3Desc implements ObjectRefDesc {
private ConstList mySearchPath;
private String myHostID;
private BigInteger myNonce;
private Object myOptFarVine;
//XXX Possible SECURITY BUG: Needs a validate() method.
/**
* Constructor.
*/
/*package*/ Promise3Desc(ConstList searchPath,
String hostID,
BigInteger nonce,
Object optFarVine)
{
mySearchPath = searchPath;
myHostID = hostID;
myNonce = nonce;
myOptFarVine = optFarVine;
}
/**
* What the other side imported (from somebody other than
* ourselves), we dereference as a RemotePromise to the same
* arrowhead.
*/
public Object dereference(ProxyConnection conn) {
if (Trace.captp.debug && Trace.ON) {
Trace.captp.debugm(conn + " deref Promise3Desc: " + this);
}
Vine optVine = null;
if (null != myOptFarVine) {
optVine = new Vine(myOptFarVine);
}
return conn.getLookup(mySearchPath,
myHostID,
myNonce,
optVine);
}
/**
*
*/
public String toString() {
return "Promise3Desc(" + mySearchPath + ",\n "
+ myHostID.substring(0,4) + ",\n "
+ myNonce + ",\n "
+ myOptFarVine + ")";
}
}
1.1 e/src/jsrc/net/captp/jcomm/RemotePromiseHandler.java
Index: RemotePromiseHandler.java
===================================================================
package net.captp.jcomm;
/*
The contents of this file are subject to the Electric Communities E Open
Source Code License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License
at http://www.communities.com/EL/.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is the Distributed E Language Implementation, released
July 20, 1998.
The Initial Developer of the Original Code is Electric Communities.
Copyright (C) 1998 Electric Communities. All Rights Reserved.
Contributor(s): ______________________________________.
*/
import org.erights.e.elib.ref.Ref;
/**
* Handles an unresolved remote reference (a RemotePromise).
*
* @author Mark S. Miller
*/
/*package*/ class RemotePromiseHandler extends RemoteHandler {
/**
* Flag to remember whether any E-level messages have been sent over me.
*/
private boolean myFreshFlag = true;
/**
* Construct a new RemotePromiseHandler.
*
* @param connection The ProxyConnection to communicate via
* @param pos The Imports or Questions map pos of the object
*/
/*package*/ RemotePromiseHandler(ProxyConnection connection, int pos) {
super(connection, pos, null);
}
/**
* Override to also clear myFreshFlag
*/
public void handleSendAllOnly(String verb, Object[] args) {
myFreshFlag = false;
super.handleSendAllOnly(verb, args);
}
/**
* Override to also clear myFreshFlag
*/
public Ref handleSendAll(String verb, Object[] args) {
myFreshFlag = false;
return super.handleSendAll(verb, args);
}
/**
* Have no E-level messages yet been sent over me?
*/
/*package*/ boolean isFresh() { return myFreshFlag; }
}
1.3 +3 -2 e/src/jsrc/net/captp/tables/NearGiftTable.java
Index: NearGiftTable.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/captp/tables/NearGiftTable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NearGiftTable.java 2001/07/14 12:57:21 1.2
+++ NearGiftTable.java 2001/08/20 21:17:49 1.3
@@ -75,8 +75,9 @@
private FlexMap myStuff;
/**
- * @param nonceLocatorPromise A RemoveVow for the Donor's NonceLocator.
- * The ignore(vine) message is sent to it, so that it can ignore it.
+ * @param nonceLocatorPromise A RemotePromise for the Donor's
+ * NonceLocator. The ignore(vine) message is
+ * sent to it, so that it can ignore it.
*/
public NearGiftTable() {
myStuff = FlexMap.fromTypes(Object[].class, Object.class);
1.1 e/src/jsrc/net/captp/tables/PromiseGiftTable.java
Index: PromiseGiftTable.java
===================================================================
package net.captp.tables;
/*
The contents of this file are subject to the Improvements to the
Distributed E Language Implementation License Version 1.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.erights.org/mmlicense.html
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
The Original Code is the Improvements to the Distributed E Language
Implementation, released May 27, 1999.
The Initial Developer of the Original Code is Mark S. Miller.
Copyright (C) 1999 Mark S. Miller. All Rights Reserved.
Contributor(s): ______________________________________.
*/
import java.math.BigInteger;
import org.erights.e.elib.prim.E;
import org.erights.e.elib.prim.WeakPtr;
import org.erights.e.elib.ref.Ref;
import org.erights.e.elib.ref.Resolver;
import org.erights.e.elib.tables.FlexMap;
/**
* Rendezvous point for 3-vat live Granovetter introductions of Unresolved
* remote references (RemotePromises). <p>
*
* Where we normally speak of Alice giving Bob a reference to Carol, we here
* speak of the Donor (VatA) giving to the Recipient (VatB) a reference to
* the Gift (Carol) residing on the Host (VatC). There is one
* PromiseGiftTable in the Host per Donor. The Donor associates the gift
* with a Nonce and the Recipient's ID, and she tells the Nonce to the
* Recipient. The Recipient asks the Host "What gift has Donor (identified
* by DonorID) deposited for me at this Nonce?".
* <p>
* A Nonce is a use once unique number. It only needs to be "impossible" to
* collide under benevolent assumptions; it doesn't need to be unguessable,
* so perhaps a 64 bit number could have been used instead. For now, we just
* use our normal unguessable numbers (given by 'entropy nextSwiss()'). <p>
*
* Two interesting complexities: 1) The Recipient's lookup request may arrive
* at the Host before the Donors donation request does. 2) A partition could
* prevent the operation from completing, in which case the Recipient cannot
* be left hanging, and the association must be cleaned up. <p>
*
* For 3-vat live Granovetter introductions of Resolved remote references
* (FarRefs), see the NearGiftTable.
*
* @author Mark S. Miller.
*/
public class PromiseGiftTable {
/**
* Maps from [recipID, Nonce] to [referent, optResolver]
*/
private FlexMap myStuff;
/**
* A RemotePromise for the Donor's NonceLocator.
*/
private Object myNonceLocatorPromise;
/**
* @param nonceLocatorPromise A RemotePromise for the Donor's
* NonceLocator. The ignore(vine) message is
* sent to it, so that it can ignore it.
*/
public PromiseGiftTable(Object nonceLocatorPromise) {
myStuff = FlexMap.fromTypes(Object[].class, Object[].class);
myNonceLocatorPromise = nonceLocatorPromise;
}
/**
* Smash all untaken promises for undonated gifts, and then disable this
* table.
*/
public void smash(Throwable problem) {
Object[][] vals = (Object[][])myStuff.getValues(Object[].class);
for (int i = 0; i < vals.length; i++) {
Resolver optResolver = (Resolver)vals[i][1];
if (null != optResolver) {
optResolver.smash(problem);
}
}
myStuff = null;
}
/**
* Make the gift available to the recipient so long as the Vine is held
* onto (isn't garbage).
*/
public Vine provideFor(Object gift,
String recipID,
BigInteger nonce)
{
Object[] keyPair = { recipID, nonce };
Object[] optValuePair = (Object[])myStuff.get(keyPair, null);
Vine result = new Vine(null);
if (null == optValuePair) {
//donation happened first.
optValuePair[0] = gift;
optValuePair[1] = null;
myStuff.put(keyPair, optValuePair);
//XXX do we need to hold onto the weakPtr in order for it to be
//finalized? If so, then we must.
WeakPtr weakPtr = WeakPtr.make(result, this, "drop", keyPair);
} else {
//resolve the promise for a gift already looked up. Done.
Resolver resolver = (Resolver)optValuePair[1];
resolver.resolve(gift);
myStuff.removeKey(keyPair);
}
return result;
}
/**
* Lookup the gift. <p>
*
* If absent, return a promise for what will be given, and sends an
* ignore(vine) to the nonceLocatorPromise. The promise is good as long
* as the vine is held. <p>
*
* Note that this message is named "acceptFor" whereas the corresponding
* NonceLocator message is names "acceptFrom". In acceptFor, the
* recipient is explicit and the donor implicit. In acceptFrom, the
* donor is explicit and the recipient implicit.
*
* @param recipID The vatID of the vat (Bob, the gift recipient) that the
* gift is being picked up for.
* @param nonce Identifies (together with the recipID) the gift.
*/
public Object acceptFor(String recipID, BigInteger nonce) {
Object[] keyPair = { recipID, nonce };
Object[] optValuePair = (Object[])myStuff.get(keyPair, null);
if (null == optValuePair) {
//lookup happened first, promise a gift to be donated.
optValuePair = Ref.promise();
myStuff.put(keyPair, optValuePair);
Vine vine = new Vine(null);
//XXX do we need to hold onto the weakPtr in order for it to be
//finalized? If so, then we must.
WeakPtr weakPtr = WeakPtr.make(vine, this, "drop", keyPair);
E.sendOnly(myNonceLocatorPromise, "ignore", vine);
} else {
//Done.
myStuff.removeKey(keyPair);
}
return optValuePair[0];
}
/**
* Automagically called when the vine is dropped. <p>
* The Donor is able to call this as well, which isn't appropriate, but
* isn't dangerous, so what the hell.
*/
public void drop(String recipID, BigInteger nonce) {
Object[] keyPair = { recipID, nonce };
Object[] optValuePair = (Object[])myStuff.get(keyPair, null);
if (null == optValuePair) {
return;
}
Resolver optResolver = (Resolver)optValuePair[1];
if (null != optResolver) {
optResolver.smash("The vine was dropped: " + nonce);
}
myStuff.removeKey(keyPair);
}
}
1.2 +2 -0 e/src/jsrc/net/vattp/data/NetConfig.java
Index: NetConfig.java
===================================================================
RCS file: /cvs/e/src/jsrc/net/vattp/data/NetConfig.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NetConfig.java 2001/04/13 08:08:33 1.1
+++ NetConfig.java 2001/08/20 21:17:49 1.2
@@ -37,6 +37,8 @@
* @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
*/
public class NetConfig implements PassByConstruction, Persistent, Selfless {
+
+ static final long serialVersionUID = 7141557786514460621L;
/**
*
1.12 +2 -0 e/src/jsrc/org/erights/e/elib/base/SourceSpan.java
Index: SourceSpan.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/base/SourceSpan.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SourceSpan.java 2001/04/01 08:13:41 1.11
+++ SourceSpan.java 2001/08/20 21:17:49 1.12
@@ -35,6 +35,8 @@
public class SourceSpan
implements PassByConstruction, Persistent, Selfless {
+ static private final long serialVersionUID = -7424472535435659022L;
+
/**
*
*/
1.4 +1 -1 e/src/jsrc/org/erights/e/elib/ref/Proxy.java
Index: Proxy.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/ref/Proxy.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Proxy.java 2001/05/11 02:30:59 1.3
+++ Proxy.java 2001/08/20 21:17:49 1.4
@@ -41,7 +41,7 @@
*
* A Settled Proxy (one with sameness identity) is represented by the
* subclass FarRef. An Unsettled Proxy (one without such identity, and
- * therefore a Promise) is represented by the subclass RemoteVow.
+ * therefore a Promise) is represented by the subclass RemotePromise.
*
* @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
*/
1.6 +6 -6 e/src/jsrc/org/erights/e/elib/ref/ProxyResolver.java
Index: ProxyResolver.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/ref/ProxyResolver.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ProxyResolver.java 2001/08/17 03:11:33 1.5
+++ ProxyResolver.java 2001/08/20 21:17:49 1.6
@@ -68,11 +68,11 @@
* @param handler Delegates delegatable eventual-ref behavior to the
* handler.
* @param optIdentity If null, the handled reference will be unresolved
- * (a RemoteVow). If non-null, the optIdentity must be an honorary {@link
- * Selfless} object. This includes {@link java.math.BigInteger} and
- * {@link net.captp.jcomm.ObjectID}. The identity object serves as the
- * basis for the sameness identity of the resulting handled resolved
- * reference (FarRef).
+ * (a RemotePromise). If non-null, the optIdentity must be an honorary
+ * {@link Selfless} object. This includes {@link java.math.BigInteger}
+ * and {@link net.captp.jcomm.ObjectID}. The identity object serves as
+ * the basis for the sameness identity of the resulting handled resolved
+ * reference (FarRef).
*/
public ProxyResolver(ProxyHandler handler, Object optIdentity) {
optIdentity = Ref.resolution(optIdentity);
@@ -119,7 +119,7 @@
return result;
}
if (null == myOptIdentity) {
- result = new RemoteVow(myOptHandler);
+ result = new RemotePromise(myOptHandler);
} else {
result = new FarRef(myOptIdentity, myOptHandler);
}
1.23 +7 -7 e/src/jsrc/org/erights/e/elib/ref/Ref.java
Index: Ref.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/ref/Ref.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Ref.java 2001/08/19 06:35:55 1.22
+++ Ref.java 2001/08/20 21:17:49 1.23
@@ -315,13 +315,13 @@
* Far reference, since identity must be stable. Other Broken references
* are the same iff their problems are the same. <p>
*
- * Far references cannot point at Selfless objects (although RemoteVows
- * can, as a transient state). Therefore, the only case left is a Near
- * reference to a Selfless object. A Near reference to a Selfless object
- * is settled iff the Selfless object is settled. Just as two Selfless
- * objects are the same iff they are of the same types are their parts
- * are recursively the same, a Selfless object is settled when all its
- * parts are recursively settled. For example, <pre>
+ * Far references cannot point at Selfless objects (although
+ * RemotePromises can, as a transient state). Therefore, the only case
+ * left is a Near reference to a Selfless object. A Near reference to a
+ * Selfless object is settled iff the Selfless object is settled. Just
+ * as two Selfless objects are the same iff they are of the same types
+ * are their parts are recursively the same, a Selfless object is settled
+ * when all its parts are recursively settled. For example, <pre>
*
* [x, y]
* </pre>
1.5 +3 -3 e/src/jsrc/org/erights/e/elib/ref/Resolver.java
Index: Resolver.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/ref/Resolver.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Resolver.java 2001/08/17 03:11:33 1.4
+++ Resolver.java 2001/08/20 21:17:49 1.5
@@ -32,9 +32,9 @@
/**
* Queues all accumulated and future messages for delivery to target,
- * and, for example, a LocalVow becomes resolved into being E-equivalent
- * to the target. If isDone(), an exception is thrown instead. A
- * Resolver will be isDone() following a resolve().
+ * and, for example, a local promise becomes resolved into being
+ * E-equivalent to the target. If isDone(), an exception is thrown
+ * instead. A Resolver will be isDone() following a resolve().
*/
void resolve(Object target);
1.1 e/src/jsrc/org/erights/e/elib/ref/RemotePromise.java
Index: RemotePromise.java
===================================================================
package org.erights.e.elib.ref;
/*
The contents of this file are subject to the Electric Communities E Open
Source Code License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License
at http://www.communities.com/EL/.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is the Distributed E Language Implementation, released
July 20, 1998.
The Initial Developer of the Original Code is Electric Communities.
Copyright (C) 1998 Electric Communities. All Rights Reserved.
Contributor(s): ______________________________________.
*/
import org.erights.e.elib.prim.E;
/**
* A RemotePromise is a Proxy intended to represent a promise that will be
* resolved remotely (in another vat).
* <p>
* A RemotePromise is born handled (delegating to its ProxyHandler). While it is
* handled, it is EVENTUAL and has no identity. It is therefore also
* unsettled.
*
* @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
*/
/*package*/ class RemotePromise extends Proxy {
/**
*
*/
/*package*/ RemotePromise(ProxyHandler handler) {
super(handler);
}
/**
*
*/
public boolean isResolved() {
if (null == myOptTarget) {
return false;
} else {
return myOptTarget.isResolved();
}
}
/**
* To set me is to commit me
*/
/*package*/ void setTarget(Ref newTarget) {
if (null != myOptTarget) {
throw new RuntimeException("No longer handled");
}
ProxyHandler handler = myOptHandler;
myOptHandler = null;
myOptTarget = TheViciousRef;
newTarget = newTarget.resolutionRef();
if (newTarget == TheViciousRef) {
myOptTarget =
new UnconnectedRef(new ViciousCycleException("Ref loop"));
} else {
myOptTarget = newTarget;
}
//XXX should we allow throws to propogate?
handler.handleResolution(myOptTarget);
}
}
1.4 +2 -0 e/src/jsrc/org/erights/e/elib/tables/AtomicTwine.java
Index: AtomicTwine.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/AtomicTwine.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AtomicTwine.java 2001/07/14 12:57:24 1.3
+++ AtomicTwine.java 2001/08/20 21:17:50 1.4
@@ -28,6 +28,8 @@
*/
/*package*/ abstract class AtomicTwine extends Twine {
+ static private final long serialVersionUID = 2310317145102038297L;
+
/**
*
*/
1.7 +2 -0 e/src/jsrc/org/erights/e/elib/tables/CompositeTwine.java
Index: CompositeTwine.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/CompositeTwine.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CompositeTwine.java 2001/08/17 20:59:26 1.6
+++ CompositeTwine.java 2001/08/20 21:17:50 1.7
@@ -31,6 +31,8 @@
*/
/*package*/ final class CompositeTwine extends Twine {
+ static private final long serialVersionUID = -4692386437819865069L;
+
private transient int mySizeCache = -1;
/**
1.14 +2 -0 e/src/jsrc/org/erights/e/elib/tables/ConstList.java
Index: ConstList.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/ConstList.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ConstList.java 2001/04/01 08:13:42 1.13
+++ ConstList.java 2001/08/20 21:17:50 1.14
@@ -35,6 +35,8 @@
public abstract class ConstList
extends EList implements PassByConstruction, Selfless {
+ static private final long serialVersionUID = -4704670888158933364L;
+
/**
*
*/
1.8 +2 -0 e/src/jsrc/org/erights/e/elib/tables/ConstListImpl.java
Index: ConstListImpl.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/ConstListImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ConstListImpl.java 2001/02/01 05:52:01 1.7
+++ ConstListImpl.java 2001/08/20 21:17:50 1.8
@@ -26,6 +26,8 @@
*/
/*package*/ class ConstListImpl extends ConstList implements ArrayedList {
+ static private final long serialVersionUID = 6618785990395724987L;
+
/** myVals is an array */
private Object myVals;
1.5 +2 -0 e/src/jsrc/org/erights/e/elib/tables/LocatedTwine.java
Index: LocatedTwine.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/LocatedTwine.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LocatedTwine.java 2001/08/17 20:59:26 1.4
+++ LocatedTwine.java 2001/08/20 21:17:50 1.5
@@ -31,6 +31,8 @@
*/
/*package*/ final class LocatedTwine extends AtomicTwine {
+ static private final long serialVersionUID = 2201288242995979823L;
+
/**
*
*/
1.6 +2 -0 e/src/jsrc/org/erights/e/elib/tables/SimpleTwine.java
Index: SimpleTwine.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/SimpleTwine.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SimpleTwine.java 2001/08/17 20:59:26 1.5
+++ SimpleTwine.java 2001/08/20 21:17:50 1.6
@@ -30,6 +30,8 @@
*/
/*package*/ final class SimpleTwine extends AtomicTwine {
+ static private final long serialVersionUID = -6842512130437927421L;
+
/**
* The empty Twine.
*/
1.15 +2 -0 e/src/jsrc/org/erights/e/elib/tables/Twine.java
Index: Twine.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/Twine.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Twine.java 2001/08/17 20:59:26 1.14
+++ Twine.java 2001/08/20 21:17:50 1.15
@@ -50,6 +50,8 @@
*/
public abstract class Twine extends ConstList {
+ static private final long serialVersionUID = 5436911677426527143L;
+
/**
*
*/
1.36 +3 -0 e/src/jsrc/org/erights/e/ui/jed/JedMain.java
Index: JedMain.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/ui/jed/JedMain.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- JedMain.java 2001/08/20 15:44:31 1.35
+++ JedMain.java 2001/08/20 21:17:50 1.36
@@ -279,6 +279,7 @@
myOptFile = file;
myTextArea.setText(text);
myAmDirty = false;
+ myTextArea.setCaretPosition(0);
setMenuState(); //to remove the bad "*" indicator
setVisible(true);
return true;
@@ -345,7 +346,9 @@
showProblem("can't read " + myOptFile, iox);
return false;
}
+ int pos = myTextArea.getCaretPosition();
myTextArea.setText(text);
+ myTextArea.setCaretPosition(Math.min(pos, text.length()));
myAmDirty = false;
return true;
} else {