[Webfunds-commits] java/webfunds/sox AbstractPayment.java AccountId.java Id.java Payment.java Receipt.java RegisterReply.java TokenPayment.java

Ian Grigg iang@cypherpunks.ai
Fri, 23 Mar 2001 11:06:05 -0400 (AST)


iang        01/03/23 11:06:05

  Modified:    webfunds/client AccountInfo.java SimplePaymentFrame.java
               webfunds/client/sox PendingReceipt.java SOXWallet.java
               webfunds/client/sox/gui PaymentFrame.java
               webfunds/sox AbstractPayment.java AccountId.java Id.java
                        Payment.java Receipt.java RegisterReply.java
                        TokenPayment.java
  Log:
  cash was a bad move, term now is OPEN, and we can change the string

Revision  Changes    Path
1.24      +4 -4      java/webfunds/client/AccountInfo.java

Index: AccountInfo.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/AccountInfo.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- AccountInfo.java	2001/02/27 01:28:20	1.23
+++ AccountInfo.java	2001/03/23 15:06:01	1.24
@@ -1,5 +1,5 @@
 /*
- * $Id: AccountInfo.java,v 1.23 2001/02/27 01:28:20 iang Exp $
+ * $Id: AccountInfo.java,v 1.24 2001/03/23 15:06:01 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -48,7 +48,7 @@
         return ai ;
     }
 
-    public boolean isBearer()
+    public boolean isOpen()
     {
         if (id == null || id.length == 0)
             return true;
@@ -75,7 +75,7 @@
 ////// Construction ///////////////////////////////////
 
     /**
-     *  Use this constructor for a bearer (empty) info.
+     *  Use this constructor for an OPEN (empty) info.
      */
     public AccountInfo()
     {
@@ -172,7 +172,7 @@
         if (name != null)
             return name ; // + " (" + webfunds.utils.Hex.data2hex(id) + ")";
         if (id == null || id.length == 0)
-    	    return "BEARER";
+    	    return AccountId.open();
     	String retval = webfunds.utils.Hex.data2hex(id);
     	if (retval.length() > 10)
             retval = retval.substring(0, 9);



1.54      +5 -5      java/webfunds/client/SimplePaymentFrame.java

Index: SimplePaymentFrame.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/SimplePaymentFrame.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- SimplePaymentFrame.java	2001/03/23 01:21:40	1.53
+++ SimplePaymentFrame.java	2001/03/23 15:06:01	1.54
@@ -1,5 +1,5 @@
 /*
- * $Id: SimplePaymentFrame.java,v 1.53 2001/03/23 01:21:40 iang Exp $
+ * $Id: SimplePaymentFrame.java,v 1.54 2001/03/23 15:06:01 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -285,7 +285,7 @@
         long longamount = contract.getUnitsOfContract(dub);
 
         // who to
-        AccountInfo tgt = (AccountInfo)combo.getSelectedItem(); //default CASH
+        AccountInfo tgt = (AccountInfo)combo.getSelectedItem(); //default OPEN
         String tgtName = target.getText();
 
         if (!"".equals(tgtName))
@@ -294,8 +294,8 @@
 
             tgt = new AccountInfo(bytes, null, null);
         }
-        else if (tgt.isCash())             // what does tgt return ?
-            tgtName = AccountId.CASH_STRING;
+        else if (tgt.isOpen())             // what does tgt return ?
+            tgtName = AccountId.open();
         else
             tgtName = tgt.getName() + " ("+Hex.data2hex(tgt.getByteArray())+")";
 
@@ -346,7 +346,7 @@
 
         else if ("Direct Transfer".equals(command))
         {
-            if (tgt == null || tgt.isCash())
+            if (tgt == null || tgt.isOpen())
             {
                 String e = "You have to specify a target";
                 pm.getUInterface(this).errorMessage(e);



1.14      +3 -3      java/webfunds/client/sox/PendingReceipt.java

Index: PendingReceipt.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/PendingReceipt.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PendingReceipt.java	2001/03/23 01:21:40	1.13
+++ PendingReceipt.java	2001/03/23 15:06:02	1.14
@@ -1,5 +1,5 @@
 /*
- * $Id: PendingReceipt.java,v 1.13 2001/03/23 01:21:40 iang Exp $
+ * $Id: PendingReceipt.java,v 1.14 2001/03/23 15:06:02 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -170,8 +170,8 @@
                 return false;
         }
         ot = other.target;
-        if (ot.isCash()) {
-            if (!target.isCash())
+        if (ot.isOpen()) {
+            if (!target.isOpen())
                 return false ;
         } else {
             if (!ot.equals(target))



1.147     +15 -15    java/webfunds/client/sox/SOXWallet.java

Index: SOXWallet.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/SOXWallet.java,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -r1.146 -r1.147
--- SOXWallet.java	2001/03/18 23:23:11	1.146
+++ SOXWallet.java	2001/03/23 15:06:02	1.147
@@ -1,4 +1,4 @@
-/* $Id: SOXWallet.java,v 1.146 2001/03/18 23:23:11 iang Exp $
+/* $Id: SOXWallet.java,v 1.147 2001/03/23 15:06:02 iang Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * The WebFunds Development Team.  All Rights Reserved.
@@ -77,7 +77,7 @@
  *  See quiteCancel for example of low call.  It should not use AccountInfo
  *  (artifact of Receipt Store).
  *
- * @version $Revision: 1.146 $
+ * @version $Revision: 1.147 $
  */
 public class SOXWallet
     extends Debug
@@ -609,13 +609,13 @@
                                    String paymentId)
     {
         AccountId tgt = new AccountId();
-        if (target != null)               // target might be bearer
+        if (target != null)               // target might be open
             tgt.setByteArray(target.getByteArray());
 
         if (source == null)
             throw new IllegalArgumentException("source == null");
 
-        AccountId src = getAccountId(source);   // source better not be bearer
+        AccountId src = getAccountId(source);   // source better not be open
 
         return makePurePayment(
                     src, tgt,
@@ -654,7 +654,7 @@
      *  As a principle, we deal in Units of Contract (underlying units)
      *  and not Units of Account (displayed units).
      *
-     * @param tgt the target account, may be bearer
+     * @param tgt the target account, may be open
      * @param src the source account where funds are written from
      * @param contractid is the name of the contract
      * @param amount the (contract) qty of items of which the payment is for
@@ -779,7 +779,7 @@
      *     * saves the pending payment for later reconciliation.
      *  and delivers the payment back.  It is thread safe.
      *
-     * @param tgt the target account, may be bearer
+     * @param tgt the target account, may be open
      * @param src the source account where funds are written from
      * @param contractid is the name of the contract
      * @param amount the (contract) qty of items of which the payment is for
@@ -912,7 +912,7 @@
      *  It does not check balances (by definition).
      *  It is thread safe.  Why?
      *
-     * @param tgt the target account, should not be bearer, where funds go
+     * @param tgt the target account, should not be open, where funds go
      * @param src the source account (to be frozen) where funds are 
      * @param contractid is the name of the contract, but this is only used
      *        to identify the issuer, all contracts at that issuer effected
@@ -980,7 +980,7 @@
      *     * saves the pending payment for later reconciliation.
      *  and delivers the payment back.  It is thread safe.
      *
-     * @param tgt the target account, may be bearer
+     * @param tgt the target account, may be open
      * @param src the source account where funds are written from
      * @param contractid is the name of the contract
      * @param amount the (contract) qty of items of which the payment is for
@@ -1043,7 +1043,7 @@
          *  of the primary payment in order to pay for the proto.
          *
          *  We need to write a payment to someone who can cash these
-         *  payments ...  it has to be bearer, as we don't otherwise
+         *  payments ...  it has to be open, as we don't otherwise
          *  know the name of the float as yet.
          */
 
@@ -1310,11 +1310,11 @@
         boolean knownAccount = true;  // following code should work, except...
         try
         {
-            if (pt.isBearer())
+            if (pt.isOpen())
             {
-                logmsg("pt.isBearer() says 'true'");
+                logmsg("pt.isOpen() says 'true'");
 
-                // Ok, so it's bearer, and we can deposit it anywhere.
+                // Ok, so it's open, and we can deposit it anywhere.
                 ac = getAccount(callerAc);
 
                 if (ac == null)
@@ -1324,11 +1324,11 @@
                     ac = getAccount(ps);
                     if (ac == null)
                     {
-                        error("no target for bearer ?");
+                        error("no target for open payment?");
                         return;
                     }
                 }
-                // this is who we are going to deposit the bearer into
+                // this is who we are going to deposit the open payment into
                 ptt = ac.getId();
                 pt = new AccountInfo(ptt, null, this);
                 knownAccount = true;
@@ -1340,7 +1340,7 @@
                 //  subaccount, so as to do a deposit.  It doesn't
                 //  actually make much difference which sub account
                 //  does the deposit, as the issuer checks that the
-                //  payment is good, not the deposit (unless bearer).
+                //  payment is good, not the deposit (unless open).
                 //  But, it's nice for the receipt if it is all
                 //  aligned.
                 //



1.9       +6 -6      java/webfunds/client/sox/gui/PaymentFrame.java

Index: PaymentFrame.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/gui/PaymentFrame.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PaymentFrame.java	2001/03/23 01:21:40	1.8
+++ PaymentFrame.java	2001/03/23 15:06:03	1.9
@@ -1,5 +1,5 @@
 /*
- * $Id: PaymentFrame.java,v 1.8 2001/03/23 01:21:40 iang Exp $
+ * $Id: PaymentFrame.java,v 1.9 2001/03/23 15:06:03 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -339,7 +339,7 @@
 
         //
         //  Get the target.  Text box of KHID overrides address book list.
-        //  Default is to Cash.
+        //  Default is to Open.
         //
         AccountInfo target = (AccountInfo)target2.getSelectedItem();
         byte[] rawTgtName = target.getByteArray();
@@ -351,8 +351,8 @@
 
             target = new AccountInfo(bytes, null, null);
         }
-        else if (target.isCash())             // what does target return ?
-            tgtName = AccountId.CASH_STRING;
+        else if (target.isOpen())             // what does target return ?
+            tgtName = AccountId.open();
         else
             tgtName = target.getName() + " (" + Hex.data2hex(rawTgtName) + ")";
 
@@ -362,7 +362,7 @@
         Date validTill = new Date(System.currentTimeMillis() + future);
 
         AccountId tgt = new AccountId();
-        if (target != null)               // target probably CASH
+        if (target != null)               // target probably OPEN
             tgt.setByteArray(rawTgtName);
          
 
@@ -490,7 +490,7 @@
 
         else if (DIRECT_TFR.equals(command))
         {
-            if (target == null || target.isCash())
+            if (target == null || target.isOpen())
             {
                 String e = "You have to specify a target";
                 pm.getUInterface(this).errorMessage(e);



1.5       +4 -4      java/webfunds/sox/AbstractPayment.java

Index: AbstractPayment.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/AbstractPayment.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractPayment.java	2001/03/23 01:19:57	1.4
+++ AbstractPayment.java	2001/03/23 15:06:03	1.5
@@ -1,5 +1,5 @@
 /*
- * $Id: AbstractPayment.java,v 1.4 2001/03/23 01:19:57 iang Exp $
+ * $Id: AbstractPayment.java,v 1.5 2001/03/23 15:06:03 iang Exp $
  *
  * Copyright (c) Systemics Inc 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -64,14 +64,14 @@
      *  Get the account from which the transaction is drawn,
      *  should be overridden for sourced payments.
      */
-    public AccountId getSource() { return AccountId.CASH; }
+    public AccountId getSource() { return AccountId.OPEN; }
      
     /**
      *  Get the account to which the payment is made,
      *  should be overridden for targetted payments.
      */
-    public AccountId getTarget() { return AccountId.CASH; }
-    public boolean   isCash()    { return true; }
+    public AccountId getTarget() { return AccountId.OPEN; }
+    public boolean   isOpen()    { return true; }
 
     /**
      *  The identifer for this payment.  This is used locally for



1.24      +20 -12    java/webfunds/sox/AccountId.java

Index: AccountId.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/AccountId.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- AccountId.java	2001/03/23 01:19:57	1.23
+++ AccountId.java	2001/03/23 15:06:03	1.24
@@ -1,4 +1,4 @@
-/* $Id: AccountId.java,v 1.23 2001/03/23 01:19:57 iang Exp $
+/* $Id: AccountId.java,v 1.24 2001/03/23 15:06:03 iang Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -14,7 +14,7 @@
  * This class represents an Account identifier,
  * which is the standard way of referring to an account.
  *
- * @version $Revision: 1.23 $
+ * @version $Revision: 1.24 $
  */
 public class AccountId extends Id
 {
@@ -38,18 +38,15 @@
         id = Crypto.fingerprint(pk);
     }
 
-    public boolean isCash()
+    public boolean isOpen()
     {
         // Encodeable currently transfers null to byte[0] ...
 
         return this.id == null || this.id.length == 0;
     }
 
-    public boolean isBearer()                       { return isCash(); }
+    public static final AccountId OPEN = new AccountId();   // empty is open
 
-    public static final AccountId BEARER = new AccountId(); // empty is bearer
-    public static final AccountId CASH = new AccountId();   // empty is open
-
     public boolean equals(Object object)
     {
         if(!(object instanceof AccountId))
@@ -62,20 +59,31 @@
 
 ////// Self-Test //////////////////////////////////
 
-    public static String CASH_STRING = "<CASH>";
+    private static String open = null;
+    /**
+     *  @return the string to display if the account is not set.
+     */
+    public static String open()
+    {
+        // if a different string is desired, like CASH, set this
+        // at the start of the program.
+        if (open == null)
+            open =  "<OPEN>";
+        return open;
+    }
 
     public String toString()
     {
-        if (isCash())
-            return CASH_STRING;
+        if (isOpen())
+            return open();
 
         return super.toString();
     }
 
     public String fp()
     {
-        if (isCash())
-            return CASH_STRING;
+        if (isOpen())
+            return open();
 
         return super.fp();
     }



1.11      +4 -4      java/webfunds/sox/Id.java

Index: Id.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Id.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Id.java	2001/03/17 20:18:15	1.10
+++ Id.java	2001/03/23 15:06:03	1.11
@@ -1,5 +1,5 @@
 /*
- * $Id: Id.java,v 1.10 2001/03/17 20:18:15 iang Exp $
+ * $Id: Id.java,v 1.11 2001/03/23 15:06:03 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -14,7 +14,7 @@
  * an object by means of a hash or similar.
  * This is a pseudo abstract class for other identifier classes.
  *
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
  */
 public /*abstract*/ class Id extends Encodable
     // should be abstract but this makes the test harder
@@ -76,7 +76,7 @@
     
     /**
      *  Assumes length of the hash array will determine.
-     *  @return the OpenPGP hash id for this hash, else 0 for bearer,
+     *  @return the OpenPGP hash id for this hash, else 0 for empty,
      *  else -1 for unknown hash array?
      */
     public int getOpenPGPId()
@@ -84,7 +84,7 @@
         if (openPGPId >= 0)        // user of this should save it
            return openPGPId;
 
-        if (this instanceof AccountId && ((AccountId)this).isBearer())
+        if (this instanceof AccountId && ((AccountId)this).isOpen())
             return MD_SHA1;        // how they are done at the moment
 
         if (id == null || id.length == 0)



1.29      +5 -5      java/webfunds/sox/Payment.java

Index: Payment.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Payment.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- Payment.java	2001/03/23 01:19:57	1.28
+++ Payment.java	2001/03/23 15:06:03	1.29
@@ -1,5 +1,5 @@
 /*
- * $Id: Payment.java,v 1.28 2001/03/23 01:19:57 iang Exp $
+ * $Id: Payment.java,v 1.29 2001/03/23 15:06:03 iang Exp $
  *
  * Copyright (c) Systemics Inc 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -114,9 +114,9 @@
     public AccountId getTarget() { return target; }
 
     /**
-     * @return true if the payment is made out to CASH
+     * @return true if the payment is open (not made out to a given target)
      */
-    public boolean isCash() { return target.isCash(); }
+    public boolean isOpen() { return target.isOpen(); }
 
     /**
      * Get the date from which the payment is valid
@@ -392,8 +392,8 @@
                 return false;
         }
         ot = other.getTarget();
-        if (ot.isBearer()) {
-            if (!target.isBearer())
+        if (ot.isOpen()) {
+            if (!target.isOpen())
                 return false ;
         } else {
             if (!ot.equals(target))



1.43      +2 -2      java/webfunds/sox/Receipt.java

Index: Receipt.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Receipt.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- Receipt.java	2000/11/30 13:42:00	1.42
+++ Receipt.java	2001/03/23 15:06:03	1.43
@@ -1,5 +1,5 @@
 /*
- * $Id: Receipt.java,v 1.42 2000/11/30 13:42:00 iang Exp $
+ * $Id: Receipt.java,v 1.43 2001/03/23 15:06:03 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -202,7 +202,7 @@
             errors++;
         }
 
-        if (!tgt.equals(this.tgt) && !tgt.isBearer())
+        if (!tgt.equals(this.tgt) && !tgt.isOpen())
         {
             logmsg("mismatch Target: "+tgt+" != "+this.tgt);
             errors++;



1.12      +2 -2      java/webfunds/sox/RegisterReply.java

Index: RegisterReply.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/RegisterReply.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- RegisterReply.java	2000/09/24 23:32:04	1.11
+++ RegisterReply.java	2001/03/23 15:06:04	1.12
@@ -1,5 +1,5 @@
 /*
- * $Id: RegisterReply.java,v 1.11 2000/09/24 23:32:04 iang Exp $
+ * $Id: RegisterReply.java,v 1.12 2001/03/23 15:06:04 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -37,7 +37,7 @@
     public RegisterReply(RegisterRequest request, int errNum)
     {
         super(request, errNum);
-        accId = new AccountId();    // is null, BEARER, but can encode
+        accId = new AccountId();    // is null, but can encode
     }
   
     public RegisterReply(RegisterRequest request, byte[] data)



1.4       +5 -5      java/webfunds/sox/TokenPayment.java

Index: TokenPayment.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/TokenPayment.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TokenPayment.java	2000/11/30 13:43:42	1.3
+++ TokenPayment.java	2001/03/23 15:06:04	1.4
@@ -1,5 +1,5 @@
 /*
- * $Id: TokenPayment.java,v 1.3 2000/11/30 13:43:42 iang Exp $
+ * $Id: TokenPayment.java,v 1.4 2001/03/23 15:06:04 iang Exp $
  *
  * Copyright (c) Systemics Inc 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -60,10 +60,10 @@
     public void      setSource(AccountId id) { source = id; }
 
     /*
-     *  The account to which the payment is made out is always BEARER,
+     *  The account to which the payment is made out is always OPEN,
      *  so AbstractPayment covers that fine.
-    public AccountId getTarget() { return AccountId.BEARER; }
-    public boolean isBearer() { return true; }
+    public AccountId getTarget() { return AccountId.OPEN; }
+    public boolean isOpen()      { return true; }
      */
 
     /**
@@ -274,7 +274,7 @@
 
         s += "  " + tokens.length + " tokens";
 
-        if (!source.isBearer())
+        if (!source.isOpen())
             s += "\n   from: " + source.fp();
 
         return s;