[Webfunds-commits] java/webfunds/ricardian DirContractStore.java

Ian Grigg iang@cypherpunks.ai
Fri, 6 Apr 2001 18:32:49 -0400 (AST)


iang        01/04/06 18:32:49

  Modified:    webfunds/ricardian DirContractStore.java
  Log:
  now uses Panic, also added method to add known Providers.

Revision  Changes    Path
1.20      +21 -3     java/webfunds/ricardian/DirContractStore.java

Index: DirContractStore.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/DirContractStore.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- DirContractStore.java	2001/02/27 01:28:27	1.19
+++ DirContractStore.java	2001/04/06 22:32:49	1.20
@@ -1,5 +1,5 @@
 /*
- * $Id: DirContractStore.java,v 1.19 2001/02/27 01:28:27 iang Exp $
+ * $Id: DirContractStore.java,v 1.20 2001/04/06 22:32:49 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -15,9 +15,16 @@
 import java.util.Enumeration;
 
 import java.net.URL;
+
+import webfunds.util.Panic;
+
 import webfunds.sox.*;
 import webfunds.utils.Debug;
 
+import java.security.Security;
+import webfunds.openpgp.provider.CryptixOpenPGP;
+
+
 
 /**
  * Read in a directory of contracts and provide access to them.
@@ -67,10 +74,11 @@
      */
     public DirContractStore()
     {
+        addProviders();
         try {
             setDirectory(new File("."));
         } catch (ContractDirectoryException ex) {
-            throw new RuntimeException("CDE: " + ex);
+            throw new Panic("CDE: " + ex);
         }
     }
 
@@ -81,6 +89,7 @@
     public DirContractStore(File storedir)
         throws ContractDirectoryException
     {
+        addProviders();
         setDirectory(storedir);
     }
 
@@ -93,9 +102,19 @@
         throws ContractDirectoryException
     {
         debug(bug, "     Cons; ");
+        addProviders();
         setDirectory(storedir);
     }
 
+    private void addProviders()
+    {
+        logmsg("adding provider for OpenPGP");
+        Security.addProvider(new CryptixOpenPGP());
+        logmsg("adding provider for X.509");
+        Security.addProvider(new webfunds.x509.provider.WebFundsX509());
+    }
+
+
 
 
 /////// Initialisation From Directories  //////////////////////////////
@@ -495,7 +514,6 @@
     public Contract getUniqueContract(String name)
         throws ContractException
     {
-logmsg("allNames " + allNames + " name " + name);
         Hashtable nameHash = (Hashtable) allNames.get(name);
         if (nameHash == null)
             throw new ContractException("no contract of this name: " + name);