alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Jetty example source code file (test-jndi.xml)

This example Jetty source code file (test-jndi.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Jetty tags/keywords

arg, arg, atomikos, call, call, change-me, configure, jotm, new, new, put, ref, set, set

The Jetty test-jndi.xml source code

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">

<!-- =============================================================== -->
<!-- Configure the test-jndi webapp                                  -->
<!-- =============================================================== -->
<Configure class="org.mortbay.jetty.webapp.WebAppContext">

<!-- Ensure Jetty Plus features are enabled for this webapp                      -->
  <Set name="configurationClasses">
    <Array type="java.lang.String">
      <Item>org.mortbay.jetty.webapp.WebInfConfiguration
      <Item>org.mortbay.jetty.plus.webapp.EnvConfiguration
      <Item>org.mortbay.jetty.plus.webapp.Configuration
      <Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration
      <Item>org.mortbay.jetty.webapp.TagLibConfiguration
    </Array>
  </Set>

  <Set name="contextPath">/test-jndi
  <Set name="war">/contexts/test-jndi.d
  <Set name="extractWAR">false
  <Set name="copyWebDir">false
  <Set name="descriptor">/contexts/test-jndi.d/WEB-INF/instruction-web.xml



<!-- Define a couple of system properties. These are jdbc and jta impl specific.  -->
  <Call class="java.lang.System" name="setProperty">
    <Arg>derby.system.home
    <Arg>
  </Call>

  <Call class="java.lang.System" name="setProperty">
    <Arg>com.atomikos.icatch.file
    <Arg>/contexts/test-jndi.d/WEB-INF/classes/jta.properties
  </Call>

  <!-- Define some env entries for java:comp/env                                  -->
  <New id="woggle"  class="org.mortbay.jetty.plus.naming.EnvEntry">
    <Arg>woggle
    <Arg type="java.lang.Integer">4000
  </New>

  <New id="wiggle"  class="org.mortbay.jetty.plus.naming.EnvEntry">
    <Arg>wiggle
    <Arg type="java.lang.Double">100
    <Arg type="boolean">true
  </New>

 <!-- Mail Session setup                                          -->
 <New id="xxxmail" class="org.mortbay.jetty.plus.naming.Resource">
     <Arg>mail/Session
     <Arg>
       <New class="org.mortbay.naming.factories.MailSessionReference">
         <Set name="user">CHANGE-ME
         <Set name="password">CHANGE-ME
         <Set name="properties">
           <New class="java.util.Properties">
             <Put name="mail.smtp.auth">false 
             <Put name="mail.smtp.host">CHANGE-ME
             <Put name="mail.from">CHANGE-ME
             <Put name="mail.debug">true
           </New>
          </Set>
       </New>
     </Arg>
 </New>

  <!-- =============================================================== -->
  <!-- Configuring Transactions and XA Datasources                     -->
  <!-- Uncomment EITHER the setup for Atomikos OR for Jotm             -->
  <!-- =============================================================== -->


  <!-- Atomikos        
  

  <New id="tx" class="org.mortbay.jetty.plus.naming.Transaction">
   <Arg>
     <New class="com.atomikos.icatch.jta.UserTransactionImp"/>
   </Arg>
  </New>


  


  <New id="mydatasource" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/mydatasource
    <Arg>
     <New class="com.atomikos.jdbc.SimpleDataSourceBean">org.apache.derby.jdbc.EmbeddedXADataSourcedatabaseName=testdb;createDatabase=createmydatasource
    </Arg>
   </New>


  

  <New id="mydatasource2" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/mydatasource2
    <Arg>
       <New class="com.atomikos.jdbc.SimpleDataSourceBean">org.apache.derby.jdbc.EmbeddedXADataSourcedatabaseName=testdb2;createDatabase=createmydatasource2
    </Arg>
   </New>
   END OF ATOMIKOS -->

  <!-- JOTM
  <New id="jotm" class="org.objectweb.jotm.Jotm">TrueFalsetxmgrjavax.transaction.TransactionManager

  <New id="tx" class="org.mortbay.jetty.plus.naming.Transaction">
   <Arg>
     <Ref id="ut"/>
   </Arg>
  </New>


  <New class="org.mortbay.jetty.plus.naming.Resource">myxadatasourceorg.apache.derby.jdbc.EmbeddedDriverjdbc:derby:myderbyDB1;create=true


  <New id="mydatasource" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/mydatasource
    <Arg>
     <New class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">myxadatasource
    </Arg>
   </New>


  <New class="org.mortbay.jetty.plus.naming.Resource">myxadatasource2org.apache.derby.jdbc.EmbeddedDriverjdbc:derby:myderbyDB2;create=true

  <New id="mydatasource2" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/mydatasource2
    <Arg>
       <New class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">myxadatasource2
    </Arg>
   </New>
  END OF JOTM -->

</Configure>

Other Jetty examples (source code examples)

Here is a short list of links related to this Jetty test-jndi.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.