[Webfunds-commits] java/webfunds/sox Account.java SubAccount.java

Ian Grigg iang@cypherpunks.ai
Fri, 13 Apr 2001 22:55:36 -0400 (AST)


iang        01/04/13 22:55:36

  Modified:    webfunds/sox Account.java SubAccount.java
  Log:
  fixed up getServer linkage

Revision  Changes    Path
1.75      +14 -2     java/webfunds/sox/Account.java

Index: Account.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Account.java,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- Account.java	2001/04/11 19:14:24	1.74
+++ Account.java	2001/04/14 02:55:35	1.75
@@ -1,4 +1,4 @@
-/* $Id: Account.java,v 1.74 2001/04/11 19:14:24 iang Exp $
+/* $Id: Account.java,v 1.75 2001/04/14 02:55:35 iang Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * The WebFunds Development Team. All rights reserved.
@@ -19,6 +19,7 @@
 import java.util.Vector;
 
 import webfunds.util.Armoury;
+import webfunds.util.Panic;
 
 
 /**
@@ -27,7 +28,7 @@
  * information, except perhaps for holding a key passphrase,
  * which is not stored in the Store (only in a runtime object).
  *
- * @version $Revision: 1.74 $
+ * @version $Revision: 1.75 $
  * @author  Jeroen C. van Gelderen (gelderen@webfunds.org)
  * @author  Unknown
  */
@@ -137,6 +138,17 @@
         if (finder == null)      // is this an error?  maybe not
             throw new SOXLaterException("No finder set in account " + getId());
         return finder.getIssuer(id) ;
+    }
+
+    public Server getServer(ItemId id)
+        throws SOXServerException, SOXLaterException
+    {
+        if (finder == null)      // is this an error?  maybe not
+            throw new SOXLaterException("No finder set in account " + getId());
+        if (finder instanceof ServerFinder)
+            return ((ServerFinder)finder).getServer(id) ;
+
+        throw new Panic("call to getServer() but only IssuerFinder avail");
     }
 
 



1.34      +23 -7     java/webfunds/sox/SubAccount.java

Index: SubAccount.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SubAccount.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- SubAccount.java	2001/04/13 16:31:04	1.33
+++ SubAccount.java	2001/04/14 02:55:35	1.34
@@ -1,4 +1,4 @@
-/* $Id: SubAccount.java,v 1.33 2001/04/13 16:31:04 iang Exp $
+/* $Id: SubAccount.java,v 1.34 2001/04/14 02:55:35 iang Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * The WebFunds Development Team.  All Rights Reserved.
@@ -13,6 +13,7 @@
 import java.security.PublicKey;
 
 import webfunds.comms.NetWatcher; 
+import webfunds.util.Panic;
 
 /**
  * SubAccount handles an Item for an account,
@@ -113,19 +114,35 @@
     /**
      * @return an server for use with this subaccount.
      * @except SOXSubAccountException if the account cannot find an server.
+     * @deprecated XXX: old name
      */
     public Issuer   getIssuer()
         throws SOXSubAccountException, SOXLaterException
     {
+        return getServer() ;
+    }
+
+    /**
+     * @return an server for use with this subaccount.
+     * @except SOXSubAccountException if the account cannot find an server.
+     */
+    public Server   getServer()
+        throws SOXSubAccountException, SOXLaterException
+    {
         if (acct == null)
             throw new SOXSubAccountException("no acct, not ready for ops") ;
         checkNet();
         if (server != null)
-            return server ;
+        {
+            if (server instanceof Server)
+                return (Server)server ;
+            else
+                throw new Panic("call for getServer() has only Issuer avail");
+        }
 
         try {
-            server = acct.getIssuer(itemId);
-        } catch (SOXIssuerException ex) {
+            server = acct.getServer(itemId);
+        } catch (SOXServerException ex) {
             if (ex.isNoContract())
                 throw new SOXSubAccountException(
                       SOXSubAccountException.NO_CONTRACT, ex.toString());
@@ -139,12 +156,11 @@
             throw new SOXSubAccountException(SOXSubAccountException.NO_SERVER,
                       "no SOX server available for " + itemId);
 
-        return server ;
+        return (Server)server ;
     }
 
     /**
-     * @return an server for use with this subaccount.
-     * @except SOXSubAccountException if the account cannot find an server.
+     * @deprecated XXX: old feature
      */
     public void   setIssuer(Issuer server)
     {