<!-- Tomcat BioCoRE Context Configuration File -->
<Context path="/biocore" docBase="biocore"  >


   <!-- Logging and debugging mail setup -->
   <Environment name="FileLogFile" type="java.lang.String"
                value="/tmp/biocore.log" />
   <Environment name="ErrorMailSMTPHost" type="java.lang.String"
                value="localhost" />
   <Environment name="ErrorMailFromAddress" type="java.lang.String"
                value="DevBioCoREServer@your.site.edu" />
   <!-- multiple addresses can be me@uiuc.edu,you@uiuc.edu -->
   <Environment name="ErrorMailToAddress" type="java.lang.String"
                value="youremail@your.site.edu" />

   <Logger className="org.apache.catalina.logger.FileLogger"
         prefix="localhost_biocore_log." suffix=".txt" timestamp="true"/>

   <!-- Mail setup that BioCoRE will use to send mail to users -->
   <Resource name="mail/biocoreJavaMail" auth="Container"
         type="javax.mail.Session"/>

   <ResourceParams name="mail/biocoreJavaMail">
      <parameter>
           <name>mail.smtp.host</name>
           <value>localhost</value>
      </parameter>
   </ResourceParams>

<!--
If you are wanting to use SMTP-AUTH, you need to move the following
parameter settings up above into the ResourceParams for 
javamail/biocoreJavaMail.
In addation, you might need to add mail.smtp.saslrealm.  See 
http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html

      <parameter>
           <name>mail.smtp.user</name>
           <value>username</value>
      </parameter>
      <parameter>
           <name>mail.smtp.auth</name>
           <value>true</value>
      </parameter>
-->


   <!-- Database setup -->
   <Resource name="jdbc/biocoreJDBC" auth="Container"
         type="javax.sql.DataSource"/>

   <ResourceParams name="jdbc/biocoreJDBC">
<!--
MySQL dB username and password for dB connections 
-->
      <parameter>
         <name>username</name>
         <value>DBUSER</value>
      </parameter>
      <parameter>
         <name>password</name>
         <value>DBPASS</value>
      </parameter>
        
<!--
The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection.  mysqld by default closes idle connections after 8 hours.
The zeroDateTimeBehavior allows the newer versions of the driver to work
and doesn't affect older versions.
-->

      <parameter>
         <name>url</name>
         <value>jdbc:mysql://VALUEOFLOCALURL?autoReconnect=true&amp;zeroDateTimeBehavior=convertToNull</value>
      </parameter>

      <parameter>
         <name>factory</name>
         <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>

<!--
Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->

      <parameter>
         <name>maxActive</name>
         <value>6</value>
      </parameter>
        
<!--
Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->

      <parameter>
         <name>maxIdle</name>
         <value>3</value>
      </parameter>
        
<!--
Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded.  Set to -1 to wait indefinitely.
-->

      <parameter>
         <name>maxWait</name>
         <value>10000</value>
      </parameter>

<!--
get rid of abandoned connections if they don't get dropped 
defaults to doing this after 300 seconds                  
-->
      <parameter>
         <name>removeAbandoned</name>
         <value>true</value>
      </parameter>

<!--
set timeout to 60 seconds instead of the default 300
-->
      <parameter>
         <name>removeAbandonedTimeout</name>
         <value>60</value>
      </parameter>



<!--
log the fact that we had to kill a connection
-->
      <parameter>
         <name>logAbandoned</name>
         <value>true</value>
      </parameter>
 
<!--
Class name for mm.mysql JDBC driver
         <value>org.gjt.mm.mysql.Driver</value>
Class name for the connector         (although mm.mysql still works)
         <value>com.mysql.jdbc.Driver</value>
-->
      <parameter>
         <name>driverClassName</name>
         <value>org.gjt.mm.mysql.Driver</value>
      </parameter>

   </ResourceParams>
        

</Context>

