Author: batosai
Date: 2008-08-11 01:19:23 +0000 (Mon, 11 Aug 2008)
New Revision: 21730

Modified:
   trunk/apps/WoT/src/plugins/WoT/IdentityParser.java
Log:
Finished the parsing of identity.xml file.

Modified: trunk/apps/WoT/src/plugins/WoT/IdentityParser.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/IdentityParser.java  2008-08-11 01:06:17 UTC 
(rev 21729)
+++ trunk/apps/WoT/src/plugins/WoT/IdentityParser.java  2008-08-11 01:19:23 UTC 
(rev 21730)
@@ -7,6 +7,7 @@
 package plugins.WoT;

 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.util.Date;

 import javax.xml.parsers.ParserConfigurationException;
@@ -70,6 +71,21 @@
                        if (elt_name.equals("prop")) {
                                identity.setProp(attrs.getValue("key"), 
attrs.getValue("value"), db);
                        }
+                       else if (elt_name.equals("prop")) {
+                               try {
+                                       Identity trustee = 
wot.getIdentityByURI(new FreenetURI(attrs.getValue("uri")));
+                                       if (trustee == null) {
+                                               trustee = new Identity(new 
FreenetURI(attrs.getValue("uri")), new Date(0));
+                                               db.store(trustee);
+                                       }
+                                       int value = 
Integer.parseInt(attrs.getValue("value"));
+                                       String comment = 
attrs.getValue("comment");
+       
+                                       wot.setTrust(new Trust(identity, 
trustee, value, comment));                                     
+                               } catch (MalformedURLException e) {
+                                       
System.out.println(e.getLocalizedMessage());
+                               }
+                       }
                }
        }
 }


Reply via email to