Author: batosai
Date: 2008-09-01 20:00:24 +0000 (Mon, 01 Sep 2008)
New Revision: 22314

Added:
   trunk/apps/WoT/src/plugins/WoT/DuplicateIdentityException.java
Modified:
   trunk/apps/WoT/src/plugins/WoT/Identity.java
   trunk/apps/WoT/src/plugins/WoT/IdentityInserter.java
   trunk/apps/WoT/src/plugins/WoT/IdentityParser.java
   trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
   trunk/apps/WoT/src/plugins/WoT/WebInterface.java
   trunk/apps/WoT/src/plugins/WoT/WoT.java
   trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
   trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java
Log:
Refactor.

Added: trunk/apps/WoT/src/plugins/WoT/DuplicateIdentityException.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/DuplicateIdentityException.java              
                (rev 0)
+++ trunk/apps/WoT/src/plugins/WoT/DuplicateIdentityException.java      
2008-09-01 20:00:24 UTC (rev 22314)
@@ -0,0 +1,19 @@
+/**
+ * This code is part of WoT, a plugin for Freenet. It is distributed 
+ * under the GNU General Public License, version 2 (or at your option
+ * any later version). See http://www.gnu.org/ for details of the GPL.
+ */
+package plugins.WoT;
+
+/**
+ * @author Julien Cornuwel (batosai at freenetproject.org)
+ *
+ */
+public class DuplicateIdentityException extends Exception {
+       
+       private static final long serialVersionUID = -1;
+
+       public DuplicateIdentityException(String message) {
+               super(message);
+       }
+}

Modified: trunk/apps/WoT/src/plugins/WoT/Identity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/Identity.java        2008-09-01 19:51:37 UTC 
(rev 22313)
+++ trunk/apps/WoT/src/plugins/WoT/Identity.java        2008-09-01 20:00:24 UTC 
(rev 22314)
@@ -13,6 +13,7 @@

 import com.db4o.ObjectContainer;
 import com.db4o.ObjectSet;
+import com.db4o.query.Query;

 import freenet.keys.FreenetURI;

@@ -50,6 +51,23 @@
                contexts = new ArrayList<String>();
        }

+       @SuppressWarnings("unchecked")
+       public static Identity getByURI (ObjectContainer db, FreenetURI uri) 
throws UnknownIdentityException, DuplicateIdentityException {
+               
+               Query query = db.query();
+               query.constrain(Identity.class);
+               
query.descend("requestURI").constrain(uri.toString().substring(uri.toString().indexOf("@")
 + 1, uri.toString().indexOf("/")));
+               ObjectSet<Identity> result = query.execute();
+               
+               if(result.size() == 0) throw new UnknownIdentityException("No 
identity has this request URI ("+uri.toString()+")");
+               if(result.size() > 1) throw new 
DuplicateIdentityException("There are two Identities matching this URI : " + 
uri.toString());
+               return result.next();
+       }
+       
+       public static Identity getByURI (ObjectContainer db, String uri) throws 
UnknownIdentityException, DuplicateIdentityException, MalformedURLException {
+               return getByURI(db, new FreenetURI(uri));
+       }
+       
        /**
         * Finds the score of an identity in the database.
         * @param treeOwner

Modified: trunk/apps/WoT/src/plugins/WoT/IdentityInserter.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/IdentityInserter.java        2008-09-01 
19:51:37 UTC (rev 22313)
+++ trunk/apps/WoT/src/plugins/WoT/IdentityInserter.java        2008-09-01 
20:00:24 UTC (rev 22314)
@@ -140,7 +140,7 @@

                OwnIdentity identity;
                try {
-                       identity = 
wot.getOwnIdentityByURI(state.getURI().toString());
+                       identity = OwnIdentity.getByURI(db, state.getURI());
                } catch (Exception e) {
                        Logger.error(this, "Identity insert failed", e);
                        return;

Modified: trunk/apps/WoT/src/plugins/WoT/IdentityParser.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/IdentityParser.java  2008-09-01 19:51:37 UTC 
(rev 22313)
+++ trunk/apps/WoT/src/plugins/WoT/IdentityParser.java  2008-09-01 20:00:24 UTC 
(rev 22314)
@@ -46,9 +46,9 @@
                saxParser = SAXParserFactory.newInstance().newSAXParser();
        }

-       public void parse (InputStream is, FreenetURI uri) throws 
InvalidParameterException, SAXException, IOException, UnknownIdentityException {
+       public void parse (InputStream is, FreenetURI uri) throws 
InvalidParameterException, SAXException, IOException, UnknownIdentityException, 
DuplicateIdentityException {

-               identity = wot.getIdentityByURI(uri.toString());
+               identity = Identity.getByURI(db,uri);
                if(!(identity instanceof OwnIdentity)) 
identity.setLastChange(new Date());
                identity.setEdition(uri.getSuggestedEdition());

@@ -87,7 +87,7 @@

                                        Identity trustee;
                                        try{
-                                               trustee = 
wot.getIdentityByURI(attrs.getValue("uri")) ;
+                                               trustee = Identity.getByURI(db, 
attrs.getValue("uri"));
                                        }
                                        catch (UnknownIdentityException e) {
                                                trustee = new 
Identity(attrs.getValue("uri"), new Date(0), "Not found yet...", "false"); 

Modified: trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java     2008-09-01 19:51:37 UTC 
(rev 22313)
+++ trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java     2008-09-01 20:00:24 UTC 
(rev 22314)
@@ -33,8 +33,10 @@
 import org.w3c.dom.Element;

 import com.db4o.ObjectContainer;
+import com.db4o.ObjectSet;
 import com.db4o.ext.DatabaseClosedException;
 import com.db4o.ext.Db4oIOException;
+import com.db4o.query.Query;

 import freenet.keys.FreenetURI;

@@ -58,6 +60,24 @@
                setLastInsert(lastInsert);              
        }

+       @SuppressWarnings("unchecked")
+       public static OwnIdentity getByURI (ObjectContainer db, FreenetURI uri) 
throws UnknownIdentityException, DuplicateIdentityException {
+               
+               Query query = db.query();
+               query.constrain(OwnIdentity.class);
+               
query.descend("requestURI").constrain(uri.toString().substring(uri.toString().indexOf("@")
 + 1, uri.toString().indexOf("/")));
+               ObjectSet<OwnIdentity> result = query.execute();
+               
+               if(result.size() == 0) throw new UnknownIdentityException("No 
identity has this request URI ("+uri.toString()+")");
+               if(result.size() > 1) throw new 
DuplicateIdentityException("There are two Identities matching this URI : " + 
uri.toString());
+               return result.next();
+       }
+       
+       public static OwnIdentity getByURI (ObjectContainer db, String uri) 
throws UnknownIdentityException, DuplicateIdentityException, 
MalformedURLException {
+               return getByURI(db, new FreenetURI(uri));
+       }
+
+               
        /**
         * Generates a XML file describing the identity
         * 

Modified: trunk/apps/WoT/src/plugins/WoT/WebInterface.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WebInterface.java    2008-09-01 19:51:37 UTC 
(rev 22313)
+++ trunk/apps/WoT/src/plugins/WoT/WebInterface.java    2008-09-01 20:00:24 UTC 
(rev 22314)
@@ -150,7 +150,7 @@

        public String makeKnownIdentitiesPage(String owner) throws 
Db4oIOException, DatabaseClosedException, InvalidParameterException, 
NotInTrustTreeException, DuplicateScoreException {

-               Identity treeOwner = null;
+               OwnIdentity treeOwner = null;

                HTMLNode pageNode = getPageNode();
                HTMLNode contentNode = pm.getContentNode(pageNode);
@@ -186,7 +186,7 @@
                        }
                        else {
                                try {
-                                       treeOwner = wot.getIdentityByURI(owner);
+                                       treeOwner = OwnIdentity.getByURI(db, 
owner);
                                } catch (Exception e) {
                                        return e.getMessage();
                                } 
@@ -326,9 +326,9 @@
                return pageNode.generate();
        }

-       public String makeEditIdentityPage(String requestURI) throws 
MalformedURLException, InvalidParameterException, UnknownIdentityException {
+       public String makeEditIdentityPage(String requestURI) throws 
MalformedURLException, InvalidParameterException, UnknownIdentityException, 
DuplicateIdentityException {

-               OwnIdentity id = wot.getOwnIdentityByURI(requestURI);
+               OwnIdentity id = OwnIdentity.getByURI(db, requestURI);

                HTMLNode pageNode = getPageNode();
                HTMLNode contentNode = pm.getContentNode(pageNode);

Modified: trunk/apps/WoT/src/plugins/WoT/WoT.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoT.java     2008-09-01 19:51:37 UTC (rev 
22313)
+++ trunk/apps/WoT/src/plugins/WoT/WoT.java     2008-09-01 20:00:24 UTC (rev 
22314)
@@ -13,7 +13,6 @@
 import com.db4o.ext.Db4oIOException;
 import com.db4o.query.Query;

-import freenet.keys.FreenetURI;
 import freenet.support.Logger;

 /**
@@ -229,42 +228,12 @@
        public ObjectSet<Identity> getAllIdentities() {
                return db.queryByExample(Identity.class);
        }
-       
-       public OwnIdentity getOwnIdentityByURI(String uri) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {

-               Identity identity = getIdentityByURI(uri);
-               if(!(identity instanceof OwnIdentity)) throw new 
InvalidParameterException("It's not an OwnIdentity");
-               return (OwnIdentity) identity;
-       }
-       
-       public Identity getIdentityByURI(String uri) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
-               
-               FreenetURI key = new FreenetURI(uri);
-               if(!key.getKeyType().equals("USK")) throw new 
InvalidParameterException("Not an USK");
-               
-               return getIdentityByURI(key);
-       }
-       
        @SuppressWarnings("unchecked")
-       private Identity getIdentityByURI(FreenetURI uri) throws 
InvalidParameterException, UnknownIdentityException {
+       public ObjectSet<Score> getIdentitiesByScore (String owner, String 
select) throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException, DuplicateIdentityException {

-               Query query = db.query();
-               query.constrain(Identity.class);
-               
query.descend("requestURI").constrain(uri.toString().substring(uri.toString().indexOf("@")
 + 1, uri.toString().indexOf("/")));
+               OwnIdentity treeOwner = OwnIdentity.getByURI(db, owner);

-               // This is generating warnings about unchecked conversion.
-               // Google is not my friend on this one, if you have an idea...
-               ObjectSet<Identity> result = query.execute();
-               
-               if(result.size() == 0) throw new UnknownIdentityException("No 
identity has this request URI ("+uri.toString()+")");
-               return result.next();
-       }
-       
-       @SuppressWarnings("unchecked")
-       public ObjectSet<Score> getIdentitiesByScore (String reference, String 
select) throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException {
-               
-               OwnIdentity treeOwner = getOwnIdentityByURI(reference);
-               
                Query query = db.query();
                query.constrain(Score.class);
                query.descend("treeOwner").constrain(treeOwner);
@@ -284,16 +253,16 @@
                return query.execute();
        }

-       public ObjectSet<Trust> getTrusters (String identity) throws 
Db4oIOException, DatabaseClosedException, MalformedURLException, 
InvalidParameterException, UnknownIdentityException {
-               return getTrusters(getIdentityByURI(identity));
+       public ObjectSet<Trust> getTrusters (String identity) throws 
Db4oIOException, DatabaseClosedException, MalformedURLException, 
InvalidParameterException, UnknownIdentityException, DuplicateIdentityException 
{
+               return getTrusters(Identity.getByURI(db, identity));
        }

        private ObjectSet<Trust> getTrusters (Identity identity) throws 
Db4oIOException, DatabaseClosedException, InvalidParameterException {
                return db.queryByExample(new Trust(null, identity, 0));
        }

-       public ObjectSet<Trust> getTrustees (String identity) throws 
Db4oIOException, DatabaseClosedException, MalformedURLException, 
InvalidParameterException, UnknownIdentityException { 
-               return getTrustees(getIdentityByURI(identity));
+       public ObjectSet<Trust> getTrustees (String identity) throws 
Db4oIOException, DatabaseClosedException, MalformedURLException, 
InvalidParameterException, UnknownIdentityException, DuplicateIdentityException 
{ 
+               return getTrustees(Identity.getByURI(db, identity));
        }

        private ObjectSet<Trust> getTrustees (Identity identity) throws 
Db4oIOException, DatabaseClosedException, InvalidParameterException { 

Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java       2008-09-01 19:51:37 UTC 
(rev 22313)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java       2008-09-01 20:00:24 UTC 
(rev 22314)
@@ -56,6 +56,7 @@
        private IdentityFetcher fetcher;
        private String seedURI = "USK at 
MF2Vc6FRgeFMZJ0s2l9hOop87EYWAydUZakJzL0OfV8,fQeN-RMQZsUrDha2LCJWOMFk1-EiXZxfTnBT8NEgY00,AQACAAE/WoT/0";
        private Identity seed;
+       private Config config;

        public static String SELF_URI = "/plugins/plugins.WoT.WoTplugin";

@@ -70,9 +71,20 @@
                client = pr.getHLSimpleClient();
                web = new WebInterface(pr, db, client, SELF_URI, wot);

+               ObjectSet<Config> result = db.queryByExample(Config.class);
+               if(result.size() == 0) {
+                       Logger.debug(this, "Created new config");
+                       config = new Config(db);
+                       db.store(config);
+               }
+               else {
+                       Logger.debug(this, "Loaded config");
+                       config = result.next();
+               }
+               
                // Create the seed Identity if it doesn't exist
                try {
-                       seed = wot.getIdentityByURI(seedURI);
+                       seed = Identity.getByURI(db, seedURI);
                } catch (UnknownIdentityException e) {
                        try {
                                seed = new Identity(seedURI, new Date(0), 
"Fetching seed identity...", "true");
@@ -180,12 +192,12 @@
                }
        }

-       private void restoreIdentity(String requestURI, String insertURI) 
throws InvalidParameterException, MalformedURLException, Db4oIOException, 
DatabaseClosedException, DuplicateScoreException {
+       private void restoreIdentity(String requestURI, String insertURI) 
throws InvalidParameterException, MalformedURLException, Db4oIOException, 
DatabaseClosedException, DuplicateScoreException, DuplicateIdentityException {

                OwnIdentity id;

                try {
-                       Identity old = wot.getIdentityByURI(requestURI);
+                       Identity old = Identity.getByURI(db, requestURI);

                        // We already have fetched this identity as a 
stranger's one. We need to update the database.
                        id = new OwnIdentity(insertURI, requestURI, 
old.getLastChange(), new Date(), old.getNickName(), old.doesPublishTrustList() 
? "true" : "false");
@@ -247,7 +259,7 @@
                fetcher.fetch(id);
        }

-       private void setTrust(HTTPRequest request) throws 
NumberFormatException, TransformerConfigurationException, 
FileNotFoundException, InvalidParameterException, UnknownIdentityException, 
ParserConfigurationException, TransformerException, IOException, 
InsertException, Db4oIOException, DatabaseClosedException, 
DuplicateScoreException  {
+       private void setTrust(HTTPRequest request) throws 
NumberFormatException, TransformerConfigurationException, 
FileNotFoundException, InvalidParameterException, UnknownIdentityException, 
ParserConfigurationException, TransformerException, IOException, 
InsertException, Db4oIOException, DatabaseClosedException, 
DuplicateScoreException, DuplicateIdentityException  {

                setTrust(       request.getPartAsString("truster", 1024),
                                        request.getPartAsString("trustee", 
1024),
@@ -255,10 +267,10 @@
                                        request.getPartAsString("comment", 
1024));
        }

-       private void setTrust(String truster, String trustee, String value, 
String comment) throws InvalidParameterException, UnknownIdentityException, 
NumberFormatException, TransformerConfigurationException, 
FileNotFoundException, ParserConfigurationException, TransformerException, 
IOException, InsertException, Db4oIOException, DatabaseClosedException, 
DuplicateScoreException  {
+       private void setTrust(String truster, String trustee, String value, 
String comment) throws InvalidParameterException, UnknownIdentityException, 
NumberFormatException, TransformerConfigurationException, 
FileNotFoundException, ParserConfigurationException, TransformerException, 
IOException, InsertException, Db4oIOException, DatabaseClosedException, 
DuplicateScoreException, DuplicateIdentityException  {

-               OwnIdentity trusterId = wot.getOwnIdentityByURI(truster);
-               Identity trusteeId = wot.getIdentityByURI(trustee);
+               OwnIdentity trusterId = OwnIdentity.getByURI(db, truster);
+               Identity trusteeId = Identity.getByURI(db, trustee);

                setTrust((OwnIdentity)trusterId, trusteeId, 
Integer.parseInt(value), comment);
 }      
@@ -272,14 +284,14 @@
                db.commit();    
        }

-       private void addIdentity(HTTPRequest request) throws 
MalformedURLException, InvalidParameterException, FetchException {
+       private void addIdentity(HTTPRequest request) throws 
MalformedURLException, InvalidParameterException, FetchException, 
DuplicateIdentityException {
                addIdentity(request.getPartAsString("identityURI", 
1024).trim());
        }

-       private Identity addIdentity(String requestURI) throws 
MalformedURLException, InvalidParameterException, FetchException {
+       private Identity addIdentity(String requestURI) throws 
MalformedURLException, InvalidParameterException, FetchException, 
DuplicateIdentityException {
                Identity identity;
                try {
-                       identity = wot.getIdentityByURI(requestURI);
+                       identity = Identity.getByURI(db, requestURI);
                        Logger.error(this, "Tried to manually add an identity 
we already know, ignored.");
                        throw new InvalidParameterException("We already have 
this identity");
                }
@@ -328,8 +340,8 @@
                return identity;
        }

-       private void addContext(String identity, String context) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
-               Identity id = wot.getOwnIdentityByURI(identity);
+       private void addContext(String identity, String context) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
DuplicateIdentityException {
+               Identity id = OwnIdentity.getByURI(db, identity);
                id.addContext(context, db);
                id.setLastChange(new Date());
                db.store(id);
@@ -337,8 +349,8 @@
                Logger.debug(this, "Added context '" + context + "' to identity 
'" + id.getNickName() + "'");
        }

-       private void removeContext(String identity, String context) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
-               Identity id = wot.getOwnIdentityByURI(identity);
+       private void removeContext(String identity, String context) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
DuplicateIdentityException {
+               Identity id = OwnIdentity.getByURI(db, identity);
                id.removeContext(context, db);
                id.setLastChange(new Date());
                db.store(id);
@@ -346,8 +358,8 @@
                Logger.debug(this, "Removed context '" + context + "' from 
identity '" + id.getNickName() + "'");
        }

-       private void setProperty(String identity, String property, String 
value) throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException {
-               Identity id = wot.getOwnIdentityByURI(identity);
+       private void setProperty(String identity, String property, String 
value) throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException, DuplicateIdentityException {
+               Identity id = OwnIdentity.getByURI(db, identity);
                id.setProp(property, value, db);
                id.setLastChange(new Date());
                db.store(id);
@@ -355,12 +367,12 @@
                Logger.debug(this, "Added property '" + property + "=" + value 
+ "' to identity '" + id.getNickName() + "'");
        }

-       private String getProperty(String identity, String property) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
-               return wot.getIdentityByURI(identity).getProp(property);
+       private String getProperty(String identity, String property) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
DuplicateIdentityException {
+               return Identity.getByURI(db, identity).getProp(property);
        }

-       private void removeProperty(String identity, String property) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
-               Identity id = wot.getOwnIdentityByURI(identity);
+       private void removeProperty(String identity, String property) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
DuplicateIdentityException {
+               Identity id = OwnIdentity.getByURI(db, identity);
                id.removeProp(property, db);
                id.setLastChange(new Date());
                db.store(id);
@@ -449,7 +461,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleSetTrust(SimpleFieldSet params) throws 
NumberFormatException, TransformerConfigurationException, 
FileNotFoundException, InvalidParameterException, ParserConfigurationException, 
TransformerException, IOException, InsertException, UnknownIdentityException, 
Db4oIOException, DatabaseClosedException, DuplicateScoreException  {
+       private SimpleFieldSet handleSetTrust(SimpleFieldSet params) throws 
NumberFormatException, TransformerConfigurationException, 
FileNotFoundException, InvalidParameterException, ParserConfigurationException, 
TransformerException, IOException, InsertException, UnknownIdentityException, 
Db4oIOException, DatabaseClosedException, DuplicateScoreException, 
DuplicateIdentityException  {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -461,7 +473,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleAddIdentity(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, FetchException {
+       private SimpleFieldSet handleAddIdentity(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, FetchException, 
DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -474,7 +486,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleGetIdentity(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, FetchException, 
UnknownIdentityException, DuplicateScoreException {
+       private SimpleFieldSet handleGetIdentity(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, FetchException, 
UnknownIdentityException, DuplicateScoreException, DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -482,8 +494,8 @@

                sfs.putAppend("Message", "Identity");

-               OwnIdentity treeOwner = 
wot.getOwnIdentityByURI(params.get("TreeOwner"));
-               Identity identity = 
wot.getIdentityByURI(params.get("Identity"));
+               OwnIdentity treeOwner = OwnIdentity.getByURI(db, 
params.get("TreeOwner"));
+               Identity identity = Identity.getByURI(db, 
params.get("Identity"));

                Trust trust = identity.getTrust(treeOwner, db);
                if(trust != null) sfs.putAppend("Trust", 
String.valueOf(trust.getValue()));
@@ -505,7 +517,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleGetIdentitiesByScore(SimpleFieldSet 
params) throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException {
+       private SimpleFieldSet handleGetIdentitiesByScore(SimpleFieldSet 
params) throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException, DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -523,7 +535,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleGetTrusters(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
+       private SimpleFieldSet handleGetTrusters(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
Db4oIOException, DatabaseClosedException, DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -545,7 +557,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleGetTrustees(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
+       private SimpleFieldSet handleGetTrustees(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
Db4oIOException, DatabaseClosedException, DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -567,7 +579,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleAddContext(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
+       private SimpleFieldSet handleAddContext(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -579,7 +591,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleRemoveContext(SimpleFieldSet params) 
throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException {
+       private SimpleFieldSet handleRemoveContext(SimpleFieldSet params) 
throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException, DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -591,7 +603,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleSetProperty(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
+       private SimpleFieldSet handleSetProperty(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -603,7 +615,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleGetProperty(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException {
+       private SimpleFieldSet handleGetProperty(SimpleFieldSet params) throws 
InvalidParameterException, MalformedURLException, UnknownIdentityException, 
DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);

@@ -615,7 +627,7 @@
                return sfs;
        }

-       private SimpleFieldSet handleRemoveProperty(SimpleFieldSet params) 
throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException {
+       private SimpleFieldSet handleRemoveProperty(SimpleFieldSet params) 
throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException, DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);


Modified: trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java    2008-09-01 19:51:37 UTC 
(rev 22313)
+++ trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java    2008-09-01 20:00:24 UTC 
(rev 22314)
@@ -5,13 +5,10 @@
  */
 package plugins.WoT;

-import java.net.MalformedURLException;
 import java.util.Date;

 import com.db4o.ObjectContainer;
 import com.db4o.ObjectSet;
-import com.db4o.ext.DatabaseClosedException;
-import com.db4o.ext.Db4oIOException;

 import freenet.client.HighLevelSimpleClient;
 import freenet.keys.FreenetURI;
@@ -135,7 +132,7 @@
                Identity storedA = null;
                out.append("* Try to fetch existing identity (a):");
                try {
-                       storedA = 
wot.getIdentityByURI(a.getRequestURI().toString());
+                       storedA = Identity.getByURI(db, a.getRequestURI());
                        out.append("OK\n");
                } catch (UnknownIdentityException e) {
                        out.append("NOK\n");
@@ -146,7 +143,7 @@
                Identity storedB = null;
                out.append("* Try to fetch existing identity (b):");
                try {
-                       storedB = 
wot.getIdentityByURI(b.getRequestURI().toString());
+                       storedB = Identity.getByURI(db, b.getRequestURI());
                        out.append("OK\n");
                } catch (UnknownIdentityException e) {
                        out.append("NOK\n");


Reply via email to