This approach sounds similar to the Spring IoC framework. Objects are defined in an xml file and a manager loads them into memory. Your action class looks up beans using something like:
MyBD bd = (MyBD)applicationContext.getBean("MyBD"); So you don't have to implement the ServiceLocator or Singleton patterns. It provides declarative transaction services as well. Check it out here: http://www.springframework.org/ robert > -----Original Message----- > From: HG [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 22, 2004 5:22 AM > To: Struts Users Mailing List > Subject: Re: About Struts + JBoss preference issue > > > Hi Marco > > > I have questions coz I m interested in that approach.. > > I am happy that you find it interesting :-) > > > I assume u have a config file for telling the PlugIn Mgr what > > To load, correct? > > The plugins, names and classed that implement the plugin interface are > stored in a table in a database. > When the pluginmanager initializes, it performs a query on the database, > fetching the plugins to load. > > Then the PluginManager iterates the found plugin and performs this sequence > in each interation > > - Load the class (implementing the plugin interface) and get an instance of > it. > - initialize the plugin (performing lookup of remote home through > ServiceLocator and creating remote object (Facade) to associate with the > plugin. > > But it could easily be a XML file, or anything else > > > U use the PlugInMgr as singleton, correct? Coz right now I m following > > Similar 'approach' but I m storing the BD in the ServletContext, and > > what > > I don't like much is that every time I have to retrieve it, I have to > > Do a cast.... > > The plugin manager is stored in ServletContext, and I have a base class > (PluginManagerAction) for my action, which have a method with the following > signature > > public PluginManager getPluginManager(); > > In my action which derives from PluginManagerAction I do this: > > MyPluginInterface plugin = (MyPluginInterface) > getPluginManager().getPlugin("myplugin"); > > I have to type cast the interface because getPluginManager() return the > superclass interface Plugin > > No I am ready to invoke methods of the plugin. > > What is it you don't like, when doing type casts...? > > Regards > > Henrik > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]