<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2017 Evolveum
  ~
  ~ Licensed 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.
  -->

<!-- Sample local of DB Table connector definition.
     This is provided just for illustration. The admin should never
     need to import this definition manually. This object should be
     generated by the system automatically when a connector is
     discovered during system initialization.  -->

<connector xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
           xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
           xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
           xmlns:enc="http://www.w3.org/2001/04/xmlenc#">

   <name>ICF org.identityconnectors.databasetable.DatabaseTableConnector</name>
   <framework>http://midpoint.evolveum.com/xml/ns/public/connector/icf-1</framework>
   <connectorType>org.identityconnectors.databasetable.DatabaseTableConnector</connectorType>
   <connectorVersion>1.1.4958</connectorVersion>
   <connectorBundle>org.identityconnectors.databasetable</connectorBundle>
   <namespace>http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/org.forgerock.openicf.connectors.db.databasetable/org.identityconnectors.databasetable.DatabaseTableConnector</namespace>
   <schema>
     <definition>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"
                  xmlns:tns="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/org.forgerock.openicf.connectors.db.databasetable/org.identityconnectors.databasetable.DatabaseTableConnector"
                  xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
                  xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3"
                  xmlns:ra="http://midpoint.evolveum.com/xml/ns/public/resource/annotation-3"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  elementFormDefault="qualified"
                  targetNamespace="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/org.forgerock.openicf.connectors.db.databasetable/org.identityconnectors.databasetable.DatabaseTableConnector">
         <xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"/>
         <xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/common/common-3"/>

         <xsd:import namespace="http://prism.evolveum.com/xml/ns/public/annotation-3"/>
         <xsd:complexType name="ConfigurationPropertiesType">
            <xsd:annotation>
               <xsd:appinfo>
                  <a:propertyContainer/>
               </xsd:appinfo>
            </xsd:annotation>
            <xsd:sequence>
               <xsd:element minOccurs="0" name="nativeTimestamps" type="xsd:boolean">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Native Timestamps </a:displayName>
                        <a:help>&lt;b&gt;Native Timestamps&lt;/b&gt;&lt;br&gt;Select to retrieve Timestamp data type of the columns in java.sql.Timestamp format from the database table.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="host" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Host</a:displayName>
                        <a:help>&lt;b&gt;Host&lt;/b&gt;&lt;br&gt;Enter the name of the host where the database is running.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="enableEmptyString" type="xsd:boolean">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Enable writing empty string</a:displayName>
                        <a:help>&lt;b&gt;Enable writing empty string&lt;/b&gt;&lt;br&gt;Select to enable support for writing an empty strings, instead of a NULL value, in character based columns defined as not-null in the table schema. This option does not influence the way strings are written for Oracle based tables. By default empty strings are written as a NULL value.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="jdbcUrlTemplate" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>JDBC Connection URL</a:displayName>
                        <a:help>&lt;b&gt;JDBC Connection URL&lt;/b&gt;&lt;br&gt;Specify the JDBC Driver Connection URL.&lt;br&gt; Oracle template is jdbc:oracle:thin:@[host]:[port(1521)]:[DB].&lt;br&gt;  MySQL template is jdbc:mysql://[host]:[port(3306)]/[db], for more info, read the JDBC driver documentation.&lt;br&gt;Could be empty if datasource is provided.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element name="table" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Table</a:displayName>
                        <a:help>&lt;b&gt;Table&lt;/b&gt;&lt;br&gt;Enter the name of the table in the database that contains the accounts.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="quoting" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Name Quoting</a:displayName>
                        <a:help>&lt;b&gt;Name Quoting&lt;/b&gt;&lt;br&gt;Select whether database column names for this resource should be quoted, and the quoting characters. By default, database column names are not quoted (None). For other selections (Single, Double, Back, or Brackets), column names will appear between single quotes, double quotes, back quotes, or brackets in the SQL generated to access the database.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="datasource" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Datasource Path</a:displayName>
                        <a:help>&lt;b&gt;JDBC Data Source Name/Path&lt;/b&gt;&lt;br&gt;Enter the JDBC Data Source Name/Path to connect to the Oracle server. If specified, connector will only try to connect using Datasource and ignore other resource parameters specified.&lt;br&gt;the example value is: &lt;CODE&gt;jdbc/SampleDataSourceName&lt;/CODE&gt;</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="changeLogColumn" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Change Log Column (Sync)</a:displayName>
                        <a:help>=&lt;b&gt;Change Log Column&lt;/b&gt;&lt;br&gt;The change log column store the latest change time. Providing this value the Sync capabilities are activated.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="database" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Database</a:displayName>
                        <a:help>&lt;b&gt;Database&lt;/b&gt;&lt;br&gt;Enter the name of the database on the database server that contains the table.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="allNative" type="xsd:boolean">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>All native</a:displayName>
                        <a:help>&lt;b&gt;All native&lt;/b&gt;&lt;br&gt;Select to retrieve all data type of the columns in a native format from the database table.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="user" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>User</a:displayName>
                        <a:help>&lt;b&gt;User&lt;/b&gt;&lt;br&gt;Enter the name of the mandatory Database user with permission to account table.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="jdbcDriver" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>JDBC Driver</a:displayName>
                        <a:help>&lt;b&gt;JDBC Driver&lt;/b&gt;&lt;br&gt;Specify the JDBC Driver class name. Oracle is oracle.jdbc.driver.OracleDriver. MySQL is org.gjt.mm.mysql.Driver.&lt;br&gt;Could be empty if datasource is provided.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="rethrowAllSQLExceptions" type="xsd:boolean">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Rethrow all SQLExceptions</a:displayName>
                        <a:help>If this is not checked, SQL statements which throw SQLExceptions with a 0 ErrorCode will be have the exception caught and suppressed. Check it to have exceptions with 0 ErrorCodes rethrown.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="password" type="t:ProtectedStringType">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>User Password</a:displayName>
                        <a:help>&lt;b&gt;User Password&lt;/b&gt;&lt;br&gt;Enter a user account that has permission to access accounts table.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element name="keyColumn" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Key Column</a:displayName>
                        <a:help>&lt;b&gt;Key Column&lt;/b&gt;&lt;br&gt;This mandatory column value will be used as the unique identifier for rows in the table.&lt;br&gt;</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="passwordColumn" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Password Column</a:displayName>
                        <a:help>&lt;b&gt;Password Column&lt;/b&gt;&lt;br&gt;Enter the name of the column in the table that will hold the password values. If empty, no validation on resource and passwords are activated.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element maxOccurs="unbounded" minOccurs="0" name="jndiProperties" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Initial JNDI Properties</a:displayName>
                        <a:help>&lt;b&gt;Initial JNDI Properties&lt;/b&gt;&lt;br&gt;Could be empty or enter the JDBC JNDI Initial context factory, context provider in a format: key = value.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="port" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Port</a:displayName>
                        <a:help>&lt;b&gt;TCP Port&lt;/b&gt;&lt;br&gt;Enter the port number the database server is listening on.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element minOccurs="0" name="validConnectionQuery" type="xsd:string">
                  <xsd:annotation>
                     <xsd:appinfo>
                        <a:displayName>Validate Connection Query</a:displayName>
                        <a:help>&lt;b&gt;Validate Connection Query&lt;/b&gt;&lt;br&gt;There can be specified the check connection alive query. If empty, default implementation will test it using the switch on/off the autocommit. Some select 1 from dummy table could be more efficient.</a:help>
                     </xsd:appinfo>
                  </xsd:annotation>
               </xsd:element>
            </xsd:sequence>
         </xsd:complexType>
         <xsd:element name="configurationProperties" type="tns:ConfigurationPropertiesType"/>
         <xsd:complexType name="ConfigurationType">
            <xsd:annotation>
               <xsd:appinfo>
                  <a:propertyContainer/>
               </xsd:appinfo>
            </xsd:annotation>
            <xsd:sequence>
               <xsd:element minOccurs="0" ref="icfc:timeouts"/>
               <xsd:element minOccurs="0" ref="icfc:producerBufferSize"/>
               <xsd:element minOccurs="0" ref="icfc:connectorPoolConfiguration"/>
               <xsd:element name="configurationProperties" type="tns:ConfigurationPropertiesType"/>
            </xsd:sequence>
         </xsd:complexType>
         <xsd:element name="configuration" type="tns:ConfigurationType"/>
      </xsd:schema>
    </definition>
   </schema>
</connector>
