CVS update: sierra/src/java/org/openprivacy/sierra

From: cvs@openprivacy.org
Date: Tue Jan 16 2001 - 09:14:48 PST


Date: Tuesday January 16, 19101 @ 9:14
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

-----------------------------------

Update of /usr/local/cvsroot/sierra/src/java/org/openprivacy/sierra
In directory openprivacy.org:/tmp/cvs-serv18881/src/java/org/openprivacy/sierra

Modified Files:
        Reputation.java
Log Message:
reputation:// URI is added... but currently broken I think...

*****************************************************************
File: sierra/src/java/org/openprivacy/sierra/Reputation.java

CVSWEB Options: -------------------

CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/Reputation.java?annotate=1.9

CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/Reputation.java?rev=1.9&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/Reputation.java.diff?r1=1.9&r2=1.8

-----------------------------------

Index: sierra/src/java/org/openprivacy/sierra/Reputation.java
diff -u sierra/src/java/org/openprivacy/sierra/Reputation.java:1.8 sierra/src/java/org/openprivacy/sierra/Reputation.java:1.9
--- sierra/src/java/org/openprivacy/sierra/Reputation.java:1.8 Tue Jan 16 08:40:16 2001
+++ sierra/src/java/org/openprivacy/sierra/Reputation.java Tue Jan 16 09:14:47 2001
@@ -25,7 +25,7 @@
  * Results from a Reputation server request.
  *
  * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Reputation.java,v 1.8 2001/01/16 16:40:16 burton Exp $
+ * @version $Id: Reputation.java,v 1.9 2001/01/16 17:14:47 burton Exp $
  */
 public class Reputation {
 
@@ -34,13 +34,15 @@
     /**
        Stores all values added by the server.
      */
- private Vector opinions = new Vector();
+ private Vector values = new Vector();
 
     /**
        The User which generated this reputation.
      */
     private URIReference principal = null;
 
+ private String hash = null;
+
     public Reputation() {}
     
     public Reputation( URIReference principal, String reference ) {
@@ -83,12 +85,73 @@
     public void setPrincipal( URIReference principal ) {
         this.principal = principal;
     }
+
+
+ /**
+ * <p>
+ * Return a unique, possibly verifiable, hash for this Reputation.
+ *
+ * <p>
+ * Depending on the principal, this will compute (and cache) a Hash value
+ * for this object. in most real world situations, this will be computed
+ * from the private key of the principal. If based on a private/public key
+ * pair this must be computed before it is sent to a Reputation Server
+ * because an RS can't compute it without the private key.
+ *
+ * <p>
+ * There are numerous methods of generating a hash:
+ *
+ * <ul>
+ * <li>From a private key and validated by a public key.
+ * <li>MD5 version of the raw data. The server has no way to validate
+ * the intgrity of the message with this option.
+ * <li>If done with a Java Virtual Machine.. a hashCode(). Note that
+ * this method is not secure but should work in debug environments (where it
+ * should remain).
+ * <ul>
+ *
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: Reputation.java,v 1.9 2001/01/16 17:14:47 burton Exp $
+ */
+ public String getHash() {
+
+ //FIXME: this is a hack. I don't like it.
+
+ return Integer.toString( this.hashCode() );
+ }
+
+ /**
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: Reputation.java,v 1.9 2001/01/16 17:14:47 burton Exp $
+ */
+ public void setHash( String hash ) {
+ this.hash = hash;
+ }
+
+ /**
+ * <p>Get the URI for this Reputation. Should be something like:
+ *
+ * reputation://[SERVER]/PRINCIPAL/HASH
+ *
+ * <p>
+ * SERVER is optional.
+ *
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: Reputation.java,v 1.9 2001/01/16 17:14:47 burton Exp $
+ */
+ public URIReference getURI() {
+ //FIXME: should we use a Server??
+ return new URIReference( "reputation:///" +
+ this.getPrincipal().toString() +
+ "/" +
+ getHash() );
+ }
     
     /**
      * Get human output for this Reputation
      *
      * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Reputation.java,v 1.8 2001/01/16 16:40:16 burton Exp $
+ * @version $Id: Reputation.java,v 1.9 2001/01/16 17:14:47 burton Exp $
      */
     public String getPrettyPrint() {
 



This archive was generated by hypermail 2b30 : Mon Jan 22 2001 - 15:52:15 PST