Remove getting trust values from trust updater.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 12 Sep 2012 05:48:32 +0000 (07:48 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 12 Sep 2012 05:50:41 +0000 (07:50 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java

index 275ef9b..14e9f89 100644 (file)
@@ -53,7 +53,6 @@ import net.pterodactylus.sone.freenet.wot.Identity;
 import net.pterodactylus.sone.freenet.wot.IdentityListener;
 import net.pterodactylus.sone.freenet.wot.IdentityManager;
 import net.pterodactylus.sone.freenet.wot.OwnIdentity;
 import net.pterodactylus.sone.freenet.wot.IdentityListener;
 import net.pterodactylus.sone.freenet.wot.IdentityManager;
 import net.pterodactylus.sone.freenet.wot.OwnIdentity;
-import net.pterodactylus.sone.freenet.wot.Trust;
 import net.pterodactylus.sone.main.SonePlugin;
 import net.pterodactylus.util.config.Configuration;
 import net.pterodactylus.util.config.ConfigurationException;
 import net.pterodactylus.sone.main.SonePlugin;
 import net.pterodactylus.util.config.Configuration;
 import net.pterodactylus.util.config.ConfigurationException;
@@ -1042,26 +1041,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
        }
 
        /**
        }
 
        /**
-        * Retrieves the trust relationship from the origin to the target. If the
-        * trust relationship can not be retrieved, {@code null} is returned.
-        *
-        * @see Identity#getTrust(OwnIdentity)
-        * @param origin
-        *            The origin of the trust tree
-        * @param target
-        *            The target of the trust
-        * @return The trust relationship
-        */
-       public Trust getTrust(Sone origin, Sone target) {
-               if (!isLocalSone(origin)) {
-                       logger.log(Level.WARNING, String.format("Tried to get trust from remote Sone: %s", origin));
-                       return null;
-               }
-               webOfTrustUpdater.getTrust((OwnIdentity) origin.getIdentity(), target.getIdentity());
-               return target.getIdentity().getTrust((OwnIdentity) origin.getIdentity());
-       }
-
-       /**
         * Sets the trust value of the given origin Sone for the target Sone.
         *
         * @param origin
         * Sets the trust value of the given origin Sone for the target Sone.
         *
         * @param origin
index 56716d6..bdfc1ae 100644 (file)
@@ -70,28 +70,6 @@ public class WebOfTrustUpdater extends AbstractService {
        //
 
        /**
        //
 
        /**
-        * Retrieves the trust relation between the truster and the trustee. This
-        * method will return immediately and perform a trust update in the
-        * background.
-        *
-        * @param truster
-        *            The identity giving the trust
-        * @param trustee
-        *            The identity receiving the trust
-        */
-       public void getTrust(OwnIdentity truster, Identity trustee) {
-               GetTrustJob getTrustJob = new GetTrustJob(truster, trustee);
-               if (!updateJobs.contains(getTrustJob)) {
-                       logger.log(Level.FINER, "Adding Trust Update Job: " + getTrustJob);
-                       try {
-                               updateJobs.put(getTrustJob);
-                       } catch (InterruptedException ie1) {
-                               /* the queue is unbounded so it should never block. */
-                       }
-               }
-       }
-
-       /**
         * Updates the trust relation between the truster and the trustee. This
         * method will return immediately and perform a trust update in the
         * background.
         * Updates the trust relation between the truster and the trustee. This
         * method will return immediately and perform a trust update in the
         * background.
@@ -471,45 +449,6 @@ public class WebOfTrustUpdater extends AbstractService {
        }
 
        /**
        }
 
        /**
-        * Update job that retrieves the trust relation between two identities.
-        *
-        * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
-        */
-       private class GetTrustJob extends WebOfTrustTrustUpdateJob {
-
-               /**
-                * Creates a new trust update job.
-                *
-                * @param truster
-                *            The identity giving the trust
-                * @param trustee
-                *            The identity receiving the trust
-                */
-               public GetTrustJob(OwnIdentity truster, Identity trustee) {
-                       super(truster, trustee);
-               }
-
-               /**
-                * {@inheritDoc}
-                */
-               @Override
-               @SuppressWarnings("synthetic-access")
-               public void run() {
-                       try {
-                               Trust trust = webOfTrustConnector.getTrust(truster, trustee);
-                               if (trustee instanceof DefaultIdentity) {
-                                       ((DefaultIdentity) trustee).setTrust(truster, trust);
-                               }
-                               finish(true);
-                       } catch (PluginException pe1) {
-                               logger.log(Level.WARNING, "Could not get Trust value for " + truster + " -> " + trustee + "!", pe1);
-                               finish(false);
-                       }
-               }
-
-       }
-
-       /**
         * Base class for context updates of an {@link OwnIdentity}.
         *
         * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
         * Base class for context updates of an {@link OwnIdentity}.
         *
         * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>