<?xml version="1.0" encoding="UTF-8"?>
<!--Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (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.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.-->
<!--$Rev: 778726 $ $Date: 2009-05-26 07:50:40 -0700 (Tue, 26 May 2009) $-->
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
  <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
    <dep:moduleId>
      <dep:groupId>org.apache.geronimo.plugins.monitoring</dep:groupId>
      <dep:artifactId>agent-ds</dep:artifactId>
      <dep:version>2.2</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
    <dep:dependencies>
      <dep:dependency>
        <dep:groupId>org.apache.geronimo.configs</dep:groupId>
        <dep:artifactId>system-database</dep:artifactId>
        <dep:version>2.2</dep:version>
        <dep:type>car</dep:type>
      </dep:dependency>
      <dep:dependency>
        <dep:groupId>org.apache.geronimo.plugins.monitoring</dep:groupId>
        <dep:artifactId>agent-sql</dep:artifactId>
        <dep:version>2.2</dep:version>
        <dep:type>jar</dep:type>
      </dep:dependency>
    </dep:dependencies>
    <dep:hidden-classes/>
    <dep:non-overridable-classes/>
    <dep:private-classes/>
  </dep:environment>
  <resourceadapter>
    <outbound-resourceadapter>
      <!--Pool for Active Statistics-->
      <connection-definition>
        <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
        <connectiondefinition-instance>
          <name>jdbc/ActiveDS</name>
          <config-property-setting name="CreateDatabase">true</config-property-setting>
          <config-property-setting name="Password">monitor</config-property-setting>
          <config-property-setting name="UserName">monitor</config-property-setting>
          <config-property-setting name="DatabaseName">ActiveMRCDB</config-property-setting>
          <connectionmanager>
            <local-transaction/>
            <single-pool>
              <max-size>10</max-size>
              <min-size>0</min-size>
              <match-one/>
            </single-pool>
          </connectionmanager>
        </connectiondefinition-instance>
      </connection-definition>
      <!--Pool for Archived Statistics-->
      <connection-definition>
        <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
        <connectiondefinition-instance>
          <name>jdbc/ArchiveDS</name>
          <config-property-setting name="CreateDatabase">true</config-property-setting>
          <config-property-setting name="Password">monitor</config-property-setting>
          <config-property-setting name="UserName">monitor</config-property-setting>
          <config-property-setting name="DatabaseName">ArchiveMRCDB</config-property-setting>
          <connectionmanager>
            <local-transaction/>
            <single-pool>
              <max-size>10</max-size>
              <min-size>0</min-size>
              <match-one/>
            </single-pool>
          </connectionmanager>
        </connectiondefinition-instance>
      </connection-definition>
    </outbound-resourceadapter>
  </resourceadapter>
  <!--These two GBeans will create the tables for the database automatically-->
  <gbean name="ActiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
    <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
    <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
    <reference name="DataSource">
      <name>jdbc/ActiveDS</name>
    </reference>
  </gbean>
  <gbean name="ArchiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
    <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
    <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
    <reference name="DataSource">
      <name>jdbc/ArchiveDS</name>
    </reference>
  </gbean>
  <!--this ought to be in the agent plan but this realm is not always started before the credential-store, even with the dependency-->
  <gbean name="monitoring-runas-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm">
    <attribute name="realmName">monitoring-runas-realm</attribute>
    <attribute name="global">false</attribute>
    <xml-reference name="LoginModuleConfiguration">
      <lc:login-config xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-1.2">
        <lc:login-module control-flag="REQUIRED">
          <lc:login-domain-name>monitoring-runas-domain</lc:login-domain-name>
          <lc:login-module-class>org.apache.geronimo.security.credentialstore.RunAsLoginModule</lc:login-module-class>
          <lc:option name="principalClass">org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal</lc:option>
          <lc:option name="principalNames">admin</lc:option>
        </lc:login-module>
      </lc:login-config>
    </xml-reference>
    <!--<reference name="ServerInfo">-->
    <!--<name>ServerInfo</name>-->
    <!--</reference>-->
  </gbean>
</connector>