Author: batosai
Date: 2008-08-31 11:56:40 +0000 (Sun, 31 Aug 2008)
New Revision: 22273
Modified:
trunk/apps/WoT/src/plugins/WoT/IdentityParser.java
trunk/apps/WoT/src/plugins/WoT/WoT.java
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Logging
Modified: trunk/apps/WoT/src/plugins/WoT/IdentityParser.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/IdentityParser.java 2008-08-31 11:40:48 UTC
(rev 22272)
+++ trunk/apps/WoT/src/plugins/WoT/IdentityParser.java 2008-08-31 11:56:40 UTC
(rev 22273)
@@ -52,6 +52,8 @@
if(!(identity instanceof OwnIdentity))
identity.setLastChange(new Date());
saxParser.parse(is, new IdentityHandler() );
db.store(identity);
+
+ Logger.debug(this, "Successfuly parsed identity '" +
identity.getNickName() + "'");
}
public class IdentityHandler extends DefaultHandler {
Modified: trunk/apps/WoT/src/plugins/WoT/WoT.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoT.java 2008-08-31 11:40:48 UTC (rev
22272)
+++ trunk/apps/WoT/src/plugins/WoT/WoT.java 2008-08-31 11:56:40 UTC (rev
22273)
@@ -14,6 +14,7 @@
import com.db4o.query.Query;
import freenet.keys.FreenetURI;
+import freenet.support.Logger;
/**
* The Web of Trust
@@ -55,6 +56,8 @@
boolean changedTrustValue = false;
boolean changedComment = false;
+
+ Logger.debug(this, "New trust relationship : " + newTrust);
ObjectSet<Trust> trustResult = db.queryByExample(new
Trust(newTrust.getTruster(), newTrust.getTrustee(), 0));
if(trustResult.size() != 0) { // We are updating a existing
trust relationship
@@ -75,6 +78,9 @@
}
if(changedTrustValue) { // We have to update the trust tree,
starting with the trustee
+
+ Logger.debug(this, "The trust is new or changed,
updating the trust trees.");
+
ObjectSet<OwnIdentity> ownIdentites =
db.queryByExample(OwnIdentity.class);
while(ownIdentites.hasNext()) { // Each OwnIdentity has
its trust tree, we update all
updateScore(ownIdentites.next(),
newTrust.getTrustee());
@@ -170,6 +176,8 @@
db.store(score);
// We don't commit here because this method is going to be
called *many* times while parsing a trust list.
+ Logger.debug(this, score.toString());
+
if(oldCapacity != newCapacity) { // If the capacity has
changed, we have to update all identities this one trusts
ObjectSet<Trust> trustees = getTrustees(identity);
while(trustees.hasNext()) {
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-31 11:40:48 UTC
(rev 22272)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-31 11:56:40 UTC
(rev 22273)
@@ -224,7 +224,7 @@
// Remove the old identity
db.delete(old);
- Logger.normal(this, "Successfully restored an already
known identity from Freenet (" + id.getNickName() + ")");
+ Logger.debug(this, "Successfully restored an already
known identity from Freenet (" + id.getNickName() + ")");
} catch (UnknownIdentityException e) {
id = new OwnIdentity(insertURI, requestURI, new Date(),
new Date(0), "Restore in progress...", "false");
@@ -236,7 +236,7 @@
// Store the new identity
db.store(id);
- Logger.normal(this, "Trying to restore a not-yet-known
identity from Freenet (" + id.getRequestURI() + ")");
+ Logger.debug(this, "Trying to restore a not-yet-known
identity from Freenet (" + id.getRequestURI() + ")");
}
db.commit();
@@ -262,7 +262,8 @@
private void setTrust(OwnIdentity truster, Identity trustee, int value,
String comment) throws TransformerConfigurationException,
FileNotFoundException, ParserConfigurationException, TransformerException,
IOException, InsertException, Db4oIOException, DatabaseClosedException,
InvalidParameterException {
- wot.setTrust(new Trust(truster, trustee, value, comment));
+ Trust trust = new Trust(truster, trustee, value, comment);
+ wot.setTrust(trust);
truster.setLastChange(new Date());
db.store(truster);
db.commit();
@@ -283,7 +284,7 @@
identity = new Identity(requestURI, new
Date(0), "Not found yet...", "false");
db.store(identity);
db.commit();
- Logger.normal(this, "Trying to fetch manually
added identity (" + identity.getRequestURI() + ")");
+ Logger.debug(this, "Trying to fetch manually
added identity (" + identity.getRequestURI() + ")");
fetcher.fetch(identity);
}
return identity;
@@ -317,7 +318,7 @@
// This identity trusts the seed identity
wot.setTrust(new Trust(identity, seed, 100, "I trust the WoT
plugin"));
- Logger.normal(this, "Successfully created a new OwnIdentity ("
+ identity.getNickName() + ")");
+ Logger.debug(this, "Successfully created a new OwnIdentity (" +
identity.getNickName() + ")");
db.commit();
@@ -330,7 +331,7 @@
id.setLastChange(new Date());
db.store(id);
- Logger.normal(this, "Added context '" + context + "' to
identity '" + id.getNickName() + "'");
+ Logger.debug(this, "Added context '" + context + "' to identity
'" + id.getNickName() + "'");
}
private void removeContext(String identity, String context) throws
InvalidParameterException, MalformedURLException, UnknownIdentityException {
@@ -339,7 +340,7 @@
id.setLastChange(new Date());
db.store(id);
- Logger.normal(this, "Removed context '" + context + "' from
identity '" + id.getNickName() + "'");
+ Logger.debug(this, "Removed context '" + context + "' from
identity '" + id.getNickName() + "'");
}
private void setProperty(String identity, String property, String
value) throws InvalidParameterException, MalformedURLException,
UnknownIdentityException {
@@ -348,7 +349,7 @@
id.setLastChange(new Date());
db.store(id);
- Logger.normal(this, "Added property '" + property + "=" + value
+ "' to identity '" + id.getNickName() + "'");
+ Logger.debug(this, "Added property '" + property + "=" + value
+ "' to identity '" + id.getNickName() + "'");
}
private String getProperty(String identity, String property) throws
InvalidParameterException, MalformedURLException, UnknownIdentityException {
@@ -361,7 +362,7 @@
id.setLastChange(new Date());
db.store(id);
- Logger.normal(this, "Removed property '" + property + "' from
identity '" + id.getNickName() + "'");
+ Logger.debug(this, "Removed property '" + property + "' from
identity '" + id.getNickName() + "'");
}
@Override