From: Adam M. <ada...@co...> - 2006-03-22 13:38:05
|
Plugins are something that Boding desparately needs, perhaps we should de= dicate some time to work with Al after our new WebLearn release? adam In message <7A5...@sm...> bod...@li... writes: > damn list - I didn't get the original of this message and it came =20 > from me! >=20 > > Can you create a subclass of Facility? > I think Facility is a lost cause. We'll wait for Tetra! >=20 > Thinking about maybe specific plugins - ScreenPlugin - writes to =20 > screen, DBPlugin - does stuff with the DB. It's just a way to =20 > refactor code out of Facility into small packages of functionality =20 > that can better be merged etc. Dare I even say, configured at run =20 > time too, ala struts/spring (I see cabbages heading my way). >=20 > The basic idea is to have, say, a plugins package in bod: >=20 > org.bodington.plugin >=20 > and have specific interfaces in there: >=20 > ScreenPlugin > DBPlugin >=20 > public interface ScreenPlugin { > public void run(Request req, PrintWriter writer) throws UP; > } >=20 > not saying that's what they should be called, just to illustrate. >=20 > Template then calls Facility.writeModuleLinks >=20 > Facility.writeModuleLinks (Request req, PrintWriter writer) { > ScreenPlugin minerva =3D (ScreenPlugin)Class.forName=20 > ("org.bodington.contrib.Minerva"); > minerva.run(req, writer): > } >=20 > maybe as you say, use a subclass of Facility as a facade for the plugin= . >=20 > public class MinervaHelper extends Facility { > writeModuleLinks( ... ) { > ScreenPlugin ... > } > } >=20 > so a template calls a plugin's facade - MinervaHelper - class instead =20 > of Facility >=20 > Can a template call methods in more than one class though? i.e. it =20 > might need functionality that's in more than one plugin. >=20 > Alistair >=20 >=20 >=20 > On 22 Mar 2006, at 10:17, Matthew Buckett wrote: >=20 > > Alistair Young wrote: > >> Bodders, I've been delurked, damn, to ask opinions. > >> > >> We have a requirement for My Modules, which is specific to us so =20 > >> we don't > >> want to pollute Facility. However, a template must call facility =20 > >> to get it > >> to write stuff to the screen. > > > > Can you create a subclass of Facility? > > > >> The writing is delegated to another class which is currently in > >> org.bodington.contrib on our HEAD but Facility still needs to know =20 > >> about > >> the class to delegate to it - it has to cast to call methods etc, =20 > >> so it > >> has to know about the specific class. > > > > At least the delegate methods should be small. This is how I pulled =20 > > the > > StyleSheet code out on WebLearn HEAD. There is still the problem that > > Facility ends up with 100s of method calls. > > > >> A better way would be to define, e.g. > >> > >> package org.bodington.contrib; > >> > >> public interface Plugin { > >> public void run(Request req, PrintWriter writer) throws > >> SomeOrribleException; > >> } > >> > >> then our class could implement Plugin and Facility would only have =20 > >> to load > >> it via Class.forName as a Plugin and call it's run method. > > > > Can you explain the call graph a little more. > > > >> It reduces the code in Facility and brings a sort of IOC/dependancy > >> injection to Facility. > >> > >> What would be even better though is allowing templates to call =20 > >> whatever > >> class they wanted and not just Facility or a subclass thereof. > > > > I added support for making static calls from template but I don't =20 > > think > > this is a good move as then it becomes move difficult to refactor cod= e > > as you can't be sure without recompiling the templates if a method is > > actually used. At the moment you only have todo this checking when > > working with public methods in Facility. It also means that the =20 > > idea of > > linking a template with a Facility in a configuration file breaks =20 > > down. > > > > > > --=20 > > -- Matthew Buckett, VLE Developer > > -- Learning Technologies Group, Oxford University Computing Services > > -- Tel: +44 (0)1865 283660 http://www.oucs.ox.ac.uk/ltg/ > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a groundbreaking scripting =20 > > language > > that extends applications into web and mobile media. Attend the =20 > > live webcast > > and join the prime developer group breaking into this new coding =20 > > territory! > > http://sel.as-us.falkag.net/sel?=20 > > cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=3D121642 > > _______________________________________________ > > Bodington-developers mailing list > > Bod...@li... > > https://lists.sourceforge.net/lists/listinfo/bodington-developers >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > that extends applications into web and mobile media. Attend the live we= bcast > and join the prime developer group breaking into this new coding territ= ory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > Bodington-developers mailing list > Bod...@li... > https://lists.sourceforge.net/lists/listinfo/bodington-developers >=20 --=20 -- Dr AC Marshall (Bodington developer) OUCS, 13, Banbury Rd. Oxford. OX2 6N= N Cheese of the month: Smoked Wensleydale |