From: cvs@openprivacy.orgCVS update: sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple
Date: Wednesday March 21, 19101 @ 21:44
Author: burton
CVSWEB Options: -------------------
Main CVSWeb: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi
View this module: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple
-----------------------------------
Update of /usr/local/cvs/public/sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple
In directory giga:/tmp/cvs-serv28845/src/java/org/openprivacy/sierra/store/talon/implementations/simple
Modified Files:
SimpleStoreEngine.java
Log Message:
step 2 works
*****************************************************************
File: sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java?annotate=1.10
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java?rev=1.10&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java.diff?r1=1.10&r2=1.9
-----------------------------------
Index: sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java
diff -u sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java:1.9 sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java:1.10
--- sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java:1.9 Wed Mar 21 12:59:38 2001
+++ sierra/src/java/org/openprivacy/sierra/store/talon/implementations/simple/SimpleStoreEngine.java Wed Mar 21 21:44:05 2001
@@ -1,7 +1,7 @@
/*
* ----
*
- * $Id: SimpleStoreEngine.java,v 1.9 2001/03/21 20:59:38 burton Exp $
+ * $Id: SimpleStoreEngine.java,v 1.10 2001/03/22 05:44:05 burton Exp $
* $Project: http://sierra.openprivacy.org $
* $CVSROOT: :pserver:anoncvs@sierra.openprivacy.org:/usr/local/cvs/public $
* $WebCVS: http://www.openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/ $
@@ -42,6 +42,7 @@
import org.openprivacy.sierra.store.talon.components.*;
import org.openprivacy.sierra.util.*;
import talon.*;
+import talon.interfaces.*;
import talon.components.*;
import talon.util.net.*;
@@ -58,10 +59,16 @@
*
* dd
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleStoreEngine.java,v 1.9 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: SimpleStoreEngine.java,v 1.10 2001/03/22 05:44:05 burton Exp $
*/
-public class SimpleStoreEngine extends BaseComponent implements Component, StoreEngine {
+public class SimpleStoreEngine extends BaseComponent implements Dumpable,
+ Component,
+ StoreEngine {
+
+ /**
+ * Stores Signature value (String) -> Reputation
+ */
private Hashtable store = new Hashtable();
public void init() throws TalonException {
@@ -74,36 +81,46 @@
/**
* @see Store
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleStoreEngine.java,v 1.9 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: SimpleStoreEngine.java,v 1.10 2001/03/22 05:44:05 burton Exp $
*/
- public Reputation get( URI url ) {
+ public Reputation get( URI uri ) throws SierraException {
//build a signature value object. and call get(SignatureValue sv)
+
+ return get( ReputationURIDecoder.decode( uri ) );
- return null; //FIXME: should use correct code
}
/**
* @see Store
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleStoreEngine.java,v 1.9 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: SimpleStoreEngine.java,v 1.10 2001/03/22 05:44:05 burton Exp $
*/
- public Reputation get( SignatureValue sv ) {
+ public Reputation get( SignatureValue sv ) throws SierraException {
+
+ Reputation reputation = (Reputation)store.get( sv.toString() );
- return (Reputation)store.get( sv );
+ //FIXME: should we throw an exception if this isn't found?
+ if ( reputation == null ) {
+ getLogger().warning( "Unable to find reputation: " + sv.toString() );
+ }
+
+
+ return reputation;
+
}
/**
* @see Store
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleStoreEngine.java,v 1.9 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: SimpleStoreEngine.java,v 1.10 2001/03/22 05:44:05 burton Exp $
*/
public void put( Reputation reputation ) throws SierraException {
SignatureValue sv = reputation.getSignatureValue();
- store.put( sv, reputation );
+ store.put( sv.toString(), reputation );
//notify the QueryManager and all necessary QueryEngines
getQueryManager().putReputation( reputation );
@@ -113,7 +130,7 @@
/**
* @see Store
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleStoreEngine.java,v 1.9 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: SimpleStoreEngine.java,v 1.10 2001/03/22 05:44:05 burton Exp $
*/
public void populate( RCE rce ) {
@@ -124,7 +141,7 @@
/**
* @see StoreEngine
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleStoreEngine.java,v 1.9 2001/03/21 20:59:38 burton Exp $
+ * @version $Id: SimpleStoreEngine.java,v 1.10 2001/03/22 05:44:05 burton Exp $
*/
public QueryManager getQueryManager() throws SierraException {
@@ -139,5 +156,29 @@
}
}
+
+ public void dump() {
+ dump( System.out );
+
+ }
+
+ public void dump( PrintStream ps ) {
+
+ ps.println( "-- dumping " + this.getTypeReference() + " -- " );
+
+ Enumeration keys = store.keys();
+
+ while ( keys.hasMoreElements() ) {
+
+ String key = (String)keys.nextElement();
+ Object value = store.get( key );
+
+ ps.println( key + " == " + value.toString() );
+
+ }
+
+
+ }
+
}
This archive was generated by hypermail 2b30 : Wed Mar 21 2001 - 21:44:37 PST