I won't repeat what Berin has said, so I will address the Struts +
Avalon question. Our soon-to-be-released product (eQ!) is being built on
top of Avalon for several components and the download demo that will be
available shortly will be a struts application. Now in that app, Struts
itself isn't really aware of Avalon, but the Action class that we use
for our script engine accesses that script engine via a
ComponentManager.
What do we have that uses Avalon? Well, our Persistence layer, XML-based
script engine, and our Struts adapter/manager are all based on the
Component framework/architecture. We use the built in JDBCConnection
pooling from Excalibur for the persistence layer and I'm investigating
using the caching and monitoring API's in Excalibur as well, for caching
collections and monitoring changes to the XML script files.
The question/answers about the access to the container are good ones,
and I'll admit that we probably don't do it 'correctly'. We have a
singleton class with a static method for getting a hold of the root
ComponentManager, which is an ExcaliburComponentManager. We did this
because we have some clients who are in a 2-tier environment with a fat
Swing client talking to a db on a server and running a JNDI process on
the client is still up for debate. If we were doing only serverside
apps, then binding the component manager to JNDI wouldn't be a bad idea,
and we may allow either one later on.
HTH,
Robert
-----Original Message-----
From: Gonzalo Diethelm [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 09, 2002 10:14 PM
To: Avalon Developers List; Avalon Developers List
Subject: Basic questions
Hello,
I have been doing some reading on Framework and components,
trying to understand the basic concepts behind their design.
I have some honest questions, not intended to express any
opinion on anything at all, just looking for answers. In fact, I think
I know the answers to some of the questions, but I'm asking them anyway
to check my understanding.
Say I write a class with some kind of business logic:
class Foo { public String getAnswer(String data) { ... } }
The class would in principle benefit with some of the life cycle
abstractions in Framework. For example, the class could need some
kind of configuration and logging, so it could be declared
as:
class Foo implements LogEnabled, Configurable { ... }
Now, I start by testing this class from a simple command line
program. At this point:
1. Do I gain anything by having Foo implement LogEnabled and
Configurable?
2. Who will call the proper configure() method in the class? Does
the class have to be put into a component manager? This seems to me
to be the case, and if this is so, then it is kind of useless to have a
component "living by itself", not as part of a component manager. Is
this correct?
3. If the "component by itself" does indeed not make sense: the docos
talk about running components as stand-alone programs (such as my test
case). In this case, the test program is responsible for taking the
component through the life cycle, right? In this case, and supposing
the component will ONLY be run from a test program, is there any
value at all in making this class a component and having it
implement Configurable? I mean, someone will have to call the
configure() method anyway; why not have the component call it itself
when appropriate?
The second scenario is running this business logic from a
servlet-based application. Under this scenario, the user
interface is handled with Struts; the user enters some data, clicks
on a button, and a Struts Action class is reached. At this point,
the Action class grabs the entered data and is ready to call the
business logic component.
4. Is there any benefit in using a ComponentManager here? After
all, the Action class could simply create an instance of Foo, pass
the parameters and grab the result, right?
5. My understanding is that the ComponentManager at least would
be helpful in providing some kind of pooling of components. If
this is the case, would the ComponentManager be a Singleton? If
yes, who instantiates it? Who ensures it really IS a singleton?
The Struts scenario is more than just an hypothetic example; it is
EXACTLY the way we plan to build our applications. So, my last
questions are:
6. Anybody is using Struts + Framework? Can anybody share
comments, hints, caveats, etc.? For example, can you use LogKit on the
Struts Action classes and on the Components, and have all output
treated uniformly? Or does Struts REQUIRE using log4j?
7. Anybody can provide a real working example of the Struts +
Framework combination?
Sorry if the questions seem basic or confused, and thanks in
advance for any help.
--
Gonzalo A. Diethelm
[EMAIL PROTECTED]
--
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>