Author: batosai
Date: 2008-08-30 09:25:57 +0000 (Sat, 30 Aug 2008)
New Revision: 22242
Modified:
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Added handling of the seed identity (bug #2503)
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-30 00:19:53 UTC
(rev 22241)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-30 09:25:57 UTC
(rev 22242)
@@ -54,12 +54,14 @@
private WebInterface web;
private IdentityInserter inserter;
private IdentityFetcher fetcher;
+ private String seedURI = "SSK at
MF2Vc6FRgeFMZJ0s2l9hOop87EYWAydUZakJzL0OfV8,fQeN-RMQZsUrDha2LCJWOMFk1-EiXZxfTnBT8NEgY00,AQACAAE/";
+ private Identity seed;
public static String SELF_URI = "/plugins/plugins.WoT.WoTplugin";
public void runPlugin(PluginRespirator pr) {
- Logger.error(this, "Start");
+ Logger.debug(this, "Start");
this.pr = pr;
db = Db4o.openFile("WoT.db4o");
@@ -68,6 +70,23 @@
web = new WebInterface(pr, db, client, SELF_URI, wot);
+ try {
+ seed = wot.getIdentityByURI(seedURI);
+ } catch (UnknownIdentityException e) {
+ try {
+ seed = new Identity(seedURI, new Date(0),
"Fetching seed identity...", "true");
+ } catch (InvalidParameterException e1) {
+ Logger.error(this, "Seed identity error", e);
+ return;
+ }
+ db.store(seed);
+ db.commit();
+ } catch (Exception e) {
+ Logger.error(this, "Seed identity error", e);
+ return;
+ }
+
+
inserter = new IdentityInserter(wot, db, client);
pr.getNode().executor.execute(inserter, "WoTinserter");
@@ -233,10 +252,12 @@
identity.addContext(context, db);
db.store(identity);
- Score score = new Score(identity, identity, 100, 0, 100); // We
need to initialize the trust tree
+ // This identity has capacity on its own trust tree
+ Score score = new Score(identity, identity, 100, 0, 100);
db.store(score);
- //TODO Make the new identity trust the seed identity
+ // This identity trusts the seed identity
+ wot.setTrust(new Trust(identity, seed, 100, "Seed identity"));
db.commit();