I wouldn't recommend putting your application specific stuff in the
server.xml file for Tomcat.  

A better approach would be to create a context.xml file and place it in
the META-INF of your war file.  When you do it this way, any changes to
the context.xml file are done immediately when you redeploy the war
file.

Have a look here:

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

"For Tomcat 5, unlike Tomcat 4.x, it is NOT recommended to place
<Context> elements directly in the server.xml file. This is because it
makes modifing the Context configuration more invasive since the main
conf/server.xml file cannot be reloaded without restarting Tomcat."

 
 
   Mark Coffin 
   mcof...@aalsolutions.com 
   Phone: 905.632.0864 
   1.800.668.8486 
   Fax: 905.632.2605 
   www.aalsolutions.com 

-----Original Message-----
From: Lukacs, Gabriel [mailto:gabriel.luk...@siemens.com] 
Sent: May 4, 2009 5:18 AM
To: Cool The Breezer; xmltask-users@lists.sourceforge.net
Subject: Re: [Xmltask-users] Conditional insert based on xpath

Hello,
        maybe it exists other solutions, but in such I am using the
following 2 step code:

        <xmltask source="${tomcat.home}/conf/server.xml">
            <copy
path="boolean(/Server/Service/Engine/Host/conte...@path='/doceng'])"
property="is.path.available" />
        </xmltask>

        <if>    (this if task is from antcontrib)
            <isfalse value="${is.path.available}"/> 
        <then>
                ....your insert....
        </then>
        </if>   


-----Original Message-----
From: Cool The Breezer [mailto:techcool.ku...@yahoo.com] 
Sent: Monday, May 04, 2009 11:02 AM
To: xmltask-users@lists.sourceforge.net
Subject: [Xmltask-users] Conditional insert based on xpath


Hi,
   I am currently using <insert> task for deploying my webapp. However
sometimes, the context is inserted more than once and I have to perform
conditional insert in target. Before inserting, I have to check whether
path="/Server/Service/Engine/Host/conte...@path='/doceng'] exists or
not. If exists then dont insert otherwise insert. I was looking into
"if" subtask but could not able to find any examples. Please find my
code below and would appreciate your help.

<target name="deploy_local">
                <echo message="(INFO): Please ensure that server is
down, while deploying to localhost"/>
                <xmltask source="${tomcat.home}/conf/server.xml"
dest="${tomcat.home}/conf/server.xml">
                        <insert
path="/Server/Service/Engine/Host/text()[1]" position="before">
                                <![CDATA[
                                        <Context path="/doceng"
reloadable="true" docBase="${docBase}">
                                   <Resource name="jdbc/docengdb"
auth="Container"
                                        type="javax.sql.DataSource" 
        
driverClassName="${driverclassName}"
                                        url="${dburl}" 
        
username="${dbusername}" 
        
password="${dbpassword}" 
        
maxActive="${maxactive}" 
        
maxIdle="${maxidle}"
                                        maxWait="${maxwait}"/> 
                                        </Context>
                                ]]>
                        </insert> 
                </xmltask>
        </target>



      

------------------------------------------------------------------------
------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

------------------------------------------------------------------------
------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users




****** CONFIDENTIALITY NOTICE ******

NOTICE: This e-mail message and all attachments transmitted with it may contain 
legally privileged and confidential information intended solely for the use of 
the addressee. If the reader of this message is not the intended recipient, you 
are hereby notified that any reading, dissemination, distribution, copying, or 
other use of this message or its attachments is strictly prohibited. If you 
have received this message in error, please notify the sender immediately and 
delete this message from your system. Thank you.



------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to