I was somewhat concerned about the disorderly proliferation of servlets
designed to provide information about internal node status, and wanted to
create a better thought-out structure into which code designed to give
status information could be placed.

To address this problem, I have created a new Servlet called the
freenet.client.http.NodeInfoServlet, with which implementations of the
freenet.client.http.Infolet interface can register.  To enable this, get
current CVS or tomorrow's snapshot, and add:

nodeinfo.class=freenet.client.http.NodeInfoServlet
nodeinfo.port=8890

To your config file.  If you visit it you won't see much, just a somewhat
ugly page with a menu down the left (with a test infolet), and some text
(anyone who wants to improve the HTML should take a look at the
NodeInfoServlet class - it is *very* ugly right now).  Each Infolet should
provide information on one aspect of Freenet's operation, and the should
be split into groups.

Creating a new Infolet is simplicity itself, take a look at the classes in 
the freenet.client.http.infolets package for some simple examples.  Just 
implement the freenet.client.http.Infolet interface and fill out the two 
simple methods in it (one initialises the Infolet with the node's 
freenet.node.Node object, the other grabs the Infolet's output for 
inclusion in a page.  The output should be a HTML fragment (ie. the stuff 
that goes between the <body> tags).

The infolet must then be hardwired into the NodeInfoServlet, take a look
at its init() method, it is really straight-forward - here is the comment 
that explains it:

       Create the group, register it, and then register the
       Infolets which are to be part of that group in the order you
       want to see them in the menu.  The long group name should be
       the name which will appear in the menu, the short group name
       will be the name that will appear in the URL (so it should
       basically be nothing but lower-case alphanumeric characters).
       The same is true for the long and short names of the Infolets
       themselves.

       For example:
       Group testGroup = new Group("Long Group Name", "briefgroupname");
       registerGroup(testGroup);
       registerInfolet(testGroup, new TestInfolet());
       registerInfolet(testGroup, new TestInfolet2());
       ...
       Group testGroup2 = new Group("Second Long Group Name", 
                                    "briefgroupname2");
       ...

As can be seen, I have created a new package to contain the infolets 
(freenet.client.http.infolets), but they don't have to go in there if you 
have a good reason to put them somewhere else.

People will notice that Infolets are much more constrained in the 
information they have access to, and the way they can respond to it, than 
Servlets.  This is deliberate, Infolets shouldn't modify the Node in any 
way, they are purely for giving the status of a particular aspect of node 
operation, although if there are specific pieces of functionality that 
people really want Infolets to have (such as getting access to the GET 
parameters) we could do that (this might be nescessary, for example, to 
allow Oskar's Diagnostics stuff to be converted to an Infolet).

I would invite the authors of existing node status servlets to convert 
them to Infolets, if there is any functionality you *really* need that is 
currently lacking, either let me know, or add it yourself.

Thoughts, comments, insults?

Ian.

-- 
Ian Clarke                                        ian at freenetproject.org
Founder & Coordinator, The Freenet Project    http://freenetproject.org/
Chief Technology Officer, Uprizer Inc.           http://www.uprizer.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20020224/1729f3f9/attachment.pgp>

Reply via email to