<?xml version="1.0" encoding="UTF-8"?>

  <!-- ==================================================================== -->
  <!-- ConnectionManager setup for LiDO jdo using Versant object db.-->
  <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
  <!-- ==================================================================== -->

<service>

  <!-- the enhanced classes must already be deployed before this adapter is started.  Currently
       LiDO does not work with jboss to find the metadata.jdo if it is in a jar file, so you must
       put it on the classpath independently as a file.  The license can be added similarly -->

  <!-- as of LiDO build 17 it is necessary that all metadata be in one metadata.jdo file. -->

  <!--Specify the metadata file name and get the metadata file on the classpath.  
    Hopefully LiDO will make this a ManagedConnectionFactory property soon.-->
  <mbean code="org.jboss.deployment.ClasspathExtension" name="jboss.jdo.lido:service=metadata">
    <attribute name="MetadataURL">file:/usr/java/fgm/co4copy/tracker2/domain/src/resources/</attribute>
  </mbean>

  <mbean code="org.jboss.deployment.ClasspathExtension" name="jboss.jdo.lido:service=license">
    <attribute name="MetadataURL">file:/usr/java/lido/bin/</attribute>
  </mbean>

  <mbean code="org.jboss.resource.connectionmanager.XATxConnectionManager" name="jboss.jca:service=XaTxCM,name=LiDOVersantDS">

    <!--depend on the metadata helper-->
    <depends>jboss.jdo.lido:service=metadata</depends>
    <depends>jboss.jdo.lido:service=license</depends>


    <attribute name="JndiName">adap_1</attribute>
    <depends optional-attribute-name="ManagedConnectionPool">
      <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=XaTxPool,name=LiDOVersantDS">

    <depends optional-attribute-name="ManagedConnectionFactoryName">
      <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=XaTxDS,name=LiDOVersantDS">
        <!--more hack-->
        <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=LiDO</depends>
        <attribute name="ManagedConnectionFactoryProperties">
          <properties>
            <config-property name="ConnectionDriverName" type="java.lang.String">versant</config-property>
            <config-property name="ConnectionURL" type="java.lang.String">trackerdb</config-property>
            <!--config-property name="ConnectionDriverName" type="java.lang.String">fdb</config-property>
            <config-property name="ConnectionURL" type="java.lang.String">/usr/java/lido/samples/company_basic/fdb.properties</config-property-->
            <config-property name="ConnectionUserName" type="java.lang.String">david</config-property>
            <config-property name="ConnectionPassword" type="java.lang.String">david</config-property>
          </properties>
        </attribute>
      </mbean>

    </depends>
        <attribute name="MinSize">0</attribute>
        <attribute name="MaxSize">50</attribute>
        <attribute name="BlockingTimeoutMillis">5000</attribute>
        <attribute name="IdleTimeoutMinutes">15</attribute>
        <!--criteria indicates if Subject (from security domain) or app supplied
            parameters (such as from getConnection(user, pw)) are used to distinguish
            connections in the pool. Choices are 
            ByContainerAndApplication (use both), 
            ByContainer (use Subject),
            ByApplication (use app supplied params only),
            ByNothing (all connections are equivalent, usually if adapter supports
              reauthentication)-->
        <attribute name="Criteria">ByContainer</attribute>
      </mbean>
    </depends>
    <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
    <!-- Include a login module configuration named FirebirdDBRealm.
         Update your login-conf.xml, here is an example for a 
         ConfiguredIdentityLoginModule:

    <application-policy name = "LiDOVersantDSBRealm">
       <authentication>
          <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
             <module-option name = "principal">sysdba</module-option>
             <module-option name = "userName">sysdba</module-option>
             <module-option name = "password">masterkey</module-option>
             <module-option name = "managedConnectionFactoryName">jboss.jca:service=XaTxCM,name=LiDOVersantDS</module-option>
          </login-module>
       </authentication>
    </application-policy>

    NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the 
      module-option name = "managedConnectionFactoryName"
    must match the object name of the ConnectionManager you are configuring here.
    -->
    <!--comment out this line if you want component managed security or want
        to use the default values in the ManagedConnectionFactoryProperties - ->
    <attribute name="SecurityDomainJndiName">LiDOVersantDSRealm</attribute-->

    <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>

    <attribute name="TransactionManager">java:/TransactionManager</attribute>
  </mbean>

</service>