A good way to integrate each extension would be to great an Inteface
that each extension needs to implement.  Then the ActionServlet can call
certail methods to initialize the extension.  Have a method to set up
the digester, one for logging, a generic one, whatever we need.  Then
register each extension with in the struts-config file with the class
name that implements the interface and maybe a configuration file for it
also.

Alan Yackel
CTO
Creatrixs INC.


Ron Smith wrote:

> I have a couple subsystems (data access subsystem,
> authorization, logging, etc..) that I initialize by extending
> ActionServlet.  It would be nice to not have to extend
> ActionServlet and initialize each extension/subsystem manually.
>
> One approach would be to trigger initialization of the
> services off of the struts-config.xml.
> For each service you want to use, you'd just list it in
> your struts-config.xml:
> <extension class="org.apache.strutsx.some.Extension"/>.
>
> Another issue is how to configure these extensions/subsystems.
> Right now I'm using the Digester class to configure
> my subsystems off of seperate config files.
> Each subsystem having its own configuration file
> is simple (e.g. each config file can have a separate
> format and DTD, and each subsystem can register
> its own configuration rules with the Digester),
> but you end up having to manage
> a bunch of configuration files instead of just one.
>
> By the way, thanks to whoever worked on the Digester -
> very useful and a breeze to use.
>
> --Ron
>
> David Winterfeldt wrote:
>
> > It might be nice if there was a way to register an
> > interface with the ActionServlet in the config file
> > for it to initialize a service.  All the
> > ValidatorServlet I made does is parse the xml file
> > with the Digester and put an object into application
> > scope.  If a class could be registered, then a servlet
> > wouldn't hang around for no reason and it wouldn't
> > need to be defined in the web.xml.  And it sounds like
> > a lot of people extend the ActionServlet just to
> > initialize resources on startup.
> >
> > David
> >
> > --- Ted Husted <[EMAIL PROTECTED]> wrote:
> > > I agree that most extensions would be best written
> > > as independant
> > > servlets that plug into the application alongside
> > > the Struts
> > > ActionServlet. Though, I'm not sure they would need
> > > to register with the
> > > ActionServlet to access other parts of the
> > > framework.
> > >
> > > I haven't worked with the Digester directly, but
> > > most of the other
> > > Struts services are already exposed through the
> > > application context.
> > > Custom tags, for example, already access the Action
> > > Mappings this way.
> > > So any other servlet in the application (since
> > > that's all JSP's are)
> > > should be able to do the same.
> > >
> > > Another example is the Generic Connection Pool. The
> > > datasource is
> > > exposed through the application context and other
> > > services, like the
> > > TagLibs JDBC tags, can use the pool without knowing
> > > anything about
> > > Struts (or Struts knowing anything about them).
> > >
> > > So I would suggest that if there are other services
> > > that an extension
> > > needs to share that we expose them through the
> > > Application context.
> > >
> > > Oleg V Alexeev wrote:
> > >
> > > > To support flexible extensions mechanism for
> > > struts there are can be
> > > > made some additions to the core structure of the
> > > framework -
> > > >
> > > > 1. Add ability to register components or external
> > > servlets (at
> > > >    application level) via struts-config file.
> > > > 2. Give such external components or servlets
> > > ability to use action
> > > >    mappings database from ActionServlet.
> > > > 3. Extend core API of struts to support pluggable
> > > extensions - for
> > > >    example use event model or direct calls via
> > > registrations in action
> > > >    mappiongs database.
> > > >
> > > > The best way for my mind is to write external
> > > servlets, register it in
> > > > struts ActionServlet and use it as external
> > > services. This approach
> > > > can be useful in case of mutliple ActionServlet
> > > instances in one
> > > > application - every ActionServlet subscribe to use
> > > and uses some
> > > > amount of external services.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get personalized email addresses from Yahoo! Mail - only $35
> > a year!  http://personal.mail.yahoo.com/
begin:vcard 
n:Yackel;Alan
tel;fax:301.656.7644
tel;work:301.656.1946
x-mozilla-html:FALSE
url:www.creatrixs.com
version:2.1
email;internet:[EMAIL PROTECTED]
title:CTO
adr;quoted-printable:;;4915 St. Elmo Avenue=0D=0ASuite 501;Bethesda;MD;20814;USA
x-mozilla-cpt:;0
fn:Alan Yackel
end:vcard

Reply via email to