- /**
- * Adds a context to the given own identity.
- *
- * @param ownIdentity
- * The own identity
- * @param context
- * The context to add
- */
- public void addContext(OwnIdentity ownIdentity, String context) {
- if (ownIdentity.hasContext(context)) {
- return;
- }
- try {
- webOfTrustConnector.addContext(ownIdentity, context);
- wotPluginConnected = true;
- ownIdentity.addContext(context);
- } catch (PluginException pe1) {
- logger.log(Level.WARNING, "Could not add context " + context + " to OwnIdentity " + ownIdentity + ".", pe1);
- wotPluginConnected = false;
+ @Override
+ protected void serviceRun() {
+ Multimap<OwnIdentity, Identity> oldIdentities = create();
+
+ while (!shouldStop()) {
+ try {
+ Collection<OwnIdentity> currentOwnIdentities = webOfTrustConnector.loadAllOwnIdentities();
+ Multimap<OwnIdentity, Identity> currentIdentities = loadTrustedIdentitiesForOwnIdentities(currentOwnIdentities);
+
+ detectChangesInIdentities(currentOwnIdentities, currentIdentities, oldIdentities);
+ oldIdentities = currentIdentities;
+
+ synchronized (currentOwnIdentities) {
+ this.currentOwnIdentities.clear();
+ this.currentOwnIdentities.addAll(currentOwnIdentities);
+ }
+ } catch (WebOfTrustException wote1) {
+ logger.log(Level.WARNING, "WoT has disappeared!", wote1);
+ }
+
+ /* wait a minute before checking again. */
+ sleep(60 * 1000);