-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Matthew Toseland a ?crit :
> What's your consistency strategy going to be? Never commit, just set()
> everywhere, thus can access from any thread (hopefully) ?
I'm affraid I don't understand what you are talking about. Can you explain ?
>
> On Monday 04 August 2008 20:00, batosai at freenetproject.org wrote:
>> Author: batosai
>> Date: 2008-08-04 18:59:59 +0000 (Mon, 04 Aug 2008)
>> New Revision: 21600
>>
>> Modified:
>> trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
>> Log:
>> Added Homepage and OwnIdentities pages.
>>
>> Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
>> ===================================================================
>> --- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-03 16:24:28 UTC
> (rev 21599)
>> +++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-04 18:59:59 UTC
> (rev 21600)
>> @@ -6,10 +6,15 @@
>>
>> package plugins.WoT;
>>
>> +import com.db4o.Db4o;
>> +import com.db4o.ObjectContainer;
>> +import com.db4o.ObjectSet;
>> +
>> import freenet.client.HighLevelSimpleClient;
>> import freenet.clients.http.PageMaker;
>> import freenet.config.Config;
>> import freenet.config.SubConfig;
>> +import freenet.keys.FreenetURI;
>> import freenet.node.fcp.FCPServer;
>> import freenet.pluginmanager.FredPlugin;
>> import freenet.pluginmanager.FredPluginHTTP;
>> @@ -27,26 +32,31 @@
>> */
>> public class WoTplugin implements FredPlugin, FredPluginHTTP,
> FredPluginThreadless, FredPluginVersioned {
>>
>> - public static String SELF_URI = "/plugins/plugins.WoT.WoTplugin/";
>> + public static String SELF_URI = "/plugins/plugins.WoT.WoTplugin";
>> private PluginRespirator pr;
>> private PageMaker pm;
>> private HighLevelSimpleClient client;
>> private FCPServer fcp;
>> + private ObjectContainer db;
>>
>> public void runPlugin(PluginRespirator pr) {
>>
>> Logger.error(this, "Start");
>>
>> this.pr = pr;
>> + db = Db4o.openFile("WoT.db4o");
>>
>> Config nc = pr.getNode().config;
>> SubConfig fc = nc.get("fproxy");
>> String cssName = fc.getString("css");
>>
>> pm = new PageMaker(cssName);
>> +
>> + pm.addNavigationLink(SELF_URI, "Home", "Home page", false,
>> null);
>> + pm.addNavigationLink(SELF_URI + "/ownidentities", "Own
> Identities", "Manage your own identities", false, null);
>> + pm.addNavigationLink(SELF_URI + "/test", "Test", "Testing
>> page", false,
> null);
>> + pm.addNavigationLink("/plugins/", "Plugins page", "Back to
>> Plugins page",
> false, null);
>>
>> - pm.addNavigationLink("/", "Fproxy", "Back to Fproxy", false,
>> null);
>> -
>> client = pr.getHLSimpleClient();
>>
>> fcp = pr.getNode().clientCore.getFCPServer();
>> @@ -54,16 +64,33 @@
>> }
>>
>> public void terminate() {
>> + db.close();
>> }
>>
>> @Override
>> public String handleHTTPGet(HTTPRequest request) throws
> PluginHTTPException {
>> - return makeHomePage();
>> +
>> + String page = request.getPath().substring(SELF_URI.length());
>> + if(page.equals("/ownidentities")) {
>> + return makeOwnIdentitiesPage();
>> + }
>> + else {
>> + return makeHomePage();
>> + }
>> }
>>
>> @Override
>> public String handleHTTPPost(HTTPRequest request) throws
> PluginHTTPException {
>> - return null;
>> +
>> + String page = request.getPath().substring(SELF_URI.length());
>> + if(page.equals("/createIdentity")) {
>> + FreenetURI[] keypair = client.generateKeyPair("WoT");
>> + FreenetURI insertURI =
> keypair[0].setKeyType("USK").setSuggestedEdition(0);
>> + FreenetURI requestURI =
> keypair[1].setKeyType("USK").setSuggestedEdition(0);
>> +
>> + return insertURI + "<br>" + requestURI;
>> + }
>> + else return makeHomePage();
>> }
>>
>> @Override
>> @@ -72,17 +99,56 @@
>> }
>>
>> private String makeHomePage() {
>> +
>> + int nbOwnIdentities;
>> + int nbIdentities;
>> +
>> + HTMLNode list = new HTMLNode("ul");
>> +
>> + ObjectSet<OwnIdentity> ownIdentities =
> db.queryByExample(OwnIdentity.class);
>> + nbOwnIdentities = ownIdentities.size();
>> + list.addChild(new HTMLNode("li", "Own Identities : " +
>> nbOwnIdentities));
>> +
>> + ObjectSet<Identity> identities =
>> db.queryByExample(Identity.class);
>> + nbIdentities = identities.size();
>> + list.addChild(new HTMLNode("li", "Known Identities : " +
>> nbIdentities));
>> +
>> +
>> HTMLNode pageNode = getPageNode();
>> HTMLNode contentNode = pm.getContentNode(pageNode);
>> + HTMLNode box = pm.getInfobox("Summary");
>>
>> - HTMLNode box = pm.getInfobox("Summary");
>> HTMLNode boxContent = pm.getContentNode(box);
>> - boxContent.addChild("#", "The WoT plugin is running...");
>> + boxContent.addChild(list);
>>
>> contentNode.addChild(box);
>> return pageNode.generate();
>> }
>> +
>> + private String makeOwnIdentitiesPage() {
>>
>> + HTMLNode pageNode = getPageNode();
>> + HTMLNode contentNode = pm.getContentNode(pageNode);
>> + HTMLNode box = pm.getInfobox("Own Identities");
>> + HTMLNode boxContent = pm.getContentNode(box);
>> +
>> + ObjectSet<OwnIdentity> ownIdentities =
> db.queryByExample(OwnIdentity.class);
>> + if(ownIdentities.size() == 0) {
>> + boxContent.addChild("p", "You have no own identites
>> yet, you should
> create one...");
>> + }
>> + else {
>> + while(ownIdentities.hasNext()) {
>> + boxContent.addChild(new HTMLNode("p",
> ownIdentities.next().getRequestURI()));
>> + }
>> + }
>> +
>> + HTMLNode createForm = pr.addFormChild(boxContent, SELF_URI
> + "/createIdentity", "createForm");
>> + createForm.addChild("input", new String[] { "type", "name",
>> "value" },
> new String[] { "submit", "create", "Create a new identity !" });
>> +
>> + contentNode.addChild(box);
>> + return pageNode.generate();
>> + }
>> +
>> private HTMLNode getPageNode() {
>> return pm.getPageNode("Web of Trust", null);
>> }
>>
>> _______________________________________________
>> cvs mailing list
>> cvs at freenetproject.org
>> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Devl mailing list
>> Devl at freenetproject.org
>> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFImGEKmY5qNqKdYw0RAujdAJ9Xr8JA5f5/n/oihK7jxEdgyxlQKQCeLJwX
QYkDIyo3r6Rs10fi4doQuZY=
=xEFB
-----END PGP SIGNATURE-----