SOCKET
Sunday Jun 04, 2006
Writing new tools for Bodington
I've written a couple of tools for Bodington - the Peer Marker and the SOCKET Link. I thought it might be useful to document how this is done because as far as I'm aware it is not documented anywhere else. The easiest way to write a new tool is to download the latest Bodington code from Sourceforge and copy/edit the code for an existing tool. Each tool has the following components:
- A unique tool ID number.
- A tool class that extends org.bodington.server.resources.Resource.
This class contains get/set methods for the tool's properties and also methods that allow the tool object to be retrieved from the database using various keys.
- A session interface that extends org.bodington.server.BuildingSession. This interface specifies methods that represent a user's session with a specific tool.
- A session class that implements the session interface.
- A facility class that extends org.bodington.servlet.facilities.Facility.
This class implements the user interface using the tool's templates. All input/output code is confined to this class.
- An SQL script that is used to create the table and fields needed to store persistent information about the tool.
- A set of resources that contain the localised strings for the code and templates
- A set of HTML and/or XHTML templates containing tags which will be replaced by interactive content generated by the methods in the facility class.
- Add the sql script to the String[] array tables_sql_in_order in org.bodington.installation.Installer.java. The first entry should be the name of the tool's table and the second should be the full path to the SQL script.
- Add the tool ID to the list at the beginning of Resource.java
- Add the tool ID to the list in the method Resource.mapHttpFacilityNoToResourceType()
- Add the tool ID to the list in the method Resource.getResourceTypeName()
- Add the tool's nickname to the comma-separated list in bodington-defaults.properties. The nickname should be the same as the name of the directory containing the tool's templates.
- Add an entry to bodington-defaults.properties of the form:
bodington.facility.<tool nickname> = <tool facility class>
- Add an entry to org.bodington.server.resources.ResourceTypeNames.properties
- Create create_tool.html and confirmcreate_tool.html templates in the style_default/default directory
- Add a section to the creationmenu.html in the appropriate template directories so that the option to create your tool appears in the list of tools.
Posted at 11:57AM Jun 04, 2006 by Andrew G. Booth in Bodington | Comments[1]
Post a Comment:
Comments are closed for this entry.
Couple of comments:
1/ this would be good to go in the wiki as a guide to wriiting new tools, I've put a link to your blog, but other people may like to chip in with comments
2/ You should point out that the logbook is a good example of a tool - it is in its own package
3/ You could also point out about the shift to JSP's
adam
Posted by adam m on June 08, 2006 at 03:32 PM BST #