Craig,

Thanx for writing!

I want to provide our users the convienience of doing the necessary
operations (start/stop and disbaling/enabling contexts dynamically)that
they want to do on tomcat for our apps from our console.

I am writing a wrapper on top of tomcat for the same. The thing I dont
like about calling org.apache.catalina.startup.Bootstrap.main is that 

1. The api is asynchronous I dont really know when its started
completely / stopped completely

2. It handles all exceptions by itself , so my wrapper has no way of
knowing if it started correctly or not.

3. I dont have handles to tomcat objects like contexts, connectors - so
if I wanted to change something dynamically I cant

4. Atleast earlier versions of tomcat when invoked via main used to call
System.exit and stuff , so I had to register system.exit handlers to
deal with this condition

I like the embedded approach in that it solves all my problems. What I
want to be able to do is

Embedded server = getEmbeddedTomcat(String strConfFile); // The tomcat
server is constructed based //on the xml config gile
server.start(); //at the end of this I know its started , I see
exceptions I there is a failure
server.stop();//at the end of this I know its stopped


In short ,I am trying to see if I can have the convenience of
construction of my embedded tomcat object hierarchy (through an api)
with out me having to parse the server.xml and construct my embedded
tomcat heirarchy. This way I dont have to deal with the config files now
and any changes that might happen to them in future.

Thanx
Ganesh

-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 07, 2002 2:30 PM
To: Tomcat Users List
Subject: Re: Making Embedded tomcat work off tomcat config files




On Thu, 7 Mar 2002, Sankaranarayanan Ganapathy wrote:

> Date: Thu, 7 Mar 2002 12:23:15 -0800
> From: Sankaranarayanan Ganapathy <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Making Embedded tomcat work off tomcat config files
>
> Hi All,
>
> I am embedding tomcat in my application , but I dont want to deal with
> the configuration aspects of tomcat. I see that embedded tomcat
requires
> that we set the configuration information programatically (like ports,
> connectors, contexts) etc. Is there a way to make an embedded tomcat
> read this information from the configuration files!
>

Simplest thing would be to call the main() method of
org.apache.catalina.startup.Bootstrap yourself -- that's all that the
catalina.sh/catalina.bat scripts do.  It will then parse server.xml and
create the hierarchy.

> Alos that the org.apache.catalina.startup.Catalina uses a SAX parser
and
> adds actions and builds a object hierarchy . Alternatively Is there a
> single tomcat api that we could call to build this object hierarchy?
>

That's what the Embedded class is for, but you said you didn't want to
deal with the configuration complexity yourself.  Tomcat's standard
approach is to do an XML parse of $CATALINA_HOME/conf/server.xml and
create the corresponding Catalina components in response to interesting
SAX events.  Without reading server.xml, it's up to you to build the
object hierarchy yourself, which Embedded can help you with.

Note that you're going to need an XML parser anyway, because it's used
for
reading web.xml files, tag library descriptors, and JSP pages in XML
syntax.

> Any help will be greatly appreciated !
>
> Thanx in advance
> Ganesh
>

Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to