<?xml version="1.0"?>
<!--
    The contents of this file are subject to the Mozilla Public License Version 1.1
    (the "License"); you may not use this file except in compliance with the License.
    You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.

    Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
    WARRANTY OF ANY KIND, either express or implied. See the License for the specific
    language governing rights and limitations under the License.

    The Original Code is the Venice Web Communities System.

    The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
    for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
    Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.

    Contributor(s): 
-->
<configuration>

  <!-- Low-level Dynamo application container configuration -->
  <control>
    <background-threads normal="2" low="2"/>
    <resource-root>${code.path}</resource-root>
    <url-rewrite-rules>
      <rule type="ABSOLUTE" encode="false">${url}</rule>
      <rule type="SERVLET" encode="true">${context.path}/${url}</rule>
      <rule type="IMAGE" encode="false">${context.path}/images/${url}</rule>
      <rule type="IMAGEDATA" encode="false">${context.path}/imagedata/${url}</rule>
      <rule type="FRAME" encode="true">${context.path}/frame/${url}</rule>
    </url-rewrite-rules>
  </control>

  <!-- The database connection pool -->
  <dbconnection name="data" classname="com.silverwrist.dynamo.db.DatabaseConnectionPool">
    <dbtype>mysql</dbtype>
    <!-- driver name is the new MySQL Connector for Java - replaces org.gjt.mm.mysql.Driver -->
    <driver>com.mysql.jdbc.Driver</driver>
    <uri>jdbc:mysql://localhost/venice</uri>
    <username>veniceuser</username>
    <password>XYZZY0099</password>
    <connections initial="5" max="20" busywait="true"/>
  </dbconnection>

  <!-- Infrastructure objects -->
  <object name="connector" classname="com.silverwrist.dynamo.app.ConnectionManager" priority="0">
    <connection-point name="srm_proxy" interface="com.silverwrist.dynamo.db.UserProxyManagement"/>
  </object>

  <object name="module-manager" classname="com.silverwrist.dynamo.module.ModuleManager" priority="0">
    <module-directory>${code.path}/modules</module-directory>
  </object>

  <!-- Data-driven objects -->
  <object name="nscache" classname="com.silverwrist.dynamo.db.NamespaceCacheObject" priority="0">
    <database connection="data"/>
  </object>

  <object name="index" classname="com.silverwrist.dynamo.index.IndexManagerObject" priority="1">
    <database connection="data" namespaces="nscache"/>
  </object>

  <object name="srm" classname="com.silverwrist.dynamo.security.SRMObject" priority="1">
    <database connection="data" namespaces="nscache"/>
    <user-manager cpoint="srm_proxy"/>
  </object>

  <object name="globals" classname="com.silverwrist.dynamo.db.GlobalDataManagerObject" priority="2">
    <database connection="data" namespaces="nscache"/>
    <security object="srm"/>
    <block-cache hardlimit="5" softlimit="20"/>
  </object>

  <object name="users" classname="com.silverwrist.dynamo.db.UserManagerObject" priority="2">
    <database connection="data" namespaces="nscache"/>
    <security object="srm"/>
    <connect-proxy-services cpoint="srm_proxy"/>
  </object>

  <object name="images" classname="com.silverwrist.dynamo.db.ImageStoreObject" priority="2">
    <database connection="data" namespaces="nscache"/>
  </object>

  <object name="audit" classname="com.silverwrist.dynamo.security.SystemAuditManager" priority="3">
    <database connection="data" namespaces="nscache" userproxy="users"/>
  </object>

  <object name="htmlchecker" classname="com.silverwrist.dynamo.htmlcheck.HTMLCheckerManager" priority="5">
    <database connection="data" namespaces="nscache"/>
  </object>

  <object name="dictionary" classname="com.silverwrist.dynamo.dict.DictionarySubsystem" priority="6">
    <dictionary name="BASE" classname="com.silverwrist.dynamo.dict.ResourceDictionary" resource="en-us.dict"/>
    <dictionary name="SUPP" classname="com.silverwrist.dynamo.dict.ResourceDictionary" resource="supplemental.dict"/>
    <dictionary name="DB" classname="com.silverwrist.dynamo.dict.DatabaseDictionary">
      <database connection="data"/>
    </dictionary>
  </object>

  <object name="unistore" classname="com.silverwrist.dynamo.unistore.UniStoreManager" priority="5">
    <database connection="data" namespaces="nscache"/>
    <security object="srm"/>
    <user-manager object="users"/>
    <message-cache hardlimit="100" softlimit="1000"/>
  </object>

  <!-- Presentation and interface objects -->
  <object name="remapper" classname="com.silverwrist.dynamo.servlet.RemapperData" priority="0">
    <remap path="/verifyemail">
      <param name="tgt">top.js.vs</param>
      <target type="SERVLET">verify_email.js.vs?tgt=${tgt}</target>
    </remap>
  </object>

  <object name="velocity" classname="com.silverwrist.dynamo.velocity.VelocityRenderer" priority="0">
    <resource-prefix>/velocity</resource-prefix>
  </object>

  <object name="xmlrpc" classname="com.silverwrist.dynamo.xmlrpc.XmlRpcSubSystem"
          priority="-10" maxAge="3600">
    <dispatch method="validator1\.\w+" classname="com.silverwrist.dynamo.xmlrpc.Validator1Suite"/>
    <dispatch method="venice:siteinfo" classname="com.silverwrist.dynamo.xmlrpc.ScriptDispatcher">
      <script>/xmlrpc/siteinfo.js</script>
      <session param="0"/>
      <metadata-file>/xmlrpc/siteinfo-metadata.xml</metadata-file>
    </dispatch>
    <dispatch method="venice:session\.create" classname="com.silverwrist.venice.xmlrpc.VeniceCreateSession"/>
    <dispatch method="venice:session\.\w+" classname="com.silverwrist.dynamo.xmlrpc.ScriptDispatcher">
      <script>/xmlrpc/session.js</script>
      <session param="0"/>
      <metadata-file>/xmlrpc/session-metadata.xml</metadata-file>
    </dispatch>
  </object>

  <object name="dialog" classname="com.silverwrist.dynamo.dialog.DialogManager" priority="0">
    <resource-prefix>/dialogs</resource-prefix>
    <resource-dialog-cache hardlimit="5" softlimit="20"/>
  </object>

  <object name="mail" classname="com.silverwrist.dynamo.mail.MailSubSystem" priority="10">
    <global-properties object="globals"
                       namespace="http://www.silverwrist.com/NS/venice/2002/12/28/mail.properties"/>
    <smtp-host property="smtp.host"/>
    <system-mail-name property="system.mail.from.name"/>
    <system-mail-addr property="system.mail.from.addr"/>
    <mailer property="mailer.name"/>
    <template-resource-prefix>/mailmessages</template-resource-prefix>
    <user-disclaimer block="user.disclaimer"/>
    <user-info-header property="user.info.header"/>
    <signature block="signature"/>
  </object>

  <!-- Venice-layer objects -->

  <object name="user-default-ns" classname="com.silverwrist.venice.app.UserDefaultNamespaceHolder" priority="50"/>

  <object name="venice-session" classname="com.silverwrist.venice.session.VeniceSessionManager" priority="50">
    <global-properties object="globals"/>
    <user-manager object="users"/>
  </object>

  <object name="venice-menus" classname="com.silverwrist.venice.menu.MenuManager" priority="100">
    <database connection="data" namespaces="nscache"/>
    <security object="srm"/>
  </object>

  <object name="venice-frame" classname="com.silverwrist.venice.frame.FrameAssembler" priority="101">
    <global-properties object="globals"/>
    <providers security="srm" menu="venice-menus"/>
  </object>

  <object name="venice-content" classname="com.silverwrist.venice.content.StandardContentSupplier" priority="100">
    <global-properties object="globals"/>
  </object>

  <object name="venice-buttons" classname="com.silverwrist.venice.content.ButtonSupplier" priority="100">
    <global-properties object="globals"/>
  </object>

  <object name="venice-userphoto" classname="com.silverwrist.venice.content.UserPhotoRenderer" priority="100">
    <global-properties object="globals"/>
  </object>

  <object name="venice-dlg-manager" classname="com.silverwrist.venice.dialog.VeniceDialogManager" priority="101">
    <providers button="venice-buttons" content="venice-content"/>
  </object>

  <object name="venice-auditor" classname="com.silverwrist.venice.app.StartupShutdownAuditor" priority="100"/>

  <object name="venice-sidebox" classname="com.silverwrist.venice.sidebox.SideboxManager" priority="100">
    <database connection="data" namespaces="nscache"/>
  </object>

  <object name="categories" classname="com.silverwrist.venice.community.CategoryManager" priority="100">
    <database connection="data"/>
  </object>

  <object name="adv-users" classname="com.silverwrist.venice.app.AdvancedUserManager" priority="100">
    <database connection="data" namespaces="nscache"/>
    <security object="srm"/>
    <user-manager object="users"/>
  </object>

  <object name="communities" classname="com.silverwrist.venice.community.CommunityManager" priority="101">
    <database connection="data" namespaces="nscache"/>
    <security object="srm"/>
    <user-manager object="users"/>
    <providers categories="categories"/>
  </object>

  <!-- The Venice application layer -->
  <application name="venice" classname="com.silverwrist.venice.app.VeniceApplication">
    <stylesheet-mappings>
      <stylesheet path="/stylesheet-base.css" prefix="base"/>
      <stylesheet path="/stylesheet-advanced.css" prefix="adv"/>
    </stylesheet-mappings>
  </application>

</configuration>
