// Path: src/main/java/plugins/floghelper/fcp/ReceptorCore.java
// public interface ReceptorCore {
// 
// 	public void onReply(String arg0, String arg1, SimpleFieldSet arg2, Bucket arg3);
// }
// 
// Path: src/main/java/plugins/floghelper/fcp/SyncPluginTalker.java
// public class SyncPluginTalker {
// 
// 	/**
// 	 * Full classname of the WoT plugin.
// 	 */
// 	public final static String WOT_NAME = "plugins.WebOfTrust.WebOfTrust";
// 	private final PluginReceptor receptor;
// 	private final String to;
// 	private final PluginTalker talker;
// 	private final SimpleFieldSet data;
// 	private final Bucket data2;
// 	private final long millisTimeout;
// 
// 	public SyncPluginTalker(final ReceptorCore receptor, final SimpleFieldSet data, final Bucket data2) throws PluginNotFoundException {
// 		this(receptor, WOT_NAME, data, data2);
// 	}
// 
// 	public SyncPluginTalker(final ReceptorCore receptor, final String to, final SimpleFieldSet data, final Bucket data2) throws PluginNotFoundException {
// 		this(receptor, to, FlogHelper.class.getName(), data, data2);
// 	}
// 
// 	public SyncPluginTalker(final ReceptorCore receptor, final String to, final String identifier, final SimpleFieldSet data, final Bucket data2) throws PluginNotFoundException {
// 		this(receptor, to, identifier, data, data2, 30000);
// 	}
// 
// 	public SyncPluginTalker(final ReceptorCore receptorCore, final String to, final String identifier, final SimpleFieldSet data, final Bucket data2, final long millisTimeout) throws PluginNotFoundException {
// 		this.to = to;
// 		this.receptor = new PluginReceptor(receptorCore);
// 		this.talker = FlogHelper.getPR().getPluginTalker(this.receptor, this.to, identifier);
// 		this.data = data;
// 		this.data2 = data2;
// 		this.millisTimeout = millisTimeout;
// 	}
// 
// 	public boolean run() {
// 		long start = System.currentTimeMillis();
// 
// 		// This call is async
// 		this.talker.send(this.data, this.data2);
// 
// 		// If the receptor don't recieve anything in the timeout period,
// 		// we return false
// 		while (!this.receptor.isStarted()) {
// 			if (System.currentTimeMillis() - start > this.millisTimeout) {
// 				return false;
// 			} else {
// 				try {
// 					Thread.sleep(15);
// 				} catch (InterruptedException ex) {
// 				}
// 			}
// 		}
// 
// 		// We make sure that the receptor finished his stuff before
// 		// returning. This method is blocking !
// 		while (!this.receptor.isOver()) {
// 			try {
// 				Thread.sleep(15);
// 			} catch (InterruptedException ex) {
// 			}
// 		}
// 
// 		return true;
// 	}
// }


import freenet.pluginmanager.PluginNotFoundException;
import freenet.support.SimpleFieldSet;
import freenet.support.api.Bucket;
import plugins.floghelper.fcp.ReceptorCore;
import plugins.floghelper.fcp.SyncPluginTalker;

			public void onReply(String pluginname, String indentifier, SimpleFieldSet params, Bucket data) {
				if(params.get("Message").equals("Error")) {
					assert(params.get("Description").startsWith("plugins.WebOfTrust.exceptions.InvalidParameterException"));
					value[0] = null;
				} else {
					assert(params.get("Message").equals("PropertyValue"));
					value[0] = params.get("Property");
				}
			}
		}, sfs, null);

		spt.run();

		freenet.support.Logger.debug(WoTContexts.class, authorID + " -> " + value[0]);

		return value[0];
	}

	public static void removeProperty(String authorID, String propertyName) throws PluginNotFoundException {
		final SimpleFieldSet sfs = new SimpleFieldSet(true);
		sfs.putOverwrite("Message", "RemoveProperty");
		sfs.putOverwrite("Identity", authorID);
		sfs.putOverwrite("Property", propertyName);

		SyncPluginTalker spt = new SyncPluginTalker(new ReceptorCore() {

			public void onReply(String pluginname, String indentifier, SimpleFieldSet params, Bucket data) {
				assert(params.get("Message").equals("PropertyRemoved"));
			}
// Path: src/main/java/plugins/floghelper/fcp/ReceptorCore.java
// public interface ReceptorCore {
// 
// 	public void onReply(String arg0, String arg1, SimpleFieldSet arg2, Bucket arg3);
// }
// 
// Path: src/main/java/plugins/floghelper/fcp/SyncPluginTalker.java
// public class SyncPluginTalker {
// 
// 	/**
// 	 * Full classname of the WoT plugin.
// 	 */
// 	public final static String WOT_NAME = "plugins.WebOfTrust.WebOfTrust";
// 	private final PluginReceptor receptor;
// 	private final String to;
// 	private final PluginTalker talker;
// 	private final SimpleFieldSet data;
// 	private final Bucket data2;
// 	private final long millisTimeout;
// 
// 	public SyncPluginTalker(final ReceptorCore receptor, final SimpleFieldSet data, final Bucket data2) throws PluginNotFoundException {
// 		this(receptor, WOT_NAME, data, data2);
// 	}
// 
// 	public SyncPluginTalker(final ReceptorCore receptor, final String to, final SimpleFieldSet data, final Bucket data2) throws PluginNotFoundException {
// 		this(receptor, to, FlogHelper.class.getName(), data, data2);
// 	}
// 
// 	public SyncPluginTalker(final ReceptorCore receptor, final String to, final String identifier, final SimpleFieldSet data, final Bucket data2) throws PluginNotFoundException {
// 		this(receptor, to, identifier, data, data2, 30000);
// 	}
// 
// 	public SyncPluginTalker(final ReceptorCore receptorCore, final String to, final String identifier, final SimpleFieldSet data, final Bucket data2, final long millisTimeout) throws PluginNotFoundException {
// 		this.to = to;
// 		this.receptor = new PluginReceptor(receptorCore);
// 		this.talker = FlogHelper.getPR().getPluginTalker(this.receptor, this.to, identifier);
// 		this.data = data;
// 		this.data2 = data2;
// 		this.millisTimeout = millisTimeout;
// 	}
// 
// 	public boolean run() {
// 		long start = System.currentTimeMillis();
// 
// 		// This call is async
// 		this.talker.send(this.data, this.data2);
// 
// 		// If the receptor don't recieve anything in the timeout period,
// 		// we return false
// 		while (!this.receptor.isStarted()) {
// 			if (System.currentTimeMillis() - start > this.millisTimeout) {
// 				return false;
// 			} else {
// 				try {
// 					Thread.sleep(15);
// 				} catch (InterruptedException ex) {
// 				}
// 			}
// 		}
// 
// 		// We make sure that the receptor finished his stuff before
// 		// returning. This method is blocking !
// 		while (!this.receptor.isOver()) {
// 			try {
// 				Thread.sleep(15);
// 			} catch (InterruptedException ex) {
// 			}
// 		}
// 
// 		return true;
// 	}
// }


// Path: src/main/java/plugins/floghelper/fcp/wot/WoTContexts.java
import freenet.pluginmanager.PluginNotFoundException;
import freenet.support.SimpleFieldSet;
import freenet.support.api.Bucket;
import plugins.floghelper.fcp.ReceptorCore;
import plugins.floghelper.fcp.SyncPluginTalker;


			public void onReply(String pluginname, String indentifier, SimpleFieldSet params, Bucket data) {
				if(params.get("Message").equals("Error")) {
					assert(params.get("Description").startsWith("plugins.WebOfTrust.exceptions.InvalidParameterException"));
					value[0] = null;
				} else {
					assert(params.get("Message").equals("PropertyValue"));
					value[0] = params.get("Property");
				}
			}
		}, sfs, null);

		spt.run();

		freenet.support.Logger.debug(WoTContexts.class, authorID + " -> " + value[0]);

		return value[0];
	}

	public static void removeProperty(String authorID, String propertyName) throws PluginNotFoundException {
		final SimpleFieldSet sfs = new SimpleFieldSet(true);
		sfs.putOverwrite("Message", "RemoveProperty");
		sfs.putOverwrite("Identity", authorID);
		sfs.putOverwrite("Property", propertyName);

		SyncPluginTalker spt = new SyncPluginTalker(new ReceptorCore() {

			public void onReply(String pluginname, String indentifier, SimpleFieldSet params, Bucket data) {
				assert(params.get("Message").equals("PropertyRemoved"));
			}
		}, sfs, null);