On 4/5/02 4:14 PM, "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:
>
>
> On Fri, 5 Apr 2002 [EMAIL PROTECTED] wrote:
>
>>
>> [snip]
>> You can still choose to ignore it - or to use a different mechanism.
>> Including JNDI - Craig may explain us if web.xml would allow
>> us to define 'custom' resources ( besides JDBC drivers, etc ). If it
>> does, then we automatically have another valid mechansim to get a Log in
>> a servlet environment - pushed by the 'deployer' via JNDI and web.xml.
>> Class.forName() also works.
>>
>
> As a general rule, JNDI is the preferred resource discovery mechanism in
> the J2EE application programming model. For example, if you stored a Log
> instance in JNDI with Tomcat, under resource name "log/VelocityLog", you
> would access it like this:
>
> InitialContext ic = new InitialContext();
> Log log = (Log) ic.lookup("java:comp/env/log/VelocityLog");
(I heart JNDI)
>
> Conceptually, this is not a lot different from using a static factory
> method, so the IoC advocates are still not going to like it :-).
I don't know if that's fair - because the application has setup and pushed
into the context the Log..
In the o.a.c.l model, I can't even replace the static LogFactory....
> One
> thing that makes it less painful is that the contents of the initial
> context are dependent on the calling environment -- for example, each
> webapp has their own InitialContext, populated only with the resources
> defined in that app's web.xml file.
>
I looked for docs on how to setup the web.xml for tc4 to specify my ctx
factory, but didn't find them when I looked. I assume they are there
somewhere?
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>