X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FWebOfTrustUpdater.java;h=3d4ad7d1ca490ea113be6f6a334d11b607ec9b79;hb=26dbc1f7ba2c4243d8cc07986b0e943a2238ea08;hp=cb73297c3ac85b38414e0f6f63f3e88f547aca9e;hpb=e16231611a47bf260fef446d2ae9fa5bcbc7e537;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java b/src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java
index cb73297..3d4ad7d 100644
--- a/src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java
+++ b/src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java
@@ -33,6 +33,8 @@ import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.service.AbstractService;
import net.pterodactylus.util.validation.Validation;
+import com.google.inject.Inject;
+
/**
* Updates WebOfTrust identity data in a background thread because communicating
* with the WebOfTrust plugin can potentially last quite long.
@@ -60,6 +62,7 @@ public class WebOfTrustUpdater extends AbstractService {
* @param webOfTrustConnector
* The web of trust connector
*/
+ @Inject
public WebOfTrustUpdater(WebOfTrustConnector webOfTrustConnector) {
super("Trust Updater");
this.webOfTrustConnector = webOfTrustConnector;
@@ -70,28 +73,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.
@@ -471,45 +452,6 @@ public class WebOfTrustUpdater extends AbstractService {
}
/**
- * Update job that retrieves the trust relation between two identities.
- *
- * @author David âBombeâ Roden
- */
- 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 David âBombeâ Roden
@@ -684,8 +626,8 @@ public class WebOfTrustUpdater extends AbstractService {
if ((object == null) || !object.getClass().equals(getClass())) {
return false;
}
- WebOfTrustContextUpdateJob updateJob = (WebOfTrustContextUpdateJob) object;
- return updateJob.ownIdentity.equals(ownIdentity) && updateJob.context.equals(propertyName);
+ WebOfTrustPropertyUpdateJob updateJob = (WebOfTrustPropertyUpdateJob) object;
+ return updateJob.ownIdentity.equals(ownIdentity) && updateJob.propertyName.equals(propertyName);
}
/**