[Webfunds-commits] java/webfunds/sox AccountId.java Id.java ItemId.java MailId.java SubAccount.java
Ian Grigg
iang@cypherpunks.ai
Mon, 26 Feb 2001 21:28:31 -0400 (AST)
iang 01/02/26 21:28:31
Modified: webfunds/client AccountBrowserImpl.java AccountInfo.java
AccountTreeModel.java Addressbook.java
SimplePaymentFrame.java
webfunds/client/sox PendingReceipt.java SOXWallet.java
StoreAccountStore.java StoreReceiptStore.java
webfunds/client/sox/gui PaymentFrame.java
webfunds/ricardian Contract.java DirContractStore.java
webfunds/sox AccountId.java Id.java ItemId.java MailId.java
SubAccount.java
Log:
got rid of all Id.getId() calls, dropped the methods, rewrote some
calls to use more convenient methods or code.
Users need to replace
getId() with getByteArray()
setId() with setBytesArray(),
so as to remove confusion as to what an Id is within method names.
Tested a few times, could still cause problems.
Revision Changes Path
1.83 +2 -2 java/webfunds/client/AccountBrowserImpl.java
Index: AccountBrowserImpl.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/AccountBrowserImpl.java,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- AccountBrowserImpl.java 2000/11/30 17:12:27 1.82
+++ AccountBrowserImpl.java 2001/02/27 01:28:19 1.83
@@ -1,5 +1,5 @@
/*
- * $Id: AccountBrowserImpl.java,v 1.82 2000/11/30 17:12:27 iang Exp $
+ * $Id: AccountBrowserImpl.java,v 1.83 2001/02/27 01:28:19 iang Exp $
*
* Copyright (c) Systemics Inc 1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -799,7 +799,7 @@
//this is DUMB! should ask the wallet for its info display...
String msg = "Hash of the account is: " +
- webfunds.utils.Hex.data2hex(acct.getId());
+ webfunds.utils.Hex.data2hex(acct.getByteArray());
text.setText(msg);
text.setEditable(false);
text.setBackground(frame.getBackground());
1.23 +17 -9 java/webfunds/client/AccountInfo.java
Index: AccountInfo.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/AccountInfo.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- AccountInfo.java 2001/02/20 21:42:51 1.22
+++ AccountInfo.java 2001/02/27 01:28:20 1.23
@@ -1,5 +1,5 @@
/*
- * $Id: AccountInfo.java,v 1.22 2001/02/20 21:42:51 gelderen Exp $
+ * $Id: AccountInfo.java,v 1.23 2001/02/27 01:28:20 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -13,7 +13,6 @@
import webfunds.sox.AccountId;
public class AccountInfo
-// implements Externalizable
{
/**
@@ -21,8 +20,8 @@
*/
protected byte[] id;
- public byte[] getId() { return id; }
- public void setId(byte[] id)
+ public byte[] getId() { return id; } // XXX: DEPRECATED NAME
+ public void setId(byte[] id) // XXX: DEPRECATED NAME
{
// check that it is valid for hashCode, 1,2,3 bytes doesn't work
if (id != null && (0 < id.length && id.length < 4))
@@ -30,13 +29,22 @@
this.id = id;
}
+ public byte[] getByteArray() { return id; }
+ public void setByteArray(byte[] id)
+ {
+ // check that it is valid for hashCode, 1,2,3 bytes doesn't work
+ if (id != null && (0 < id.length && id.length < 4))
+ throw new RuntimeException("id too small");
+ this.id = id;
+ }
+
// This should not really be here,
// client doesn't want to know about
// SOX AccountIds.
public AccountId getAccountId()
{
AccountId ai = new AccountId();
- ai.setId(id);
+ ai.setByteArray(id);
return ai ;
}
@@ -71,7 +79,7 @@
*/
public AccountInfo()
{
- setId(null);
+ setByteArray(null);
setName(null);
setWalletInterface(null);
}
@@ -79,7 +87,7 @@
public AccountInfo(AccountId id, String name, WalletInterface wi)
{
- setId(id.getByteArray());
+ setByteArray(id.getByteArray());
setName(name);
setWalletInterface(wi);
}
@@ -90,7 +98,7 @@
*/
public AccountInfo(byte[] id, String name, WalletInterface wi)
{
- setId(id);
+ setByteArray(id);
setName(name);
setWalletInterface(wi);
}
@@ -189,7 +197,7 @@
* Check lengths of id, then contents.
*/
int me = (id == null) ? 0 : id.length;
- byte[] his = info.getId();
+ byte[] his = info.getByteArray();
int him = (his == null) ? 0 : his.length;
if (me != him)
1.23 +5 -4 java/webfunds/client/AccountTreeModel.java
Index: AccountTreeModel.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/AccountTreeModel.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- AccountTreeModel.java 2000/09/30 18:48:06 1.22
+++ AccountTreeModel.java 2001/02/27 01:28:20 1.23
@@ -1,5 +1,5 @@
/*
- * $Id: AccountTreeModel.java,v 1.22 2000/09/30 18:48:06 iang Exp $
+ * $Id: AccountTreeModel.java,v 1.23 2001/02/27 01:28:20 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -186,6 +186,7 @@
if(obj instanceof Contract)
{
Contract con = (Contract)obj;
+ ItemId itemId = con.getId();
DefaultMutableTreeNode acctnode, tn;
tn = (DefaultMutableTreeNode)treenode;
acctnode = (DefaultMutableTreeNode)tn.getParent();
@@ -193,15 +194,15 @@
WalletInterface wi = acct.getWalletInterface();
if(column == 1)
{
- long amount = wi.getValue(acct, con.getId(), false);
+ long amount = wi.getValue(acct, itemId, false);
return new AccountRendererData(con,
con.getUnitsOfAccount(amount),
0, false);
}
else
{
- long amount = wi.getValue(acct, con.getId(), false);
- long amountpend = wi.getValue(acct, con.getId(), true);
+ long amount = wi.getValue(acct, itemId, false);
+ long amountpend = wi.getValue(acct, itemId, true);
return new AccountRendererData(con,
con.getUnitsOfAccount(amount),
con.getUnitsOfAccount(amount + amountpend), true);
1.18 +20 -10 java/webfunds/client/Addressbook.java
Index: Addressbook.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/Addressbook.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Addressbook.java 2000/10/14 01:21:38 1.17
+++ Addressbook.java 2001/02/27 01:28:20 1.18
@@ -1,5 +1,5 @@
/*
- * $Id: Addressbook.java,v 1.17 2000/10/14 01:21:38 iang Exp $
+ * $Id: Addressbook.java,v 1.18 2001/02/27 01:28:20 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -14,6 +14,7 @@
import webfunds.store.StoreException;
import webfunds.utils.Hex;
+import webfunds.sox.AccountId;
public class Addressbook
implements CorePart
@@ -56,8 +57,8 @@
*/
public void updateInfo(AccountInfo info)
{
- String id = Hex.data2hex(info.getId());
- String name = (String)infoname.get(id);
+ String infoBytes = Hex.data2hex(info.getByteArray());
+ String name = (String)infoname.get(infoBytes);
info.setName(name);
}
@@ -73,17 +74,26 @@
}
/**
- * Get an/the AccountInfo that uses this id.
+ * Get an/the AccountInfo that uses this raw name (in bytes).
*/
- public AccountInfo getInfo(byte[] id)
+ public AccountInfo getInfo(byte[] rawBytes)
{
- String strid = Hex.data2hex(id);
- AccountInfo info = new AccountInfo(id, null,null);
+ String strid = Hex.data2hex(rawBytes);
+ AccountInfo info = new AccountInfo(rawBytes, null,null);
String name = (String)infoname.get(strid);
info.setName(name);
return info;
}
+ /**
+ * Get an/the AccountInfo that uses this AccountId
+ * (Using AccountIds is the more approved method.)
+ */
+ public AccountInfo getInfo(AccountId id)
+ {
+ return getInfo(id.getByteArray());
+ }
+
public AccountInfo[] getAccounts()
throws IOException
{
@@ -131,12 +141,12 @@
name = info.toString();
}
info.setName(name);
- String id = Hex.data2hex(info.getId());
- infoname.put(id, name);
+ String infoBytes = Hex.data2hex(info.getByteArray());
+ infoname.put(infoBytes, name);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
info.encode(baos);
nameinfo.put(name, baos.toByteArray());
-System.err.println("Set name " + name + " on account: " + id);
+System.err.println("Set name " + name + " on account: " + infoBytes);
}
/** not used? */
1.48 +3 -3 java/webfunds/client/SimplePaymentFrame.java
Index: SimplePaymentFrame.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/SimplePaymentFrame.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- SimplePaymentFrame.java 2001/02/22 15:39:25 1.47
+++ SimplePaymentFrame.java 2001/02/27 01:28:20 1.48
@@ -1,5 +1,5 @@
/*
- * $Id: SimplePaymentFrame.java,v 1.47 2001/02/22 15:39:25 iang Exp $
+ * $Id: SimplePaymentFrame.java,v 1.48 2001/02/27 01:28:20 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -349,7 +349,7 @@
else if (tgt.isBearer()) // what does tgt return ?
tgtName = "BEARER";
else
- tgtName = tgt.getName() + " (" + Hex.data2hex(tgt.getId()) + ")";
+ tgtName = tgt.getName() + " ("+Hex.data2hex(tgt.getByteArray())+")";
// expiry date and earliest date
Date validFrom = new Date(0);
@@ -382,7 +382,7 @@
String msg = "\nThis is a payment for " + tla + am + nam +
"\nfrom " + source.getName() +
- " (" + Hex.data2hex(source.getId()) + ")" +
+ " (" + Hex.data2hex(source.getByteArray()) + ")" +
"\nto " + tgtName +
"\n";
1.11 +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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PendingReceipt.java 2000/05/28 02:59:56 1.10
+++ PendingReceipt.java 2001/02/27 01:28:22 1.11
@@ -1,5 +1,5 @@
/*
- * $Id: PendingReceipt.java,v 1.10 2000/05/28 02:59:56 iang Exp $
+ * $Id: PendingReceipt.java,v 1.11 2001/02/27 01:28:22 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -196,8 +196,8 @@
{
Payment p = Payment.example();
Date date = new Date(p.getValidFrom());
- AccountInfo src = new AccountInfo(p.getSource().getId(), null, null);
- AccountInfo tgt = new AccountInfo(p.getTarget().getId(), null, null);
+ AccountInfo src = new AccountInfo(p.getSource(), null, null);
+ AccountInfo tgt = new AccountInfo(p.getTarget(), null, null);
PendingReceipt pr = new PendingReceipt(
p.getId(), p.getItem(),
src, tgt,
1.142 +60 -45 java/webfunds/client/sox/SOXWallet.java
Index: SOXWallet.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/SOXWallet.java,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -r1.141 -r1.142
--- SOXWallet.java 2001/02/20 21:58:27 1.141
+++ SOXWallet.java 2001/02/27 01:28:22 1.142
@@ -1,4 +1,4 @@
-/* $Id: SOXWallet.java,v 1.141 2001/02/20 21:58:27 gelderen Exp $
+/* $Id: SOXWallet.java,v 1.142 2001/02/27 01:28:22 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.141 $
+ * @version $Revision: 1.142 $
*/
public class SOXWallet
extends Debug
@@ -394,9 +394,7 @@
*/
public long getValue(AccountInfo info, ItemId contract, boolean pending)
{
- AccountId acct = new AccountId();
- acct.setId(info.getId());
- return getValue(acct, contract, pending) ;
+ return getValue(getAccountId(info), contract, pending) ;
}
public long getValue(AccountId acct, ItemId contract, boolean pending)
@@ -469,36 +467,57 @@
public AccountId getAccountId(AccountInfo info)
{
+ if (info == null)
+ return null; // whatever that means...
+
AccountId acct = new AccountId();
- acct.setId(info.getId());
+ acct.setByteArray(info.getByteArray());
return acct;
}
public AccountInfo[] getAccounts()
{
+ Account[] accounts;
+ try {
+ accounts = accountStore.getAllAccounts();
+ } catch (StoreException ex) {
+ ex.printStackTrace();
+ error("Store is bad: " + ex);
+ return new AccountInfo[0];
+ }
+
+ if (accounts == null)
+ return new AccountInfo[0];
+logmsg("Retrieved " + accounts.length + " accounts");
+
Addressbook ad = context.getAddressbook(this);
- AccountInfo[] retval = new AccountInfo[0];
- try
+ AccountInfo[] acInfos = new AccountInfo[accounts.length];
+ boolean failed = false;
+
+ for (int i = 0; i < accounts.length; i++)
{
- Account[] accounts = accountStore.getAllAccounts();
-logmsg("Retrieved " + accounts.length + " accounts");
- retval = new AccountInfo[accounts.length];
- byte[] id = null;
- AccountInfo info = null;
- for (int i = 0; i < accounts.length; i++)
+ try
{
- id = accounts[i].getId().getId();
- info = ad.getInfo(id);
+ byte[] rawName = accounts[i].getId().getByteArray();
+ AccountInfo info = ad.getInfo(rawName);
info.setWalletInterface(this);
- retval[i] = info;
+ acInfos[i] = info;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ logmsg("error on " + i + ": " + ex);
+ failed = true;
+ acInfos[i] = null;
}
}
- catch (Exception ex)
+
+ if (failed)
{
- ex.printStackTrace();
- error("IOError");
+ error("IOErrors occured");
}
- return retval;
+
+ return acInfos;
}
@@ -580,13 +599,12 @@
{
AccountId tgt = new AccountId();
if (target != null) // target might be bearer
- tgt.setId(target.getId());
+ tgt.setByteArray(target.getByteArray());
- AccountId src = new AccountId();
if (source == null)
throw new IllegalArgumentException("source == null");
- src.setId(source.getId()); // source better not be bearer
+ AccountId src = getAccountId(source); // source better not be bearer
return makePurePayment(
src, tgt,
@@ -858,8 +876,8 @@
PendingReceipt pending = new PendingReceipt(pay.getId(),
pay.getItem(),
// disappears when we get new better StateReceipts....
- new AccountInfo(src.getId(), null, null),
- new AccountInfo(pay.getTarget().getId(), null, null),
+ new AccountInfo(src, null, null),
+ new AccountInfo(pay.getTarget(), null, null),
pay.getQty(),
pay.getDesc(),
new Date());
@@ -1197,14 +1215,15 @@
return thing;
} catch (Exception ex) { }
- logmsg("failed on Armoury.decode, trying decodeByteArray");
+ logmsg("failed on Armoury.decode (" + Armoury.getErrors() +
+ "), trying decodeByteArray");
try {
thing = Armoury.decodeByteArray(SOX_MESSAGE, pay);
return thing;
} catch (Exception ex) { }
- logmsg("failed on Armoury.decodeByteArray");
+ logmsg("failed on Armoury.decodeByteArray (" + Armoury.getErrors());
return null;
}
@@ -1240,8 +1259,8 @@
AccountId ptt = pay.getTarget();
AccountId pss = pay.getSource();
- AccountInfo ps = new AccountInfo(pss.getId(), null, null);
- AccountInfo pt = new AccountInfo(ptt.getId(), null, null);
+ AccountInfo ps = new AccountInfo(pss, null, null);
+ AccountInfo pt = new AccountInfo(ptt, null, null);
String pid = pay.getId();
@@ -1277,7 +1296,7 @@
}
// this is who we are going to deposit the bearer into
ptt = ac.getId();
- pt = new AccountInfo(ptt.getId(), null, this);
+ pt = new AccountInfo(ptt, null, this);
knownAccount = true;
}
else
@@ -1458,9 +1477,8 @@
}
- byte[] srcId = pss.getId(); // already checked
AccountInfo source;
- source = context.getAddressbook(this).getInfo(srcId);
+ source = context.getAddressbook(this).getInfo(pss);
String name = source.getName();
if (name == null)
@@ -1550,8 +1568,7 @@
// throw new Panic("no target for bearer");
//
// // this is who we are going to deposit the bearer into
-// ptt = ac.getId();
-// //pt = new AccountInfo(ptt.getId(), null, this);
+// //pt = new AccountInfo(ptt, null, this);
// knownAccount = true;
// }
// else
@@ -1820,8 +1837,7 @@
//
AccountInfo source = trans.getSource();
logmsg(source.toString());
- AccountId src = new AccountId();
- src.setId(source.getId());
+ AccountId src = getAccountId(source);
Account account;
try {
@@ -2302,8 +2318,7 @@
return false ;
}
- AccountId acct = new AccountId();
- acct.setId(accountinfo.getId());
+ AccountId acct = getAccountId(accountinfo);
Account account;
try
@@ -2579,8 +2594,9 @@
* The address bits are unset.
*/
protected AccountInfo getAccountInfo(SubAccount sub)
- { AccountId id = getAccountId(sub);
- return new AccountInfo(id.getId(), null, this);
+ {
+ AccountId id = getAccountId(sub);
+ return new AccountInfo(id, null, this);
}
@@ -2827,8 +2843,7 @@
{
Receipt[] receipts;
PendingReceipt[] pendings;
- AccountId acct = new AccountId();
- acct.setId(info.getId());
+ AccountId acct = getAccountId(info);
Addressbook ab = context.getAddressbook(this);
try
@@ -2851,8 +2866,8 @@
Receipt receipt = receipts[i];
String transid = receipt.getPaymentId();
ItemId item = receipt.getItem();
- byte[] src = receipt.getSource().getId();
- byte[] tgt = receipt.getTarget().getId();
+ AccountId src = receipt.getSource();
+ AccountId tgt = receipt.getTarget();
AccountInfo source = ab.getInfo(src);
AccountInfo target = ab.getInfo(tgt);
long amount = receipt.getQty();
1.22 +5 -5 java/webfunds/client/sox/StoreAccountStore.java
Index: StoreAccountStore.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/StoreAccountStore.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- StoreAccountStore.java 2000/09/30 18:50:13 1.21
+++ StoreAccountStore.java 2001/02/27 01:28:23 1.22
@@ -1,5 +1,5 @@
/*
- * $Id: StoreAccountStore.java,v 1.21 2000/09/30 18:50:13 iang Exp $
+ * $Id: StoreAccountStore.java,v 1.22 2001/02/27 01:28:23 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -91,7 +91,7 @@
throw new StoreException("bad account: " + ex);
}
- String key = Hex.data2hex(acct.getId().getId());
+ String key = Hex.data2hex(acct.getId().getByteArray());
logmsg("Putting account: " + key);
store.put(key, baos.toByteArray());
}
@@ -102,7 +102,7 @@
if (acct == null)
throw new IllegalArgumentException("getAccount(null)");
- String key = Hex.data2hex(acct.getId().getId());
+ String key = Hex.data2hex(acct.getId().getByteArray());
store.remove(key);
if (store.checkErrors())
{
@@ -117,7 +117,7 @@
throw new IllegalArgumentException("getAccount(null)");
logmsg("get " + acct);
- String key = Hex.data2hex(acct.getId());
+ String key = Hex.data2hex(acct.getByteArray());
Object obj = store.get(key);
if (store.checkErrors())
{
@@ -164,7 +164,7 @@
// {
// logmsg("DEPRECATED get AccountInfo " + info);
// AccountId acct = new AccountId();
-// acct.setId(info.getId());
+// acct.setByteArray(info.getByteArray());
// return getAccount(acct);
// }
1.31 +11 -19 java/webfunds/client/sox/StoreReceiptStore.java
Index: StoreReceiptStore.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/StoreReceiptStore.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- StoreReceiptStore.java 2000/07/16 19:32:39 1.30
+++ StoreReceiptStore.java 2001/02/27 01:28:23 1.31
@@ -1,5 +1,5 @@
/*
- * $Id: StoreReceiptStore.java,v 1.30 2000/07/16 19:32:39 iang Exp $
+ * $Id: StoreReceiptStore.java,v 1.31 2001/02/27 01:28:23 iang Exp $
*
* Copyright (c) Systemics Ltd 1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -61,10 +61,10 @@
protected Store getSub(AccountId acct, ItemId item)
throws StoreException
{
- String acctId = Hex.data2hex(acct.getId());
- String subId = Hex.data2hex(item.getId());
+ String acctName = Hex.data2hex(acct.getByteArray());
+ String subName = Hex.data2hex(item.getByteArray());
Store sub;
- sub = store.getStore(acctId).getStore(subId);
+ sub = store.getStore(acctName).getStore(subName);
return sub ;
}
@@ -106,7 +106,6 @@
ItemId item = receipt.getItem();
AccountId src = receipt.getSource();
- // AccountInfo info = new AccountInfo(src.getId(), null, null);
Store sub = getSub(src, item);
if (sub != null) // is a source receipt
@@ -131,7 +130,6 @@
if (src.equals(tgt))
return ;
- // info = new AccountInfo(tgt.getId(), null, null);
sub = getSub(tgt, item);
if (sub != null) // this is a target receipt
@@ -411,15 +409,15 @@
*/
public boolean isChanged(AccountId acct)
{
- String acctId = Hex.data2hex(acct.getId());
+ String acctName = Hex.data2hex(acct.getByteArray());
Store thisstore;
try {
- thisstore = store.getStore(acctId);
+ thisstore = store.getStore(acctName);
} catch (StoreException ex) {
return true;
}
- // Store pendstore = pendingstore.getStore(acctId);
+ // Store pendstore = pendingstore.getStore(acctName);
return ( thisstore.isChanged() ) ; //|| pendstore.isChanged() );
}
@@ -484,8 +482,6 @@
long amount = 0;
PendingReceipt pending = null;
- // AccountId id = new AccountId();
- // id.setId(acct.getId());
for (int i = 0; i < pendings.length; i++)
{
pending = pendings[i];
@@ -560,8 +556,6 @@
// }
long amount = 0;
- // AccountId id = new AccountId();
- // id.setId(acct.getId());
for (int i = 0; i < receipts.length; i++)
{
Receipt receipt = receipts[i];
@@ -611,8 +605,6 @@
throws Exception
{
bug.println(" checking: " + item + " to " + acct);
- // AccountInfo info = new AccountInfo();
- // info.setId(who.getId());
Account realAccount = as.getAccount(acct);
if (realAccount == null)
return ;
@@ -673,7 +665,7 @@
// AccountInfo bic = new AccountInfo(Hex.hex2data(biro),
// null, null);
AccountId bic = new AccountId();
- bic.setId(Hex.hex2data(biro));
+ bic.setByteArray(Hex.hex2data(biro));
//
// Each Pending was just like Accounts.
@@ -703,8 +695,8 @@
AccountId tgt = new AccountId();
AccountId src = new AccountId();
- tgt.setId(pend.target.getId());
- src.setId(pend.source.getId());
+ tgt.setByteArray(pend.target.getByteArray());
+ src.setByteArray(pend.source.getByteArray());
bug.println(" P" + src + " ==> " + tgt);
//
@@ -727,7 +719,7 @@
// AccountInfo info = new AccountInfo(Hex.hex2data(name),
// null, null);
AccountId acct = new AccountId();
- acct.setId(Hex.hex2data(name));
+ acct.setByteArray(Hex.hex2data(name));
Store saved = ac.getStore(SAVED); // shove oldies here
1.6 +6 -5 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PaymentFrame.java 2001/02/22 15:39:26 1.5
+++ PaymentFrame.java 2001/02/27 01:28:25 1.6
@@ -1,5 +1,5 @@
/*
- * $Id: PaymentFrame.java,v 1.5 2001/02/22 15:39:26 iang Exp $
+ * $Id: PaymentFrame.java,v 1.6 2001/02/27 01:28:25 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -81,7 +81,7 @@
if (source == null)
throw new IllegalArgumentException("source == null");
src = new AccountId();
- src.setId(source.getId());
+ src.setByteArray(source.getByteArray());
// might be null
contract = cs.getContract(contractid);
@@ -339,6 +339,7 @@
// Default is bearer.
//
AccountInfo target = (AccountInfo)target2.getSelectedItem();
+ byte[] rawTgtName = target.getByteArray();
String tgtName = target1.getText();
if (!"".equals(tgtName)) // text box is (also?) set, use it
@@ -349,7 +350,7 @@
else if (target.isBearer()) // what does target return ?
tgtName = "BEARER";
else
- tgtName = target.getName() + " (" + Hex.data2hex(target.getId()) + ")";
+ tgtName = target.getName() + " (" + Hex.data2hex(rawTgtName) + ")";
// expiry date and earliest date
Date validFrom = new Date(0);
@@ -358,7 +359,7 @@
AccountId tgt = new AccountId();
if (target != null) // target probably bearer
- tgt.setId(target.getId());
+ tgt.setByteArray(rawTgtName);
//
@@ -466,7 +467,7 @@
String msg = "\nThis is a " + typeString +
" payment for " + tla + am + nam +
"\nfrom " + source.getName() +
- " (" + Hex.data2hex(source.getId()) + ")" +
+ " (" + Hex.data2hex(source.getByteArray()) + ")" +
"\nto " + tgtName +
"\nCut and Paste the following lines into an email:" +
"\n";
1.49 +2 -2 java/webfunds/ricardian/Contract.java
Index: Contract.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/Contract.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- Contract.java 2000/11/09 13:19:28 1.48
+++ Contract.java 2001/02/27 01:28:26 1.49
@@ -1,4 +1,4 @@
-/* $Id: Contract.java,v 1.48 2000/11/09 13:19:28 iang Exp $
+/* $Id: Contract.java,v 1.49 2001/02/27 01:28:26 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -165,7 +165,7 @@
// how stupid. To keep it static, need to copy the errors over.
mixedModeErrors = errors;
this.id = new ItemId();
- this.id.setId(hash);
+ this.id.setByteArray(hash);
this.name = Hex.data2hex(hash);
1.19 +2 -2 java/webfunds/ricardian/DirContractStore.java
Index: DirContractStore.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/DirContractStore.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DirContractStore.java 2001/02/20 21:55:47 1.18
+++ DirContractStore.java 2001/02/27 01:28:27 1.19
@@ -1,5 +1,5 @@
/*
- * $Id: DirContractStore.java,v 1.18 2001/02/20 21:55:47 gelderen Exp $
+ * $Id: DirContractStore.java,v 1.19 2001/02/27 01:28:27 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -295,7 +295,7 @@
ItemId id = contract.getId();
contracts.put(id, contract);
- String s = webfunds.utils.Hex.data2hex(id.getId());
+ String s = webfunds.utils.Hex.data2hex(id.getByteArray());
logstart(" " + s.substring(0, 10) + " ");
//
1.21 +3 -3 java/webfunds/sox/AccountId.java
Index: AccountId.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/AccountId.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- AccountId.java 2000/11/09 13:13:50 1.20
+++ AccountId.java 2001/02/27 01:28:28 1.21
@@ -1,4 +1,4 @@
-/* $Id: AccountId.java,v 1.20 2000/11/09 13:13:50 iang Exp $
+/* $Id: AccountId.java,v 1.21 2001/02/27 01:28:28 iang Exp $
*
* Copyright (c) Systemics Inc. 1995-2000 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -14,12 +14,12 @@
* This class represents an Account identifier,
* which is the standard way of referring to an account.
*
- * @version $Revision: 1.20 $
+ * @version $Revision: 1.21 $
*/
public class AccountId extends Id
{
public AccountId() { id = null; }
- protected AccountId(Id i) { super(); setId(i.getId()); }
+ protected AccountId(Id i) { super(); setByteArray(i.getByteArray()); }
/**
* Recover from byte array (not set this byte array).
1.8 +7 -16 java/webfunds/sox/Id.java
Index: Id.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Id.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Id.java 2001/02/20 21:53:10 1.7
+++ Id.java 2001/02/27 01:28:28 1.8
@@ -1,5 +1,5 @@
/*
- * $Id: Id.java,v 1.7 2001/02/20 21:53:10 gelderen Exp $
+ * $Id: Id.java,v 1.8 2001/02/27 01:28:28 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.7 $
+ * @version $Revision: 1.8 $
*/
public /*abstract*/ class Id extends Encodable
// should be abstract but this makes the test harder
@@ -28,6 +28,7 @@
/**
* Get the underlying byte[]. You should probably not be using this but
* pass the whole Id object around instead.
+ * (This call was getId)
*/
public byte[] getByteArray() {
return id;
@@ -36,6 +37,7 @@
/**
* Set the underlying byte[].
+ * (This call was setId)
*
* XXX: Id should probably become immutable.
*/
@@ -44,17 +46,6 @@
}
- /**
- * @deprecated Misnamed, confusing name. An Id is an Id, not a byte[].
- * Use setByteArray() instead.
- */
- public void setId(byte[] id) { this.id = id; }
-
- /**
- * @deprecated Misnamed, confusing name. An Id is an Id, not a byte[].
- * Use getByteArray() instead.
- */
- public byte[] getId() { return id; }
////// Construction ///////////////////////////////////
@@ -186,11 +177,11 @@
Id id = new Id(); // avoid exception
if ((b[0] & 0xF) == 0xF)
- id.setId(null);
+ id.setByteArray(null);
else if ((b[0] & 0xF) == 0xE)
- id.setId(new byte[0]); // equivalent to null
+ id.setByteArray(new byte[0]); // equivalent to null
else
- id.setId(b);
+ id.setByteArray(b);
return id ;
}
1.14 +5 -5 java/webfunds/sox/ItemId.java
Index: ItemId.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/ItemId.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ItemId.java 1999/12/29 03:56:50 1.13
+++ ItemId.java 2001/02/27 01:28:28 1.14
@@ -1,5 +1,5 @@
/*
- * $Id: ItemId.java,v 1.13 1999/12/29 03:56:50 iang Exp $
+ * $Id: ItemId.java,v 1.14 2001/02/27 01:28:28 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -13,7 +13,7 @@
* This class represents an Item identifer,
* which is the standard way of refering to an item.
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*/
public class ItemId
extends Id
@@ -26,12 +26,12 @@
{
byte[] canonical = Armoury.prepareDataToSign(txt);
ItemId itemId = new ItemId();
- itemId.setId(Crypto.digest(canonical));
+ itemId.setByteArray(Crypto.digest(canonical));
return itemId;
}
- public ItemId() { super(); }
- protected ItemId(Id i) { super(); setId(i.getId()); }
+ public ItemId() { super(); }
+ protected ItemId(Id i) { super(); setByteArray(i.getByteArray()); }
/**
* Recover from byte array (not set this byte array).
1.9 +4 -4 java/webfunds/sox/MailId.java
Index: MailId.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/MailId.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MailId.java 2000/03/22 08:50:34 1.8
+++ MailId.java 2001/02/27 01:28:29 1.9
@@ -1,5 +1,5 @@
/*
- * $Id: MailId.java,v 1.8 2000/03/22 08:50:34 iang Exp $
+ * $Id: MailId.java,v 1.9 2001/02/27 01:28:29 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -18,7 +18,7 @@
{
public MailId() { id = null; }
- protected MailId(Id i) { super(); setId(i.getId()); }
+ protected MailId(Id i) { super(); setByteArray(i.getByteArray()); }
/**
* Recover from byte array (not set this byte array).
@@ -35,7 +35,7 @@
MailId mailId = new MailId();
// try
// {
- mailId.setId(Crypto.digest(b));
+ mailId.setByteArray(Crypto.digest(b));
// }
// catch (Exception e)
// {
@@ -52,7 +52,7 @@
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
receipt.encode(bos);
- mailId.setId(Crypto.digest(bos.toByteArray() ));
+ mailId.setByteArray(Crypto.digest(bos.toByteArray() ));
}
catch (Exception e)
{
1.30 +3 -3 java/webfunds/sox/SubAccount.java
Index: SubAccount.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SubAccount.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- SubAccount.java 2000/10/14 01:50:44 1.29
+++ SubAccount.java 2001/02/27 01:28:29 1.30
@@ -1,4 +1,4 @@
-/* $Id: SubAccount.java,v 1.29 2000/10/14 01:50:44 iang Exp $
+/* $Id: SubAccount.java,v 1.30 2001/02/27 01:28:29 iang Exp $
*
* Copyright (c) Systemics Inc. 1995-2000 on behalf of
* The WebFunds Development Team. All Rights Reserved.
@@ -535,7 +535,7 @@
{
DataOutputStream dos = new DataOutputStream(os);
dos.writeInt(2);
- writeByteArray(dos, itemId.getId());
+ writeByteArray(dos, itemId.getByteArray());
// added, but there are no live 2's out there yet.
dos.writeInt(status);
@@ -549,7 +549,7 @@
if (version == 2)
{
itemId = new ItemId();
- itemId.setId(readByteArray(dis));
+ itemId.setByteArray(readByteArray(dis));
// added, but there are no live 2's out there yet.
try {