<!-- Resin 3.1.3 configuration file. -->
<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core">

	<!-- Set the system properties to tell the app what config file to load -->
	<system-property environment="Secondary"/>

	<!-- adds all .jar files under the resin/lib directory -->
	<class-loader>
    		<tree-loader path="${resin.home}/lib"/>
    		<tree-loader path="${server.root}/lib"/>
	</class-loader>
  
	<!-- Management configuration -->
	<management path="${server.root}/admin"></management>

	<!-- Logging configuration for the JDK logging API.-->
	<log name="global" level="info" path="log/stdout.log" rollover-size="10M" /> 
	<logger name="com.caucho" level="info"/>
	<logger name="com.caucho.java" level="config" /> 
	<logger name="com.caucho.loader" level="config" />
	<log name="compliance" level="info" path="log/stdout.log" rollover-size="10M"/> 
	<log name="logistics" level="all" path="log/stdout.log" rollover-size="10M"/>
  
	<system-property javax.xml.parsers.SAXParserFactory="com.caucho.xml.parsers.XmlSAXParserFactory"/>
  
	<!-- For production sites, change dependency-check-interval to something like 600s, so it only checks for updates every 10 minutes.-->
	<dependency-check-interval>30s</dependency-check-interval>  

	<cluster id="app-tier">
		<!-- sets the content root for the cluster, relative to server.root -->
		<root-directory>.</root-directory>
		<!-- Enables/disables exceptions when the browser closes a connection. -->
		<ignore-client-disconnect>true</ignore-client-disconnect>

		<server-default>
			<!-- The http port -->
			<http address="*" port="80"/>
			<http server-id="" host="*" port="443">
		        	<jsse-ssl>
				        <key-store-type>jks</key-store-type>
				        <key-store-file>keys/portal.keystore</key-store-file>
				        <password>ilovetires07</password>
				</jsse-ssl>
    			</http>

      		      <jvm-arg>-Xmx1280M</jvm-arg>
		      <jvm-arg>-Xms1280M</jvm-arg>      
		      <jvm-arg>-Xmn100M</jvm-arg>
		      <jvm-arg>-Xss1M</jvm-arg>      
		      <jvm-arg>-Xdebug</jvm-arg>
		      <jvm-arg>-server</jvm-arg>
		      <jvm-arg>-XX:MaxPermSize=256M</jvm-arg> 
		      <jvm-arg>-XX:+UseParallelGC</jvm-arg> 
		      <jvm-arg>-XX:ParallelGCThreads=20</jvm-arg>
		      <jvm-arg>-Xnoagent</jvm-arg>  

		      <!-- Configures the minimum free memory allowed before Resin will force a restart.-->
		      <memory-free-min>1M</memory-free-min>

		      <!-- Maximum number of threads. -->
		      <thread-max>150</thread-max>

		      <!-- Configures the socket timeout -->
		      <socket-timeout>65s</socket-timeout>

		      <!-- Configures the keepalive -->
		      <keepalive-max>250</keepalive-max>
		      <keepalive-timeout>120s</keepalive-timeout>      
		</server-default>

		<!-- define the servers in the cluster -->
		<server id="" address="127.0.0.1" port="6800"/>
		
		<!-- Configures the persistent store for single-server or clustered in Resin professional.-->
		<!-- <resin:if test="${resin.isProfessional()}">
      			<persistent-store type="cluster">
			       	<init path="session"/>
      			</persistent-store>
		</resin:if>-->
		
		<!-- For security, use a different cookie for SSL sessions. -->
		<!-- <ssl-session-cookie>SSL_JSESSIONID</ssl-session-cookie> -->

		<!-- Enables the cache (available in Resin Professional) -->
		<!-- <resin:if test="${isResinProfessional}">
      			<cache path="cache" memory-size="64M">         
			    	<rewrite-vary-as-private/>
		      	</cache>
    		</resin:if>-->

		<!-- Enables periodic checking of the server status and check for deadlocks. All servers can add <url>s to be checked -->
		<!-- TURN THIS ON IN PROD -->
     		<!--<resin:if test="${isResinProfessional}">
      		<ping>
        		<url>http://localhost:8080/test-ping.jsp</url>
      		</ping>
    		</resin:if> -->

	   	<!-- includes the app-default for default web-app behavior -->
   		<resin:import path="${resin.home}/conf/app-default.xml"/>

    		<!-- Defaults applied to each web-app.-->
	    	<web-app-default>
			<!--
			 - Extension library for common jar files.  The ext is safe
			 - even for non-classloader aware jars.  The loaded classes
			 - will be loaded separately for each web-app, i.e. the class
			 - itself will be distinct.
			-->
			<class-loader>
				<tree-loader path="${server.root}/ext-webapp"/>
			</class-loader>
			<!-- Sets timeout values for cacheable pages, e.g. static pages. -->
			<!-- <cache-mapping url-pattern="/" expires="5s"/>
			<cache-mapping url-pattern="*.gif" expires="60s"/>
			<cache-mapping url-pattern="*.jpg" expires="60s"/>
			<cache-mapping url-pattern="*.png" expires="60s"/>
			<cache-mapping url-pattern="*.html" expires="60s"/>
			<cache-mapping url-pattern="*.css" expires="60s"/>
			<cache-mapping url-pattern="*.js" expires="60s"/> -->
		      	
		      	<!-- Enable EL expressions in Servlet and Filter init-param -->
		      	<allow-servlet-el/>
		      	
		      	<!-- for security, disable session URLs by default.  -->
		      	<session-config>
				<session-max>4096</session-max>
				<session-timeout>30</session-timeout>
				<enable-cookies>true</enable-cookies>
				<enable-url-rewriting>true</enable-url-rewriting>
			</session-config>
			<listener>
				<listener-class>com.caucho.jsp.JspPrecompileListener</listener-class>
				<init>
					<extension>jsp</extension>
					<extension>jspx</extension>
					<extension>xtp</extension>
				</init>
			</listener>
		      <!-- For security, set the HttpOnly flag in cookies. -->
		      <!-- <cookie-http-only/>-->
    		</web-app-default> 
    		<database>
			<jndi-name>jdbc/portal</jndi-name>
			<driver type="com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource">
				<serverName>test</serverName>
				<portNumber>1210</portNumber>
				<databaseName>PORTALPROD</databaseName>
				<user>user</user>
				<password>password</password>
				<selectMethod>cursor</selectMethod>
			</driver>
			<ping>true</ping>
			<ping-table>users</ping-table>
			<ping-interval>2s</ping-interval>
		</database>
		<database>
			<jndi-name>jdbc/compliance</jndi-name>
			<driver type="com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource">
				<serverName>portaldb2dc1.dc1.rubbernetwork.com</serverName>
				<portNumber>1210</portNumber>
				<databaseName>PORTALCOMPLIANCE</databaseName>
				<user>user</user>
				<password>password</password>
				<selectMethod>cursor</selectMethod>
			</driver>
		</database>
		<database>
			<jndi-name>jdbc/logistics</jndi-name>
			<driver type="com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource">
				<serverName>portaldb2dc1.dc1.rubbernetwork.com</serverName>
				<portNumber>1210</portNumber>
				<databaseName>PORTALLOGISTICS</databaseName>
				<user>user</user>
				<password>password</password>
				<selectMethod>cursor</selectMethod>
			</driver>
		</database>
		
		<!-- Default host configuration applied to all virtual hosts.-->
		<host-default>
		      <!-- With another web server, like Apache, this can be commented out because the web server will log this information.  -->
		      <access-log path='log/access.log' format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"' rollover-period='1W'/>
		      <stdout-log path='log/stdout.log' rollover-size='15M'/>
		      <stderr-log path='log/stdout.log' rollover-size='15M'/>

			<!-- creates the webapps directory for .war expansion -->
			<web-app-deploy path="webapps"/>
	
			<!-- creates the deploy directory for .ear expansion -->
		      	<ear-deploy path="deploy">
			<ear-default>
				<ejb-server>
					<config-directory>WEB-INF</config-directory>
					<data-source>jdbc/test</data-source>
				</ejb-server>
				</ear-default>
			</ear-deploy>
		      	<!-- creates the deploy directory for .rar expansion -->
			<resource-deploy path="deploy"/>
		</host-default>

		<!-- configures a deployment directory for virtual hosts -->
		<host-deploy path="hosts">
			<host-default>
				<resin:import path="host.xml" optional="true"/>
		   	</host-default>
		</host-deploy>

    		<!-- configures the default host, matching any host name -->
		<host id="" root-directory=".">
      			<web-app id='/' document-directory="webapps/portal" archive-path="webapps/portal.war">
				<listener>
					<listener-class>SiteControl</listener-class>
				</listener>
			</web-app>      
			<web-app id='/compliance' document-directory="webapps/compliance" archive-path="webapps/compliance.war"/>
            		<web-app id='/logistics' document-directory="webapps/logisitics" archive-path="webapps/logistics.war"/>     
		</host>
  	</cluster>
  	
	<!-- Configuration for the web-tier/load-balancer -->
	<!-- <resin:if test="${resin.isProfessional()}">
		<cluster id="web-tier">
			<server-default>
				<http address="*" port="9080"/>
	      		</server-default>
	      		<server id="web-a" address="127.0.0.1" port="6700"/>
	      		<cache path="cache" memory-size="64M"/>
	      		<host id="">
				<web-app id="/">
					<rewrite-dispatch>
						<load-balance regexp="" cluster="app-tier"/>
					</rewrite-dispatch>
				</web-app>
	      		</host>
		</cluster>
	</resin:if> -->
</resin>